diff -r 43e37759235e -r 51a74ef9ed63 Symbian3/SDK/Source/GUID-2277BB1C-C04D-56C8-9B9B-FBC2EDCA9B07.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-2277BB1C-C04D-56C8-9B9B-FBC2EDCA9B07.dita Wed Mar 31 11:11:55 2010 +0100 @@ -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