aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorStephen Kennedy2008-07-07 15:42:26 +0000
committerStephen Kennedy2008-07-07 15:42:26 +0000
commit275ffece2f2e2d39eef3409090b6be28827e0de3 (patch)
tree9c51aae5d309a428f1b397f4194c1677f530ad43 /common
parent5840c2480f2ca97a565d22c79a937615b5da3d25 (diff)
downloadscummvm-rg350-275ffece2f2e2d39eef3409090b6be28827e0de3.tar.gz
scummvm-rg350-275ffece2f2e2d39eef3409090b6be28827e0de3.tar.bz2
scummvm-rg350-275ffece2f2e2d39eef3409090b6be28827e0de3.zip
- changed VirtualKeyboard classes to Common namespace
- updated XMLParser from Tanoku's branch svn-id: r32943
Diffstat (limited to 'common')
-rw-r--r--common/xmlparser.cpp10
-rw-r--r--common/xmlparser.h14
2 files changed, 20 insertions, 4 deletions
diff --git a/common/xmlparser.cpp b/common/xmlparser.cpp
index 3452db9e00..d0c89a9d3e 100644
--- a/common/xmlparser.cpp
+++ b/common/xmlparser.cpp
@@ -143,10 +143,7 @@ bool XMLParser::parse() {
_pos = 0;
_activeKey.clear();
- while (_text[_pos]) {
- if (_state == kParserError)
- break;
-
+ while (_text[_pos] && _state != kParserError) {
if (skipSpaces())
continue;
@@ -197,6 +194,11 @@ bool XMLParser::parse() {
case kParserNeedPropertyName:
if (activeClosure) {
+ if (!closedKeyCallback(_activeKey.top()->name)) {
+ parserError("Missing data when closing key '%s'.", _activeKey.top()->name.c_str());
+ break;
+ }
+
activeClosure = false;
delete _activeKey.pop();
diff --git a/common/xmlparser.h b/common/xmlparser.h
index 3738b69b7b..4c77696482 100644
--- a/common/xmlparser.h
+++ b/common/xmlparser.h
@@ -204,6 +204,20 @@ protected:
}
/**
+ * The closed key callback function must be overloaded by inheriting classes to
+ * implement parser-specific functions.
+ *
+ * The closedKeyCallback is issued once a key has been finished parsing, to let
+ * the parser verify that all the required subkeys, etc, were included.
+ *
+ * Returns true if the key was properly closed, false otherwise.
+ * By default, all keys are properly closed.
+ */
+ virtual bool closedKeyCallback(Common::String keyName) {
+ return true;
+ }
+
+ /**
* Parses the value of a given key. There's no reason to overload this.
*/
virtual bool parseKeyValue(Common::String keyName);