From 86e7235e791284e57b76662dce1b8319d1b52361 Mon Sep 17 00:00:00 2001 From: twanvl Date: Thu, 19 Oct 2006 12:30:57 +0000 Subject: [PATCH] implemented reflection git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@27 0fc631ac-6414-0410-93d0-97cfa31319b6 --- src/script/scriptable.cpp | 11 ++++------- src/script/scriptable.hpp | 34 +++++++++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/script/scriptable.cpp b/src/script/scriptable.cpp index dbc3dbd6..afe4a6e5 100644 --- a/src/script/scriptable.cpp +++ b/src/script/scriptable.cpp @@ -24,7 +24,7 @@ void store(const ScriptValueP& val, Defaultable& var) { var.assign(*val) OptionalScript::~OptionalScript() {} -ScriptValueP OptionalScript::invoke(Context& ctx) { +ScriptValueP OptionalScript::invoke(Context& ctx) const { if (script) { return ctx.eval(*script); } else { @@ -44,14 +44,11 @@ template <> void Writer::handle(const OptionalScript& os) { handle(os.unparsed); } -template <> void GetMember::handle(const OptionalScript& os) { - // no members -} -template <> void GetMember::store(const OptionalScript& os) { +template <> void GetDefaultMember::handle(const OptionalScript& os) { // reflect as the script itself if (os.script) { - store(os.script); + handle(os.script); } else { - store(script_nil); + handle(script_nil); } } diff --git a/src/script/scriptable.hpp b/src/script/scriptable.hpp index 17e9f100..39230d3d 100644 --- a/src/script/scriptable.hpp +++ b/src/script/scriptable.hpp @@ -13,6 +13,7 @@ #include #include #include