EPOC   SDK Home Glossary Indexes Previous Next Up

CMsvStore class


Contents


CMsvStore class — Message store access

Section Contents


Overview

Compatibility

Applications that use this class will not work correctly on a version of EPOC earlier than ER5.

Derivation

CBase

Abstract: CBase behaviour

Defined in

msvstore.h

Link against

ment.lib

Description

This class provides an interface over the message store that is associated with a message entry. It is similar to the dictionary store in supporting the concept of streams referenced by UID.

This class is intended for use by MTM implementations. Message client applications access the store through the higher-level functions provided by Client-side and User Interface MTMs.

A CMsvStore object is created by a CMsvEntry object (see Message store access) and passed to a client process. The client process then becomes responsible for deleting the CMsvStore object. The store can be opened in two modes, read or edit, and only one CMsvStore object can have edit access to a store.

CMsvStore provides functions for general manipulation of the store, and for accessing the standard body text stream. RMsvReadStream and RMsvWriteStream must be used to access other streams.


Destructor


~CMsvStore()

~CMsvStore();

Description

If the message store is currently locked, the destructor releases it before deleting the object.


Body text


DeleteBodyTextL() — Delete body text stream

void DeleteBodyTextL();

Description

Use this function to deletes the stream that contains the body text. Write access is needed for this function.

Leave considerations

KErrAccessDenied

Store is not open for writing

Other

Standard streaming leave codes


HasBodyTextL() — Check for body text

TBool HasBodyTextL() const;

Description

Use this function to check if the store has a body text stream.

Return value

TBool

ETrue if the store has a body text stream, else EFalse


RestoreBodyTextL() — Get body text

void RestoreBodyTextL(CRichText& aRichTextBody) const;

Description

Use this function to read the body text stream from the message store into the given rich text object.

Arguments

CRichText& aRichTextBody

On return, the message store’s body text is inserted into this object. Any previously existing contents is lost.

Leave considerations

KErrNotFound

There is no body text stream in the store

Other

Standard streaming leave codes


StoreBodyTextL() — Write body text

void StoreBodyTextL(const CRichText& aRichTextBody);

Description

Use this function to store and commit aRichTextBody in the body text stream of the message store. Any existing data is overwritten. Write access is needed for this function.

Arguments

const CRichText& aRichTextBody

The body data to be externalised

Leave considerations

KErrAccessDenied

Store is not open for writing

Other

Standard streaming leave codes


Commit to message store

Use these functions to commit changes to the message store. Committing changes makes these changes permanent, and means that the store cannot be rolled back to a state before the changes were begun. See Commit and revert for a full explanation of the commit-revert model in EPOC.

You should use these functions before deleting a CMsvStore, if you have made changes to it through RMsvWriteStream . Note that StoreBodyTextL() performs a commit itself, so an additional commit is not required after its use.

The two functions are identical, except that the Commit() returns any error code, while CommitL() leaves with the error code if an error occurs.

Write access is needed for these functions.


Commit() — Commit changes

TInt Commit();

Description

Use this function to commit changes to the message store, returning any error code.

Return values

KErrNone

Changes committed successfully

KErrAccessDenied

Store open for read only

Standard streaming error codes

Unable to commit changes


CommitL() — Commit changes and leave if error

void CommitL();

Description

Use this function to commit changes to the message store, leaving if an error occurs.

Leave considerations

KErrAccessDenied

Store open for read only

Standard streaming error codes

Unable to commit changes


General message store functions


DeleteL() — Delete message store

void DeleteL();

Description

Use this function to delete the message store. After a delete, the behaviour of the object is undefined: it can only be deleted.

Write access is needed for this function.

Leave considerations

KErrAccessDenied

The store is read only

Other

Standard file store error codes


IsNullL() — Check for streams

TBool IsNullL() const;

Description

Use this function to determine whether the message store contains any streams.

Return value

TBool

ETrue if the store has no streams, else EFalse


IsPresentL() — Check for particular stream

TBool IsPresentL(TUid aUid) const;

Description

Use this function to determine whether the message store contains a stream identified by the aUid.

Arguments

TUid aUid

Identifier of stream

Return value

TBool

ETrue if the store has a stream aUid, else EFalse


Remove() — Delete stream from store

void Remove(TUid aUid);

Description

Use this function to delete the stream identified by aUid from the store. The function returns, whether or not it completes successfully.

Write access is needed for this function.

Arguments

TUid aUid

The UID of the stream to delete


RemoveL() — Delete stream from store and leave if error

void RemoveL(TUid aUid);

Description

Use this function to delete the stream identified by aUid from the store. It leaves if it cannot complete successfully.

Write access is needed for this function.

Arguments

TUid aUid

The UID of the stream to delete

Leave considerations

KErrAccessDenied

The store is read only

Other

Standard streaming error codes


Revert() — Revert to previous commit

void Revert();

Description

Use this function to revert the store to the previous commit level. This removes all changes that have been made to the store since the last commit. See Commit and revert for a full explanation of the commit-revert model in EPOC.

The function cannot leave: it returns, whether or not it completes successfully.

Write access is needed for this function.


RevertL() — Revert to previous commit and leave if error

void RevertL();

Description

Use this function to revert the store to the previous commit level. This removes all changes that have been made to the store since the last commit. See Commit and revert for a full explanation of the commit-revert model in EPOC.

The function leaves if it cannot complete successfully.

Write access is needed for this function.

Leave considerations

KErrAccessDenied

The store is read only

Other

Standard streaming error codes


SizeL() — Store size

TInt SizeL();

Description

Use this function to get the size of the message store.

Return value

TInt

Size of the message store in bytes

Leave considerations

Standard file store error codes

EPOC       SDK Home Glossary Indexes Previous Next Up