CXCFWEngine Class Reference

class CXCFWEngine : public CActive

XCFW Engine class Responsible for internalizing / externalizing XML files to and from a XCFW tree

XCFW.lib
Since
Series 60 3.1

Inherits from

Public Member Functions
~CXCFWEngine ()
IMPORT_C void AttributeDetailsL (const TInt , TPtrC &, TPtrC &, TBool &)
IMPORT_C void AttributeDetailsL (const TInt , TPtrC &, TPtrC &)
IMPORT_C void CancelOperation ()
void ComposeFileCompleteL ()
IMPORT_C TXCFWEngineState CurrentState ()
IMPORT_C TBool HasTextData ()
IMPORT_C void LoadL ( MXCFWTree &, const TDesC &)
IMPORT_C void LoadL ( MXCFWTree &, const TDesC &, const TDesC &)
IMPORT_C CXCFWEngine * NewL ( MXCFWEngineObserver *)
IMPORT_C TInt NumAttributes ()
void ParseFileCompleteL ()
IMPORT_C void RegisterObjectFactoryL ( CGECOObjectFactoryBase *)
IMPORT_C void SaveL ( MXCFWTree &, const TDesC &)
IMPORT_C void SaveL ( MXCFWTree &, const TDesC &, const TDesC &)
IMPORT_C void TextDetailsL ( TPtrC &, TBool &)
IMPORT_C TInt UnRegisterObjectFactory ( CGECOObjectFactoryBase *)
Protected Member Functions
void DoCancel ()
TInt RunError ( TInt )
void RunL ()
Private Member Functions
CXCFWEngine ( MXCFWEngineObserver *)
void AddCurrentTreeNodeToDOML ()
void AddCurrentXMLNodeToTreeL ()
void ConstructL ()
void DOM2TreeNextCycleL ()
void FreeResources ()
void PrepareDTDPathL ()
void PrepareEntityConverterAndSetActiveL ()
void Tree2DOMNextCycleL ()
Inherited Functions
CActive::CActive(TInt)
CActive::Cancel()
CActive::Deque()
CActive::Extension_(TUint,TAny *&,TAny *)
CActive::IsActive()const
CActive::IsAdded()const
CActive::Priority()const
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()
Public Member Enumerations
enum TXCFWEngineState {
EStateIdle  = 0, EStateInitializingLoad , EStateLoadingFile , EStateInitializingSave , EStateSavingFile , EStateParsing , EStateConstructingDOM
}
Inherited Enumerations
CActive:TPriority
Private Attributes
CMDXMLComposer * iComposer
CXCFWEntityConverter * iConverter
MXCFWNode * iCurrentTreeNode
CMDXMLNode * iCurrentXMLNode
HBufC * iDTD
CGECODefaultObjectFactory * iDefaultFactory
RFactoryArray iFactoryList
HBufC * iFile
RFs iFileSystem
CXCFWLocalizer * iLocalizer
HBufC * iNodeText
MXCFWEngineObserver * iObserver
CMDXMLParser * iParser
TXCFWEngineState iState
TXCFWEngineState iStateByLastError
MXCFWTree * iTree
CMDXMLDocument * iXMLDoc
Inherited Attributes
CActive::iStatus

Constructor & Destructor Documentation

CXCFWEngine(MXCFWEngineObserver *)

CXCFWEngine ( MXCFWEngineObserver * aObserver ) [private]

C++ default constructor.

Parameters

MXCFWEngineObserver * aObserver Engine observer

~CXCFWEngine()

IMPORT_C ~CXCFWEngine ( ) [virtual]

Destructor.

Member Functions Documentation

AddCurrentTreeNodeToDOML()

void AddCurrentTreeNodeToDOML ( ) [private]
Adds a XCFW Tree node to DOM Called repeatedly during parsing from Tree2DOMNextCycle()
Since
Series 60 3.1

AddCurrentXMLNodeToTreeL()

void AddCurrentXMLNodeToTreeL ( ) [private]
Adds a XML element to content tree Called repeatedly during parsing from Dom2TreeNextCycle()
Since
Series 60 3.1

AttributeDetailsL(const TInt, TPtrC &, TPtrC &, TBool &)

IMPORT_C void AttributeDetailsL ( const TInt aIndex,
TPtrC & aAttributeName,
TPtrC & aAttributeValue,
TBool & aIsLocalized
)

From MGECOAttributeProvider . Returns attribute details for given index.

Parameters

const TInt aIndex
TPtrC & aAttributeName
TPtrC & aAttributeValue
TBool & aIsLocalized

AttributeDetailsL(const TInt, TPtrC &, TPtrC &)

IMPORT_C void AttributeDetailsL ( const TInt aIndex,
TPtrC & aAttributeName,
TPtrC & aAttributeValue
)

From MGECOAttributeProvider . Returns attribute details for given index.

Parameters

const TInt aIndex
TPtrC & aAttributeName
TPtrC & aAttributeValue

CancelOperation()

IMPORT_C void CancelOperation ( )
Cancels currently ongoing load/save operation
Since
Series 60 3.1

ComposeFileCompleteL()

void ComposeFileCompleteL ( )

From MMDXMLComposerObserver . Called when DOM to XML composing is done.

ConstructL()

void ConstructL ( ) [private]

By default Symbian 2nd phase constructor is private.

CurrentState()

IMPORT_C TXCFWEngineState CurrentState ( )
Returns engine's current state Client may want to check state at error events
Since
Series 60 3.1

DOM2TreeNextCycleL()

void DOM2TreeNextCycleL ( ) [private]
Traverses XML DOM and constructs XCFW tree Each call to this function processes one DOM element
Since
Series 60 3.1

DoCancel()

void DoCancel ( ) [protected, virtual]

Implements cancellation of an outstanding request.

This function is called as part of the active object's Cancel() .

It must call the appropriate cancel function offered by the active object's asynchronous service provider. The asynchronous service provider's cancel is expected to act immediately.

DoCancel() must not wait for event completion; this is handled by Cancel() .

CActive::Cancel

FreeResources()

void FreeResources ( ) [private]
Frees resources used during parse / compose operation
Since
Series 60 3.1

HasTextData()

IMPORT_C TBool HasTextData ( )

From MGECOAttributeProvider . Returns ETrue if xml node has text data

LoadL(MXCFWTree &, const TDesC &)

IMPORT_C void LoadL ( MXCFWTree & aTree,
const TDesC & aFile
)
Loads given XML content definition to given tree. Operation is asynchronous. Engine will notify client through MXCFWEngineObserver interface when parsing completes. XCFW Engine will look for localization DTD based on the doctype declaration of loaded XML file. It assumes that the localization files are stored in language variant specific subdirectories under the directory where the loaded content file exists.
Since
Series 60 3.1

Parameters

MXCFWTree & aTree Target tree to construct the content into
const TDesC & aFile File to load

LoadL(MXCFWTree &, const TDesC &, const TDesC &)

IMPORT_C void LoadL ( MXCFWTree & aTree,
const TDesC & aFile,
const TDesC & aDTDFile
)
Loads given XML content definition to given tree with localized strings from given DTD file Operation is asynchronous.
Since
Series 60 3.1

Parameters

MXCFWTree & aTree Target tree to construct the content into
const TDesC & aFile File to load
const TDesC & aDTDFile DTD to use for localization. This parameter overrides the possible DOCTYPE definition in the XML file.

NewL(MXCFWEngineObserver *)

IMPORT_C CXCFWEngine * NewL ( MXCFWEngineObserver * aObserver ) [static]

Two-phased constructor.

Parameters

MXCFWEngineObserver * aObserver

NumAttributes()

IMPORT_C TInt NumAttributes ( )

From MGECOAttributeProvider . Returns number of attributes for a xml tag.

ParseFileCompleteL()

void ParseFileCompleteL ( )

From MMDXMLParserObserver . Called when XML to DOM parsing is done

PrepareDTDPathL()

void PrepareDTDPathL ( ) [private]

Prepares DTD file path for localization file loading This function checks the DTD path from XML doctype declaration

PrepareEntityConverterAndSetActiveL()

void PrepareEntityConverterAndSetActiveL ( ) [private]
Loads DTD for the requested save / load op and sets engine active.
Since
Series 60 3.1

RegisterObjectFactoryL(CGECOObjectFactoryBase *)

IMPORT_C void RegisterObjectFactoryL ( CGECOObjectFactoryBase * aFactory )
Adds new object factory to engine factory array. Engine does NOT take ownership of the factory.
Since
Series 60 3.1

Parameters

CGECOObjectFactoryBase * aFactory Object factory to add. Engine will query factories for objects when constructing tree.

RunError(TInt)

TInt RunError ( TInt aError ) [protected, virtual]

Parameters

TInt aError

RunL()

void RunL ( ) [protected, virtual]

Handles an active object's request completion event.

A derived class must provide an implementation to handle the completed request. If appropriate, it may issue another request.

The function is called by the active scheduler when a request completion event occurs, i.e. after the active scheduler's WaitForAnyRequest() function completes.

Before calling this active object's RunL() function, the active scheduler has:

1. decided that this is the highest priority active object with a completed request

2. marked this active object's request as complete (i.e. the request is no longer outstanding)

RunL() runs under a trap harness in the active scheduler. If it leaves, then the active scheduler calls RunError() to handle the leave.

Note that once the active scheduler's Start() function has been called, all user code is run under one of the program's active object's RunL() or RunError() functions.

CActiveScheduler::Start CActiveScheduler::Error CActiveScheduler::WaitForAnyRequest TRAPD

SaveL(MXCFWTree &, const TDesC &)

IMPORT_C void SaveL ( MXCFWTree & aTree,
const TDesC & aFile
)
Saves given Tree to given XML content definition file. Operation is asynchronous.
Since
Series 60 3.1

Parameters

MXCFWTree & aTree Target tree to construct XML from
const TDesC & aFile File to save the XML definition to

SaveL(MXCFWTree &, const TDesC &, const TDesC &)

IMPORT_C void SaveL ( MXCFWTree & aTree,
const TDesC & aFile,
const TDesC & aDTDFile
)
Saves given Tree to given XML content definition file with entity references from given DTD file. Operation is asynchronous.
Since
Series 60 3.1

Parameters

MXCFWTree & aTree Target tree to construct XML from
const TDesC & aFile File to save the XML definition to
const TDesC & aDTDFile DTD to use for entity localization. This parameter overrides the possible DOCTYPE definition that was internalized to content tree when it was loaded from XML.

TextDetailsL(TPtrC &, TBool &)

IMPORT_C void TextDetailsL ( TPtrC & aText,
TBool & aIsLocalized
)

From MGECOAttributeProvider . Returns node / data object text and possible localization status for the text.

Parameters

TPtrC & aText
TBool & aIsLocalized

Tree2DOMNextCycleL()

void Tree2DOMNextCycleL ( ) [private]
Traverses content tree and constructs XML DOM Each call to this function processes one XCFW Tree element
Since
Series 60 3.1

UnRegisterObjectFactory(CGECOObjectFactoryBase *)

IMPORT_C TInt UnRegisterObjectFactory ( CGECOObjectFactoryBase * aFactory )
Removes a factory from Engine's object factory array.
Since
Series 60 3.1

Parameters

CGECOObjectFactoryBase * aFactory Object factory to be removed

Member Enumerations Documentation

Enum TXCFWEngineState

Enumerators

EStateIdle = 0
EStateInitializingLoad
EStateLoadingFile
EStateInitializingSave
EStateSavingFile
EStateParsing
EStateConstructingDOM

Member Data Documentation

CMDXMLComposer * iComposer

CMDXMLComposer * iComposer [private]

CXCFWEntityConverter * iConverter

CXCFWEntityConverter * iConverter [private]

MXCFWNode * iCurrentTreeNode

MXCFWNode * iCurrentTreeNode [private]

CMDXMLNode * iCurrentXMLNode

CMDXMLNode * iCurrentXMLNode [private]

HBufC * iDTD

HBufC * iDTD [private]

CGECODefaultObjectFactory * iDefaultFactory

CGECODefaultObjectFactory * iDefaultFactory [private]

RFactoryArray iFactoryList

RFactoryArray iFactoryList [private]

HBufC * iFile

HBufC * iFile [private]

RFs iFileSystem

RFs iFileSystem [private]

CXCFWLocalizer * iLocalizer

CXCFWLocalizer * iLocalizer [private]

HBufC * iNodeText

HBufC * iNodeText [private]

MXCFWEngineObserver * iObserver

MXCFWEngineObserver * iObserver [private]

CMDXMLParser * iParser

CMDXMLParser * iParser [private]

TXCFWEngineState iState

TXCFWEngineState iState [private]

TXCFWEngineState iStateByLastError

TXCFWEngineState iStateByLastError [private]

MXCFWTree * iTree

MXCFWTree * iTree [private]

CMDXMLDocument * iXMLDoc

CMDXMLDocument * iXMLDoc [private]