summaryrefslogtreecommitdiff
path: root/src/core/script
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2014-10-26 23:51:44 +0000
committerandreas <andreas@daaaf23c-2e50-4459-9457-1e69db5a47bf>2014-10-26 23:51:44 +0000
commit7ea06d81b263d23bbe3cb5a4480e63857cb36f0f (patch)
tree6faa2dbc88cb787b1383077b17da0dc17bdc3c57 /src/core/script
parenta093d01e6a9b3dd8974a6a6d26706ed73a9c6217 (diff)
implemented setting/getting host variables, including host functions but not yet host objects
git-svn-id: file:///var/local/svn/basicwriter@81 daaaf23c-2e50-4459-9457-1e69db5a47bf
Diffstat (limited to 'src/core/script')
-rw-r--r--src/core/script/Variant.cpp16
-rw-r--r--src/core/script/Variant.hpp1
2 files changed, 9 insertions, 8 deletions
diff --git a/src/core/script/Variant.cpp b/src/core/script/Variant.cpp
index 72749b1..bb9f566 100644
--- a/src/core/script/Variant.cpp
+++ b/src/core/script/Variant.cpp
@@ -173,7 +173,7 @@ bool Variant::getBooleanValue() const
case VariantType::map:
return !getMapValue().empty();
default:
- throw VariantTypeException{type, VariantType::boolean};
+ throw VariantTypeException{VariantType::boolean, type};
}
}
@@ -187,7 +187,7 @@ int64_t Variant::getIntegerValue() const
case VariantType::number:
return static_cast<int64_t>(numberValue);
default:
- throw VariantTypeException{type, VariantType::integer};
+ throw VariantTypeException{VariantType::integer, type};
}
}
@@ -201,7 +201,7 @@ double Variant::getNumberValue() const
case VariantType::number:
return numberValue;
default:
- throw VariantTypeException{type, VariantType::number};
+ throw VariantTypeException{VariantType::number, type};
}
}
@@ -211,7 +211,7 @@ const std::string &Variant::getStringValue() const
case VariantType::string:
return *(static_cast<std::string *>(objectValue));
default:
- throw VariantTypeException{type, VariantType::string};
+ throw VariantTypeException{VariantType::string, type};
}
}
@@ -221,7 +221,7 @@ const std::vector<Variant> &Variant::getArrayValue() const
case VariantType::array:
return *(static_cast<std::vector<Variant> *>(objectValue));
default:
- throw VariantTypeException{type, VariantType::array};
+ throw VariantTypeException{VariantType::array, type};
}
}
@@ -232,7 +232,7 @@ const std::map<std::string, Variant> &Variant::getMapValue() const
return *(static_cast<std::map<std::string, Variant> *>(
objectValue));
default:
- throw VariantTypeException{type, VariantType::map};
+ throw VariantTypeException{VariantType::map, type};
}
}
@@ -241,7 +241,7 @@ const Function *Variant::getFunctionValue() const
switch (type) {
case VariantType::function: return static_cast<Function *>(objectValue);
default:
- throw VariantTypeException{type, VariantType::function};
+ throw VariantTypeException{VariantType::function, type};
}
}
@@ -250,7 +250,7 @@ const Object &Variant::getObjectValue() const
switch (type) {
case VariantType::object: return *(static_cast<Object *>(objectValue));
default:
- throw VariantTypeException{type, VariantType::function};
+ throw VariantTypeException{VariantType::object, type};
}
}
diff --git a/src/core/script/Variant.hpp b/src/core/script/Variant.hpp
index 8cb0e8f..848c595 100644
--- a/src/core/script/Variant.hpp
+++ b/src/core/script/Variant.hpp
@@ -31,6 +31,7 @@
// TODO: Use std::unique_ptr for *Function
// TODO: Move semantic in complex constructors
// TODO: Delete default constructors/assignment operators in pretty much everything
+// TODO: Remove implicit type conversions, but add explicit conversion function!
namespace ousia {
namespace script {