CMsvPlainBodyText Class Reference

class CMsvPlainBodyText : public CMsgActive

This class encapsulates plainbody text information for storage within the Message Store.It also populates a CRichText object with the 8 bit data decoded to the specified character set.If a character set is not specified, then the default character set is used.

Inherits from

Public Member Functions
~CMsvPlainBodyText()
IMPORT_C TUintCharacterSet()
IMPORT_C voidCommitL()
IMPORT_C TUintDefaultCharacterSet()
CMsvPlainBodyText *NewL(MMsvStoreManager &, CMsvStore &, TBool, TUint, TUint, TMsvId, RFs &)
CMsvPlainBodyText *NewL(MMsvStoreManager &, CMsvStore &, TMsvId, RFs &, TInt)
IMPORT_C voidNextChunkL(TDes8 &, TRequestStatus &)
IMPORT_C voidNextChunkL(TDes8 &)
IMPORT_C voidNextChunkL(TDes16 &, TRequestStatus &)
IMPORT_C voidNextChunkL(TDes16 &)
IMPORT_C voidPreviousChunkL(TDes8 &, TRequestStatus &)
IMPORT_C voidPreviousChunkL(TDes8 &)
IMPORT_C voidPreviousChunkL(TDes16 &, TRequestStatus &)
IMPORT_C voidPreviousChunkL(TDes16 &)
IMPORT_C voidSetCharacterSetL(const TUint)
IMPORT_C TIntSize()
IMPORT_C voidStoreChunkL(const TDesC8 &, TRequestStatus &)
IMPORT_C voidStoreChunkL(const TDesC8 &)
IMPORT_C voidStoreChunkL(const TDesC16 &, TRequestStatus &)
IMPORT_C voidStoreChunkL(const TDesC16 &)
IMPORT_C voidStoreRichTextAsPlainTextL(CRichText &)
Private Member Functions
CMsvPlainBodyText(MMsvStoreManager &, CMsvStore &, TBool, TUint, TUint, TMsvId, RFs &)
CMsvPlainBodyText(MMsvStoreManager &, CMsvStore &, TMsvId, RFs &, TInt)
voidConstructReadL()
voidConstructWriteL()
TInt ConvertChunkToUnicodeForRestoreL()
voidConvertChunkToUnicodeForStoreL(const TDesC8 &)
voidDoCancel()
voidDoComplete()
voidDoRunL()
voidExtractNextChunkFromRichText(TDes16 &)
voidExtractPreviousChunkFromRichText(TDes16 &)
voidPrepareToConvertL()
voidRevertL()
Inherited Functions
CActive::CActive(TInt)
CActive::Cancel()
CActive::Deque()
CActive::Extension_(TUint,TAny *&,TAny *)
CActive::IsActive()const
CActive::IsAdded()const
CActive::Priority()const
CActive::RunError(TInt)
CActive::SetActive()
CActive::SetPriority(TInt)
CActive::~CActive()
CBase::CBase()
CBase::Delete(CBase *)
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()
CMsgActive::CMsgActive(TInt)
CMsgActive::Complete(TInt)
CMsgActive::Queue(TRequestStatus &)
CMsgActive::~CMsgActive()
Inherited Enumerations
CActive:TPriority
Private Attributes
CCnvCharacterSetConverter::TAvailability iAvailable
CCharFormatLayer *iCharLayer
TUint iCharsetId
TDes16 *iChunk16
TDes8 *iChunk8
TInt iChunkMaxLength
CCnvCharacterSetConverter *iConverter
TInt iCurrentFilePos
TUint iDefaultCharsetId
RFs &iFSession
RFile iFile
HBufC *iFilePath
TBool iIs8Bit
TBool iIsCommitted
TBool iIsLastChunk
TMsvId iMessageId
enum CMsvPlainBodyText::@70iMsvFileStatus
MMsvStoreManager &iMsvStoreManager
CParaFormatLayer *iParaLayer
TInt iPos
TBool iPrevChunk
TInt iReadChunkLength
RBuf16 iRemainingConvertedData
HBufC8 *iRemainingUnConvertedData
TBool iRetrieving8bit
RBuf8 iRfileReadBuf8
TPtrC8 iRfileWritePtr8
CRichText *iRichText
RArray< TInt >iStartPosOfEachChunkInFile
TInt iStartPosOfNextChunk
CMsvStore &iStore
RBuf16 iTempChunk16
Inherited Attributes
CActive::iStatus

Constructor & Destructor Documentation

CMsvPlainBodyText(MMsvStoreManager &, CMsvStore &, TBool, TUint, TUint, TMsvId, RFs &)

CMsvPlainBodyText(MMsvStoreManager &aMsvStoreManager,
CMsvStore &aStore,
TBoolaIs8Bit,
TUintaCharsetId,
TUintaDefaultCharsetId,
TMsvIdaMessageId,
RFs &aFs
)[private]

Default Constructor for write operation.

Parameters

MMsvStoreManager & aMsvStoreManager
CMsvStore & aStore
TBool aIs8Bit
TUint aCharsetId
TUint aDefaultCharsetId
TMsvId aMessageId
RFs & aFs

CMsvPlainBodyText(MMsvStoreManager &, CMsvStore &, TMsvId, RFs &, TInt)

CMsvPlainBodyText(MMsvStoreManager &aMsvStoreManager,
CMsvStore &aStore,
TMsvIdaMessageId,
RFs &aFs,
TIntaChunkLength
)[private]

Default Constructor called for Read operation..

Parameters

MMsvStoreManager & aMsvStoreManager
CMsvStore & aStore
TMsvId aMessageId
RFs & aFs
TInt aChunkLength

~CMsvPlainBodyText()

IMPORT_C~CMsvPlainBodyText()

Destructor

Member Functions Documentation

CharacterSet()

IMPORT_C TUintCharacterSet()

Returns the charset for the plain text part TUint

CommitL()

IMPORT_C voidCommitL()

Commit the file and the store after it is written and and also closes the file.

ConstructReadL()

voidConstructReadL()[private]

ConstructL for Read operation.

ConstructWriteL()

voidConstructWriteL()[private]

ConstructWriteL for creating and writing to the plain bodytext file.

ConvertChunkToUnicodeForRestoreL()

TInt ConvertChunkToUnicodeForRestoreL()[private]

Converts the 8 bit chunk to unicode.When this is called iRfileReadBuf8 will have the 8-bit data that needs to be converted to unicode.8 bit data that is not converted is copied to iRemainingUnConvertedData, which is used in conversion when this is called again. TInt Number of bytes in Current Chunk.

ConvertChunkToUnicodeForStoreL(const TDesC8 &)

voidConvertChunkToUnicodeForStoreL(const TDesC8 &aChunk)[private]

Converts the 8 bit chunk to Unicode. void.

Parameters

const TDesC8 & aChunkThe 8bit chunk to be converted.

DefaultCharacterSet()

IMPORT_C TUintDefaultCharacterSet()

Returns the default charset for the plain text part TUint

DoCancel()

voidDoCancel()[private, virtual]

Cancel the file read operation and set the filepointer to the current position of the file so that next call to NextChunkL() will attempt to read the same chunk that was cancelled void.

DoComplete()

voidDoComplete()[private]

DoRunL()

voidDoRunL()[private, virtual]

Asynchronously retrives the body text chunks.If body is stored as 8bit, converts the chunk to Unicode.

ExtractNextChunkFromRichText(TDes16 &)

voidExtractNextChunkFromRichText(TDes16 &aChunk)[private]

Extracts a chunk of iChunkMaxLength or less, from the CRichText object.

Parameters

TDes16 & aChunk

ExtractPreviousChunkFromRichText(TDes16 &)

voidExtractPreviousChunkFromRichText(TDes16 &aChunk)[private]

Extracts a chunk of iChunkMaxLength or less, from the CRichText object.

Parameters

TDes16 & aChunk

NewL(MMsvStoreManager &, CMsvStore &, TBool, TUint, TUint, TMsvId, RFs &)

CMsvPlainBodyText *NewL(MMsvStoreManager &aMsvStoreManager,
CMsvStore &aStore,
TBoolaIs8Bit,
TUintaCharsetId,
TUintaDefaultCharsetId,
TMsvIdaMessageId,
RFs &aFs
)[static]

The NewL factory function for Write operation. CMsvPlainBodyText.

Parameters

MMsvStoreManager & aMsvStoreManagerThe MMsvStoreManager reference to call Store related RFile APIs
CMsvStore & aStoreThe CMsvStore object.
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.
TMsvId aMessageIdThe Id of the message that is to be stored.
RFs & aFsThe RFs for handling RFile related operations.

NewL(MMsvStoreManager &, CMsvStore &, TMsvId, RFs &, TInt)

CMsvPlainBodyText *NewL(MMsvStoreManager &aMsvStoreManager,
CMsvStore &aStore,
TMsvIdaMessageId,
RFs &aFs,
TIntaChunkLength
)[static]

Overloaded NewL for Read operation. CMsvPlainBodyText.

Parameters

MMsvStoreManager & aMsvStoreManagerThe MMsvStoreManager reference to call Store related RFile APIs
CMsvStore & aStoreThe CMsvStore object.
TMsvId aMessageIdThe Id of the message that is to be stored.
RFs & aFsThe RFs for handling RFile related operations.
TInt aChunkLengthThe length of the chunk that will be stored/restored in single operaion

NextChunkL(TDes8 &, TRequestStatus &)

IMPORT_C voidNextChunkL(TDes8 &aChunk,
TRequestStatus &aStatus
)

Retrieve the next chunk of the plain body text. leave

KErrAccessDenied If CMsvStore was opened in Write mode.

leave

KErrNotSupported If 16-bit storage is enabled.

leave

KErrUnderflow If aChunk MaxLength is less than iChunkMaxLength.

leave

Other Standard system-wide error codes.

void

Parameters

TDes8 & aChunkThe output parameter contains the requested chunk.
TRequestStatus & aStatus

NextChunkL(TDes8 &)

IMPORT_C voidNextChunkL(TDes8 &aChunk)

Retrieve the next chunk of the plain body text. leave

KErrNotSupported If CMsvStore was opened in Write mode.

leave

KErrNotSupported If 16-bit storage is enabled.

leave

KErrUnderflow If aChunk MaxLength is less than iChunkMaxLength.

leave

Other Standard system-wide error codes.

void

Parameters

TDes8 & aChunkThe output parameter contains the requested chunk.

NextChunkL(TDes16 &, TRequestStatus &)

IMPORT_C voidNextChunkL(TDes16 &aChunk,
TRequestStatus &aStatus
)

Retrieve the next chunk of the plain body text. If body is stored as 8bit, the chunk is converted to unicode.Unconverted bytes will be converted while reading the next chunk. leave

KErrAccessDenied If CMsvStore was opened in Write mode.

leave

KErrUnderflow If aChunk MaxLength is less than iChunkMaxLength.

leave

Other Standard system-wide error codes.

void

Parameters

TDes16 & aChunkThe output parameter contains the requested chunk.If no more data is in Store this contains NULL descriptor.
TRequestStatus & aStatusThe TRequestStatus for this request.

NextChunkL(TDes16 &)

IMPORT_C voidNextChunkL(TDes16 &aChunk)

Retrieve the next chunk of the plain body text. If body is stored as 8bit, convert the chunk to Unicode. Unconverted bytes will be converted while reading the next chunk. leave

KErrAccessDenied If CMsvStore was opened in Write mode.

leave

KErrUnderflow If aChunk MaxLength is less than iChunkMaxLength.

leave

Other Standard system-wide error codes.

void

Parameters

TDes16 & aChunkThe output parameter contains the requested chunk.If no more data is in Store this contains NULL descriptor.

PrepareToConvertL()

voidPrepareToConvertL()[private]

Creates the character converter and specifies the character set to convert to or from. Leaves if the specified or default character set is not available. void.

PreviousChunkL(TDes8 &, TRequestStatus &)

IMPORT_C voidPreviousChunkL(TDes8 &aChunk,
TRequestStatus &aStatus
)

Retrieve the previous chunk of the plain body text asynchronously. leave

KErrNotSupported If 16-bit storage is enabled.

leave

KErrAccessDenied If CMsvStore was opened in Write mode.

leave

KErrUnderflow If aChunk MaxLength is less than iChunkMaxLength.

leave

Other Standard system-wide error codes.

void

Parameters

TDes8 & aChunkThe output parameter containing the requested chunk on completion.
TRequestStatus & aStatusThe TRequestStatus for this request.

PreviousChunkL(TDes8 &)

IMPORT_C voidPreviousChunkL(TDes8 &aChunk)

Retrieve the previous chunk of the plain body text. leave

KErrNotSupported If 16-bit storage is enabled.

leave

KErrAccessDenied If CMsvStore was opened in Write mode.

leave

KErrUnderflow If aChunk MaxLength is less than iChunkMaxLength.

leave

Other Standard system-wide error codes.

void

Parameters

TDes8 & aChunkThe output parameter containing the requested chunk.

PreviousChunkL(TDes16 &, TRequestStatus &)

IMPORT_C voidPreviousChunkL(TDes16 &aChunk,
TRequestStatus &aStatus
)

Retrieve the previous chunk of the plain body text asynchronously.DoRunl converts the chunk to unicode. leave

KErrNotSupported If CMsvStore was opened in Write mode.

leave

KErrUnderflow If aChunk MaxLength is less than iChunkMaxLength.

leave

Other Standard system-wide error codes.

void

Parameters

TDes16 & aChunkThe output parameter containing the requested chunk on completion.
TRequestStatus & aStatusThe TRequestStatus for this request.

PreviousChunkL(TDes16 &)

IMPORT_C voidPreviousChunkL(TDes16 &aChunk)

Retrieve the Previouschunk of the plain body text. If body is stored as 8bit, convert the chunk to Unicode. leave

KErrNotSupported If CMsvStore was opened in Write mode.

leave

KErrUnderflow If aChunk MaxLength is less than iChunkMaxLength.

leave

Other Standard system-wide error codes.

void

Parameters

TDes16 & aChunkThe output parameter contains the requested chunk.

RevertL()

voidRevertL()[private]

Revert/Delete the file if it is not committed. void.

SetCharacterSetL(const TUint)

IMPORT_C voidSetCharacterSetL(const TUintaCharset)

Set iCharsetId to aCharset if body text of the message was downloaded as 8 bit. This can be used to override the charset with which a message was downloaded, when the body text is opened for reading. void.

Parameters

const TUint aCharsetThe new charset with which it needs to be converted.

Size()

IMPORT_C TIntSize()

Returns the size of body text in bytes. TInt The size of the plain body text stored in bytes.

StoreChunkL(const TDesC8 &, TRequestStatus &)

IMPORT_C voidStoreChunkL(const TDesC8 &aChunk,
TRequestStatus &aStatus
)

Store the plain body text part in chunks. leave

KErrAccessDenied. If CMsvStore was opened in Read mode or If CommitL is already called.

leave

Other Standard system-wide error codes.

void.

Parameters

const TDesC8 & aChunk
TRequestStatus & aStatus

StoreChunkL(const TDesC8 &)

IMPORT_C voidStoreChunkL(const TDesC8 &aChunk)

Store the plain body text part in chunks,synchronous version. leave

KErrAccessDenied. If CMsvStore was opened in Read mode or If CommitL is already called.

leave

Other Standard system-wide error codes.

void.

Parameters

const TDesC8 & aChunk

StoreChunkL(const TDesC16 &, TRequestStatus &)

IMPORT_C voidStoreChunkL(const TDesC16 &aChunk,
TRequestStatus &aStatus
)

Store the body part in chunks(16 bit version). leave

KErrNotSupported If the 8-bit storage was enabled.

leave

KErrAccessDenied If CMsvStore was opened in Read mode or IfCommitL is already called.

leave

Other Standard system-wide error codes.

void

Parameters

const TDesC16 & aChunkThe 16 bit chunk that is to be stored.
TRequestStatus & aStatusThe TRequestStatus parameter for this request.

StoreChunkL(const TDesC16 &)

IMPORT_C voidStoreChunkL(const TDesC16 &aChunk)

Store the body part in chunks(16 bit synchronous version). leave

KErrNotSupported If the 8-bit storage was enabled.

leave

KErrAccessDenied If CMsvStore was opened in Read mode or If CommitL is already called.

leave

Other Standard system-wide error codes.

void

Parameters

const TDesC16 & aChunkThe 16 bit chunk that is to be stored.

StoreRichTextAsPlainTextL(CRichText &)

IMPORT_C voidStoreRichTextAsPlainTextL(CRichText &aRichText)

Converts and stores the CRichText contents to a plain text. leave

KErrNotSupported If CMsvStore was opened in Read mode or If CommitL is already called.

leave

Other Standard system-wide error codes.

void.

Parameters

CRichText & aRichTextThe CRichText object that will be stored as plain body text.

Member Data Documentation

CCnvCharacterSetConverter::TAvailability iAvailable

CCnvCharacterSetConverter::TAvailability iAvailable[private]

CCharFormatLayer * iCharLayer

CCharFormatLayer *iCharLayer[private]

TUint iCharsetId

TUint iCharsetId[private]

The charset of the body text

TDes16 * iChunk16

TDes16 *iChunk16[private]

Pointer to a 16 bit chunk that is being read from the store.

TDes8 * iChunk8

TDes8 *iChunk8[private]

Pointer to a 8 bit chunk that is being read from the store.

TInt iChunkMaxLength

TInt iChunkMaxLength[private]

Contains the size of the chunk that will be read or write in the RFile

CCnvCharacterSetConverter * iConverter

CCnvCharacterSetConverter *iConverter[private]

Character converter for 8 to 16 bit conversion.

TInt iCurrentFilePos

TInt iCurrentFilePos[private]

TUint iDefaultCharsetId

TUint iDefaultCharsetId[private]

RFs & iFSession

RFs &iFSession[private]

RFile iFile

RFile iFile[private]

The RFile to which body text is written.

HBufC * iFilePath

HBufC *iFilePath[private]

The RFile Path.

TBool iIs8Bit

TBool iIs8Bit[private]

Indicates whether to store text as 8 bit or 16 bit.

TBool iIsCommitted

TBool iIsCommitted[private]

Indicates whether the Rfile is commited or not.

TBool iIsLastChunk

TBool iIsLastChunk[private]

Indicates whether the chunk being read is last.

TMsvId iMessageId

TMsvId iMessageId[private]

enum CMsvPlainBodyText::@70 iMsvFileStatus

enum CMsvPlainBodyText::@70iMsvFileStatus[private]

Enum indicating if RFile is being written or read

MMsvStoreManager & iMsvStoreManager

MMsvStoreManager &iMsvStoreManager[private]

To access APIs related to RFile operations.

CParaFormatLayer * iParaLayer

CParaFormatLayer *iParaLayer[private]

TInt iPos

TInt iPos[private]

The position from where to extract data in CRichText

TBool iPrevChunk

TBool iPrevChunk[private]

Indicates whether call to DoRunl was initiated by PreviousChunkL method.

TInt iReadChunkLength

TInt iReadChunkLength[private]

RBuf16 iRemainingConvertedData

RBuf16 iRemainingConvertedData[private]

Contains the remaining converted Unicode Data

HBufC8 * iRemainingUnConvertedData

HBufC8 *iRemainingUnConvertedData[private]

Contains the remaining unconverted Unicode Data

TBool iRetrieving8bit

TBool iRetrieving8bit[private]

Indicates whether call to DoRunl was initiated by 8 bit PreviousChunkL and NextChunkL methods.

RBuf8 iRfileReadBuf8

RBuf8 iRfileReadBuf8[private]

Buffer used to read data from RFile.

TPtrC8 iRfileWritePtr8

TPtrC8 iRfileWritePtr8[private]

Pointer to 8-bit buffer that needs to be written to RFile.

CRichText * iRichText

CRichText *iRichText[private]

RArray< TInt > iStartPosOfEachChunkInFile

RArray< TInt >iStartPosOfEachChunkInFile[private]

Array that stores the start positions of each chunk,in Rfile

TInt iStartPosOfNextChunk

TInt iStartPosOfNextChunk[private]

Contains the start position of the next chunk

CMsvStore & iStore

CMsvStore &iStore[private]

RBuf16 iTempChunk16

RBuf16 iTempChunk16[private]

Temporary buffer created to Store chunk while it is being written aynchronously.