aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/xmlparser.cpp19
-rw-r--r--common/xmlparser.h24
2 files changed, 23 insertions, 20 deletions
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 =
- "<render_info>\n"
- "<palette>\n"
- "<color name = \"red\" rgb = \"255, 255, 255\"/>\n"
- "</palette>\n"
- "<drawdata id = \"mainmenu_bg\" cache = true>\n"
- "<drawstep func = \"roundedsq\" radius = 23 fill = \"none\" color = \"0, 1, 2\" size = \"auto\" />\n"
- "<drawstep func = \"roundedsq\" radius = 15 fill = \"none\" color = \"red\" size = \"auto\"/>\n"
- "</drawdata>/* lol this is just a simple test*/\n"
- "</render_info>";
-
- 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