CBaseScriptParser2 Class Reference

#include <mw/bsp.h>

Link against: biut.lib

class CBaseScriptParser2 : public CActive

Inherits from

Detailed Description

Base class for BIO message parsers V2.

Concrete derived classes are implemented in parser DLL's to parse particular types of BIO message.

On receiving an appropriate command (see TBioOperation), the BIO server MTM loads the appropriate parser and passes the message body to it for interpretation. In fact, the parser interface expects the parser to divide its operation into two stages:

1. parsing: which involves extracting information from the raw message body and storing it in a structured format. The parsing stage can also alter the message body, and create files in the directory associated with the message (e.g. parsing a ring tones message will generate a ring tone file).

2. processing: which involves using the extracted information to achieve the purpose of the BIO message (e.g. setting some phone configuration setttings).

This separation allows, for example, a UI to display the parsed information to the user for confirmation, before it is acted upon. For some parsers, however, this two stage division is not sensible, in which case they implement only the first.

The base class provides a pointer iSettings to reference the raw message data, and an array of token-value pairs, iParsedFieldArray, for storing parsed information (if this is appropriate).

Member Attribute Documentation

iEntry

CMsvEntry &iEntry[protected]

The message entry the parser should parse.

iEntryId

TMsvId iEntryId[protected]

ID of iEntry.

iFs

RFs &iFs[protected]

Connected file server handle.

iParsedFieldArray

CArrayPtrSeg< CParsedField > *iParsedFieldArray[protected]

Array of token-value pairs.

Derived classes can use this for storing parsed information (if this is appropriate).

iReadBuffer

HBufC8 *iReadBuffer[protected]

Temporary pointer used by RestoreL().

iRegisteredParserDll

CRegisteredParserDll &iRegisteredParserDll[protected]

Object that loaded the parser. It contains a reference counter of the use of the parser.

iSettings

HBufC *iSettings[protected]

Pointer to message data.

This is not set by the base class.

iSms

TLex iSms[protected]

Lexer intended for Smart Message use.

This is not used by the base class.

iSmsBuf

HBufC *iSmsBuf[protected]

Pointer to SMS data (intended for Smart Message use).

This is not set by the base class.

iSmsParsed

TBool iSmsParsed[protected]

Flag intended for Smart Message use.

This is not used by the base class.

Constructor & Destructor Documentation

CBaseScriptParser2 ( CRegisteredParserDll &, CMsvEntry &, RFs & )

IMPORT_CCBaseScriptParser2(CRegisteredParserDll &aRegisteredParserDll,
CMsvEntry &aEntry,
RFs &aFs
)

Constructor.

This is called by CBIOServerMtm to create a parser object.

Parameters
aRegisteredParserDllObject that loaded the parser. It contains a reference counter of the use of the parser.
aEntryThe message entry the parser should parse
aFsConnected file server handle

~CBaseScriptParser2 ( )

IMPORT_C~CBaseScriptParser2()

Destructor.

This deletes iSettings and iReadBuffer and calls iRegisteredParserDll.ReleaseLibrary().

Member Function Documentation

ExternalizeL ( RMsvWriteStream & )

voidExternalizeL(RMsvWriteStream &aStream)const [protected]

InternalizeL ( RMsvReadStream & )

voidInternalizeL(RMsvReadStream &aStream)[protected]

ParseL ( TRequestStatus &, const TDesC & )

voidParseL(TRequestStatus &aStatus,
const TDesC &aSms
)[pure virtual]

Called by the BIO server MTM to asynchronously parse message body data.

When parsing is complete, the function should indicate this by setting the message's index field iMtmData3 to 1.

The function should leave if the buffer cannot be parsed successfully.

Parameters
aStatusAsynchronous status word
aSmsBuffer to parse

ParserUid ( )

IMPORT_C TUidParserUid()

Gets the UID of the BIO message type handled by the parser.

Return Value
BIO message type UID

ProcessL ( TRequestStatus & )

voidProcessL(TRequestStatus &aStatus)[pure virtual]

Called by the BIO server MTM to asynchronously process the parsed data.

The function takes appropriate parser-specific action on the results of a previous call to ParseL().

When processing is complete, the function should indicate this by setting the message's index field iMtmData3 to 2.

The function should leave if processing is not successful.

Parameters
aStatusAsynchronous status word

ResetL ( )

IMPORT_C voidResetL()

Deletes the iParsedFieldArray parsed fields array and sets it to NULL.

RestoreL ( CMsvStore & )

IMPORT_C voidRestoreL(CMsvStore &aMessageStore)

Restores the parsed fields array.

It restores the iParsedFieldArray array from the specified CMsvStore.

Parameters
aMessageStoreStore to read from

RestoreL ( const TFileName & )

IMPORT_C voidRestoreL(const TFileName &aFileName)

Restores the message data from a specified file.

It restores iSettings from the specified file.

Parameters
aFileNameFile to read from

StoreL ( CMsvStore & )

IMPORT_C voidStoreL(CMsvStore &aMsvStore)const

Stores the parsed fields array.

It stores the iParsedFieldArray array in the specified CMsvStore.

Parameters
aMsvStoreStore to write to

StoreL ( const TFileName & )

IMPORT_C voidStoreL(const TFileName &aFileName)const

Stores the message data in a specified file.

It stores iSettings in the specified file. Write contents of Smart message to a file as attachment

Parameters
aFileNameFile to write to

UnfoldMessageL ( )

IMPORT_C voidUnfoldMessageL()[protected]

Utility function for unfolding Smart Messages.

Nokia protocol allows for folding of long fields (see Nokia Smart Messaging spec 2.0.0pre, 3-34 and RFC822, 3.1.1). This method unfolds the message by deleting any linefeed characters which are followed immediately by linear white space. It expects the buffer to be in iSmsBuf.