mostly backwards compatibility with old pack system, uses boost tribool

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1311 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2009-01-09 00:49:14 +00:00
parent bce5761781
commit 432cdcd583
8 changed files with 30 additions and 5 deletions
+2
View File
@@ -11,6 +11,7 @@
#include <util/vector2d.hpp>
#include <script/script.hpp>
#include <script/to_value.hpp>
#include <boost/logic/tribool.hpp>
// ---------------------------------------------------------------------------- : GetDefaultMember
@@ -21,6 +22,7 @@ template <> void GetDefaultMember::handle(const int& v) { value = to_sc
template <> void GetDefaultMember::handle(const unsigned int& v) { value = to_script((int)v); }
template <> void GetDefaultMember::handle(const double& v) { value = to_script(v); }
template <> void GetDefaultMember::handle(const bool& v) { value = to_script(v); }
template <> void GetDefaultMember::handle(const tribool& v) { value = to_script((bool)v); }
template <> void GetDefaultMember::handle(const Vector2D& v) { value = to_script(String::Format(_("(%.10lf,%.10lf)"), v.x, v.y)); }
template <> void GetDefaultMember::handle(const Color& v) { value = to_script(v); }
void GetDefaultMember::handle(const ScriptValueP& v) { value = v; }
+5
View File
@@ -11,6 +11,7 @@
#include <util/vector2d.hpp>
#include <util/error.hpp>
#include <util/io/package_manager.hpp>
#include <boost/logic/tribool.hpp>
#undef small
typedef void (*ReaderPragmaHandler)(String&);
@@ -366,6 +367,10 @@ template <> void Reader::handle(bool& b) {
const String& v = getValue();
b = (v==_("true") || v==_("1") || v==_("yes"));
}
template <> void Reader::handle(tribool& b) {
const String& v = getValue();
b = (v==_("true") || v==_("1") || v==_("yes"));
}
// ----------------------------------------------------------------------------- : Handling less basic util types
template <> void Reader::handle(Vector2D& vec) {
+6
View File
@@ -12,6 +12,7 @@
#include <util/error.hpp>
#include <util/version.hpp>
#include <util/io/package.hpp>
#include <boost/logic/tribool.hpp>
// ----------------------------------------------------------------------------- : Writer
@@ -104,6 +105,11 @@ template <> void Writer::handle(const double& value) {
template <> void Writer::handle(const bool& value) {
handle(value ? _("true") : _("false"));
}
template <> void Writer::handle(const tribool& value) {
if (!indeterminate(value)) {
handle(value ? _("true") : _("false"));
}
}
// ----------------------------------------------------------------------------- : Handling less basic util types