CMsvStore Class Reference

#include <mw/msvstore.h>

Link against: msgs_autoshutdown.lib

class CMsvStore : public CBase, public CBase

Inherits from

Public Member Functions
~CMsvStore()
IMPORT_C MMsvAttachmentManagerSync &AttachmentManagerExtensionsL()
IMPORT_C MMsvAttachmentManager &AttachmentManagerL()
IMPORT_C TIntCommit()
IMPORT_C voidCommitL()
IMPORT_C voidCreateShareProtectedAttachmentL(const TDesC &, RFile &, CMsvAttachment *)
IMPORT_C voidDeleteBodyTextL()
IMPORT_C voidDeleteL()
IMPORT_C TBoolHasBodyTextL()
IMPORT_C CMsvPlainBodyText *InitialisePlainBodyTextForReadL(TInt)
IMPORT_C CMsvPlainBodyText *InitialisePlainBodyTextForWriteL(TBool, TUint, TUint)
IMPORT_C TBoolIsNullL()
IMPORT_C TBoolIsPresentL(TUid)
IMPORT_C voidRemove(TUid)
IMPORT_C voidRemoveL(TUid)
voidRestore8BitBodyTextL(RFileReadStream &)
IMPORT_C voidRestoreBodyTextL(CRichText &)
IMPORT_C voidRestoreBodyTextL(CRichText &, TUint)
IMPORT_C voidRevert()
IMPORT_C voidRevertL()
IMPORT_C TIntSizeL()
IMPORT_C voidStoreBodyTextL(const CRichText &)
Protected Member Functions
CMsvStore(MMsvStoreObserver &, RFs &, TMsvId, MMsvStoreManager &)
IMPORT_C CMsvStore *OpenForReadL(MMsvStoreObserver &, RFs &, MMsvStoreManager &, TMsvId)
IMPORT_C CMsvStore *OpenForWriteL(MMsvStoreObserver &, RFs &, MMsvStoreManager &, TMsvId)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()

Detailed Description

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 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.

Constructor & Destructor Documentation

CMsvStore ( MMsvStoreObserver &, RFs &, TMsvId, MMsvStoreManager & )

IMPORT_CCMsvStore(MMsvStoreObserver &aObserver,
RFs &aFs,
TMsvIdaId,
MMsvStoreManager &aStoreManager
)[protected]

~CMsvStore ( )

IMPORT_C~CMsvStore()

Destructor.

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

Member Function Documentation

AttachmentManagerExtensionsL ( )

IMPORT_C MMsvAttachmentManagerSync &AttachmentManagerExtensionsL()

AttachmentManagerL ( )

IMPORT_C MMsvAttachmentManager &AttachmentManagerL()

Returns an interface for the Attachment Manager.

This methods returns an interface that can be used to provided attachment management functionality for each message entry.

See also: MMsvAttachmentManager

Return Value
A reference to the Attachment Manager interface

Commit ( )

IMPORT_C TIntCommit()

Commits changes to the message store, returning any error code.

Committing changes makes these changes permanent, and means that the store cannot be rolled back to a state before the changes were begun.

You should use this function 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 functions is identical to the following one, except that it returns an error code if an error occurs.

Write access is needed.

Return Value
Changes committed successfully Store open for read only Unable to commit changes

CommitL ( )

IMPORT_C voidCommitL()

Commits changes to the message store, leaving if an error occurs.

Committing changes makes these changes permanent, and means that the store cannot be rolled back to a state before the changes were begun.

You should use this function 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 functions is identical to the previous one, except that it leaves with the error code if an error occurs.

Write access is needed.

Leave Codes
KErrAccessDeniedStore open for read only
Standardstreaming error codes Unable to commit changes

CreateShareProtectedAttachmentL ( const TDesC &, RFile &, CMsvAttachment * )

IMPORT_C voidCreateShareProtectedAttachmentL(const TDesC &aFileName,
RFile &aAttachmentFile,
CMsvAttachment *aAttachmentInfo
)

DeleteBodyTextL ( )

IMPORT_C voidDeleteBodyTextL()

Deletes the stream that contains the body text. Write access is needed for this function.

Leave Codes
KErrAccessDeniedStore is not open for writing
OtherStandard streaming leave codes

DeleteL ( )

IMPORT_C voidDeleteL()

Deletes 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 Codes
KErrAccessDeniedThe store is read only
OtherStandard file store error codes

HasBodyTextL ( )

IMPORT_C TBoolHasBodyTextL()const

Checks if the store has a body text stream; IsPresentL(KMsvEntryRichTextBody) will always return EFalse when the store_8bit_flag in imcm.rss is enabled.

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

InitialisePlainBodyTextForReadL ( TInt )

IMPORT_C CMsvPlainBodyText *InitialisePlainBodyTextForReadL(TIntaChunkLength)
Intialise and return the CMsvPlainBodyText object that can be used for reading plain body text.
Parameters
aChunkLengthThe length of the chunk that will be processed while reading.
Return Value
CMsvPlainBodyText.
Leave Codes
KErrAccessDeniedIf Store is opened in Write mode.

InitialisePlainBodyTextForWriteL ( TBool, TUint, TUint )

IMPORT_C CMsvPlainBodyText *InitialisePlainBodyTextForWriteL(TBoolaIs8Bit,
TUintaCharsetId,
TUintaDefaultCharsetId
)
Intialise and return the CMsvPlainBodyText object that can be used for reading/writing plain body text.
Parameters
aIs8BitTBool indicating whether to store bdy text as 8/16 bit.
aCharsetIdThe charset of the body part.
aDefaultCharsetIdThe default charset of the system.
Return Value
CMsvPlainBodyText.
Leave Codes
KErrAccessDeniedIf Store is opened in Read mode.

IsNullL ( )

IMPORT_C TBoolIsNullL()const

Tests whether the message store contains any streams.

Return Value
ETrue if the store has no streams, else EFalse

IsPresentL ( TUid )

IMPORT_C TBoolIsPresentL(TUidaUid)const

Tests whether the message store contains a stream identifier. Do not use to check if there is a body text part stored with the email; use CMsvStore::HasBodyTextL() instead.

Parameters
aUidIdentifier of stream
Return Value
ETrue if the store has a stream aUid, else EFalse

OpenForReadL ( MMsvStoreObserver &, RFs &, MMsvStoreManager &, TMsvId )

IMPORT_C CMsvStore *OpenForReadL(MMsvStoreObserver &aObserver,
RFs &aFs,
MMsvStoreManager &aStoreManager,
TMsvIdaId
)[protected, static]

OpenForWriteL ( MMsvStoreObserver &, RFs &, MMsvStoreManager &, TMsvId )

IMPORT_C CMsvStore *OpenForWriteL(MMsvStoreObserver &aObserver,
RFs &aFs,
MMsvStoreManager &aStoreManager,
TMsvIdaId
)[protected, static]

Remove ( TUid )

IMPORT_C voidRemove(TUidaUid)

Deletes the identified stream from the store. The function returns, whether or not it completes successfully.

Write access is needed for this function.

Parameters
aUidThe UID of the stream to delete

RemoveL ( TUid )

IMPORT_C voidRemoveL(TUidaUid)

Deletes the identified stream from the store. It leaves if it cannot complete successfully.

Write access is needed for this function.

Parameters
aUidThe UID of the stream to delete
Leave Codes
KErrAccessDeniedThe store is read only
OtherStandard streaming error codes

Restore8BitBodyTextL ( RFileReadStream & )

voidRestore8BitBodyTextL(RFileReadStream &aInputStream)

Restores 8 bit body text from the Message Store

Parameters
aInputStreamon completion the RFileReadStream contains the message body text stream.

RestoreBodyTextL ( CRichText & )

IMPORT_C voidRestoreBodyTextL(CRichText &aRichTextBody)
Restores body text into the given rich text object - doesnt matter if store is locked or not will leave if the file store doesn't exist, the body text does not exist, and also propagate store leaves Reads the body text stream from the message store into the given rich text object.
Parameters
aRichTextBodyOn return, the message store's body text is inserted into this object. Any previously existing contents is lost.
Leave Codes
KErrNotFoundThere is no body text stream in the store
OtherStandard streaming leave codes

RestoreBodyTextL ( CRichText &, TUint )

IMPORT_C voidRestoreBodyTextL(CRichText &aRichTextBody,
TUintaCharsetOverride
)
Restores body text into the given rich text object - doesnt matter if store is locked or not. Reads the body text stream from the message store into the given rich text object.
Parameters
aRichTextBodyOn return, the message store's body text is inserted into this object. Any previously existing contents is lost.
aCharsetOverrideThe charset with which to override the existing charset when data is stored a 8 bit format.
Leave Codes
KErrNotFoundThere is no body text stream in the store
OtherStandard streaming leave codes

Revert ( )

IMPORT_C voidRevert()

Reverts the store to the previous commit level. This removes all changes that have been made to the store since the last commit.

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

Write access is needed for this function.

RevertL ( )

IMPORT_C voidRevertL()

Reverts the store to the previous commit level. This removes all changes that have been made to the store since the last commit.

The function leaves if it cannot complete successfully.

Write access is needed for this function.

Leave Codes
KErrAccessDeniedThe store is read only
OtherStandard streaming error codes

SizeL ( )

IMPORT_C TIntSizeL()

Gets the size of the message store.

Return Value
Size of the message store in bytes

StoreBodyTextL ( const CRichText & )

IMPORT_C voidStoreBodyTextL(const CRichText &aRichTextBody)

Stores the body text stream of the message store. Any existing data is overwritten. Write access is needed for this function. A commit must be done following this function for the new data to be retained.

Parameters
aRichTextBodyThe body data to be externalised
Leave Codes
KErrAccessDeniedStore is not open for writing
OtherStandard streaming leave codes