mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
added support for includes
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@31 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
+19
-1
@@ -9,10 +9,11 @@
|
||||
#include "reader.hpp"
|
||||
#include <util/vector2d.hpp>
|
||||
#include <util/error.hpp>
|
||||
#include <util/io/package_manager.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- : Reader
|
||||
|
||||
Reader::Reader(const InputStreamP& input, String filename)
|
||||
Reader::Reader(const InputStreamP& input, const String& filename)
|
||||
: input(input), filename(filename), line_number(0)
|
||||
, indent(0), expected_indent(0), just_opened(false)
|
||||
, stream(*input)
|
||||
@@ -20,6 +21,16 @@ Reader::Reader(const InputStreamP& input, String filename)
|
||||
moveNext();
|
||||
}
|
||||
|
||||
Reader::Reader(const String& filename)
|
||||
: input(packages.openFileFromPackage(filename))
|
||||
, filename(filename), line_number(0)
|
||||
, indent(0), expected_indent(0), just_opened(false)
|
||||
, stream(*input)
|
||||
{
|
||||
moveNext();
|
||||
}
|
||||
|
||||
|
||||
void Reader::warning(const String& msg) {
|
||||
wxMessageBox((msg + _("\nOn line: ")) << line_number << _("\nIn file: ") << filename, _("Warning"), wxOK | wxICON_EXCLAMATION);
|
||||
}
|
||||
@@ -84,6 +95,13 @@ void Reader::readLine() {
|
||||
value = pos == String::npos ? _("") : trim_left(line.substr(pos+1));
|
||||
}
|
||||
|
||||
void Reader::unknownKey() {
|
||||
warning(_("Unexpected key: '") + key + _("'"));
|
||||
do {
|
||||
moveNext();
|
||||
} while (indent > expected_indent);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Handling basic types
|
||||
|
||||
template <> void Reader::handle(String& s) {
|
||||
|
||||
Reference in New Issue
Block a user