diff -r ebc84c812384 -r 46218c8b8afa Symbian3/PDK/Source/GUID-3B0BF8FF-88AB-5BF4-9F04-5F82A3998699.dita --- a/Symbian3/PDK/Source/GUID-3B0BF8FF-88AB-5BF4-9F04-5F82A3998699.dita Thu Mar 11 15:24:26 2010 +0000 +++ b/Symbian3/PDK/Source/GUID-3B0BF8FF-88AB-5BF4-9F04-5F82A3998699.dita Thu Mar 11 18:02:22 2010 +0000 @@ -1,51 +1,51 @@ - - - - - -How -to store and restore a non-compound object -
Storing

The basic protocol for storing is the StoreL() function -and should be prototyped as:

TStreamId StoreL(CStreamStore& aStore) const;

The function takes a reference to the store in which the stream is to -be stored and returns the stream ID through which the object can be restored.

In -some cases, the design of a class may be such that it maintains a pointer -or reference to the store. In this event, the CStreamStore argument -would be redundant.

To store an object that does not contain any other -objects:

    -
  1. construct a write stream -object, i.e. an instance of RStoreWriteStream

  2. -
  3. externalise the object

  4. -
  5. return the ID of the -stream

  6. -

The following code fragment shows the canonical form for some general -class CClassA:

TStreamId CClassA::StoreL(CStreamStore& aStore) const - { - RStoreWriteStream stream; - TStreamId id=stream.CreateLC(aStore); - ExternalizeL(stream); - stream.CommitL(); - CleanupStack::PopAndDestroy(); - return id; - }
-
Restoring

The basic protocol for restoring is the -<code>RestoreL()</code> function and should be prototyped as: -

void RestoreL(CStreamStore& aStore,TStreamId anId);

The -function takes a reference to the store in which the stream is stored and -the ID that identifies that stream is stored.

To restore an object that -does not contain any other objects:

    -
  • construct a read stream object, i.e. an instance of

    RStoreReadStream
  • -
  • internalise the object.

  • -

The following code fragment shows an example for some general class

CClassA void CClassA::RestoreL(CStreamStore& aStore, TStreamId anId) - { - RStoreReadStream stream; - stream.OpenLC(aStore,anId); - InternalizeL(stream); - CleanupStack::PopAndDestroy(); - }

+ + + + + +How +to store and restore a non-compound object +
Storing

The basic protocol for storing is the StoreL() function +and should be prototyped as:

TStreamId StoreL(CStreamStore& aStore) const;

The function takes a reference to the store in which the stream is to +be stored and returns the stream ID through which the object can be restored.

In +some cases, the design of a class may be such that it maintains a pointer +or reference to the store. In this event, the CStreamStore argument +would be redundant.

To store an object that does not contain any other +objects:

    +
  1. construct a write stream +object, i.e. an instance of RStoreWriteStream

  2. +
  3. externalise the object

  4. +
  5. return the ID of the +stream

  6. +

The following code fragment shows the canonical form for some general +class CClassA:

TStreamId CClassA::StoreL(CStreamStore& aStore) const + { + RStoreWriteStream stream; + TStreamId id=stream.CreateLC(aStore); + ExternalizeL(stream); + stream.CommitL(); + CleanupStack::PopAndDestroy(); + return id; + }
+
Restoring

The basic protocol for restoring is the +<code>RestoreL()</code> function and should be prototyped as: +

void RestoreL(CStreamStore& aStore,TStreamId anId);

The +function takes a reference to the store in which the stream is stored and +the ID that identifies that stream is stored.

To restore an object that +does not contain any other objects:

    +
  • construct a read stream object, i.e. an instance of

    RStoreReadStream
  • +
  • internalise the object.

  • +

The following code fragment shows an example for some general class

CClassA void CClassA::RestoreL(CStreamStore& aStore, TStreamId anId) + { + RStoreReadStream stream; + stream.OpenLC(aStore,anId); + InternalizeL(stream); + CleanupStack::PopAndDestroy(); + }

\ No newline at end of file