Ginga  0.13.6.2086-83aa
The iTV middleware.
ParserState Class Reference

Parser state. More...

Collaboration diagram for ParserState:

Public Types

enum  Error {
  ERROR_NONE = 0, ERROR_ELT_UNKNOWN, ERROR_ELT_MISSING_PARENT, ERROR_ELT_BAD_PARENT,
  ERROR_ELT_UNKNOWN_ATTRIBUTE, ERROR_ELT_MISSING_ATTRIBUTE, ERROR_ELT_BAD_ATTRIBUTE, ERROR_ELT_MUTUALLY_EXCL_ATTRIBUTES,
  ERROR_ELT_UNKNOWN_CHILD, ERROR_ELT_MISSING_CHILD, ERROR_ELT_BAD_CHILD, ERROR_ELT_IMPORT
}
 Parser error codes. More...
 

Public Member Functions

 ParserState (int, int)
 Creates a new state. More...
 
 ~ParserState ()
 Destroys state.
 
ParserState::Error getError (string *)
 Gets last parser error. More...
 
Documentprocess (xmlDoc *)
 Processes XML document. More...
 

Static Public Member Functions

static bool pushNcl (ParserState *, ParserElt *)
 Starts the processing of <ncl> element. More...
 
static bool popNcl (ParserState *, ParserElt *)
 Ends the processing of <ncl> element. More...
 
static bool pushRegion (ParserState *, ParserElt *)
 Starts the processing of <region> element. More...
 
static bool popRegion (ParserState *, ParserElt *)
 Ends the processing of <region> element. More...
 
static bool pushDescriptorParam (ParserState *, ParserElt *)
 Starts the processing of <descriptorParam> element. More...
 
static bool pushCausalConnector (ParserState *, ParserElt *)
 Starts the processing of <causalConnector> element. More...
 
static bool popCausalConnector (ParserState *, ParserElt *)
 Ends the processing of <causalConnector> element. More...
 
static bool pushCompoundCondition (ParserState *, ParserElt *)
 Starts the processing of <compoundCondition> element. More...
 
static bool pushSimpleCondition (ParserState *, ParserElt *)
 Starts the processing of <simpleCondition> or <simpleAction> element. More...
 
static bool pushCompoundStatement (ParserState *, ParserElt *)
 Starts the processing of <compoundStatement> element. More...
 
static bool popCompoundStatement (ParserState *, ParserElt *)
 Ends the processing of <compoundStatement> element. More...
 
static bool popAssessmentStatement (ParserState *, ParserElt *)
 Ends the processing of <assessmentStatement> element. More...
 
static bool pushAttributeAssessment (ParserState *, ParserElt *)
 Starts the processing of <attributeAssessment> or <valueAssessment> element. More...
 
static bool pushRule (ParserState *, ParserElt *)
 Starts the processing of <rule> or <compositeRule> element. More...
 
static bool pushImportBase (ParserState *, ParserElt *)
 Starts the processing of <importBase> element. More...
 
static bool pushContext (ParserState *, ParserElt *)
 Starts the processing of <body> or <context> element. More...
 
static bool popContext (ParserState *, ParserElt *)
 Ends the processing of <body> or <context> element. More...
 
static bool pushPort (ParserState *, ParserElt *)
 Starts the processing of <port> element. More...
 
static bool pushSwitch (ParserState *, ParserElt *)
 Starts the processing of <switch>. More...
 
static bool popSwitch (ParserState *, ParserElt *)
 Ends the processing of <switch> element. More...
 
static bool pushBindRule (ParserState *, ParserElt *)
 Starts the processing of <bindRule> or <defaultComponent> element. More...
 
static bool pushMedia (ParserState *, ParserElt *)
 Starts the processing of <media> element. More...
 
static bool popMedia (ParserState *, ParserElt *)
 Ends the processing of <media> element. More...
 
static bool pushArea (ParserState *, ParserElt *)
 Starts the processing of <area> element. More...
 
static bool pushProperty (ParserState *, ParserElt *)
 Starts the processing of <property> element. More...
 
static bool pushLink (ParserState *, ParserElt *)
 Starts the processing of <link> element. More...
 
static bool pushLinkParam (ParserState *, ParserElt *)
 Starts the processing of <linkParam> or <bindParam> element. More...
 
static bool pushBind (ParserState *, ParserElt *)
 Starts the processing of <bind> element. More...
 

Private Member Functions

string genId ()
 Generates an unique id. More...
 
string getDirname ()
 Gets the directory part of current loaded XML file. More...
 
bool isInUniqueSet (const string &)
 Tests whether id is unique (hasn't been seen yet). More...
 
void addToUniqueSet (const string &)
 Adds id to the set of known ids. More...
 
bool getData (const string &, void **)
 Gets user data attached to parser state. More...
 
bool setData (const string &, void *, UserDataCleanFunc fn=nullptr)
 Attaches user data to parser state. More...
 
bool errElt (xmlNode *, ParserState::Error, const string &)
 Sets parser error code and error message. More...
 
bool errEltUnknown (xmlNode *)
 Sets parser error to "Unknown element". More...
 
bool errEltMissingParent (xmlNode *)
 Sets parser error to "Missing parent". More...
 
bool errEltBadParent (xmlNode *)
 Sets parser error to "Bad parent". More...
 
bool errEltUnknownAttribute (xmlNode *, const string &)
 Sets parser error to "Unknown attribute". More...
 
bool errEltMissingAttribute (xmlNode *, const string &)
 Sets parser error to "Missing attribute". More...
 
bool errEltBadAttribute (xmlNode *, const string &, const string &, const string &explain="")
 Sets parser error to "Bad value for attribute". More...
 
bool errEltMutuallyExclAttributes (xmlNode *, const string &, const string &)
 Sets parser error to "Attributes are mutually exclusive". More...
 
bool errEltUnknownChild (xmlNode *, const string &)
 Sets parser error to "Unknown child". More...
 
bool errEltMissingChild (xmlNode *, const list< string > &)
 Sets parser error to "Missing child". More...
 
bool errEltBadChild (xmlNode *, const string &, const string &explain="")
 Sets parser error to "Bad child". More...
 
bool errEltImport (xmlNode *, const string &explain="")
 Sets parser error to "Syntax error in imported document". More...
 
bool eltCacheIndex (xmlNode *, ParserElt **)
 Indexes element cache by node. More...
 
bool eltCacheIndexParent (xmlNode *, ParserElt **)
 Indexes element cache by node parent. More...
 
bool eltCacheIndexById (const string &, ParserElt **, const list< string > &)
 Indexes element cache by id. More...
 
size_t eltCacheIndexByTag (const list< string > &, list< ParserElt *> *)
 Indexes element cache by tag. More...
 
bool eltCacheAdd (ParserElt *)
 Adds element to cache. More...
 
string aliasStackCombine ()
 Combines all aliases in alias stack. More...
 
bool aliasStackPeek (string *, string *)
 Peeks at alias stack. More...
 
bool aliasStackPop (string *, string *)
 Pops alias stack. More...
 
bool aliasStackPush (const string &, const string &)
 Pushes alias and path onto alias stack. More...
 
ObjectobjStackPeek ()
 Peeks at object stack. More...
 
ObjectobjStackPop ()
 Pops object from stack. More...
 
void objStackPush (Object *)
 Pushes object onto stack. More...
 
Rect rectStackPeek ()
 Peeks at rectangle stack. More...
 
Rect rectStackPop ()
 Pops rectangle from stack. More...
 
void rectStackPush (Rect)
 Pushes rectangle onto stack. More...
 
bool referMapIndex (const string &, Media **)
 Indexes refer map. More...
 
bool referMapAdd (const string &, Media *)
 Adds entry to refer map. More...
 
bool resolveComponent (Composition *, ParserElt *, Object **)
 Resolves reference to component within a context. More...
 
bool resolveInterface (Context *, ParserElt *, Event **)
 Resolves reference to an interface within a context. More...
 
string resolveParameter (const string &, const map< string, string > *, const map< string, string > *, const map< string, string > *)
 Resolve reference to (bind, link, or ghost) parameter. More...
 
PredicateobtainPredicate (xmlNode *)
 Obtains predicate associated with a <simpleCondition> node. More...
 
PredicatesolvePredicate (Predicate *, const map< string, string > *)
 Obtains predicate by solving role references in another predicate. More...
 
ParserSyntaxEltcheckNode (xmlNode *, map< string, string > *, list< xmlNode *> *)
 Checks node syntax according to syntax table. More...
 
bool processNode (xmlNode *)
 Processes node. More...
 

Private Attributes

Document_doc
 The resulting Document.
 
xmlDoc * _xml
 The DOM tree being processed.
 
int _genid
 Last generated id.
 
UserData _udata
 Attached user data.
 
set< string > _unique
 Unique attributes seen so far.
 
ParserState::Error _error
 Last error code.
 
string _errorMsg
 Last error message.
 
map< xmlNode *, ParserElt * > _eltCache
 Element cache.
 
map< string, list< ParserElt * > > _eltCacheByTag
 Element cache by tag.
 
list< pair< string, string > > _aliasStack
 Alias stack for solving imports. More...
 
list< Object * > _objStack
 Rectangle stack for solving region hierarchy.
 
list< Rect > _rectStack
 Reference map for solving the refer attribute in <media>.
 
map< string, Media * > _referMap
 

Detailed Description

Parser state.

Parser state while it's parsing the document.

Member Enumeration Documentation

◆ Error

Parser error codes.

Enumerator
ERROR_NONE 

No error.

ERROR_ELT_UNKNOWN 

Unknown element.

ERROR_ELT_MISSING_PARENT 

Missing parent element.

ERROR_ELT_BAD_PARENT 

Bad parent element.

ERROR_ELT_UNKNOWN_ATTRIBUTE 

Unknown attribute.

ERROR_ELT_MISSING_ATTRIBUTE 

Missing attribute.

ERROR_ELT_BAD_ATTRIBUTE 

Bad attribute.

ERROR_ELT_MUTUALLY_EXCL_ATTRIBUTES 

Mutually exclusive attributes.

ERROR_ELT_UNKNOWN_CHILD 

Unknown child element.

ERROR_ELT_MISSING_CHILD 

Missing child element.

ERROR_ELT_BAD_CHILD 

Bad child element.

ERROR_ELT_IMPORT 

Error in imported document.

Constructor & Destructor Documentation

◆ ParserState()

ParserState::ParserState ( int  width,
int  height 
)

Creates a new state.

Parameters
widthInitial screen width (in pixels).
heightInitial screen height (in pixels).
Returns
New ParserState.

Member Function Documentation

◆ addToUniqueSet()

void ParserState::addToUniqueSet ( const string &  id)
private

Adds id to the set of known ids.

Parameters
idThe id to add.

◆ aliasStackCombine()

string ParserState::aliasStackCombine ( )
private

Combines all aliases in alias stack.

Returns
The combined alias.

◆ aliasStackPeek()

bool ParserState::aliasStackPeek ( string *  alias,
string *  path 
)
private

Peeks at alias stack.

Parameters
aliasVariable to store the alias at top of stack.
pathVariable to store the path at top of stack.
Returns
true if successful, or false otherwise (alias stack is empty).

◆ aliasStackPop()

bool ParserState::aliasStackPop ( string *  alias,
string *  path 
)
private

Pops alias stack.

Parameters
aliasVariable to store the popped alias.
pathVariable to store the popped path.
Returns
true if successful, or false otherwise (alias stack is empty).

◆ aliasStackPush()

bool ParserState::aliasStackPush ( const string &  alias,
const string &  path 
)
private

Pushes alias and path onto alias stack.

Parameters
aliasThe alias to push.
pathThe path to push.
Returns
true if successful, or false otherwise (path already in stack).

◆ checkNode()

ParserSyntaxElt * ParserState::checkNode ( xmlNode *  node,
map< string, string > *  attrs,
list< xmlNode *> *  children 
)
private

Checks node syntax according to syntax table.

Parameters
nodeThe node to check.
[out]attrsVariable to store node's attributes.
[out]childrenVariable to store node's children.
Returns
Pointer to entry in syntax table if successful, otherwise returns nullptr and sets Parser error accordingly.

◆ eltCacheAdd()

bool ParserState::eltCacheAdd ( ParserElt elt)
private

Adds element to cache.

Parameters
eltThe element to add.
Returns
true if successful, or false otherwise (already in cache).

◆ eltCacheIndex()

bool ParserState::eltCacheIndex ( xmlNode *  node,
ParserElt **  elt 
)
private

Indexes element cache by node.

Parameters
nodeThe node to be used as key.
[out]eltVariable to store the element associated with node (if any).
Returns
true if successful, or false otherwise.

◆ eltCacheIndexById()

bool ParserState::eltCacheIndexById ( const string &  id,
ParserElt **  elt,
const list< string > &  tags 
)
private

Indexes element cache by id.

Parameters
idThe id to be used as key.
[out]eltVariable to store the element associated with id (if any).
tagsAccepted tags (match only elements with one of these).
Returns
true if successful, or false otherwise.

◆ eltCacheIndexByTag()

size_t ParserState::eltCacheIndexByTag ( const list< string > &  tags,
list< ParserElt *> *  result 
)
private

Indexes element cache by tag.

Parameters
tagsThe tags to be used as keys.
[out]resultVariable to store the list of matched elements.
Returns
The number of matched elements.

◆ eltCacheIndexParent()

bool ParserState::eltCacheIndexParent ( xmlNode *  node,
ParserElt **  elt 
)
private

Indexes element cache by node parent.

Parameters
nodeThe node whose parent will be used as key.
[out]eltVariable to store the element associated with node (if any).
Returns
true if successful, or false otherwise.

◆ errElt()

bool ParserState::errElt ( xmlNode *  node,
ParserState::Error  error,
const string &  message 
)
private

Sets parser error code and error message.

Parameters
nodeThe node that caused the error.
errorThe error code to be set.
messageThe error message to be set.
Returns
false.

◆ errEltBadAttribute()

bool ParserState::errEltBadAttribute ( xmlNode *  node,
const string &  name,
const string &  value,
const string &  explain = "" 
)
private

Sets parser error to "Bad value for attribute".

Parameters
nodeThe node that caused the error.
nameThe name of the attribute that caused the error.
valueThe value of the attribute that caused the error.
explainFurther explanation.
Returns
false.

◆ errEltBadChild()

bool ParserState::errEltBadChild ( xmlNode *  node,
const string &  name,
const string &  explain = "" 
)
private

Sets parser error to "Bad child".

Parameters
nodeThe node that caused the error.
nameThe name of the child that caused the error.
explainFurther explanation.
Returns
false.

◆ errEltBadParent()

bool ParserState::errEltBadParent ( xmlNode *  node)
private

Sets parser error to "Bad parent".

Parameters
nodeThe node that caused the error.
Returns
false.

◆ errEltImport()

bool ParserState::errEltImport ( xmlNode *  node,
const string &  explain = "" 
)
private

Sets parser error to "Syntax error in imported document".

Parameters
nodeThe <importBase> node that caused the error.
explainFurther explanation. return false

◆ errEltMissingAttribute()

bool ParserState::errEltMissingAttribute ( xmlNode *  node,
const string &  name 
)
private

Sets parser error to "Missing attribute".

Parameters
nodeThe node that caused the error.
nameThe name of the attribute that caused the error.
Returns
false.

◆ errEltMissingChild()

bool ParserState::errEltMissingChild ( xmlNode *  node,
const list< string > &  children 
)
private

Sets parser error to "Missing child".

Parameters
nodeThe node that caused the error.
childrenThe list of names of children that caused the error.
Returns
false.

◆ errEltMissingParent()

bool ParserState::errEltMissingParent ( xmlNode *  node)
private

Sets parser error to "Missing parent".

Parameters
nodeThe node that caused the error.
Returns
false.

◆ errEltMutuallyExclAttributes()

bool ParserState::errEltMutuallyExclAttributes ( xmlNode *  node,
const string &  attr1,
const string &  attr2 
)
private

Sets parser error to "Attributes are mutually exclusive".

Parameters
nodeThe node that caused the error.
attr1The name of the first attribute.
attr2The name of the second attribute.
Returns
false.

◆ errEltUnknown()

bool ParserState::errEltUnknown ( xmlNode *  node)
private

Sets parser error to "Unknown element".

Parameters
nodeThe node that caused the error.
Returns
false.

◆ errEltUnknownAttribute()

bool ParserState::errEltUnknownAttribute ( xmlNode *  node,
const string &  name 
)
private

Sets parser error to "Unknown attribute".

Parameters
nodeThe node that caused the error.
nameThe name of the attribute that caused the error.
Returns
false.

◆ errEltUnknownChild()

bool ParserState::errEltUnknownChild ( xmlNode *  node,
const string &  name 
)
private

Sets parser error to "Unknown child".

Parameters
nodeThe node that caused the error.
nameThe name of the child element that caused the error.
Returns
false.

◆ genId()

string ParserState::genId ( )
private

Generates an unique id.

Returns
Unique id.

◆ getData()

bool ParserState::getData ( const string &  key,
void **  value 
)
private

Gets user data attached to parser state.

Parameters
keyUser data key.
[out]valueVariable to store user data value (if any).
Returns
true if successful, or false otherwise.

◆ getDirname()

string ParserState::getDirname ( )
private

Gets the directory part of current loaded XML file.

Returns
Directory part if there is a loaded XML file, or the empty string otherwise.

◆ getError()

ParserState::Error ParserState::getError ( string *  message)

Gets last parser error.

Parameters
[out]messageVariable to store the last error message (if any).
Returns
Last error code.

◆ isInUniqueSet()

bool ParserState::isInUniqueSet ( const string &  id)
private

Tests whether id is unique (hasn't been seen yet).

Parameters
idThe id to test.
Returns
true if successful, or false otherwise.

◆ objStackPeek()

Object * ParserState::objStackPeek ( )
private

Peeks at object stack.

Returns
The top of object stack or null if stack is empty.

◆ objStackPop()

Object * ParserState::objStackPop ( )
private

Pops object from stack.

Returns
The popped object or null if the stack is empty.

◆ objStackPush()

void ParserState::objStackPush ( Object obj)
private

Pushes object onto stack.

Parameters
objThe object to push.

◆ obtainPredicate()

Predicate * ParserState::obtainPredicate ( xmlNode *  node)
private

Obtains predicate associated with a <simpleCondition> node.

This function collects all predicates inherited by node and, if there are such predicates, combines them into a new predicate and returns it.

Parameters
nodeThe simple condition node.
Returns
A new predicate for node, or nullptr if node has no associated predicate.

◆ popAssessmentStatement()

bool ParserState::popAssessmentStatement ( ParserState st,
ParserElt elt 
)
static

Ends the processing of <assessmentStatement> element.

This function creates an associated atomic Predicate for elt.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.

◆ popCausalConnector()

bool ParserState::popCausalConnector ( ParserState st,
ParserElt elt 
)
static

Ends the processing of <causalConnector> element.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.

◆ popCompoundStatement()

bool ParserState::popCompoundStatement ( ParserState st,
ParserElt elt 
)
static

Ends the processing of <compoundStatement> element.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.

◆ popContext()

bool ParserState::popContext ( ParserState st,
ParserElt elt 
)
static

Ends the processing of <body> or <context> element.

This function resolves context ports and pops the object stack.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.

◆ popMedia()

bool ParserState::popMedia ( ParserState st,
ParserElt elt 
)
static

Ends the processing of <media> element.

This function pops the object stack.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.

◆ popNcl()

bool ParserState::popNcl ( ParserState st,
ParserElt elt 
)
static

Ends the processing of <ncl> element.

This function resolves all non-local references.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.

◆ popRegion()

bool ParserState::popRegion ( ParserState st,
ParserElt elt 
)
static

Ends the processing of <region> element.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.

◆ popSwitch()

bool ParserState::popSwitch ( ParserState st,
ParserElt elt 
)
static

Ends the processing of <switch> element.

This function pops the object stack.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.

◆ process()

Document * ParserState::process ( xmlDoc *  xml)

Processes XML document.

This function is a wrapper over ParserState::processNode(). It calls the later with the root node of the given XML document and, if nothing goes wrong, returns the resulting document.

Parameters
xmlThe XML document to process.
Returns
The resulting Document if successful, or null otherwise.

◆ processNode()

bool ParserState::processNode ( xmlNode *  node)
private

Processes node.

After being called by ParserState::process(), starting from the root node, this function proceeds recursively, processing each node in the input document tree. For each node, it checks its syntax (according to #parser_syntax_table), calls the corresponding push function (if any), processes the node's children, and calls the corresponding pop function (if any). At any moment, if something goes wrong the function sets Parser error and returns false.

Parameters
nodeThe node to process.
Returns
true if successful, or false otherwise.

◆ pushArea()

bool ParserState::pushArea ( ParserState st,
ParserElt elt 
)
static

Starts the processing of <area> element.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.

◆ pushAttributeAssessment()

bool ParserState::pushAttributeAssessment ( ParserState st,
ParserElt elt 
)
static

Starts the processing of <attributeAssessment> or <valueAssessment> element.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.

◆ pushBind()

bool ParserState::pushBind ( ParserState st,
ParserElt elt 
)
static

Starts the processing of <bind> element.

This function parsers elt and stores it as a ParserLinkBind in the list of binds of the current link.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.

◆ pushBindRule()

bool ParserState::pushBindRule ( ParserState st,
ParserElt elt 
)
static

Starts the processing of <bindRule> or <defaultComponent> element.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.

◆ pushCausalConnector()

bool ParserState::pushCausalConnector ( ParserState st,
ParserElt elt 
)
static

Starts the processing of <causalConnector> element.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.

◆ pushCompoundCondition()

bool ParserState::pushCompoundCondition ( ParserState st,
ParserElt elt 
)
static

Starts the processing of <compoundCondition> element.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.

◆ pushCompoundStatement()

bool ParserState::pushCompoundStatement ( ParserState st,
ParserElt elt 
)
static

Starts the processing of <compoundStatement> element.

This function creates an associated compound Predicate for elt.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.

◆ pushContext()

bool ParserState::pushContext ( ParserState st,
ParserElt elt 
)
static

Starts the processing of <body> or <context> element.

This function parses elt and pushes it as a Context onto the object stack.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.

◆ pushDescriptorParam()

bool ParserState::pushDescriptorParam ( ParserState st,
ParserElt elt 
)
static

Starts the processing of <descriptorParam> element.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.

◆ pushImportBase()

bool ParserState::pushImportBase ( ParserState st,
ParserElt elt 
)
static

Starts the processing of <importBase> element.

This function uses the ParserState alias stack to collect and process nested imports.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.
Todo:
Check for circular imports.

◆ pushLink()

bool ParserState::pushLink ( ParserState st,
ParserElt elt 
)
static

Starts the processing of <link> element.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.

◆ pushLinkParam()

bool ParserState::pushLinkParam ( ParserState st,
ParserElt elt 
)
static

Starts the processing of <linkParam> or <bindParam> element.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.

◆ pushMedia()

bool ParserState::pushMedia ( ParserState st,
ParserElt elt 
)
static

Starts the processing of <media> element.

This function parsers elt and pushes it as a Media onto the object stack.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.

◆ pushNcl()

bool ParserState::pushNcl ( ParserState st,
ParserElt elt 
)
static

Starts the processing of <ncl> element.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.

◆ pushPort()

bool ParserState::pushPort ( ParserState st,
ParserElt elt 
)
static

Starts the processing of <port> element.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.

◆ pushProperty()

bool ParserState::pushProperty ( ParserState st,
ParserElt elt 
)
static

Starts the processing of <property> element.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.

◆ pushRegion()

bool ParserState::pushRegion ( ParserState st,
ParserElt elt 
)
static

Starts the processing of <region> element.

This function uses the initial screen dimensions stored in ParserState to convert into absolute values any relative values used in <region> attributes.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.

◆ pushRule()

bool ParserState::pushRule ( ParserState st,
ParserElt elt 
)
static

Starts the processing of <rule> or <compositeRule> element.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.

◆ pushSimpleCondition()

bool ParserState::pushSimpleCondition ( ParserState st,
ParserElt elt 
)
static

Starts the processing of <simpleCondition> or <simpleAction> element.

This function parsers elt and stores it as a ParserConnRole in the list of rules of the current connector.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.

◆ pushSwitch()

bool ParserState::pushSwitch ( ParserState st,
ParserElt elt 
)
static

Starts the processing of <switch>.

This function parsers elt and pushes it as a Switch onto the object stack.

Parameters
stParserState.
eltElement wrapper.
Returns
true if successful, or false otherwise.

◆ rectStackPeek()

Rect ParserState::rectStackPeek ( )
private

Peeks at rectangle stack.

Returns
The top of rectangle stack.

This function aborts when called with the empty stack.

◆ rectStackPop()

Rect ParserState::rectStackPop ( )
private

Pops rectangle from stack.

Returns
The popped rectangle.

This function aborts when called with the empty stack.

◆ rectStackPush()

void ParserState::rectStackPush ( Rect  rect)
private

Pushes rectangle onto stack.

Parameters
rectThe rectangle to push.

◆ referMapAdd()

bool ParserState::referMapAdd ( const string &  id,
Media media 
)
private

Adds entry to refer map.

Parameters
idThe id of the reference.
mediaThe referenced media.
Returns
true if successful, or false otherwise (already in map).

◆ referMapIndex()

bool ParserState::referMapIndex ( const string &  id,
Media **  media 
)
private

Indexes refer map.

Parameters
idThe id of the reference.
[out]mediaVariable to store referenced media.
Returns
true if successful, or false otherwise.

◆ resolveComponent()

bool ParserState::resolveComponent ( Composition scope,
ParserElt elt,
Object **  obj 
)
private

Resolves reference to component within a context.

This function assumes that elt has an attribute "component" which contains the id of the component to be resolved. In case resolution fails, the function sets Parser error accordingly.

Parameters
scopeThe composition that determines the resolution scope.
eltThe element to be resolved.
[out]objVariable to store the resulting object (if any).
Returns
true if successful, or false otherwise.

◆ resolveInterface()

bool ParserState::resolveInterface ( Context ctx,
ParserElt elt,
Event **  evt 
)
private

Resolves reference to an interface within a context.

This function assumes that elt has attributes "component" and "interface" which identify the interface to be resolved. In case resolution fails, the function sets Parser error accordingly.

Parameters
ctxThe contexts that determines the resolution scope.
eltThe element to be resolved.
[out]evtVariable to store the resulting event (if any).
Returns
true if successful, or false otherwise.

◆ resolveParameter()

string ParserState::resolveParameter ( const string &  ref,
const map< string, string > *  bindParams,
const map< string, string > *  linkParams,
const map< string, string > *  ghosts 
)
private

Resolve reference to (bind, link, or ghost) parameter.

The function uses the translation tables in the order they were given, and returns as soon as any of them resolves the reference.

Parameters
refThe reference to resolve.
bindParamsThe bind parameter translation table.
linkParamsThe link parameter translation table.
ghostsThe ghost binds translation table.
Returns
The resolved reference or ref itself if it is not a reference.

◆ setData()

bool ParserState::setData ( const string &  key,
void *  value,
UserDataCleanFunc  fn = nullptr 
)
private

Attaches user data to parser state.

Parameters
keyUser data key.
valueUser data value.
fnCleanup function (used to destroy data when ParserElt is destroyed or key is overwritten).
Returns
true if key was previously unset, or false otherwise.

◆ solvePredicate()

Predicate * ParserState::solvePredicate ( Predicate pred,
const map< string, string > *  tr 
)
private

Obtains predicate by solving role references in another predicate.

This function does not modify predicate pred.

Parameters
predThe predicate to solve.
trThe role translation table mapping role references to property references.
Returns
A new predicate obtained by solving pred via table tr.

Member Data Documentation

◆ _aliasStack

list<pair<string, string> > ParserState::_aliasStack
private

Alias stack for solving imports.

Object stack for solving object hierarchy.


The documentation for this class was generated from the following file: