CMsvStore Class Reference

class CMsvStore : public CBase

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.

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)
Private Member Functions
voidConstructL(TBool)
voidConvert8BitToRichTextL(RFile &, CRichText &, TUint, TUint)
voidGetRichTextFrom16BitL(RFile &, CRichText &)
voidGetRichTextFrom8BitL(RFile &, CRichText &, TUint, TUint)
voidLock()
voidRestorePlainBodyTextL(CRichText &, TUint)
const CMsvCachedStore &Store()
CMsvCachedStore &Store()
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()
Private Attributes
CMsvAttachmentManager *iAttachmentManager
CMsvBodyText *iBodyText
TBool iConstructed
RFs &iFs
const TMsvIdiId
enum CMsvStore::@61iLockStatus
MMsvStoreObserver &iObserver
CMsvCachedStore *iStore
MMsvStoreManager &iStoreManager

Constructor & Destructor Documentation

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

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

Parameters

MMsvStoreObserver & aObserver
RFs & aFs
TMsvId aId
MMsvStoreManager & aStoreManager

~CMsvStore()

IMPORT_C~CMsvStore()

Destructor.

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

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

MMsvAttachmentManager

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.

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
KErrAccessDenied Store open for read only
leave
Standard streaming error codes Unable to commit changes

ConstructL(TBool)

voidConstructL(TBoolaReadOnly)[private]

Parameters

TBool aReadOnly

Convert8BitToRichTextL(RFile &, CRichText &, TUint, TUint)

voidConvert8BitToRichTextL(RFile &aBodyTextFile,
CRichText &aRichText,
TUintaCharSet,
TUintaDefaultCharSet
)[private]

Converts 8 bit data to Unicode and inserts to the CRichText object.

Parameters

RFile & aBodyTextFile
CRichText & aRichTextThe CRichText object that will be filled on return.
TUint aCharSetThe charset of the body part.
TUint aDefaultCharSetThe default charset of the system.

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

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

Parameters

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
KErrAccessDenied Store is not open for writing
leave
Other Standard 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
KErrAccessDenied The store is read only
leave
Other Standard file store error codes

GetRichTextFrom16BitL(RFile &, CRichText &)

voidGetRichTextFrom16BitL(RFile &aBodyTextFile,
CRichText &aRichText
)[private]

Gets CRichText from plain body text file if data stored as 16 bit.

Parameters

RFile & aBodyTextFile
CRichText & aRichTextThe CRichText object that will be filled on return.

GetRichTextFrom8BitL(RFile &, CRichText &, TUint, TUint)

voidGetRichTextFrom8BitL(RFile &aBodyTextFile,
CRichText &aRichText,
TUintaCharSet,
TUintaDefaultCharSet
)[private]

Gets CRichText from plain body text file if data stored as 8 bit.

Parameters

RFile & aBodyTextFile
CRichText & aRichTextThe CRichText object that will be filled on return.
TUint aCharSetThe charset of the body part.
TUint aDefaultCharSetThe default charset of the system.

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.

InitialisePlainBodyTextForReadL(TInt)

IMPORT_C CMsvPlainBodyText *InitialisePlainBodyTextForReadL(TIntaChunkLength)
Intialise and return the CMsvPlainBodyText object that can be used for reading plain body text.
leave
KErrAccessDenied If Store is opened in Write mode.

Parameters

TInt aChunkLengthThe length of the chunk that will be processed while reading.

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.
leave
KErrAccessDenied If Store is opened in Read mode.

Parameters

TBool aIs8BitTBool indicating whether to store bdy text as 8/16 bit.
TUint aCharsetIdThe charset of the body part.
TUint aDefaultCharsetIdThe default charset of the system.

IsNullL()

IMPORT_C TBoolIsNullL()const

Tests whether the message store contains any streams.

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

TUid aUidIdentifier of stream

Lock()

voidLock()[private]

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

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

Parameters

MMsvStoreObserver & aObserver
RFs & aFs
MMsvStoreManager & aStoreManager
TMsvId aId

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

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

Parameters

MMsvStoreObserver & aObserver
RFs & aFs
MMsvStoreManager & aStoreManager
TMsvId aId

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

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

leave
KErrAccessDenied The store is read only
leave
Other Standard streaming error codes

Parameters

TUid aUidThe UID of the stream to delete

Restore8BitBodyTextL(RFileReadStream &)

voidRestore8BitBodyTextL(RFileReadStream &aInputStream)

Restores 8 bit body text from the Message Store

Parameters

RFileReadStream & 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.
leave
KErrNotFound There is no body text stream in the store
leave
Other Standard streaming leave codes

Parameters

CRichText & aRichTextBodyOn return, the message store's body text is inserted into this object. Any previously existing contents is lost.

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.
leave
KErrNotFound There is no body text stream in the store
leave
Other Standard streaming leave codes

Parameters

CRichText & aRichTextBodyOn return, the message store's body text is inserted into this object. Any previously existing contents is lost.
TUint aCharsetOverrideThe charset with which to override the existing charset when data is stored a 8 bit format.

RestorePlainBodyTextL(CRichText &, TUint)

voidRestorePlainBodyTextL(CRichText &aRichText,
TUintaCharsetOverride
)[private]

Restores a CRichText object from the plain body text file.

Parameters

CRichText & aRichTextOn completion this contains the plain body text.
TUint aCharsetOverrideThe new charset with which to override the existing charset when data is stored a 8 bit plain text format.

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
KErrAccessDenied The store is read only
leave
Other Standard streaming error codes

SizeL()

IMPORT_C TIntSizeL()

Gets the size of the message store.

Store()

const CMsvCachedStore &Store()const [private, inline]

Store()

CMsvCachedStore &Store()[private, inline]

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.

leave
KErrAccessDenied Store is not open for writing
leave
Other Standard streaming leave codes

Parameters

const CRichText & aRichTextBodyThe body data to be externalised

Member Data Documentation

CMsvAttachmentManager * iAttachmentManager

CMsvAttachmentManager *iAttachmentManager[private]

CMsvBodyText * iBodyText

CMsvBodyText *iBodyText[private]

TBool iConstructed

TBool iConstructed[private]

RFs & iFs

RFs &iFs[private]

const TMsvId iId

const TMsvIdiId[private]

enum CMsvStore::@61 iLockStatus

enum CMsvStore::@61iLockStatus[private]

MMsvStoreObserver & iObserver

MMsvStoreObserver &iObserver[private]

CMsvCachedStore * iStore

CMsvCachedStore *iStore[private]

MMsvStoreManager & iStoreManager

MMsvStoreManager &iStoreManager[private]