[Scummvm-cvs-logs] SF.net SVN: scummvm: [32909] scummvm/branches/gsoc2008-gui/common

Tanoku at users.sourceforge.net Tanoku at users.sourceforge.net
Sat Jul 5 01:51:24 CEST 2008


Revision: 32909
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32909&view=rev
Author:   Tanoku
Date:     2008-07-04 16:51:23 -0700 (Fri, 04 Jul 2008)

Log Message:
-----------
closedKeyCallback on XMLParser (as asked by Kenny)

Modified Paths:
--------------
    scummvm/branches/gsoc2008-gui/common/xmlparser.cpp
    scummvm/branches/gsoc2008-gui/common/xmlparser.h

Modified: scummvm/branches/gsoc2008-gui/common/xmlparser.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/common/xmlparser.cpp	2008-07-04 20:05:30 UTC (rev 32908)
+++ scummvm/branches/gsoc2008-gui/common/xmlparser.cpp	2008-07-04 23:51:23 UTC (rev 32909)
@@ -194,6 +194,11 @@
 
 			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();
 

Modified: scummvm/branches/gsoc2008-gui/common/xmlparser.h
===================================================================
--- scummvm/branches/gsoc2008-gui/common/xmlparser.h	2008-07-04 20:05:30 UTC (rev 32908)
+++ scummvm/branches/gsoc2008-gui/common/xmlparser.h	2008-07-04 23:51:23 UTC (rev 32909)
@@ -204,6 +204,20 @@
 	}
 
 	/**
+	 * 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);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list