From 0cd183b94b7d24f9df8453ee126bceddc1dfd857 Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Thu, 26 Jun 2008 13:50:16 +0000 Subject: InterfaceManager now loads themes. svn-id: r32800 --- common/xmlparser.cpp | 19 ------------------- common/xmlparser.h | 24 +++++++++++++++++++++++- 2 files changed, 23 insertions(+), 20 deletions(-) (limited to 'common') diff --git a/common/xmlparser.cpp b/common/xmlparser.cpp index 6cb3a8a441..22b8b22e48 100644 --- a/common/xmlparser.cpp +++ b/common/xmlparser.cpp @@ -34,25 +34,6 @@ namespace Common { using namespace Graphics; -void XMLParser::debug_testEval() { - static const char *debugConfigText = - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "/* lol this is just a simple test*/\n" - ""; - - loadBuffer(debugConfigText); - _fileName = "test_parse.xml"; - - parse(); -} - - bool XMLParser::parserError(const char *errorString, ...) { _state = kParserError; diff --git a/common/xmlparser.h b/common/xmlparser.h index 3eb87efd31..4c8e1b986f 100644 --- a/common/xmlparser.h +++ b/common/xmlparser.h @@ -120,23 +120,45 @@ public: int depth; }; + /** + * Loads a file into the parser. + * Used for the loading of Theme Description files + * straight from the filesystem. + * + * @param filename Name of the file to load. + */ virtual bool loadFile(Common::String filename) { Common::File *f = new Common::File; if (!f->open(filename, Common::File::kFileReadMode)) return false; + _fileName = filename; _text.loadStream(f); return true; } + /** + * Loads a memory buffer into the parser. + * Used for loading the default theme fallback directly + * from memory if no themes can be found. + * + * @param buffer Pointer to the buffer. + * @param disposable Sets if the XMLParser owns the buffer, + * i.e. if it can be freed safely after it's + * no longer needed by the parser. + */ virtual bool loadBuffer(const char *buffer, bool disposable = false) { _text.loadStream(new MemoryReadStream((const byte*)buffer, strlen(buffer), disposable)); + _fileName = "Memory Stream"; return true; } + /** + * The actual parsing function. + * Parses the loaded data stream, returns true if successful. + */ virtual bool parse(); - void debug_testEval(); /** * Returns the active node being parsed (the one on top of -- cgit v1.2.3