From 29355270d36994b6a33d05bcc1f9a142818a325e Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Fri, 12 Dec 2014 15:32:51 +0100 Subject: Added new version of Typesystem in cooperation with Andreas. --- src/core/common/Variant.hpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/core/common/Variant.hpp') diff --git a/src/core/common/Variant.hpp b/src/core/common/Variant.hpp index d411fd3..c57ef57 100644 --- a/src/core/common/Variant.hpp +++ b/src/core/common/Variant.hpp @@ -433,6 +433,24 @@ public: */ bool isMap() const { return type == Type::MAP; } + /** + * Checks whether this Variant instance is a primitive type. + * + * @return true if the Variant instance is a primitive type. + */ + bool isPrimitive() const { + switch(type){ + case Type::NULLPTR: + case Type::BOOL: + case Type::INT: + case Type::DOUBLE: + case Type::STRING: + return true; + default: + return false; + } + } + /** * Returns the Variant boolean value. Performs no type conversion. Throws an * exception if the underlying type is not a boolean. -- cgit v1.2.3