diff -r 89d6a7a84779 -r 25a17d01db0c Symbian3/PDK/Source/GUID-2277BB1C-C04D-56C8-9B9B-FBC2EDCA9B07.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/PDK/Source/GUID-2277BB1C-C04D-56C8-9B9B-FBC2EDCA9B07.dita Fri Jan 22 18:26:19 2010 +0000 @@ -0,0 +1,41 @@ + + + + + +How to externalise and internalise compound objects

Compound objects can be externalised and internalised. The only assumption is that all component objects (and their component objects) must be capable of being externalised and internalised.

In this example, a compound object, an instance of the CCompound class, is externalised to, and internalised from, a single stream. The class is defined as:

class CCompound : public CBase + { +public : + void ExternalizeL(RWriteStream& aStream) const; + void ExternalizeL(RReadStream& aStream); + ... + CClassA* iCa; + CClassB* iCb; + TClassC iTc; + };
Externalising

The preferred implementation of the ExternalizeL() function is:

void CCompound::ExternalizeL(RWriteStream& aStream) const + { + aStream << *iCa; + aStream << *iCb; + aStream << iTc; + }

The following implementation is also correct:

void CCompound::ExternalizeL(RWriteStream& aStream) const + { + iCa->ExternalizeL(aStream); + iCb->ExternalizeL(aStream); + iTc.ExternalizeL(aStream); + }
Internalising

The preferred implementation of the InternalizeL() function is:

void CCompound::InternalizeL(RReadStream& aStream) + { + aStream >> *iCa; + aStream >> *iCb; + aStream >> iTc; + }

The following implementation is also correct:

void CCompound::InternalizeL(RReadStream& aStream) + { + iCa->InternalizeL(aStream); + iCb->InternalizeL(aStream); + iTc.InternalizeL(aStream); + }
\ No newline at end of file