closedKeyCallback on XMLParser (as asked by Kenny)

svn-id: r32909
This commit is contained in:
Vicent Marti 2008-07-04 23:51:23 +00:00
parent 96f2d9ca18
commit 40bf717d3b
2 changed files with 19 additions and 0 deletions

View File

@ -194,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();

View File

@ -203,6 +203,20 @@ protected:
return false;
}
/**
* 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.
*/