diff -r 89d6a7a84779 -r 25a17d01db0c Symbian3/PDK/Source/GUID-95448841-5E5B-54C4-85A7-DCE6D078E036.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/PDK/Source/GUID-95448841-5E5B-54C4-85A7-DCE6D078E036.dita Fri Jan 22 18:26:19 2010 +0000 @@ -0,0 +1,23 @@ + + + + + +Constructing an embedded store

Embedded stores are represented by an instance of the CEmbeddedStore class.

A CEmbeddedStore object is constructed from a host stream.

When the CEmbeddedStore object represents a new embedded store, it is constructed from an RWriteStream object; for example, a class might include the following code fragment in one of its functions:

... + // create the stream to contain the embedded store +RStoreWriteStream childStream; + // we need to keep track of this stream id +iEmbeddedStoreId = childStream.CreateLC(iStore); + // construct the embedded store +CPersistentStore* embeddedStore = CEmbeddedStore::NewLC(childStream); +...

Here, the code assumes that iStore refers to the top level store and iEmbeddedStoreId is a data member to hold the ID of the hosting stream.

On successful construction, ownership of the host stream passes to the embedded store which means that the embedded store takes on the responsibility for closing the stream.

When the CEmbeddedStore object represents an existing embedded store, it is constructed from an RReadStream object; for example, a class might include the following code fragment in one of its functions:

... +RStoreReadStream childStream; +childStream.OpenL(iStore,iEmbeddedStoreId); +iEmbeddedStore = CEmbeddedStore::FromL(childStream); +...

Where:

When saving data, an application re-creates the embedded store by re-writing the complete partial object network to the embedded store, replacing any existing data.

\ No newline at end of file