COMMON: Add ability to handle unknown xml keys

This commit is contained in:
Matthew Duggan 2023-02-06 10:32:22 +09:00 committed by Eugene Sandulenko
parent f7785f463a
commit cd09481f6e
2 changed files with 12 additions and 1 deletions

View File

@ -190,7 +190,9 @@ bool XMLParser::parseActiveKey(bool closed) {
}
} else {
return parserError("Unexpected key in the active scope ('" + key->name + "').");
if (!handleUnknownKey(key))
return parserError("Unexpected key in the active scope ('" + key->name + "').");
ignore = true;
}
// check if any of the parents must be ignored.

View File

@ -362,6 +362,15 @@ protected:
*/
virtual void cleanup() {}
/**
* Overload if your parser wants to be notified of keys which haven't
* been explicitly declared.
*
* The functions should return true if the key was handled and parsing should
* continue, or false (default) to raise a parsing error.
*/
virtual bool handleUnknownKey(ParserNode *node) { return false; }
List<XMLKeyLayout *> _layoutList;
private: