ScummVM API documentation
XML parser

Description

The XML parser allows for parsing XML-like files.

Classes

class  Common::XMLParser
 

Macros

#define MAX_XML_DEPTH   8
 
#define XML_KEY(keyName)
 
#define XML_KEY_RECURSIVE(keyName)
 
#define KEY_END()   layout.pop(); }
 
#define XML_PROP(propName, req)
 
#define CUSTOM_XML_PARSER(parserName)
 
#define PARSER_END()   layout.clear(); }
 

Macro Definition Documentation

◆ XML_KEY

#define XML_KEY (   keyName)
Value:
{\
lay = new CustomXMLKeyLayout;\
lay->callback = (&kLocalParserName::parserCallback_##keyName);\
layout.top()->children[#keyName] = lay;\
layout.push(lay); \
_layoutList.push_back(lay);

◆ XML_KEY_RECURSIVE

#define XML_KEY_RECURSIVE (   keyName)
Value:
{\
layout.top()->children[#keyName] = layout.top();\
layout.push(layout.top());\
}

◆ XML_PROP

#define XML_PROP (   propName,
  req 
)
Value:
{\
prop.name = #propName; \
prop.required = req; \
layout.top()->properties.push_back(prop); }

◆ CUSTOM_XML_PARSER

#define CUSTOM_XML_PARSER (   parserName)
Value:
protected: \
typedef parserName kLocalParserName; \
bool keyCallback(ParserNode *node) override {return node->layout->doCallback(this, node); }\
struct CustomXMLKeyLayout : public XMLKeyLayout {\
typedef bool (parserName::*ParserCallback)(ParserNode *node);\
ParserCallback callback;\
bool doCallback(XMLParser *parent, ParserNode *node) {return ((kLocalParserName *)parent->*callback)(node);} };\
void buildLayout() override { \
Common::Stack<XMLKeyLayout *> layout; \
CustomXMLKeyLayout *lay = 0; \
XMLKeyLayout::XMLKeyProperty prop; \
_XMLkeys = new CustomXMLKeyLayout; \
layout.push(_XMLkeys);