|
||
For a class TX defined as:
class TX
{
public:
...
void ExternalizeL(RWriteStream& aStream) const;
void InternalizeL(RReadStream& aStream);
...
};
an instance of TX
can be externalised to the stream
outstream
, by calling the ExternalizeL()
member
function of TX
:
...
TX object;
...
object.ExternalizeL(outstream);
...
An alternative, and better way, is to use the templated stream
operator<<
. The Store framework implements this by calling
TX::ExternalizeL()
. The syntax is simply:
...
outstream << object; // externalise object
...
Similarly, the TX
object can be internalised from the
stream instream
, by calling the InternalizeL()
member
function of TX
:
TX object;
...
object.InternalizeL(instream);
...
The templated stream operator>>
can also be used.
The Store framework implements this by calling TX::InternalizeL()
.
The syntax is simply:
instream >> object; // internalise object