aboutsummaryrefslogtreecommitdiff
path: root/common/xmlparser.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/xmlparser.h')
-rw-r--r--common/xmlparser.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/common/xmlparser.h b/common/xmlparser.h
index 5b03f54b9d..548b9cf3e2 100644
--- a/common/xmlparser.h
+++ b/common/xmlparser.h
@@ -113,6 +113,7 @@ public:
Common::String name;
Common::StringMap values;
bool ignore;
+ int depth;
};
virtual bool loadFile(const char *filename) {
@@ -137,13 +138,20 @@ public:
* Returns the active node being parsed (the one on top of
* the node stack).
*/
- ParserNode *activeNode() {
+ ParserNode *getActiveNode() {
if (!_activeKey.empty())
return _activeKey.top();
return 0;
}
+ /**
+ * Returns the parent of a given node in the stack.
+ */
+ ParserNode *getParentNode(ParserNode *child) {
+ return child->depth > 0 ? _activeKey[child->depth - 1] : 0;
+ }
+
protected:
/**
* The keycallback function must be overloaded by inheriting classes
@@ -255,7 +263,7 @@ protected:
int _pos; /** Current position on the XML buffer. */
XMLStream _text; /** Buffer with the text being parsed */
- char *_fileName;
+ Common::String _fileName;
ParserState _state; /** Internal state of the parser */