CBusinessCardParser class — Compact Business Card Parser

Section Contents


Overview

Derivation
CBase Abstract: CBase behaviour
CActive Abstract: active object: provides facilities to encapsulate an asynchronous service, and to handle its completion using RunL()
CBaseScriptParser Abstract: parser implementation.
Defined in

cbcp.h   

Link against

cbcp.lib

Description

This class provides functions to parse a Compact Business Card message. The parser creates an informative message body for the user and generates a vCard in the store associated with the message.


Allocation and construction


NewL() — Create new CBusinessCardParser

static CBusinessCardParser* NewL(CRegisteredParserDll& aRegisteredParserDll, CMsvServerEntry& aEntry, RFs& aFs);

Description

Use these functions to construct a new CBusinessCardParser descriptor on the heap. Code should be provided to ensure that a single copy of the DLL is loaded and is released when no longer required.

If there is insufficient memory available to create the descriptor, NewL() leaves. See Motivating E32 exception facilities for more information on leave processing.

Arguments
CRegisteredParserDll& aRegisteredParserDll A
CMsvServerEntry& aEntry A message server entry containing the CBC message.
RFs& aFs Handle of a file server session.
Return value
CBusinessCardParser* The address of the newly created CBusinessCardParser descriptor.

NewL() leaves if there is insufficient memory.

Example

This code fragment illustrates how an CBusinessCardParser descriptor can be constructed:

Use of NewL():

iRegisteredParserDll = CRegisteredParserDll::NewL(uidType);
RLibrary parserlibrary;
User::LeaveIfError(iRegisteredParserDll->GetLibrary(gFs,parserlibrary));
typedef CBaseScriptParser* (*NewParserL)(CRegisteredParserDll& aRegisteredParserDll, CMsvServerEntry& aEntry, RFs& aFs);
TInt entrypointordinalnumber=1; // The one and only entry point.
TLibraryFunction libFunc=parserlibrary.Lookup(entrypointordinalnumber);
if (libFunc==NULL)
User::Leave(KErrBadLibraryEntryPoint);
NewParserL pFunc=(NewParserL) libFunc;
CBaseScriptParser* parser=NULL;
TInt refcount=iRegisteredParserDll->DllRefCount();
TRAPD(ret,parser=((*pFunc)(*iRegisteredParserDll, *iEntry, gFs)));
if ((ret!=KErrNone) && (iRegisteredParserDll->DllRefCount()==refcount))
iRegisteredParserDll->ReleaseLibrary();


API — Public functions

ParseL — Parse a Compact Business Card message.

void ParseL(TRequestStatus& aStatus, const TDesC& aSms);

Description

Use this function to parse the Compact Business Card message aSms, stored in the TDesC. The parser creates an informative message body for the user and generates a vCard in the store associated with the message.

Arguments
TRequestStatus& aStatus The request status of the active object.
const TDesC& aSms An SMS message.
Return value
void
Example

This code fragment illustrates how the parser is called:

iParser->ParseL(iStatus,iSms);


ProcessL — Parse a Compact Business Card message.

void ProcessL(TRequestStatus& aStatus);

Description

This function is not implemented in the current version of the parser. It may be used to implement further actions with the parsed message.

Arguments
TRequestStatus& aStatus The request status of the active object.
Return value
void
Example

This code fragment illustrates how the message process stage of the parser is called:

iParser->ProcessL(iStatus)

This interface currently returns after issuing a User::RequestComplete(iReport, KErrNotSupported).