External and internal representations

Describes the Internalize() and Externalize() functions for representing objects.

Since packages may be used to describe an object of any type, and may be conveniently written to a file and sent over communications links, it is tempting to use them to transmit all application data types.

Note: This is strongly discouraged in Symbian platform programming.

Packages directly package the internal representation of an object. They should only be used when the internal representation is expected by all recipients of the package. This would be the case, say, with inter thread data transfer or certain rare types of file.

When an object is stored on file, or sent over a link, it is usually desirable to define an external representation which may be safely read by any Symbian platform implementation, even on a machine with different endianness, different compiler options, and different machine word size.

In such a case, writing a struct directly is inappropriate. Instead, the InternalizeL() and ExternalizeL() functions should be implemented for the object and should encapsulate all internalisation and externalisation. The stream interface should be used, which may refer to file, communications, clipboard and a number of other possibilities.