mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 05:07:00 -04:00
Added dummy CardEditor, implemented Stylesheet loading
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@50 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -28,6 +28,7 @@ class GetDefaultMember {
|
||||
/// Tell the reflection code we are not reading
|
||||
inline bool reading() const { return false; }
|
||||
inline bool isComplex() const { return false; }
|
||||
inline void addAlias(int, const Char*, const Char*) {}
|
||||
|
||||
inline void handleAppVersion() {} // no effect
|
||||
|
||||
@@ -68,6 +69,7 @@ class GetMember : private GetDefaultMember {
|
||||
/// Tell the reflection code we are not reading
|
||||
inline bool reading() const { return false; }
|
||||
inline bool isComplex() const { return false; }
|
||||
inline void addAlias(int, const Char*, const Char*) {}
|
||||
|
||||
/// The result, or script_nil if the member was not found
|
||||
inline ScriptValueP result() { return gdm.result(); }
|
||||
|
||||
@@ -30,6 +30,11 @@ Reader::Reader(const String& filename)
|
||||
moveNext();
|
||||
}
|
||||
|
||||
void Reader::addAlias(Version end_version, const Char* a, const Char* b) {
|
||||
if (app_version < end_version) {
|
||||
aliasses[a] = b;
|
||||
}
|
||||
}
|
||||
|
||||
void Reader::handleAppVersion() {
|
||||
if (enterBlock(_("mse_version"))) {
|
||||
@@ -113,6 +118,11 @@ void Reader::readLine() {
|
||||
}
|
||||
key = cannocial_name_form(trim(line.substr(indent, pos - indent)));
|
||||
value = pos == String::npos ? _("") : trim_left(line.substr(pos+1));
|
||||
// aliasses?
|
||||
map<String,String>::const_iterator it = aliasses.find(key);
|
||||
if (it != aliasses.end()) {
|
||||
key = it->second;
|
||||
}
|
||||
}
|
||||
|
||||
void Reader::unknownKey() {
|
||||
|
||||
@@ -46,6 +46,8 @@ class Reader {
|
||||
inline bool reading() const { return true; }
|
||||
/// Is the thing currently being read 'complex', i.e. does it have children
|
||||
inline bool isComplex() const { return value.empty(); }
|
||||
/// Add a as an alias for b, all keys a will be replaced with b, only if app_version < end_version
|
||||
void addAlias(Version end_version, const Char* a, const Char* b);
|
||||
|
||||
/// Read and check the application version
|
||||
void handleAppVersion();
|
||||
@@ -80,7 +82,7 @@ class Reader {
|
||||
template <typename T> void handle(Scriptable<T>&);
|
||||
// special behaviour
|
||||
void handle(GameP&);
|
||||
void handle(StyleSheet&);
|
||||
void handle(StyleSheetP&);
|
||||
|
||||
// --------------------------------------------------- : Data
|
||||
/// App version this file was made with
|
||||
@@ -98,6 +100,8 @@ class Reader {
|
||||
int expected_indent;
|
||||
/// Did we just open a block (i.e. not read any more lines of it)?
|
||||
bool just_opened;
|
||||
/// Aliasses for compatability
|
||||
map<String, String> aliasses;
|
||||
|
||||
/// Filename for error messages
|
||||
String filename;
|
||||
|
||||
@@ -31,6 +31,7 @@ class Writer {
|
||||
/// Tell the reflection code we are not reading
|
||||
inline bool reading() const { return false; }
|
||||
inline bool isComplex() const { return false; }
|
||||
inline void addAlias(int, const Char*, const Char*) {}
|
||||
|
||||
/// Write the application version
|
||||
void handleAppVersion();
|
||||
@@ -65,7 +66,7 @@ class Writer {
|
||||
template <typename T> void handle(const Scriptable<T>&);
|
||||
// special behaviour
|
||||
void handle(const GameP&);
|
||||
void handle(const StyleSheet&);
|
||||
void handle(const StyleSheetP&);
|
||||
|
||||
private:
|
||||
// --------------------------------------------------- : Data
|
||||
|
||||
Reference in New Issue
Block a user