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 voidAttributeDetailsL(const TInt, TPtrC &, TPtrC &, TBool &)
IMPORT_C voidAttributeDetailsL(const TInt, TPtrC &, TPtrC &)
IMPORT_C voidCancelOperation()
voidComposeFileCompleteL()
IMPORT_C TXCFWEngineStateCurrentState()
IMPORT_C TBoolHasTextData()
IMPORT_C voidLoadL(MXCFWTree &, const TDesC &)
IMPORT_C voidLoadL(MXCFWTree &, const TDesC &, const TDesC &)
IMPORT_C CXCFWEngine *NewL(MXCFWEngineObserver *)
IMPORT_C TIntNumAttributes()
voidParseFileCompleteL()
IMPORT_C voidRegisterObjectFactoryL(CGECOObjectFactoryBase *)
IMPORT_C voidSaveL(MXCFWTree &, const TDesC &)
IMPORT_C voidSaveL(MXCFWTree &, const TDesC &, const TDesC &)
IMPORT_C voidTextDetailsL(TPtrC &, TBool &)
IMPORT_C TIntUnRegisterObjectFactory(CGECOObjectFactoryBase *)
Protected Member Functions
voidDoCancel()
TInt RunError(TInt)
voidRunL()
Private Member Functions
CXCFWEngine(MXCFWEngineObserver *)
voidAddCurrentTreeNodeToDOML()
voidAddCurrentXMLNodeToTreeL()
voidConstructL()
voidDOM2TreeNextCycleL()
voidFreeResources()
voidPrepareDTDPathL()
voidPrepareEntityConverterAndSetActiveL()
voidTree2DOMNextCycleL()
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
enumTXCFWEngineState {
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 * aObserverEngine observer

~CXCFWEngine()

IMPORT_C~CXCFWEngine()[virtual]

Destructor.

Member Functions Documentation

AddCurrentTreeNodeToDOML()

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

AddCurrentXMLNodeToTreeL()

voidAddCurrentXMLNodeToTreeL()[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 voidAttributeDetailsL(const TIntaIndex,
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 voidAttributeDetailsL(const TIntaIndex,
TPtrC &aAttributeName,
TPtrC &aAttributeValue
)

From MGECOAttributeProvider. Returns attribute details for given index.

Parameters

const TInt aIndex
TPtrC & aAttributeName
TPtrC & aAttributeValue

CancelOperation()

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

ComposeFileCompleteL()

voidComposeFileCompleteL()

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

ConstructL()

voidConstructL()[private]

By default Symbian 2nd phase constructor is private.

CurrentState()

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

DOM2TreeNextCycleL()

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

DoCancel()

voidDoCancel()[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()

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

HasTextData()

IMPORT_C TBoolHasTextData()

From MGECOAttributeProvider. Returns ETrue if xml node has text data

LoadL(MXCFWTree &, const TDesC &)

IMPORT_C voidLoadL(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 & aTreeTarget tree to construct the content into
const TDesC & aFileFile to load

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

IMPORT_C voidLoadL(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 & aTreeTarget tree to construct the content into
const TDesC & aFileFile to load
const TDesC & aDTDFileDTD 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 TIntNumAttributes()

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

ParseFileCompleteL()

voidParseFileCompleteL()

From MMDXMLParserObserver. Called when XML to DOM parsing is done

PrepareDTDPathL()

voidPrepareDTDPathL()[private]

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

PrepareEntityConverterAndSetActiveL()

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

RegisterObjectFactoryL(CGECOObjectFactoryBase *)

IMPORT_C voidRegisterObjectFactoryL(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 * aFactoryObject factory to add. Engine will query factories for objects when constructing tree.

RunError(TInt)

TInt RunError(TIntaError)[protected, virtual]

Parameters

TInt aError

RunL()

voidRunL()[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 voidSaveL(MXCFWTree &aTree,
const TDesC &aFile
)
Saves given Tree to given XML content definition file. Operation is asynchronous.
Since
Series 60 3.1

Parameters

MXCFWTree & aTreeTarget tree to construct XML from
const TDesC & aFileFile to save the XML definition to

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

IMPORT_C voidSaveL(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 & aTreeTarget tree to construct XML from
const TDesC & aFileFile to save the XML definition to
const TDesC & aDTDFileDTD 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 voidTextDetailsL(TPtrC &aText,
TBool &aIsLocalized
)

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

Parameters

TPtrC & aText
TBool & aIsLocalized

Tree2DOMNextCycleL()

voidTree2DOMNextCycleL()[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 TIntUnRegisterObjectFactory(CGECOObjectFactoryBase *aFactory)
Removes a factory from Engine's object factory array.
Since
Series 60 3.1

Parameters

CGECOObjectFactoryBase * aFactoryObject 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]