Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: S32STOR.H
Link against: estor.lib

Class CEmbeddedStore

class CEmbeddedStore : public CPersistentStore;

Description

Encapsulates an embedded store.

The embedded store may contain an arbitrarily complex network of streams, but is viewed as simply another stream by the embedding store. This means that the embedded store can dealt with as a single stream for purposes of copying or deleting.

Once streams within the embedded store have been committed and closed, they cannot subsequently be changed, i.e. streams cannot be replaced, deleted, extended or changed in any way.

Derivation

Members

Defined in CEmbeddedStore:
CEmbeddedStore(), ConstructL(), Detach(), DoCommitL(), DoCreateL(), DoReadL(), DoSetRootL(), FromL(), FromLC(), Host(), MarshalL(), NewL(), NewLC(), Position(), Reattach(), Start(), ~CEmbeddedStore()

Inherited from CBase:
Extension_(), operator new()

Inherited from CPersistentStore:
Root(), SetRootL(), iRoot

Inherited from CStreamStore:
Commit(), CommitL(), CompactL(), Delete(), DeleteL(), DoCompactL(), DoDeleteL(), DoExtendL(), DoReclaimL(), DoReplaceL(), DoRevertL(), DoWriteL(), ExtendL(), ReclaimL(), Revert(), RevertL()

See also:


Construction and destruction


NewL()

static IMPORT_C CEmbeddedStore *NewL(RWriteStream &aHost);

Description

Creates an embedded store within the specified host stream.

Note that ownership of the stream passes to the store and the referenced RWriteStream is cleared.

Parameters

RWriteStream &aHost

A reference to the stream which is to host the embedded store.

Return value

CEmbeddedStore *

A pointer to the embedded store object.


NewLC()

static IMPORT_C CEmbeddedStore *NewLC(RWriteStream &aHost);

Description

Creates an embedded store within the specified host stream, putting a pointer to the store onto the cleanup stack.

Putting a pointer to the embedded store object onto the cleanup stack allows the object and allocated resources to be cleaned up if a subsequent leave occurs.

Note that ownership of the stream passes to the store and the referenced RWriteStream is cleared.

Parameters

RWriteStream &aHost

A reference to the stream which is to host the embedded store.

Return value

CEmbeddedStore *

A pointer to the embedded store object.


CEmbeddedStore()

IMPORT_C CEmbeddedStore(MStreamBuf *aHost);

Description

Parameters

MStreamBuf *aHost


ConstructL()

IMPORT_C void ConstructL(RWriteStream &aStream);

Description

Parameters

RWriteStream &aStream


~CEmbeddedStore()

IMPORT_C ~CEmbeddedStore();

Description

Frees resources owned by the object, prior to its destruction. In particular, the destructor closes the associated file.

[Top]


Member functions


FromL()

static IMPORT_C CEmbeddedStore *FromL(RReadStream &aHost);

Description

Opens the store hosted by the specified stream.

Note that ownership of the stream passes to the store; the referenced RReadStream is cleared.

Parameters

RReadStream &aHost

A reference to the stream hosting the embedded store.

Return value

CEmbeddedStore *

A pointer to the embedded store object.


FromLC()

static IMPORT_C CEmbeddedStore *FromLC(RReadStream &aHost);

Description

Open the store hosted by the specified stream, putting a pointer to the store onto the cleanup stack.

Putting a pointer to the embedded store object onto the cleanup stack allows the object and allocated resources to be cleaned up if a subsequent leave occurs.

Note that ownership of the stream passes to the store and the referenced RReadStream is cleared.

Parameters

RReadStream &aHost

A reference to the stream hosting the embedded store.

Return value

CEmbeddedStore *

A pointer to the embedded store object.


Position()

static inline TStreamPos Position(TStreamId anId);

Description

Returns the position of the specified stream, within the host stream.

Parameters

TStreamId anId

The stream id of the stream in the embedded store whose position within the host stream is to be returned.

Return value

TStreamPos

The position of the stream with id anId within the host stream.


Detach()

IMPORT_C void Detach();

Description

Gives up ownership of the host stream buffer. The caller takes on the responsibility for discarding the buffer.


Reattach()

inline void Reattach(MStreamBuf *aHost);

Description

Takes ownership of the specified stream buffer. On return from this function, the embedded store assumes this to be the host stream buffer.

Parameters

MStreamBuf *aHost

A pointer to the stream buffer over which the embedded store is to take ownership.


Host()

inline MStreamBuf *Host() const;

Description

Returns a pointer to the stream buffer which is acting as host to this embedded store. The embedded store retains ownership of the host stream buffer.

Return value

MStreamBuf *

A pointer to the stream buffer which is host to this embedded store.


Start()

inline TStreamPos Start() const;

Description

Returns the start position of this embedded store within the host stream.

Return value

TStreamPos

The position of the this embedded store within the host stream.


MarshalL()

IMPORT_C void MarshalL(RReadStream &aStream);

Description

Parameters

RReadStream &aStream


DoReadL()

protected: virtual IMPORT_C MStreamBuf *DoReadL(TStreamId anId) const;

Description

Opens the requested stream for reading. The function should return a stream buffer positioned at the beginning of this stream.

This function is called by the OpenL() and OpenLC() member functions of RStoreReadStream.

Parameters

TStreamId anId

The stream to be read.

Return value

MStreamBuf *

A stream buffer positioned at the beginning of the stream to be read.

See also:


DoCreateL()

protected: virtual IMPORT_C MStreamBuf *DoCreateL(TStreamId &anId);

Description

Creates a new stream in the store. The function gets the allocated stream id in the anId parameter. A stream buffer for the stream should be returned, ready to write into the new stream. This provides the implementation for the RStoreWriteStream::CreateL() functions.

Parameters

TStreamId &anId

On return, contains the allocated stream id.

Return value

MStreamBuf *

The stream buffer to be written to.


DoSetRootL()

private: virtual IMPORT_C void DoSetRootL(TStreamId anId);

Description

Implements the setting of theroot stream.

This function is called by SetRootL()

Parameters

TStreamId anId

The id of the stream which is to be the root stream of the store.

See also:


DoCommitL()

private: virtual IMPORT_C void DoCommitL();

Description

Commits any changes to the store. For a store that provides atomic updates, this writes all of the pending updates to the to the permanent storage medium. After committing the store contains all or none of the updates since the last commit/revert.

This function provides the implementation for the public CommitL() function.