[Scummvm-cvs-logs] SF.net SVN: scummvm: [32943] scummvm/branches/gsoc2008-vkeybd

sk4425 at users.sourceforge.net sk4425 at users.sourceforge.net
Mon Jul 7 17:42:26 CEST 2008


Revision: 32943
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32943&view=rev
Author:   sk4425
Date:     2008-07-07 08:42:26 -0700 (Mon, 07 Jul 2008)

Log Message:
-----------
- changed VirtualKeyboard classes to Common namespace
- updated XMLParser from Tanoku's branch

Modified Paths:
--------------
    scummvm/branches/gsoc2008-vkeybd/backends/common/virtual-keyboard-parser.cpp
    scummvm/branches/gsoc2008-vkeybd/backends/common/virtual-keyboard-parser.h
    scummvm/branches/gsoc2008-vkeybd/backends/common/virtual-keyboard.cpp
    scummvm/branches/gsoc2008-vkeybd/backends/common/virtual-keyboard.h
    scummvm/branches/gsoc2008-vkeybd/backends/events/default/default-events.cpp
    scummvm/branches/gsoc2008-vkeybd/backends/events/default/default-events.h
    scummvm/branches/gsoc2008-vkeybd/common/xmlparser.cpp
    scummvm/branches/gsoc2008-vkeybd/common/xmlparser.h

Modified: scummvm/branches/gsoc2008-vkeybd/backends/common/virtual-keyboard-parser.cpp
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/common/virtual-keyboard-parser.cpp	2008-07-07 15:06:43 UTC (rev 32942)
+++ scummvm/branches/gsoc2008-vkeybd/backends/common/virtual-keyboard-parser.cpp	2008-07-07 15:42:26 UTC (rev 32943)
@@ -29,7 +29,7 @@
 #include "graphics/imageman.h"
 #include "common/util.h"
 
-namespace GUI {
+namespace Common {
 
 VirtualKeyboardParser::VirtualKeyboardParser(VirtualKeyboard *kbd) : XMLParser() {
 	_keyboard = kbd;

Modified: scummvm/branches/gsoc2008-vkeybd/backends/common/virtual-keyboard-parser.h
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/common/virtual-keyboard-parser.h	2008-07-07 15:06:43 UTC (rev 32942)
+++ scummvm/branches/gsoc2008-vkeybd/backends/common/virtual-keyboard-parser.h	2008-07-07 15:42:26 UTC (rev 32943)
@@ -23,13 +23,13 @@
  *
  */
 
-#ifndef GUI_VIRTUAL_KEYBOARD_PARSER
-#define GUI_VIRTUAL_KEYBOARD_PARSER
+#ifndef COMMON_VIRTUAL_KEYBOARD_PARSER
+#define COMMON_VIRTUAL_KEYBOARD_PARSER
 
 #include "common/xmlparser.h"
 #include "backends/common/virtual-keyboard.h"
 
-namespace GUI {
+namespace Common {
 
 class VirtualKeyboardParser : public Common::XMLParser {
 

Modified: scummvm/branches/gsoc2008-vkeybd/backends/common/virtual-keyboard.cpp
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/common/virtual-keyboard.cpp	2008-07-07 15:06:43 UTC (rev 32942)
+++ scummvm/branches/gsoc2008-vkeybd/backends/common/virtual-keyboard.cpp	2008-07-07 15:42:26 UTC (rev 32943)
@@ -30,7 +30,7 @@
 #include "graphics/imageman.h"
 #include "common/unzip.h"
 
-namespace GUI {
+namespace Common {
 
 VirtualKeyboard::VirtualKeyboard() : _currentMode(0), _keyDown(0) {
 	assert(g_system);

Modified: scummvm/branches/gsoc2008-vkeybd/backends/common/virtual-keyboard.h
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/common/virtual-keyboard.h	2008-07-07 15:06:43 UTC (rev 32942)
+++ scummvm/branches/gsoc2008-vkeybd/backends/common/virtual-keyboard.h	2008-07-07 15:42:26 UTC (rev 32943)
@@ -23,8 +23,8 @@
  *
  */
 
-#ifndef GUI_VIRTUAL_KEYBOARD_H
-#define GUI_VIRTUAL_KEYBOARD_H
+#ifndef COMMON_VIRTUAL_KEYBOARD_H
+#define COMMON_VIRTUAL_KEYBOARD_H
 
 class OSystem;
 
@@ -36,7 +36,7 @@
 #include "common/str.h"
 #include "graphics/surface.h"
 
-namespace GUI {
+namespace Common {
 
 class VirtualKeyboardParser;
 

Modified: scummvm/branches/gsoc2008-vkeybd/backends/events/default/default-events.cpp
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/events/default/default-events.cpp	2008-07-07 15:06:43 UTC (rev 32942)
+++ scummvm/branches/gsoc2008-vkeybd/backends/events/default/default-events.cpp	2008-07-07 15:42:26 UTC (rev 32943)
@@ -192,7 +192,7 @@
 		_hasPlaybackEvent = false;
 	}
 
-	_vk = new GUI::VirtualKeyboard();
+	_vk = new Common::VirtualKeyboard();
 }
 
 DefaultEventManager::~DefaultEventManager() {

Modified: scummvm/branches/gsoc2008-vkeybd/backends/events/default/default-events.h
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/events/default/default-events.h	2008-07-07 15:06:43 UTC (rev 32942)
+++ scummvm/branches/gsoc2008-vkeybd/backends/events/default/default-events.h	2008-07-07 15:42:26 UTC (rev 32943)
@@ -45,7 +45,7 @@
 class DefaultEventManager : public Common::EventManager {
 	OSystem *_boss;
 
-	GUI::VirtualKeyboard *_vk;
+	Common::VirtualKeyboard *_vk;
 
 	Common::Point _mousePos;
 	int _buttonState;

Modified: scummvm/branches/gsoc2008-vkeybd/common/xmlparser.cpp
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/common/xmlparser.cpp	2008-07-07 15:06:43 UTC (rev 32942)
+++ scummvm/branches/gsoc2008-vkeybd/common/xmlparser.cpp	2008-07-07 15:42:26 UTC (rev 32943)
@@ -143,10 +143,7 @@
 	_pos = 0;
 	_activeKey.clear();
 	
-	while (_text[_pos]) {
-		if (_state == kParserError)
-			break;
-
+	while (_text[_pos] && _state != kParserError) {
 		if (skipSpaces())
 			continue;
 
@@ -197,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-vkeybd/common/xmlparser.h
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/common/xmlparser.h	2008-07-07 15:06:43 UTC (rev 32942)
+++ scummvm/branches/gsoc2008-vkeybd/common/xmlparser.h	2008-07-07 15:42:26 UTC (rev 32943)
@@ -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