fluidvis
|
#include <SXParser.h>
Public Member Functions | |
EXPA | XTag () |
EXPA | ~XTag () |
EXPA void | getTags (string location, vector< XTag * > &nodes) |
EXPA XTag * | getFirst (string location) |
EXPA XTag * | getFirst () |
EXPA string | getStrAttribute (string ID) |
EXPA double | getRealAttribute (string ID) |
EXPA void | getDirectTexts (vector< string > &texts) |
EXPA void | getTexts (vector< string > &texts) |
EXPA string | getDirectTexts () |
EXPA string | getTexts () |
EXPA void | flattenTag (XTag &tag, map< string, vector< double >> &ambiguousReals, map< string, vector< string >> &ambiguousStrings) |
![]() | |
virtual EXPA | ~XNode () |
Public Attributes | |
string | name |
map< string, string > | stringAttribs |
map< string, double > | realAttribs |
vector< XNode * > | nodes |
Additional Inherited Members | |
![]() | |
EXPA | XNode () |
tag node of the SX tag language, having a name assigned , and holding texts, attributes, and trees of tags
EXPA sx::XTag::XTag | ( | ) |
default constructor, initializing an empty node
EXPA sx::XTag::~XTag | ( | ) |
deconstructor, deconstructing every element attached to the tag (for instance as a (sub)child node, or a text node)
EXPA void sx::XTag::flattenTag | ( | XTag & | tag, |
map< string, vector< double >> & | ambiguousReals, | ||
map< string, vector< string >> & | ambiguousStrings | ||
) |
Collects all the text, textless leaf tags and attributes of the tree, and stores it in the node tag. Textless leaf tags with attributes are replaced by empty tags with the same names. The order of the texts and nodes is preserved. If attributes with the same identifyer appear multiple times in different nodes, their values are stored in the maps ambiguousReals and ambiguousStrings. Nodes of the tree are traversed from left to right, from the root to the leafs, and ambiguous attributes are owerwritten in the same order.
tag | A tag node, in which the outcome is stored |
ambiguousReals | If in different nodes real attributes with the same identifyer appear, the values are stored in a vector associated with the attribute name in ambiguousReals. |
ambiguousStrings | If in different nodes string attributes with the same identifyer appear, the values are stored in a vector associated with the attribute name in ambiguousStrings. |
EXPA void sx::XTag::getDirectTexts | ( | vector< string > & | texts | ) |
Stores all texts of the direct textnode children the given order in texts.
texts | stores texts in this parameter |
EXPA string sx::XTag::getDirectTexts | ( | ) |
Concatenates the text of all direct child nodes of type XText, and returns it.
EXPA XTag* sx::XTag::getFirst | ( | string | location | ) |
Searches the first node from left given by path location, and returns it.
location | Specification of a nodes location. Let be <n1> a child node of this, <n2> a childnode of <n1>, and so on, up to a node <nm>, such that the sequence forms a branch of a childtree of this, then the location of <nm> can be specified by a the sequence of names concatenated by points, like: <n1>.<n2>.<n3>. ... .<nm-2>.<nm-1>.<nm> If one of the names in the part equals the string '*', all nodes of that path are taken into consideration. Nodes always require to have a nonempty name, hence an empty location will lead to an empty outcome. |
if | no such first node exists, an exception Exception of type EX_NODATA is thrown |
EXPA XTag* sx::XTag::getFirst | ( | ) |
Returns the first childnode.
if | no such first node exists, an exception Exception of type EX_NODATA is thrown |
EXPA double sx::XTag::getRealAttribute | ( | string | ID | ) |
Returns the value of the real attribute with identifyer ID.
ID | identifyer of the attribute |
if | no attribute with ID exists, an exception Exception of type EX_NODATA is thrown |
EXPA string sx::XTag::getStrAttribute | ( | string | ID | ) |
Returns the value of the string attribute with identifyer ID.
ID | identifyer of the attribute |
if | no attribute with ID exists, an exception Exception of type EX_NODATA is thrown |
EXPA void sx::XTag::getTags | ( | string | location, |
vector< XTag * > & | nodes | ||
) |
Searches all nodes given by path location, and stores the outcome in the list nodes.
location | Specification of a nodes location. Let be <n1> a child node of this, <n2> a childnode of <n1>, and so on, up to a node <nm>, such that the sequence forms a branch of a childtree of this, then the location of <nm> can be specified by a the sequence of names concatenated by points, like: <n1>.<n2>.<n3>. ... .<nm-2>.<nm-1>.<nm> If one of the names in the part equals the string '*', all nodes of that path are taken into consideration. Nodes always require to have a nonempty name, hence an empty location will lead to an empty outcome. |
texts | nodes specified by the string location are stored in vector nodes |
EXPA void sx::XTag::getTexts | ( | vector< string > & | texts | ) |
Stores all texts of the text nodes in the given order in texts.
texts | stores texts in this parameter |
EXPA string sx::XTag::getTexts | ( | ) |
Concatenates the text of all child nodes of type XText, and returns it.
string sx::XTag::name |
name of the node
vector<XNode *> sx::XTag::nodes |
List of child nodes
map<string,double> sx::XTag::realAttribs |
Number attributes associated with numbers. Number attributes only need to be unique over the set of all number attributes.
map<string,string> sx::XTag::stringAttribs |
String attributes associated with string. The attributes only need to be unique over the set of all string attributes in the same tag.