stmm-games-doc  0.32.0
Public Member Functions | Protected Attributes | List of all members
stmg::XmlBasicParser Class Reference

Public Member Functions

 XmlBasicParser (XmlConditionalParser &oXmlConditionalParser)
 
NRect parseNRect (ConditionalCtx &oCtx, const xmlpp::Element *p0Element, const std::string &sAttrNameX, const std::string &sAttrNameY, const std::string &sAttrNameW, const std::string &sAttrNameH, bool bMandatory, const NRect &oInRect, NSize oMinSize)
 Parse integer rectangle. More...
 

Protected Attributes

XmlConditionalParserm_oXmlConditionalParser
 

Constructor & Destructor Documentation

◆ XmlBasicParser()

stmg::XmlBasicParser::XmlBasicParser ( XmlConditionalParser oXmlConditionalParser)

Member Function Documentation

◆ parseNRect()

NRect stmg::XmlBasicParser::parseNRect ( ConditionalCtx oCtx,
const xmlpp::Element *  p0Element,
const std::string &  sAttrNameX,
const std::string &  sAttrNameY,
const std::string &  sAttrNameW,
const std::string &  sAttrNameH,
bool  bMandatory,
const NRect oInRect,
NSize  oMinSize 
)

Parse integer rectangle.

If oInRect has non zero size and all the attributes are not defined and bMandatory is false a zero sized rectangle is returned. Otherwise, if oInRect has non zero size and any of the attributes is not defined it is inferred from the oInRect in that the resulting rectangle is extended as much as possible within it. If oInRect has zero size and bMandatory is true then all attributes must be defined. If oInRect has zero size and bMandatory is false then all attributes must be not defined.

Ex. oInRect={0,0,5,4}, sAttrNameX value is 2. Result is {2,0,3,4}

Ex. oInRect={10,20,5,4}, sAttrNameH value is 2. Result is {10,20,2,4}

Ex. oInRect={10,20,5,4}, bMandatory is false, no attribute defined. Result is {?,?,0,0}

Ex. oInRect={10,20,5,4}, bMandatory is true, no attribute defined. Result is {10,20,5,4}

Ex. oInRect={?,?,0,0}, bMandatory is false, no attribute defined. Result is {?,?,0,0}

Ex. oInRect={?,?,0,0}, bMandatory is true, sAttrNameH value is 2. throws an error

Parameters
oCtxThe context.
p0ElementThe element. Cannot be null.
sAttrNameXThe x attribute name.
sAttrNameYThe y attribute name.
sAttrNameWThe w attribute name.
sAttrNameHThe h attribute name.
bMandatoryWhetherIt must be defined
oInRectThe rectangle the parsed rectangle must fit in. If its size is 0 no limits.
oMinSizeThe minimum size of the parsed rectangle. Must be positive.
Returns
The result rectangle. Has size 0 if not defined.

Member Data Documentation

◆ m_oXmlConditionalParser

XmlConditionalParser& stmg::XmlBasicParser::m_oXmlConditionalParser
protected