- changed VirtualKeyboard classes to Common namespace

- updated XMLParser from Tanoku's branch

svn-id: r32943
This commit is contained in:
Stephen Kennedy 2008-07-07 15:42:26 +00:00
parent 5840c2480f
commit 275ffece2f
8 changed files with 30 additions and 14 deletions

View File

@ -29,7 +29,7 @@
#include "graphics/imageman.h"
#include "common/util.h"
namespace GUI {
namespace Common {
VirtualKeyboardParser::VirtualKeyboardParser(VirtualKeyboard *kbd) : XMLParser() {
_keyboard = kbd;

View File

@ -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 {

View File

@ -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);

View File

@ -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 @@ class OSystem;
#include "common/str.h"
#include "graphics/surface.h"
namespace GUI {
namespace Common {
class VirtualKeyboardParser;

View File

@ -192,7 +192,7 @@ DefaultEventManager::DefaultEventManager(OSystem *boss) :
_hasPlaybackEvent = false;
}
_vk = new GUI::VirtualKeyboard();
_vk = new Common::VirtualKeyboard();
}
DefaultEventManager::~DefaultEventManager() {

View File

@ -45,7 +45,7 @@ use a subclass of EventProvider.
class DefaultEventManager : public Common::EventManager {
OSystem *_boss;
GUI::VirtualKeyboard *_vk;
Common::VirtualKeyboard *_vk;
Common::Point _mousePos;
int _buttonState;

View File

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

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.
*/