From eb7211bb8d199b60d1e15cc84e16e08f1e8c0f23 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Sun, 26 Oct 2014 01:17:02 +0000 Subject: Fully implemented reading values from MozJs (except for all bugs that are still in it); added generic unit test for java script engine implementations; added suppressions for valgrind (as the mozjs library produced some leaks that can safely be ignored); added a bunch of TODOs git-svn-id: file:///var/local/svn/basicwriter@79 daaaf23c-2e50-4459-9457-1e69db5a47bf --- src/core/script/ScriptEngine.hpp | 8 ++++++++ src/core/script/Variant.hpp | 21 ++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) (limited to 'src/core/script') diff --git a/src/core/script/ScriptEngine.hpp b/src/core/script/ScriptEngine.hpp index 2341beb..6c048aa 100644 --- a/src/core/script/ScriptEngine.hpp +++ b/src/core/script/ScriptEngine.hpp @@ -27,6 +27,14 @@ #include "Variant.hpp" +// TODO: Provide more Exception classes than ScriptEngineException -- one for +// internal errors, one for script errors + +// TODO: Allow reporting multiple exceptions (e.g. to report all syntax errors +// at once) + +// TODO: Add API that allow pre-compilation of scripts + namespace ousia { namespace script { diff --git a/src/core/script/Variant.hpp b/src/core/script/Variant.hpp index 465793f..8cb0e8f 100644 --- a/src/core/script/Variant.hpp +++ b/src/core/script/Variant.hpp @@ -26,6 +26,12 @@ #include #include +// TODO: Replace VariantType::number with VariantType::double +// TODO: Convert VariantType::integer to int32_t +// TODO: Use std::unique_ptr for *Function +// TODO: Move semantic in complex constructors +// TODO: Delete default constructors/assignment operators in pretty much everything + namespace ousia { namespace script { @@ -124,6 +130,9 @@ private: }; public: + + using Int = int32_t; + /** * Copy constructor of the Variant class. * @@ -182,7 +191,8 @@ public: Variant(const std::vector &a); /** - * Constructor for map values. The given map is copied and managed by the new + * Constructor for map values. The given map is copied and managed by the + *new * Variant instance. * * @param m is a reference to the map. @@ -190,7 +200,8 @@ public: Variant(const std::map &m); /** - * Constructor for function values. The given pointer to the function object is cloned and managed by the new Variant instance. + * Constructor for function values. The given pointer to the function object + *is cloned and managed by the new Variant instance. * * @param f is a reference to the function. */ @@ -224,10 +235,7 @@ public: * * @return the current type of the Variant. */ - VariantType getType() const - { - return type; - } + VariantType getType() const { return type; } bool getBooleanValue() const; int64_t getIntegerValue() const; @@ -253,7 +261,6 @@ public: */ friend std::ostream &operator<<(std::ostream &os, const Variant &v); }; - } } -- cgit v1.2.3