From 287bc06f77ff5e60884c1709844c5830ff7a70ce Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Sun, 11 Jan 2015 13:51:41 +0100 Subject: Added primitive Rtti Types --- src/core/common/Rtti.cpp | 12 +++++++++++- src/core/common/Rtti.hpp | 27 +++++++++++++++++++++------ 2 files changed, 32 insertions(+), 7 deletions(-) (limited to 'src/core') diff --git a/src/core/common/Rtti.cpp b/src/core/common/Rtti.cpp index 7ee3c45..a8343ef 100644 --- a/src/core/common/Rtti.cpp +++ b/src/core/common/Rtti.cpp @@ -99,6 +99,16 @@ bool RttiType::composedOf(const RttiType &other) const /* Constant initialization */ -const RttiType RttiTypes::None; +namespace RttiTypes { +const RttiType None{"unknown"}; +const RttiType Nullptr{"nullptr"}; +const RttiType Bool{"bool"}; +const RttiType Int{"int"}; +const RttiType Double{"double"}; +const RttiType String{"string"}; +const RttiType Array{"array"}; +const RttiType Map{"map"}; +const RttiType Function{"function"}; +} } diff --git a/src/core/common/Rtti.hpp b/src/core/common/Rtti.hpp index aa161d6..39a61d3 100644 --- a/src/core/common/Rtti.hpp +++ b/src/core/common/Rtti.hpp @@ -295,6 +295,11 @@ public: */ RttiType() : name("unknown") {} + /** + * Constructor for an empty RttiType with the given name. + */ + RttiType(std::string name) : name(std::move(name)) {} + /** * Creates a new RttiType instance and registers it in the global type * table. Use the Rtti and the RttiBuilder class for more convenient @@ -431,32 +436,42 @@ namespace RttiTypes { extern const RttiType None; /** - * Bool type for use by the Variant::rttiType method. + * Nullptr type for use by the Variant::getRttiType method. + */ +extern const RttiType Nullptr; + +/** + * Bool type for use by the Variant::getRttiType method. */ extern const RttiType Bool; /** - * Integer type for use by the Variant::rttiType method. + * Integer type for use by the Variant::getRttiType method. */ extern const RttiType Int; /** - * Double type for use by the Variant::rttiType method. + * Double type for use by the Variant::getRttiType method. */ extern const RttiType Double; /** - * String type for use by the Variant::rttiType method. + * String type for use by the Variant::getRttiType method. */ extern const RttiType String; /** - * Array type for use by the Variant::rttiType method. + * Array type for use by the Variant::getRttiType method. */ extern const RttiType Array; /** - * Function type for use by the Variant::rttiType method. + * Map type for use by the Variant::getRttiType method. + */ +extern const RttiType Map; + +/** + * Function type for use by the Variant::getRttiType method. */ extern const RttiType Function; } -- cgit v1.2.3