|
stmm-games-doc
0.32.0
|
Public Member Functions | |
| XmlConditionalParser (XmlVariantSetParser &oXmlVariantSetParser) | |
| Constructor. More... | |
| template<class ChildVisitor > | |
| void | visitNamedElementChildren (ConditionalCtx &oCtx, const xmlpp::Element *p0Element, const std::string &sName, ChildVisitor oChildVisitor) const |
| Visit children elements with a given name applying nested ExistIf conditions. More... | |
| template<class ChildVisitor > | |
| void | visitElementChildren (ConditionalCtx &oCtx, const xmlpp::Element *p0Element, ChildVisitor oChildVisitor) const |
| Visit all children applying nested ExistIf conditions. More... | |
| const xmlpp::Element * | parseUniqueElement (ConditionalCtx &oCtx, const xmlpp::Element *p0Parent, const std::string &sName, bool bMandatory) const |
| Parse at most one child element with given name. More... | |
| template<class P > | |
| void | checkAllChildElementsName (ConditionalCtx &oCtx, const xmlpp::Node *p0Parent, P oP) const |
| Checks whether the names of all the child elements of a node satisfy a predicate. More... | |
| std::pair< bool, std::string > | getAttributeValue (ConditionalCtx &oCtx, const xmlpp::Element *p0Element, const std::string &sName) const |
| Get attribute applying nested AttrIf conditions. More... | |
| template<class AttrVisitor > | |
| void | visitLayoutConfigNamedAttributes (ConditionalCtx &oCtx, const xmlpp::Element *p0Element, const std::string &sAttrName, int32_t nTotLayoutConfigs, AttrVisitor oAttrVisitor) const |
| Visit layout config dependant attributes applying nested ExistIf conditions. More... | |
| int32_t | getEnumAttributeValue (ConditionalCtx &oCtx, const xmlpp::Element *p0Element, const std::string &sAttrName, const std::vector< char const *> &aValues) const |
| Get enumeration attribute applying nested AttrIf conditions. More... | |
| template<class AttrVisitor > | |
| void | visitLayoutConfigNamedEnumAttributes (ConditionalCtx &oCtx, const xmlpp::Element *p0Element, const std::string &sAttrName, int32_t nTotLayoutConfigs, const std::vector< char const *> &aValues, AttrVisitor oAttrVisitor) const |
| Visit layout config dependant attributes applying nested ExistIf conditions. More... | |
| std::pair< bool, int32_t > | parseTeamExists (ConditionalCtx &oCtx, const xmlpp::Element *p0Element) const |
| Gets the team attribute. More... | |
| std::tuple< bool, int32_t, int32_t > | parseOwnerExists (ConditionalCtx &oCtx, const xmlpp::Element *p0Element) const |
| Parse the owner of an element. More... | |
| std::pair< int32_t, int32_t > | parseOwner (ConditionalCtx &oCtx, const xmlpp::Element *p0Element, OwnerType eRequireOwnerType) const |
| The owner of an element (for a required owner type). More... | |
| std::pair< int32_t, int32_t > | parseOwner (ConditionalCtx &oCtx, const xmlpp::Element *p0Element) const |
| The owner of an element. More... | |
| std::pair< bool, OwnerType > | parseOwnerType (ConditionalCtx &oCtx, const xmlpp::Element *p0Element, const std::string &sAttrName) const |
| The owner type. More... | |
| std::pair< bool, IntSet > | parseIntSetAttributes (ConditionalCtx &oCtx, const xmlpp::Element *p0Element, const std::string &sSingleAttr, const std::string &sFromAttr, const std::string &sToAttr, const std::string &sMultiAttr, const std::string &sSeparatorAttr, bool bMin, int32_t nMin, bool bMax, int32_t nMax) const |
| Parse int set attribute(s). More... | |
| template<typename T > | |
| bool | parseAttributeFromTo (ConditionalCtx &oCtx, const xmlpp::Element *p0Element, const std::string &sSingleAttr, const std::string &sFromAttr, const std::string &sToAttr, bool bMandatory, bool bMin, T oMin, bool bMax, T oMax, T &oFrom, T &oTo) const |
| Parse single or from-to pair attribute. More... | |
Static Public Attributes | |
| static const std::string | s_sConditionalExistIfNode |
| static const std::string | s_sConditionalPassthroughIfNode |
| static const std::string | s_sConditionalAttrIfNode |
| static const std::string | s_sConditionalAttrIfUndefAttr |
| static const std::string | s_sConditionalAttrIfUndefAttrSeparator |
| static const std::string | s_sConditionalOwnerTeamAttr |
| static const std::string | s_sConditionalOwnerMateAttr |
| static const std::string | s_sConditionalOwnerPlayerAttr |
| stmg::XmlConditionalParser::XmlConditionalParser | ( | XmlVariantSetParser & | oXmlVariantSetParser | ) |
Constructor.
|
inline |
Checks whether the names of all the child elements of a node satisfy a predicate.
The function object must define bool operator()(const std::string& sName). The ExistIf and AttrIf subelements are skipped. Ignored elements are skipped. If one predicate call returns false an invalid element exception is thrown.
| oCtx | The context. |
| p0Parent | The parent node. Cannot be null. |
| oP | The function object (predicate). |
| std::pair<bool, std::string> stmg::XmlConditionalParser::getAttributeValue | ( | ConditionalCtx & | oCtx, |
| const xmlpp::Element * | p0Element, | ||
| const std::string & | sName | ||
| ) | const |
Get attribute applying nested AttrIf conditions.
| oCtx | The context. |
| p0Element | The element the attribute of which should be retrieved. Cannot be null. |
| sName | The attribute name. Cannot be empty. |
| int32_t stmg::XmlConditionalParser::getEnumAttributeValue | ( | ConditionalCtx & | oCtx, |
| const xmlpp::Element * | p0Element, | ||
| const std::string & | sAttrName, | ||
| const std::vector< char const *> & | aValues | ||
| ) | const |
Get enumeration attribute applying nested AttrIf conditions.
| oCtx | The context. |
| p0Element | The element the attribute of which should be retrieved. Cannot be null. |
| sAttrName | The attribute name. Cannot be empty. |
| aValues | The valid enum strings. |
|
inline |
Parse single or from-to pair attribute.
If bMin is false oMin is overridden to std::numeric_limits<T>::lowest(). If bMax is false oMax is overridden to std::numeric_limits<T>::max(). If both true, oMax must not be smaller than oMin.
If no attribute is defined, the values oFrom and oTo are untouched if their current value satisfies the optional min and max conditions. Otherwise they are clamped.
| oCtx | The context. |
| p0Element | The element. Cannot be null. |
| sSingleAttr | The single value attribute. Cannot be empty. |
| sFromAttr | The from value attribute. Cannot be empty. |
| sToAttr | The to value attribute. Cannot be empty. |
| bMandatory | If true and no attribute is defined throws exception. |
| bMin | If true any of the values is smaller than oMin throws an exception. If false it is as if std::numeric_limits<T>::lowest() was passed to oMin. |
| oMin | The minimum value. Only is considered if bMin is set. |
| bMax | If true any of the values is bigger than oMax throws an exception. If false it is as if std::numeric_limits<T>::max() was passed to oMax. |
| oMax | The maximum value. Only is considered if bMax is set. |
| oFrom | The resulting 'from' value of the range. If single attribute is defined equals oTo. |
| oTo | The resulting 'to' value of the range. If single attribute is defined equals oFrom. |
| std::pair<bool, IntSet> stmg::XmlConditionalParser::parseIntSetAttributes | ( | ConditionalCtx & | oCtx, |
| const xmlpp::Element * | p0Element, | ||
| const std::string & | sSingleAttr, | ||
| const std::string & | sFromAttr, | ||
| const std::string & | sToAttr, | ||
| const std::string & | sMultiAttr, | ||
| const std::string & | sSeparatorAttr, | ||
| bool | bMin, | ||
| int32_t | nMin, | ||
| bool | bMax, | ||
| int32_t | nMax | ||
| ) | const |
Parse int set attribute(s).
| oCtx | The context. |
| p0Element | The element. Cannot be null. |
| sSingleAttr | The single value attribute. Cannot be empty. |
| sFromAttr | The from value attribute. Cannot be empty. |
| sToAttr | The to value attribute. Cannot be empty. |
| sMultiAttr | The multi value attribute. Cannot be empty. |
| sSeparatorAttr | The separator within the multi value. Can be empty (default is used). |
| bMin | Whether the value(s) have a minimum. |
| nMin | The minimum for each int value. Only applied if bMin is true. |
| bMax | Whether the value(s) have a maximum. |
| nMax | The maximum for each int value. Only applied if bMax is true. |
| std::pair<int32_t, int32_t> stmg::XmlConditionalParser::parseOwner | ( | ConditionalCtx & | oCtx, |
| const xmlpp::Element * | p0Element, | ||
| OwnerType | eRequireOwnerType | ||
| ) | const |
The owner of an element (for a required owner type).
If the owner doesn't exist this function throws.
If the required owner type is OwnerType::PLAYER but the player isn't defined either directly or by the context the function throws.
If the required owner type is OwnerType::TEAM but the team isn't defined either directly or by the context the function throws. Note that if the element belongs to a player the function succeeds and also sets the mate value.
If the required owner type is OwnerType::GAME the owner (whatever it is) is returned.
| oCtx | The context. |
| p0Element | The element. Cannot be null. |
| eRequireOwnerType | The owner type. |
| std::pair<int32_t, int32_t> stmg::XmlConditionalParser::parseOwner | ( | ConditionalCtx & | oCtx, |
| const xmlpp::Element * | p0Element | ||
| ) | const |
The owner of an element.
Same as parseOwner(oCtx, p0Element, OwnerType::GAME).
| oCtx | The context. |
| p0Element | The element. Cannot be null. |
| std::tuple<bool, int32_t, int32_t> stmg::XmlConditionalParser::parseOwnerExists | ( | ConditionalCtx & | oCtx, |
| const xmlpp::Element * | p0Element | ||
| ) | const |
Parse the owner of an element.
If the owner is the game, returns (true, -1, -1). If the owner is a team, returns (true, nTeam, -1) or (false, nTeam, -1) if the team doesn't exist. If the owner is a player, returns (true, nTeam, nMate) or (false, nTeam, nMate) if the player doesn't exist.
| oCtx | The context. |
| p0Element | The element. Cannot be null. |
| std::pair<bool, OwnerType> stmg::XmlConditionalParser::parseOwnerType | ( | ConditionalCtx & | oCtx, |
| const xmlpp::Element * | p0Element, | ||
| const std::string & | sAttrName | ||
| ) | const |
The owner type.
| oCtx | The context. |
| p0Element | The element. Cannot be null. |
| sAttrName | The attribute name containing the type. If empty the default attribute name ("ownerType") is used. |
| std::pair<bool, int32_t> stmg::XmlConditionalParser::parseTeamExists | ( | ConditionalCtx & | oCtx, |
| const xmlpp::Element * | p0Element | ||
| ) | const |
Gets the team attribute.
If the team is not defined as attribute the context team is returned.
| oCtx | The context. |
| p0Element | The element |
| If | the team cannot be determined. |
| const xmlpp::Element* stmg::XmlConditionalParser::parseUniqueElement | ( | ConditionalCtx & | oCtx, |
| const xmlpp::Element * | p0Parent, | ||
| const std::string & | sName, | ||
| bool | bMandatory | ||
| ) | const |
Parse at most one child element with given name.
| oCtx | The context. |
| p0Parent | The parent element. Cannot be null. |
| sName | The name of the child element. Cannot be empty. |
| bMandatory | Whether the child element must be present. |
|
inline |
Visit all children applying nested ExistIf conditions.
Ignored elements are skipped.
| oCtx | The context. |
| p0Element | The element the children of which should be visited. |
| oChildVisitor | The visitor. Takes const xmlpp::Element* p0Element as parameter. |
|
inline |
Visit layout config dependant attributes applying nested ExistIf conditions.
Layout config attributes are named by appending a '_' and the layout config number (>= 0 and < g_nTotLayoutConfigs).
The first attribute to be tried is the one in sAttrName. After that sAttrName + '_0', sAttrName + '_1', and so on.
The function object must define void operator()(const std::string& sLCAttrName, const std::string& sValue, int32_t nLayoutConfig). Parameter nLayoutConfig can be -1 (which means attribute without '_N' is defined). Parameter sLCAttrName is sAttrName with possibly suffix '_N' (N is nLayoutConfig).
| oCtx | The context. |
| p0Element | The element the attribute(s) of which should be visited. |
| sAttrName | The base name of the attribute. Cannot be empty. |
| nTotLayoutConfigs | The number of layout configurations (suffixes). |
| oAttrVisitor | The visitor. |
|
inline |
Visit layout config dependant attributes applying nested ExistIf conditions.
Layout config attributes are named by appending a '_' and the layout config number (>= 0 and < g_nTotLayoutConfigs).
The first attribute to be tried is the one in sAttrName. After that sAttrName + '_0', sAttrName + '_1', and so on.
The function object must define void operator()(const std::string& sLCAttrName, int32_t nEnum, int32_t nLayoutConfig). Parameter nLayoutConfig can be -1 (which means attribute without '_N' is defined). Parameter sLCAttrName is sAttrName with possibly suffix '_N' (N is nLayoutConfig). Parameter nEnum is the index into aValues.
| oCtx | The context. |
| p0Element | The element the attribute(s) of which should be visited. |
| sAttrName | The base name of the attribute. Cannot be empty. |
| nTotLayoutConfigs | The number of layout configurations (suffixes). |
| aValues | The valid enum strings. |
| oAttrVisitor | The visitor. |
|
inline |
Visit children elements with a given name applying nested ExistIf conditions.
If sName is empty, ignored elements are skipped.
| oCtx | The context. |
| p0Element | The element the children of which should be visited. |
| sName | The name of the child elements. If empty all are visited. |
| oChildVisitor | The visitor. Takes const xmlpp::Element* p0Element as parameter. |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
1.8.13