summaryrefslogtreecommitdiff
path: root/src/core/common
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-18 18:41:30 +0100
committerAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-18 18:41:30 +0100
commit66382c62af1be515deff66d51dba7f27e5fe4937 (patch)
treecdd661a560ef1f766889d661d8c7561d18bfbabb /src/core/common
parent7d788f2dce18c3ba6f11f7f032d35fef2e5fa9d4 (diff)
Renamed RttiType to Rtti
Diffstat (limited to 'src/core/common')
-rw-r--r--src/core/common/Argument.cpp20
-rw-r--r--src/core/common/Argument.hpp30
-rw-r--r--src/core/common/Property.hpp32
-rw-r--r--src/core/common/Rtti.cpp58
-rw-r--r--src/core/common/Rtti.hpp106
-rw-r--r--src/core/common/RttiBuilder.hpp22
-rw-r--r--src/core/common/Variant.cpp6
-rw-r--r--src/core/common/Variant.hpp10
-rw-r--r--src/core/common/VariantConverter.cpp14
-rw-r--r--src/core/common/VariantConverter.hpp34
10 files changed, 166 insertions, 166 deletions
diff --git a/src/core/common/Argument.cpp b/src/core/common/Argument.cpp
index a4c153d..21d4f6c 100644
--- a/src/core/common/Argument.cpp
+++ b/src/core/common/Argument.cpp
@@ -27,8 +27,8 @@ namespace ousia {
/* Class Argument */
-Argument::Argument(std::string name, const RttiType &type,
- const RttiType &innerType, Variant defaultValue,
+Argument::Argument(std::string name, const Rtti &type,
+ const Rtti &innerType, Variant defaultValue,
bool hasDefault)
: type(type),
innerType(innerType),
@@ -38,12 +38,12 @@ Argument::Argument(std::string name, const RttiType &type,
{
}
-Argument::Argument(std::string name, const RttiType &type, Variant defaultValue)
+Argument::Argument(std::string name, const Rtti &type, Variant defaultValue)
: Argument(std::move(name), type, RttiTypes::None, defaultValue, true)
{
}
-Argument::Argument(std::string name, const RttiType &type)
+Argument::Argument(std::string name, const Rtti &type)
: Argument(std::move(name), type, RttiTypes::None, nullptr, false)
{
}
@@ -99,13 +99,13 @@ Argument Argument::String(std::string name,
return Argument{name, RttiTypes::String, Variant::fromString(defaultValue)};
}
-Argument Argument::Object(std::string name, const RttiType &type)
+Argument Argument::Object(std::string name, const Rtti &type)
{
return Argument(std::move(name), type, RttiTypes::None,
Variant::fromObject(nullptr), false);
}
-Argument Argument::Object(std::string name, const RttiType &type,
+Argument Argument::Object(std::string name, const Rtti &type,
std::nullptr_t)
{
return Argument(std::move(name), type, RttiTypes::None,
@@ -135,13 +135,13 @@ Argument Argument::Array(std::string name,
return Argument(std::move(name), RttiTypes::Array, defaultValue);
}
-Argument Argument::Array(std::string name, const RttiType &innerType)
+Argument Argument::Array(std::string name, const Rtti &innerType)
{
return Argument(std::move(name), RttiTypes::Array, innerType, nullptr,
false);
}
-Argument Argument::Array(std::string name, const RttiType &innerType,
+Argument Argument::Array(std::string name, const Rtti &innerType,
const Variant::arrayType &defaultValue)
{
return Argument(std::move(name), RttiTypes::Array, innerType, defaultValue,
@@ -158,12 +158,12 @@ Argument Argument::Map(std::string name, const Variant::mapType &defaultValue)
return Argument(std::move(name), RttiTypes::Map, defaultValue);
}
-Argument Argument::Map(std::string name, const RttiType &innerType)
+Argument Argument::Map(std::string name, const Rtti &innerType)
{
return Argument(std::move(name), RttiTypes::Map, innerType, nullptr, false);
}
-Argument Argument::Map(std::string name, const RttiType &innerType,
+Argument Argument::Map(std::string name, const Rtti &innerType,
const Variant::mapType &defaultValue)
{
return Argument(std::move(name), RttiTypes::Map, innerType, defaultValue,
diff --git a/src/core/common/Argument.hpp b/src/core/common/Argument.hpp
index dd652de..8d01c2d 100644
--- a/src/core/common/Argument.hpp
+++ b/src/core/common/Argument.hpp
@@ -44,7 +44,7 @@ namespace ousia {
// Forward declaration
class Logger;
-class RttiType;
+class Rtti;
/**
* The Argument class represents a single argument that can be passed to a
@@ -55,13 +55,13 @@ private:
/**
* Type that should be returned by the Variant rttiType function.
*/
- const RttiType &type;
+ const Rtti &type;
/**
* Describes the inner type of the variant -- e.g. the type of the elements
- * inside an array. Normally set to RttiType::None.
+ * inside an array. Normally set to RttiTypes::None.
*/
- const RttiType &innerType;
+ const Rtti &innerType;
/**
* Private constructor used for manually setting all internal data fields.
@@ -75,7 +75,7 @@ private:
* @param hasDefault indicates whether the defaultValue actually should be
* used.
*/
- Argument(std::string name, const RttiType &type, const RttiType &innerType,
+ Argument(std::string name, const Rtti &type, const Rtti &innerType,
Variant defaultValue, bool hasDefault);
/**
@@ -87,7 +87,7 @@ private:
* expected.
* @param defaultValue is the default value to be used.
*/
- Argument(std::string name, const RttiType &type, Variant defaultValue);
+ Argument(std::string name, const Rtti &type, Variant defaultValue);
/**
* Private constructor used to build an argument describing a primitive type
@@ -97,7 +97,7 @@ private:
* @param variantType is the variant type of the argument that is to be
* expected.
*/
- Argument(std::string name, const RttiType &type);
+ Argument(std::string name, const Rtti &type);
public:
/**
@@ -226,11 +226,11 @@ public:
*
* @param name is the name of the argument as used for error messages and in
* case the arguments are given as a map.
- * @param type is the RttiType of acceptable objects. All objects where the
+ * @param type is the Rtti of acceptable objects. All objects where the
* "isa" function returns true for the given type are be accepted.
* @return a new Argument instance.
*/
- static Argument Object(std::string name, const RttiType &type);
+ static Argument Object(std::string name, const Rtti &type);
/**
* Named constructor for an object argument with default value. The default
@@ -240,13 +240,13 @@ public:
*
* @param name is the name of the argument as used for error messages and in
* case the arguments are given as a map.
- * @param type is the RttiType of acceptable objects. All objects where the
+ * @param type is the Rtti of acceptable objects. All objects where the
* "isa" function returns true for the given type are be accepted.
* @param defaultValue must be set to nullptr. Default object instances
* cannot be stored.
* @return a new Argument instance.
*/
- static Argument Object(std::string name, const RttiType &type,
+ static Argument Object(std::string name, const Rtti &type,
std::nullptr_t defaultValue);
/**
@@ -303,7 +303,7 @@ public:
* forced to be of this type.
* @return a new Argument instance.
*/
- static Argument Array(std::string name, const RttiType &innerType);
+ static Argument Array(std::string name, const Rtti &innerType);
/**
* Named constructor for an array argument of objects of the given RTTI
@@ -317,7 +317,7 @@ public:
* @param defaultValue is the default value to be used in case this argument
* is not supplied.
*/
- static Argument Array(std::string name, const RttiType &innerType,
+ static Argument Array(std::string name, const Rtti &innerType,
const Variant::arrayType &defaultValue);
/**
@@ -352,7 +352,7 @@ public:
* to be of this type.
* @return a new Argument instance.
*/
- static Argument Map(std::string name, const RttiType &innerType);
+ static Argument Map(std::string name, const Rtti &innerType);
/**
* Named constructor for a map argument with default value and a given inner
@@ -366,7 +366,7 @@ public:
* is not supplied.
* @return a new Argument instance.
*/
- static Argument Map(std::string name, const RttiType &innerType,
+ static Argument Map(std::string name, const Rtti &innerType,
const Variant::mapType &defaultValue);
/**
diff --git a/src/core/common/Property.hpp b/src/core/common/Property.hpp
index 72dff71..10db869 100644
--- a/src/core/common/Property.hpp
+++ b/src/core/common/Property.hpp
@@ -47,15 +47,15 @@ public:
};
// Forward declaration
-class RttiType;
+class Rtti;
namespace RttiTypes {
-extern const RttiType None;
+extern const Rtti None;
}
/**
* Structure describing the type of a property -- which consists of a "outer"
* type (which may either be a primitive variant type such as e.g.
- * RttiTypes::Int or any other RttiType instance) and an inner type, which
+ * RttiTypes::Int or any other Rtti instance) and an inner type, which
* describes the type contained within a container type such as RttiTypes::Array
* or RttiTypes::Map.
*/
@@ -64,17 +64,17 @@ struct PropertyType {
static const PropertyType None;
/**
- * Outer type, may be any RttiType instance. If set to RttiType::None, any
+ * Outer type, may be any Rtti instance. If set to RttiTypes::None, any
* outer type is acceptable.
*/
- const RttiType &type;
+ const Rtti &type;
/**
* Describes the inner type of the property used when the outer type is a
- * container type such as RttiType::Array or RttiType::Map. If set to
- * RttiType::None any inner type is acceptable.
+ * container type such as RttiTypes::Array or RttiTypes::Map. If set to
+ * RttiTypes::None any inner type is acceptable.
*/
- const RttiType &innerType;
+ const Rtti &innerType;
/**
* Creates a new instance of the PropertyType class with both inner and
@@ -88,10 +88,10 @@ struct PropertyType {
* type.
*
* @param type is the "outer" type of the PropertyType instance which may
- * be any RttiType instances or RttiType::None, in which case all types are
+ * be any Rtti instances or RttiTypes::None, in which case all types are
* allowed.
*/
- PropertyType(const RttiType &type)
+ PropertyType(const Rtti &type)
: type(type), innerType(RttiTypes::None){};
/**
@@ -99,13 +99,13 @@ struct PropertyType {
* inner type.
*
* @param type is the "outer" type of the PropertyType instance which may
- * be any RttiType instances or RttiType::None, in which case all types are
+ * be any Rtti instances or RttiTypes::None, in which case all types are
* allowed.
* @param innerType is the inner type of the PropertyType instance, which is
* relevant if the outer type is set to a basic container type, namely
* RttiTypes::Array or RttiTypes::Map.
*/
- PropertyType(const RttiType &type, const RttiType &innerType)
+ PropertyType(const Rtti &type, const Rtti &innerType)
: type(type), innerType(innerType){};
};
@@ -448,13 +448,13 @@ public:
*
* @param type is the type of the field that can be accessed by the
* property. This may either be a primitive variant type such as e.g.
- * RttiTypes::Int or any other RttiType instance
+ * RttiTypes::Int or any other Rtti instance
* @param getter is a Getter for accessing the described property for
* objects of type T.
* @param setter is a Setter for writing the described property for objects
* of type T.
*/
- Property(const RttiType &type, const Getter<T> &getter,
+ Property(const Rtti &type, const Getter<T> &getter,
const Setter<T> &setter = Setter<T>{})
: PropertyDescriptor(
PropertyType{type},
@@ -468,7 +468,7 @@ public:
*
* @param type is the type of the field that can be accessed by the
* property. This may either be a primitive variant type such as e.g.
- * RttiTypes::Int or any other RttiType instance.
+ * RttiTypes::Int or any other Rtti instance.
* @param innerType is only relevant if type is set to either
* RttiTypes::Array or RttiTypes::Map. In this case the innerType describes
* the type of the elements stored inside these containers.
@@ -477,7 +477,7 @@ public:
* @param setter is a Setter for writing the described property for objects
* of type T.
*/
- Property(const RttiType &type, const RttiType &innerType,
+ Property(const Rtti &type, const Rtti &innerType,
const Getter<T> &getter, const Setter<T> &setter = Setter<T>{})
: PropertyDescriptor(
PropertyType{type, innerType},
diff --git a/src/core/common/Rtti.cpp b/src/core/common/Rtti.cpp
index ad77973..1213669 100644
--- a/src/core/common/Rtti.cpp
+++ b/src/core/common/Rtti.cpp
@@ -23,18 +23,18 @@ namespace ousia {
/* Class RttiStore */
-std::unordered_map<std::type_index, const RttiType *> &RttiStore::table()
+std::unordered_map<std::type_index, const Rtti *> &RttiStore::table()
{
- static std::unordered_map<std::type_index, const RttiType *> table;
+ static std::unordered_map<std::type_index, const Rtti *> table;
return table;
}
-void RttiStore::store(const std::type_info &native, const RttiType *rtti)
+void RttiStore::store(const std::type_info &native, const Rtti *rtti)
{
table().emplace(std::type_index{native}, rtti);
}
-const RttiType &RttiStore::lookup(const std::type_info &native)
+const Rtti &RttiStore::lookup(const std::type_info &native)
{
const auto &tbl = table();
auto it = tbl.find(std::type_index{native});
@@ -69,9 +69,9 @@ RttiBuilderBase &RttiBuilderBase::genericProperty(
return *this;
}
-/* Class RttiType */
+/* Class Rtti */
-void RttiType::initialize() const
+void Rtti::initialize() const
{
// Only run this function exactly once -- directly set the initialized flag
// to prevent unwanted recursion
@@ -80,7 +80,7 @@ void RttiType::initialize() const
// Register the parent properties and methods
{
- for (const RttiType *parent: parents) {
+ for (const Rtti *parent: parents) {
parent->initialize();
methods.insert(parent->methods.begin(), parent->methods.end());
properties.insert(parent->properties.begin(), parent->properties.end());
@@ -90,12 +90,12 @@ void RttiType::initialize() const
// Insert the parent types of the parent types and the composite types
// of the parents
{
- std::unordered_set<const RttiType *> origParents = parents;
- for (const RttiType *parent : origParents) {
+ std::unordered_set<const Rtti *> origParents = parents;
+ for (const Rtti *parent : origParents) {
parent->initialize();
parents.insert(parent->parents.begin(), parent->parents.end());
}
- for (const RttiType *parent : parents) {
+ for (const Rtti *parent : parents) {
parent->initialize();
compositeTypes.insert(parent->compositeTypes.begin(),
parent->compositeTypes.end());
@@ -106,9 +106,9 @@ void RttiType::initialize() const
// Insert the composite types of the composite types and the parents
// of each composite type
{
- std::unordered_set<const RttiType *> origCompositeTypes =
+ std::unordered_set<const Rtti *> origCompositeTypes =
compositeTypes;
- for (const RttiType *compositeType : origCompositeTypes) {
+ for (const Rtti *compositeType : origCompositeTypes) {
compositeType->initialize();
compositeTypes.insert(compositeType->compositeTypes.begin(),
compositeType->compositeTypes.end());
@@ -119,29 +119,29 @@ void RttiType::initialize() const
}
}
-bool RttiType::isa(const RttiType &other) const
+bool Rtti::isa(const Rtti &other) const
{
initialize();
return parents.count(&other) > 0;
}
-bool RttiType::composedOf(const RttiType &other) const
+bool Rtti::composedOf(const Rtti &other) const
{
initialize();
return compositeTypes.count(&other) > 0;
}
-const RttiMethodMap &RttiType::getMethods() const {
+const RttiMethodMap &Rtti::getMethods() const {
initialize();
return methods;
}
-const RttiPropertyMap &RttiType::getProperties() const {
+const RttiPropertyMap &Rtti::getProperties() const {
initialize();
return properties;
}
-std::shared_ptr<Function> RttiType::getMethod(const std::string &name) const
+std::shared_ptr<Function> Rtti::getMethod(const std::string &name) const
{
initialize();
auto it = methods.find(name);
@@ -151,7 +151,7 @@ std::shared_ptr<Function> RttiType::getMethod(const std::string &name) const
return it->second;
}
-std::shared_ptr<PropertyDescriptor> RttiType::getProperty(const std::string &name) const
+std::shared_ptr<PropertyDescriptor> Rtti::getProperty(const std::string &name) const
{
initialize();
auto it = properties.find(name);
@@ -161,12 +161,12 @@ std::shared_ptr<PropertyDescriptor> RttiType::getProperty(const std::string &nam
return it->second;
}
-bool RttiType::hasMethod(const std::string &name) const
+bool Rtti::hasMethod(const std::string &name) const
{
return methods.count(name) > 0;
}
-bool RttiType::hasProperty(const std::string &name) const
+bool Rtti::hasProperty(const std::string &name) const
{
return properties.count(name) > 0;
}
@@ -174,15 +174,15 @@ bool RttiType::hasProperty(const std::string &name) const
/* Constant initialization */
namespace RttiTypes {
-const RttiType None{"none"};
-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"};
+const Rtti None{"none"};
+const Rtti Nullptr{"nullptr"};
+const Rtti Bool{"bool"};
+const Rtti Int{"int"};
+const Rtti Double{"double"};
+const Rtti String{"string"};
+const Rtti Array{"array"};
+const Rtti Map{"map"};
+const Rtti Function{"function"};
}
}
diff --git a/src/core/common/Rtti.hpp b/src/core/common/Rtti.hpp
index 6b6eff0..fa2692f 100644
--- a/src/core/common/Rtti.hpp
+++ b/src/core/common/Rtti.hpp
@@ -34,7 +34,7 @@
* this would create a significant overhead.
*
* <b>How to use:</b> The Rtti class allows to attach information to a certain
- * C++ class. To do so, create a global constant of the type RttiType in the
+ * C++ class. To do so, create a global constant of the type Rtti in the
* source file associated with the type declaration, where T is the type you
* want to register. As the type must only be registered once, you must not
* declare the variable as "static" in the header file (this would register it
@@ -50,7 +50,7 @@
* // Only needed if the type needs to be accessed
* // from other compilation units!
* namespace RttiTypes {
- * extern const RttiType MyT;
+ * extern const Rtti MyT;
* }
* \endcode
* In the source file:
@@ -60,7 +60,7 @@
* // [...]
*
* namespace RttiTypes {
- * const RttiType MyT = RttiBuilder<ousia::MyT>("MyT");
+ * const Rtti MyT = RttiBuilder<ousia::MyT>("MyT");
* }
* \endcode
*
@@ -79,14 +79,14 @@
namespace ousia {
-class RttiType;
+class Rtti;
class Function;
class PropertyDescriptor;
/**
- * Type describing a set of RttiType pointers.
+ * Type describing a set of Rtti pointers.
*/
-using RttiTypeSet = std::unordered_set<const RttiType *>;
+using RttiSet = std::unordered_set<const Rtti *>;
/**
* Type describing a map containing methods and their name.
@@ -109,11 +109,11 @@ private:
* Function used internally to access the static map storing all registered
* native types and their corresponding type information.
*/
- static std::unordered_map<std::type_index, const RttiType *> &table();
+ static std::unordered_map<std::type_index, const Rtti *> &table();
public:
/**
- * Registers the given pointer to the RttiType class in the RTTI table. Does
+ * Registers the given pointer to the Rtti class in the RTTI table. Does
* not override information for already registered types.
*
* @param native is a reference at the native type information provided
@@ -121,19 +121,19 @@ public:
* @param rtti is a pointer pointing at the type information that should be
* stored for this type.
*/
- static void store(const std::type_info &native, const RttiType *rtti);
+ static void store(const std::type_info &native, const Rtti *rtti);
/**
* Looks up the type information stored for the given native type
* information.
*/
- static const RttiType &lookup(const std::type_info &native);
+ static const Rtti &lookup(const std::type_info &native);
};
/**
* The RttiBuilderBase class is used to build new instances of the Rtti or the
- * RttiType class. It follows the "Builder" pattern and allows to create
- * the properties of the RttiType class by chaining method calls. The RttiType
+ * Rtti class. It follows the "Builder" pattern and allows to create
+ * the properties of the Rtti class by chaining method calls. The RttiType
* class can be constructed from the RttiBuilderBase instance. Use the
* RttiBuilder class for a more convenient, templated version that does not
* require the native C++ type in the constructor and allows for more convenient
@@ -156,12 +156,12 @@ public:
/**
* Set containing references to all parent types.
*/
- RttiTypeSet parentTypes;
+ RttiSet parentTypes;
/**
* Set containing references to all composite types.
*/
- RttiTypeSet compositeTypes;
+ RttiSet compositeTypes;
/**
* Map containing all methods.
@@ -175,7 +175,7 @@ public:
/**
* Default constructor, initializes the name of the type described by the
- * RttiTypeSet with "unknown".
+ * RttiSet with "unknown".
*
* @param native is the native C++ type information for which the type
* information is being built.
@@ -185,7 +185,7 @@ public:
/**
* Default constructor, initializes the name of the type described by the
- * RttiTypeSet with the given name.
+ * RttiSet with the given name.
*
* @param native is the native C++ type information for which the type
* information is being built.
@@ -217,7 +217,7 @@ public:
* @return a reference to the current RttiBuilderBase instance to allow
* method chaining.
*/
- RttiBuilderBase &parent(const RttiType *p)
+ RttiBuilderBase &parent(const Rtti *p)
{
parentTypes.insert(p);
return *this;
@@ -231,7 +231,7 @@ public:
* @return a reference to the current RttiBuilderBase instance to allow
* method chaining.
*/
- RttiBuilderBase &parent(const RttiTypeSet &p)
+ RttiBuilderBase &parent(const RttiSet &p)
{
parentTypes.insert(p.begin(), p.end());
return *this;
@@ -246,7 +246,7 @@ public:
* @return a reference to the current RttiBuilderBase instance to allow
* method chaining.
*/
- RttiBuilderBase &composedOf(const RttiType *p)
+ RttiBuilderBase &composedOf(const Rtti *p)
{
compositeTypes.insert(p);
return *this;
@@ -261,7 +261,7 @@ public:
* @return a reference to the current RttiBuilderBase instance to allow
* method chaining.
*/
- RttiBuilderBase &composedOf(const RttiTypeSet &p)
+ RttiBuilderBase &composedOf(const RttiSet &p)
{
compositeTypes.insert(p.begin(), p.end());
return *this;
@@ -272,7 +272,7 @@ public:
* type descriptor.
*
* @param name is the name of the method. Names must be unique for one
- * RttiType instance. If the name is not unique, an exception is thrown.
+ * Rtti instance. If the name is not unique, an exception is thrown.
* @param function is the function that should be registered.
* @return a reference to the current RttiBuilderBase instance to allow
* method chaining.
@@ -285,7 +285,7 @@ public:
* for this RTTI type descriptor.
*
* @param name is the name of the property. Names must be unique for one
- * RttiType instance. If the property is not unique, an exception is thrown.
+ * Rtti instance. If the property is not unique, an exception is thrown.
* @param property is the property that should be registered.
* @return a reference to the current RttiBuilderBase instance to allow
* method chaining.
@@ -295,13 +295,13 @@ public:
};
/**
- * The RttiType class allows for attaching data to native types that can be
+ * The Rtti class allows for attaching data to native types that can be
* accessed at runtime. This type information can e.g. be retrieved using the
* "type" method of the Managed class. This system is used for attaching human
* readable names, parent types and script engine functionality. Use the
- * RttiType class for convenient registration of type information.
+ * Rtti class for convenient registration of type information.
*/
-class RttiType {
+class Rtti {
private:
/**
* Set to true if once the parents and the composite types list have been
@@ -313,13 +313,13 @@ private:
/**
* Set containing references to all parent types, including their parents.
*/
- mutable RttiTypeSet parents;
+ mutable RttiSet parents;
/**
* Set containing references to all types this type is a composition of,
* including all composite types of the original composite types.
*/
- mutable RttiTypeSet compositeTypes;
+ mutable RttiSet compositeTypes;
/**
* Map used for storing all registered methods.
@@ -344,13 +344,13 @@ public:
const std::string name;
/**
- * Creates a new RttiType instance and registers it in the global type
+ * Creates a new Rtti instance and registers it in the global type
* table. Use the Rtti class for more convenient registration of type
* information.
*
* @param builder is the builder instance containing the Rtti data.
*/
- RttiType(const RttiBuilderBase &builder)
+ Rtti(const RttiBuilderBase &builder)
: initialized(false),
parents(std::move(builder.parentTypes)),
compositeTypes(std::move(builder.compositeTypes)),
@@ -365,12 +365,12 @@ public:
* Default constructor. Creates a Rtti instance with name "unknown"
* and no parents.
*/
- RttiType() : name("unknown") {}
+ Rtti() : name("unknown") {}
/**
- * Constructor for an empty RttiType with the given name.
+ * Constructor for an empty Rtti with the given name.
*/
- RttiType(std::string name) : name(std::move(name)) {}
+ Rtti(std::string name) : name(std::move(name)) {}
/**
* Returns true if this Rtti instance is the given type or has the
@@ -379,7 +379,7 @@ public:
* @param other is the other type for which the relation to this type
* should be checked.
*/
- bool isa(const RttiType &other) const;
+ bool isa(const Rtti &other) const;
/**
* Returns true if an instance of this type may have references to the other
@@ -389,7 +389,7 @@ public:
* @param other is the other type for which should be checked whether this
* type is directly or indirectly composed of it.
*/
- bool composedOf(const RttiType &other) const;
+ bool composedOf(const Rtti &other) const;
/**
* Returns all methods that are registered for this type (and the parent
@@ -457,7 +457,7 @@ public:
* @tparam T is the C++ type for which the type information should be returned.
*/
template <typename T>
-inline const RttiType &typeOf()
+inline const Rtti &typeOf()
{
return RttiStore::lookup(typeid(T));
}
@@ -473,7 +473,7 @@ inline const RttiType &typeOf()
* returned.
*/
template <typename T>
-inline const RttiType &typeOf(const T &obj)
+inline const Rtti &typeOf(const T &obj)
{
return RttiStore::lookup(typeid(obj));
}
@@ -482,47 +482,47 @@ namespace RttiTypes {
/**
* Type of no particular type.
*/
-extern const RttiType None;
+extern const Rtti None;
/**
- * Nullptr type for use by the Variant::getRttiType method.
+ * Nullptr type for use by the Variant::getRtti method.
*/
-extern const RttiType Nullptr;
+extern const Rtti Nullptr;
/**
- * Bool type for use by the Variant::getRttiType method.
+ * Bool type for use by the Variant::getRtti method.
*/
-extern const RttiType Bool;
+extern const Rtti Bool;
/**
- * Integer type for use by the Variant::getRttiType method.
+ * Integer type for use by the Variant::getRtti method.
*/
-extern const RttiType Int;
+extern const Rtti Int;
/**
- * Double type for use by the Variant::getRttiType method.
+ * Double type for use by the Variant::getRtti method.
*/
-extern const RttiType Double;
+extern const Rtti Double;
/**
- * String type for use by the Variant::getRttiType method.
+ * String type for use by the Variant::getRtti method.
*/
-extern const RttiType String;
+extern const Rtti String;
/**
- * Array type for use by the Variant::getRttiType method.
+ * Array type for use by the Variant::getRtti method.
*/
-extern const RttiType Array;
+extern const Rtti Array;
/**
- * Map type for use by the Variant::getRttiType method.
+ * Map type for use by the Variant::getRtti method.
*/
-extern const RttiType Map;
+extern const Rtti Map;
/**
- * Function type for use by the Variant::getRttiType method.
+ * Function type for use by the Variant::getRtti method.
*/
-extern const RttiType Function;
+extern const Rtti Function;
}
}
diff --git a/src/core/common/RttiBuilder.hpp b/src/core/common/RttiBuilder.hpp
index 4b27058..442f358 100644
--- a/src/core/common/RttiBuilder.hpp
+++ b/src/core/common/RttiBuilder.hpp
@@ -45,13 +45,13 @@ class RttiBuilder : public RttiBuilderBase {
public:
/**
* Default constructor, initializes the name of the type described by the
- * RttiTypeSet with "unknown".
+ * RttiSet with "unknown".
*/
RttiBuilder() : RttiBuilderBase(typeid(T)){};
/**
* Default constructor, initializes the name of the type described by the
- * RttiTypeSet with the given name.
+ * RttiSet with the given name.
*
* @param name is the initial name of the type described by the type
* builder.
@@ -78,7 +78,7 @@ public:
* @param p is the pointer to the type descriptor that should be added.
* @return a reference to the current RttiBuilder to allow method chaining.
*/
- RttiBuilder<T> &parent(const RttiType *p)
+ RttiBuilder<T> &parent(const Rtti *p)
{
RttiBuilderBase::parent(p);
return *this;
@@ -91,7 +91,7 @@ public:
* @param p is the pointer to the type descriptor that should be added.
* @return a reference to the current RttiBuilder to allow method chaining.
*/
- RttiBuilder<T> &parent(const RttiTypeSet &p)
+ RttiBuilder<T> &parent(const RttiSet &p)
{
RttiBuilderBase::parent(p);
return *this;
@@ -105,7 +105,7 @@ public:
* composition type.
* @return a reference to the current RttiBuilder to allow method chaining.
*/
- RttiBuilder<T> &composedOf(const RttiType *p)
+ RttiBuilder<T> &composedOf(const Rtti *p)
{
RttiBuilderBase::composedOf(p);
return *this;
@@ -119,7 +119,7 @@ public:
* composition type.
* @return a reference to the current RttiBuilder to allow method chaining.
*/
- RttiBuilder<T> &composedOf(const RttiTypeSet &p)
+ RttiBuilder<T> &composedOf(const RttiSet &p)
{
RttiBuilderBase::composedOf(p);
return *this;
@@ -130,7 +130,7 @@ public:
* type descriptor.
*
* @param name is the name of the method. Names must be unique for one
- * RttiType instance. If the name is not unique, an exception is thrown.
+ * Rtti instance. If the name is not unique, an exception is thrown.
* @param function is the function that should be registered.
* @return a reference to the current RttiBuilder to allow method chaining.
*/
@@ -146,7 +146,7 @@ public:
* for this RTTI type descriptor.
*
* @param name is the name of the property. Names must be unique for one
- * RttiType instance. If the property is not unique, an exception is thrown.
+ * Rtti instance. If the property is not unique, an exception is thrown.
* @param property is the property that should be registered.
* @return a reference to the current RttiBuilder to allow method chaining.
*/
@@ -161,7 +161,7 @@ public:
* Registers a method for this RTTI type descriptor.
*
* @param name is the name of the method. Names must be unique for one
- * RttiType instance. If the name is not unique, an exception is thrown.
+ * Rtti instance. If the name is not unique, an exception is thrown.
* @param method is the function that should be registered.
* @return a reference to the current RttiBuilder to allow method chaining.
*/
@@ -174,7 +174,7 @@ public:
* Registers a method for this RTTI type descriptor.
*
* @param name is the name of the method. Names must be unique for one
- * RttiType instance. If the name is not unique, an exception is thrown.
+ * Rtti instance. If the name is not unique, an exception is thrown.
* @param method is the function that should be registered.
* @return a reference to the current RttiBuilder to allow method chaining.
*/
@@ -188,7 +188,7 @@ public:
* Registers a property for this RTTI type descriptor.
*
* @param name is the name of the property. Names must be unique for one
- * RttiType instance. If the property is not unique, an exception is thrown.
+ * Rtti instance. If the property is not unique, an exception is thrown.
* @param property is the property that should be registered.
* @return a reference to the current RttiBuilder to allow method chaining.
*/
diff --git a/src/core/common/Variant.cpp b/src/core/common/Variant.cpp
index 81e6339..c5db4e5 100644
--- a/src/core/common/Variant.cpp
+++ b/src/core/common/Variant.cpp
@@ -112,7 +112,7 @@ Variant::arrayType Variant::toArray() const
return res.asArray();
}
-Variant::arrayType Variant::toArray(const RttiType &innerType) const
+Variant::arrayType Variant::toArray(const Rtti &innerType) const
{
ExceptionLogger logger;
Variant res{*this};
@@ -128,7 +128,7 @@ Variant::mapType Variant::toMap() const
return res.asMap();
}
-Variant::mapType Variant::toMap(const RttiType &innerType) const
+Variant::mapType Variant::toMap(const Rtti &innerType) const
{
ExceptionLogger logger;
Variant res{*this};
@@ -138,7 +138,7 @@ Variant::mapType Variant::toMap(const RttiType &innerType) const
/* Type management */
-const RttiType& Variant::getRttiType() const
+const Rtti& Variant::getRtti() const
{
switch (type) {
case VariantType::NULLPTR:
diff --git a/src/core/common/Variant.hpp b/src/core/common/Variant.hpp
index 7ec3481..381a13e 100644
--- a/src/core/common/Variant.hpp
+++ b/src/core/common/Variant.hpp
@@ -48,7 +48,7 @@ namespace ousia {
// Forward declarations
class Function;
-class RttiType;
+class Rtti;
/**
* Enum containing the possible types a variant may have.
@@ -764,7 +764,7 @@ public:
* to.
* @return the value of the variant as array.
*/
- arrayType toArray(const RttiType &innerType) const;
+ arrayType toArray(const Rtti &innerType) const;
/**
* Returns the value of the Variant as map.
@@ -781,7 +781,7 @@ public:
* to.
* @return the value of the variant as map.
*/
- mapType toMap(const RttiType &innerType) const;
+ mapType toMap(const Rtti &innerType) const;
/**
* Sets the variant to null.
@@ -939,9 +939,9 @@ public:
* @return the Rtti type descriptor. Either one of RttiTypes::Int,
* RttiTypes::Bool, RttiTypes::Double, RttiTypes::String, RttiTypes::Array
* or RttiTypes::Function or -- in case an object is stored inside the
- * variant -- the RttiType of that object.
+ * variant -- the Rtti of that object.
*/
- const RttiType &getRttiType() const;
+ const Rtti &getRtti() const;
/**
* Returns the name of the given variant type as C-style string.
diff --git a/src/core/common/VariantConverter.cpp b/src/core/common/VariantConverter.cpp
index 0f293f5..a14c003 100644
--- a/src/core/common/VariantConverter.cpp
+++ b/src/core/common/VariantConverter.cpp
@@ -270,7 +270,7 @@ bool VariantConverter::toString(Variant &var, Logger &logger, Mode mode)
return false;
}
-bool VariantConverter::toArray(Variant &var, const RttiType &innerType,
+bool VariantConverter::toArray(Variant &var, const Rtti &innerType,
Logger &logger, Mode mode)
{
// If unsafe conversions are allowed, encapsulate the given variant in an
@@ -302,7 +302,7 @@ bool VariantConverter::toArray(Variant &var, const RttiType &innerType,
return false;
}
-bool VariantConverter::toMap(Variant &var, const RttiType &innerType,
+bool VariantConverter::toMap(Variant &var, const Rtti &innerType,
Logger &logger, Mode mode)
{
// Make sure the variant is a map
@@ -341,8 +341,8 @@ bool VariantConverter::toFunction(Variant &var, Logger &logger)
return false;
}
-bool VariantConverter::convert(Variant &var, const RttiType &type,
- const RttiType &innerType, Logger &logger,
+bool VariantConverter::convert(Variant &var, const Rtti &type,
+ const Rtti &innerType, Logger &logger,
Mode mode)
{
// Check for simple Variant types
@@ -382,16 +382,16 @@ bool VariantConverter::convert(Variant &var, const RttiType &type,
}
// Make sure the object type is correct
- if (!var.getRttiType().isa(type)) {
+ if (!var.getRtti().isa(type)) {
logger.error(std::string("Expected object of type ") + type.name +
- " but got object of type " + var.getRttiType().name);
+ " but got object of type " + var.getRtti().name);
var.setObject(nullptr);
return false;
}
return true;
}
-bool VariantConverter::convert(Variant &var, const RttiType &type,
+bool VariantConverter::convert(Variant &var, const Rtti &type,
Logger &logger, Mode mode)
{
return convert(var, type, RttiTypes::None, logger, mode);
diff --git a/src/core/common/VariantConverter.hpp b/src/core/common/VariantConverter.hpp
index 6becbc4..0e66e39 100644
--- a/src/core/common/VariantConverter.hpp
+++ b/src/core/common/VariantConverter.hpp
@@ -33,7 +33,7 @@ namespace ousia {
// Forward declaration
class Logger;
-class RttiType;
+class Rtti;
class Variant;
/**
@@ -160,7 +160,7 @@ public:
* @return true if the operation was successful, false otherwise. In any
* case the input/output parameter "var" will have the requested type.
*/
- static bool toArray(Variant &var, const RttiType &innerType, Logger &logger,
+ static bool toArray(Variant &var, const Rtti &innerType, Logger &logger,
Mode mode = Mode::SAFE);
@@ -180,7 +180,7 @@ public:
* @return true if the operation was successful, false otherwise. In any
* case the input/output parameter "var" will have the requested type.
*/
- static bool toMap(Variant &var, const RttiType &innerType, Logger &logger,
+ static bool toMap(Variant &var, const Rtti &innerType, Logger &logger,
Mode mode = Mode::SAFE);
/**
@@ -195,17 +195,17 @@ public:
static bool toFunction(Variant &var, Logger &logger);
/**
- * Tries conversion to the given RttiType with the given optional inner
+ * Tries conversion to the given Rtti with the given optional inner
* type.
*
* @param type describes the type to which the variant should be converted.
- * This might either be a variant type such as RttiType::Bool,
- * RttiType::Int, RttiType::Double, RttiType::String, RttiType::Array,
- * RttiType::Map or RttiType::Function. All other types are regarded as
- * managed object of this type. If RttiType::None is given, all types are
+ * This might either be a variant type such as RttiTypes::Bool,
+ * RttiTypes::Int, RttiTypes::Double, RttiTypes::String, RttiTypes::Array,
+ * RttiTypes::Map or RttiTypes::Function. All other types are regarded as
+ * managed object of this type. If RttiTypes::None is given, all types are
* accepted.
* @param innerType is used in case of maps or arrays to check the type of
- * the elements of these containers. If RttiType::None is given, no special
+ * the elements of these containers. If RttiTypes::None is given, no special
* type is required.
* @param logger is a reference at the logger instance to which error
* messages are forwarded.
@@ -213,19 +213,19 @@ public:
* @return true if the operation was successful, false otherwise. In any
* case the input/output parameter "var" will have the requested type.
*/
- static bool convert(Variant &var, const RttiType &type,
- const RttiType &innerType, Logger &logger,
+ static bool convert(Variant &var, const Rtti &type,
+ const Rtti &innerType, Logger &logger,
Mode mode = Mode::SAFE);
/**
- * Tries conversion to the given RttiType without any enforcement regarding
+ * Tries conversion to the given Rtti without any enforcement regarding
* the inner type of container types.
*
* @param type describes the type to which the variant should be converted.
- * This might either be a variant type such as RttiType::Bool,
- * RttiType::Int, RttiType::Double, RttiType::String, RttiType::Array,
- * RttiType::Map or RttiType::Function. All other types are regarded as
- * managed object of this type. If RttiType::None is given, all types are
+ * This might either be a variant type such as RttiTypes::Bool,
+ * RttiTypes::Int, RttiTypes::Double, RttiTypes::String, RttiTypes::Array,
+ * RttiTypes::Map or RttiTypes::Function. All other types are regarded as
+ * managed object of this type. If RttiTypes::None is given, all types are
* accepted.
* @param logger is a reference at the logger instance to which error
* messages are forwarded.
@@ -233,7 +233,7 @@ public:
* @return true if the operation was successful, false otherwise. In any
* case the input/output parameter "var" will have the requested type.
*/
- static bool convert(Variant &var, const RttiType &type,
+ static bool convert(Variant &var, const Rtti &type,
Logger &logger, Mode mode = Mode::SAFE);
};
}