summaryrefslogtreecommitdiff
path: root/src/core/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/common')
-rw-r--r--src/core/common/Argument.cpp76
-rw-r--r--src/core/common/Argument.hpp18
-rw-r--r--src/core/common/Property.hpp18
-rw-r--r--src/core/common/Rtti.cpp14
-rw-r--r--src/core/common/Rtti.hpp10
-rw-r--r--src/core/common/Variant.cpp32
-rw-r--r--src/core/common/Variant.hpp6
-rw-r--r--src/core/common/VariantConverter.cpp48
-rw-r--r--src/core/common/VariantConverter.hpp8
9 files changed, 115 insertions, 115 deletions
diff --git a/src/core/common/Argument.cpp b/src/core/common/Argument.cpp
index 385bae1..bfe74a4 100644
--- a/src/core/common/Argument.cpp
+++ b/src/core/common/Argument.cpp
@@ -27,161 +27,161 @@ namespace ousia {
/* Class Argument */
-Argument::Argument(std::string name, const Rtti &type, const Rtti &innerType,
+Argument::Argument(std::string name, const Rtti *type, const Rtti *innerType,
Variant defaultValue, bool hasDefaultValue)
: name(std::move(name)),
- type(&type),
- innerType(&innerType),
+ type(type),
+ innerType(innerType),
defaultValue(std::move(defaultValue)),
hasDefaultValue(hasDefaultValue)
{
}
-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 Rtti *type, Variant defaultValue)
+ : Argument(std::move(name), type, &RttiTypes::None, defaultValue, true)
{
}
-Argument::Argument(std::string name, const Rtti &type)
- : Argument(std::move(name), type, RttiTypes::None, nullptr, false)
+Argument::Argument(std::string name, const Rtti *type)
+ : Argument(std::move(name), type, &RttiTypes::None, nullptr, false)
{
}
Argument Argument::Any(std::string name)
{
- return Argument{name, RttiTypes::None, RttiTypes::None, nullptr, false};
+ return Argument{name, &RttiTypes::None, &RttiTypes::None, nullptr, false};
}
Argument Argument::Any(std::string name, Variant defaultValue)
{
- return Argument{name, RttiTypes::None, RttiTypes::None, defaultValue, true};
+ return Argument{name, &RttiTypes::None, &RttiTypes::None, defaultValue, true};
}
Argument Argument::Bool(std::string name)
{
- return Argument{name, RttiTypes::Bool};
+ return Argument{name, &RttiTypes::Bool};
}
Argument Argument::Bool(std::string name, Variant::boolType defaultValue)
{
- return Argument{name, RttiTypes::Bool, defaultValue};
+ return Argument{name, &RttiTypes::Bool, defaultValue};
}
Argument Argument::Int(std::string name)
{
- return Argument{name, RttiTypes::Int};
+ return Argument{name, &RttiTypes::Int};
}
Argument Argument::Int(std::string name, Variant::intType defaultValue)
{
- return Argument{name, RttiTypes::Int, defaultValue};
+ return Argument{name, &RttiTypes::Int, defaultValue};
}
Argument Argument::Double(std::string name)
{
- return Argument{name, RttiTypes::Double};
+ return Argument{name, &RttiTypes::Double};
}
Argument Argument::Double(std::string name, Variant::doubleType defaultValue)
{
- return Argument{name, RttiTypes::Double, defaultValue};
+ return Argument{name, &RttiTypes::Double, defaultValue};
}
Argument Argument::String(std::string name)
{
- return Argument{name, RttiTypes::String};
+ return Argument{name, &RttiTypes::String};
}
Argument Argument::String(std::string name,
const Variant::stringType &defaultValue)
{
- return Argument{name, RttiTypes::String, Variant::fromString(defaultValue)};
+ return Argument{name, &RttiTypes::String, Variant::fromString(defaultValue)};
}
-Argument Argument::Object(std::string name, const Rtti &type)
+Argument Argument::Object(std::string name, const Rtti *type)
{
- return Argument(std::move(name), type, RttiTypes::None,
+ return Argument(std::move(name), type, &RttiTypes::None,
Variant::fromObject(nullptr), false);
}
-Argument Argument::Object(std::string name, const Rtti &type, std::nullptr_t)
+Argument Argument::Object(std::string name, const Rtti *type, std::nullptr_t)
{
- return Argument(std::move(name), type, RttiTypes::None,
+ return Argument(std::move(name), type, &RttiTypes::None,
Variant::fromObject(nullptr), true);
}
Argument Argument::Function(std::string name)
{
- return Argument(std::move(name), RttiTypes::Function);
+ return Argument(std::move(name), &RttiTypes::Function);
}
Argument Argument::Function(std::string name,
Variant::functionType defaultValue)
{
- return Argument(std::move(name), RttiTypes::Function,
+ return Argument(std::move(name), &RttiTypes::Function,
Variant::fromFunction(defaultValue));
}
Argument Argument::Array(std::string name)
{
- return Argument(std::move(name), RttiTypes::Array);
+ return Argument(std::move(name), &RttiTypes::Array);
}
Argument Argument::Array(std::string name,
const Variant::arrayType &defaultValue)
{
- return Argument(std::move(name), RttiTypes::Array, defaultValue);
+ return Argument(std::move(name), &RttiTypes::Array, defaultValue);
}
-Argument Argument::Array(std::string name, const Rtti &innerType)
+Argument Argument::Array(std::string name, const Rtti *innerType)
{
- return Argument(std::move(name), RttiTypes::Array, innerType, nullptr,
+ return Argument(std::move(name), &RttiTypes::Array, innerType, nullptr,
false);
}
-Argument Argument::Array(std::string name, const Rtti &innerType,
+Argument Argument::Array(std::string name, const Rtti *innerType,
const Variant::arrayType &defaultValue)
{
- return Argument(std::move(name), RttiTypes::Array, innerType, defaultValue,
+ return Argument(std::move(name), &RttiTypes::Array, innerType, defaultValue,
true);
}
Argument Argument::Map(std::string name)
{
- return Argument(std::move(name), RttiTypes::Map);
+ return Argument(std::move(name), &RttiTypes::Map);
}
Argument Argument::Map(std::string name, const Variant::mapType &defaultValue)
{
- return Argument(std::move(name), RttiTypes::Map, defaultValue);
+ return Argument(std::move(name), &RttiTypes::Map, defaultValue);
}
-Argument Argument::Map(std::string name, const Rtti &innerType)
+Argument Argument::Map(std::string name, const Rtti *innerType)
{
- return Argument(std::move(name), RttiTypes::Map, innerType, nullptr, false);
+ return Argument(std::move(name), &RttiTypes::Map, innerType, nullptr, false);
}
-Argument Argument::Map(std::string name, const Rtti &innerType,
+Argument Argument::Map(std::string name, const Rtti *innerType,
const Variant::mapType &defaultValue)
{
- return Argument(std::move(name), RttiTypes::Map, innerType, defaultValue,
+ return Argument(std::move(name), &RttiTypes::Map, innerType, defaultValue,
true);
}
Argument Argument::Cardinality(std::string name)
{
- return Argument{name, RttiTypes::Cardinality};
+ return Argument{name, &RttiTypes::Cardinality};
}
Argument Argument::Cardinality(std::string name,
Variant::cardinalityType defaultValue)
{
- return Argument{name, RttiTypes::Cardinality, defaultValue};
+ return Argument{name, &RttiTypes::Cardinality, defaultValue};
}
bool Argument::validate(Variant &var, Logger &logger) const
{
- if (!VariantConverter::convert(var, *type, *innerType, logger,
+ if (!VariantConverter::convert(var, type, innerType, logger,
VariantConverter::Mode::SAFE)) {
if (hasDefaultValue) {
var = defaultValue;
diff --git a/src/core/common/Argument.hpp b/src/core/common/Argument.hpp
index ea68e3c..679b4a5 100644
--- a/src/core/common/Argument.hpp
+++ b/src/core/common/Argument.hpp
@@ -93,7 +93,7 @@ private:
* @param hasDefault indicates whether the defaultValue actually should be
* used.
*/
- Argument(std::string name, const Rtti &type, const Rtti &innerType,
+ Argument(std::string name, const Rtti *type, const Rtti *innerType,
Variant defaultValue, bool hasDefault);
/**
@@ -105,7 +105,7 @@ private:
* expected.
* @param defaultValue is the default value to be used.
*/
- Argument(std::string name, const Rtti &type, Variant defaultValue);
+ Argument(std::string name, const Rtti *type, Variant defaultValue);
/**
* Private constructor used to build an argument describing a primitive type
@@ -115,7 +115,7 @@ private:
* @param variantType is the variant type of the argument that is to be
* expected.
*/
- Argument(std::string name, const Rtti &type);
+ Argument(std::string name, const Rtti *type);
public:
/**
@@ -230,7 +230,7 @@ public:
* "isa" function returns true for the given type are be accepted.
* @return a new Argument instance.
*/
- static Argument Object(std::string name, const Rtti &type);
+ static Argument Object(std::string name, const Rtti *type);
/**
* Named constructor for an object argument with default value. The default
@@ -246,7 +246,7 @@ public:
* cannot be stored.
* @return a new Argument instance.
*/
- static Argument Object(std::string name, const Rtti &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 Rtti &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 Rtti &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 Rtti &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 Rtti &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 10db869..546061c 100644
--- a/src/core/common/Property.hpp
+++ b/src/core/common/Property.hpp
@@ -67,21 +67,21 @@ struct PropertyType {
* Outer type, may be any Rtti instance. If set to RttiTypes::None, any
* outer type is acceptable.
*/
- const Rtti &type;
+ const Rtti *type;
/**
* Describes the inner type of the property used when the outer type is a
* container type such as RttiTypes::Array or RttiTypes::Map. If set to
* RttiTypes::None any inner type is acceptable.
*/
- const Rtti &innerType;
+ const Rtti *innerType;
/**
* Creates a new instance of the PropertyType class with both inner and
* outer type being set to RttiTypes::None and thus allowing any type to be
* represented by this property.
*/
- PropertyType() : type(RttiTypes::None), innerType(RttiTypes::None){};
+ PropertyType() : type(&RttiTypes::None), innerType(&RttiTypes::None){};
/**
* Creates a new instance of the PropertyType class with the given outer
@@ -91,8 +91,8 @@ struct PropertyType {
* be any Rtti instances or RttiTypes::None, in which case all types are
* allowed.
*/
- PropertyType(const Rtti &type)
- : type(type), innerType(RttiTypes::None){};
+ PropertyType(const Rtti *type)
+ : type(type), innerType(&RttiTypes::None){};
/**
* Creates a new instance of the PropertyType class with the given outer and
@@ -105,7 +105,7 @@ struct PropertyType {
* relevant if the outer type is set to a basic container type, namely
* RttiTypes::Array or RttiTypes::Map.
*/
- PropertyType(const Rtti &type, const Rtti &innerType)
+ PropertyType(const Rtti *type, const Rtti *innerType)
: type(type), innerType(innerType){};
};
@@ -396,7 +396,7 @@ public:
*
* @return the PropertyType instance describing the type of this property.
*/
- const PropertyType &getType() const { return *type; }
+ const PropertyType *getType() const { return type.get(); }
/**
* Returns the value of the property for the given object.
@@ -454,7 +454,7 @@ public:
* @param setter is a Setter for writing the described property for objects
* of type T.
*/
- Property(const Rtti &type, const Getter<T> &getter,
+ Property(const Rtti *type, const Getter<T> &getter,
const Setter<T> &setter = Setter<T>{})
: PropertyDescriptor(
PropertyType{type},
@@ -477,7 +477,7 @@ public:
* @param setter is a Setter for writing the described property for objects
* of type T.
*/
- Property(const Rtti &type, const Rtti &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 acc98a7..7c353d5 100644
--- a/src/core/common/Rtti.cpp
+++ b/src/core/common/Rtti.cpp
@@ -34,14 +34,14 @@ void RttiStore::store(const std::type_info &native, const Rtti *rtti)
table().emplace(std::type_index{native}, rtti);
}
-const Rtti &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});
if (it == tbl.end()) {
- return RttiTypes::None;
+ return &RttiTypes::None;
} else {
- return *(it->second);
+ return it->second;
}
}
@@ -120,10 +120,10 @@ void Rtti::initialize() const
}
}
-bool Rtti::isa(const Rtti &other) const
+bool Rtti::isa(const Rtti *other) const
{
initialize();
- return parents.count(&other) > 0;
+ return parents.count(other) > 0;
}
bool Rtti::isOneOf(const RttiSet &others) const
@@ -158,10 +158,10 @@ RttiSet Rtti::setIntersection(const RttiSet &s1, const RttiSet &s2)
return res;
}
-bool Rtti::composedOf(const Rtti &other) const
+bool Rtti::composedOf(const Rtti *other) const
{
initialize();
- return compositeTypes.count(&other) > 0;
+ return compositeTypes.count(other) > 0;
}
const RttiMethodMap &Rtti::getMethods() const
diff --git a/src/core/common/Rtti.hpp b/src/core/common/Rtti.hpp
index f371494..de9f3f6 100644
--- a/src/core/common/Rtti.hpp
+++ b/src/core/common/Rtti.hpp
@@ -127,7 +127,7 @@ public:
* Looks up the type information stored for the given native type
* information.
*/
- static const Rtti &lookup(const std::type_info &native);
+ static const Rtti *lookup(const std::type_info &native);
};
/**
@@ -381,7 +381,7 @@ public:
* @return true if this type (directly or indirectly) has the given other
* type as parent or equals the other type.
*/
- bool isa(const Rtti &other) const;
+ bool isa(const Rtti *other) const;
/**
* Returns true if this Rtti instance is one of the given types.
@@ -421,7 +421,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 Rtti &other) const;
+ bool composedOf(const Rtti *other) const;
/**
* Returns all methods that are registered for this type (and the parent
@@ -489,7 +489,7 @@ public:
* @tparam T is the C++ type for which the type information should be returned.
*/
template <typename T>
-inline const Rtti &typeOf()
+inline const Rtti *typeOf()
{
return RttiStore::lookup(typeid(T));
}
@@ -505,7 +505,7 @@ inline const Rtti &typeOf()
* returned.
*/
template <typename T>
-inline const Rtti &typeOf(const T &obj)
+inline const Rtti *typeOf(const T &obj)
{
return RttiStore::lookup(typeid(obj));
}
diff --git a/src/core/common/Variant.cpp b/src/core/common/Variant.cpp
index 0c7fceb..836fed3 100644
--- a/src/core/common/Variant.cpp
+++ b/src/core/common/Variant.cpp
@@ -148,12 +148,12 @@ Variant::arrayType Variant::toArray() const
{
ExceptionLogger logger;
Variant res{*this};
- VariantConverter::toArray(res, RttiTypes::None, logger,
+ VariantConverter::toArray(res, &RttiTypes::None, logger,
VariantConverter::Mode::ALL);
return res.asArray();
}
-Variant::arrayType Variant::toArray(const Rtti &innerType) const
+Variant::arrayType Variant::toArray(const Rtti *innerType) const
{
ExceptionLogger logger;
Variant res{*this};
@@ -166,12 +166,12 @@ Variant::mapType Variant::toMap() const
{
ExceptionLogger logger;
Variant res{*this};
- VariantConverter::toMap(res, RttiTypes::None, logger,
+ VariantConverter::toMap(res, &RttiTypes::None, logger,
VariantConverter::Mode::ALL);
return res.asMap();
}
-Variant::mapType Variant::toMap(const Rtti &innerType) const
+Variant::mapType Variant::toMap(const Rtti *innerType) const
{
ExceptionLogger logger;
Variant res{*this};
@@ -190,34 +190,34 @@ Variant::cardinalityType Variant::toCardinality() const
/* Type management */
-const Rtti &Variant::getRtti() const
+const Rtti *Variant::getRtti() const
{
switch (meta.getType()) {
case VariantType::NULLPTR:
- return RttiTypes::Nullptr;
+ return &RttiTypes::Nullptr;
case VariantType::BOOL:
- return RttiTypes::Bool;
+ return &RttiTypes::Bool;
case VariantType::INT:
- return RttiTypes::Int;
+ return &RttiTypes::Int;
case VariantType::DOUBLE:
- return RttiTypes::Double;
+ return &RttiTypes::Double;
case VariantType::STRING:
case VariantType::MAGIC:
- return RttiTypes::String;
+ return &RttiTypes::String;
case VariantType::ARRAY:
- return RttiTypes::Array;
+ return &RttiTypes::Array;
case VariantType::MAP:
- return RttiTypes::Map;
+ return &RttiTypes::Map;
case VariantType::CARDINALITY:
- return RttiTypes::Cardinality;
+ return &RttiTypes::Cardinality;
case VariantType::FUNCTION:
- return RttiTypes::Function;
+ return &RttiTypes::Function;
case VariantType::OBJECT: {
Variant::objectType o = asObject();
- return (o == nullptr) ? RttiTypes::Nullptr : o->type();
+ return (o == nullptr) ? &RttiTypes::Nullptr : o->type();
}
}
- return RttiTypes::None;
+ return &RttiTypes::None;
}
/* Output stream operators */
diff --git a/src/core/common/Variant.hpp b/src/core/common/Variant.hpp
index 76f4506..6eae7e1 100644
--- a/src/core/common/Variant.hpp
+++ b/src/core/common/Variant.hpp
@@ -929,7 +929,7 @@ public:
* to.
* @return the value of the variant as array.
*/
- arrayType toArray(const Rtti &innerType) const;
+ arrayType toArray(const Rtti *innerType) const;
/**
* Returns the value of the Variant as map.
@@ -946,7 +946,7 @@ public:
* to.
* @return the value of the variant as map.
*/
- mapType toMap(const Rtti &innerType) const;
+ mapType toMap(const Rtti *innerType) const;
/**
* Returns the value of the Variant as cardinality.
@@ -1125,7 +1125,7 @@ public:
* or RttiTypes::Function or -- in case an object is stored inside the
* variant -- the Rtti of that object.
*/
- const Rtti &getRtti() 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 29b4ef3..271fe75 100644
--- a/src/core/common/VariantConverter.cpp
+++ b/src/core/common/VariantConverter.cpp
@@ -305,7 +305,7 @@ bool VariantConverter::toString(Variant &var, Logger &logger, Mode mode)
std::stringstream ss;
ss << "<object " << obj.get();
if (obj.get() != nullptr) {
- ss << " (" << obj->type().name << ")";
+ ss << " (" << obj->type()->name << ")";
}
ss << ">";
var = ss.str().c_str();
@@ -330,7 +330,7 @@ bool VariantConverter::toString(Variant &var, Logger &logger, Mode mode)
return false;
}
-bool VariantConverter::toArray(Variant &var, const Rtti &innerType,
+bool VariantConverter::toArray(Variant &var, const Rtti *innerType,
Logger &logger, Mode mode)
{
// If unsafe conversions are allowed, encapsulate the given variant in an
@@ -343,7 +343,7 @@ bool VariantConverter::toArray(Variant &var, const Rtti &innerType,
if (var.isArray()) {
// If no specific inner type is given, conversion is successful at this
// point
- if (&innerType == &RttiTypes::None) {
+ if (innerType == &RttiTypes::None) {
return true;
}
@@ -351,7 +351,7 @@ bool VariantConverter::toArray(Variant &var, const Rtti &innerType,
// failures to do so
bool res = true;
for (Variant &v : var.asArray()) {
- res = convert(v, innerType, RttiTypes::None, logger, mode) & res;
+ res = convert(v, innerType, &RttiTypes::None, logger, mode) & res;
}
return res;
}
@@ -362,14 +362,14 @@ bool VariantConverter::toArray(Variant &var, const Rtti &innerType,
return false;
}
-bool VariantConverter::toMap(Variant &var, const Rtti &innerType,
+bool VariantConverter::toMap(Variant &var, const Rtti *innerType,
Logger &logger, Mode mode)
{
// Make sure the variant is a map
if (var.isMap()) {
// If no specific inner type is given, conversion is successful at this
// point
- if (&innerType == &RttiTypes::None) {
+ if (innerType == &RttiTypes::None) {
return true;
}
@@ -377,7 +377,7 @@ bool VariantConverter::toMap(Variant &var, const Rtti &innerType,
// all failures to do so
bool res = true;
for (auto &e : var.asMap()) {
- res = convert(e.second, innerType, RttiTypes::None, logger, mode) &
+ res = convert(e.second, innerType, &RttiTypes::None, logger, mode) &
res;
}
return res;
@@ -517,14 +517,14 @@ bool VariantConverter::toFunction(Variant &var, Logger &logger)
return false;
}
-bool VariantConverter::convert(Variant &var, const Rtti &type,
- const Rtti &innerType, Logger &logger, Mode mode)
+bool VariantConverter::convert(Variant &var, const Rtti *type,
+ const Rtti *innerType, Logger &logger, Mode mode)
{
// Check for simple Variant types
- if (&type == &RttiTypes::None) {
+ if (type == &RttiTypes::None) {
return true; // Everything is fine if no specific type was
// requested
- } else if (&type == &RttiTypes::Nullptr) {
+ } else if (type == &RttiTypes::Nullptr) {
// Make sure the variant is set to null
if (!var.isNull()) {
logger.error(msgUnexpectedType(var, VariantType::NULLPTR));
@@ -532,21 +532,21 @@ bool VariantConverter::convert(Variant &var, const Rtti &type,
return false;
}
return true;
- } else if (&type == &RttiTypes::Bool) {
+ } else if (type == &RttiTypes::Bool) {
return toBool(var, logger, mode);
- } else if (&type == &RttiTypes::Int) {
+ } else if (type == &RttiTypes::Int) {
return toInt(var, logger, mode);
- } else if (&type == &RttiTypes::Double) {
+ } else if (type == &RttiTypes::Double) {
return toDouble(var, logger, mode);
- } else if (&type == &RttiTypes::String) {
+ } else if (type == &RttiTypes::String) {
return toString(var, logger, mode);
- } else if (&type == &RttiTypes::Array) {
+ } else if (type == &RttiTypes::Array) {
return toArray(var, innerType, logger, mode);
- } else if (&type == &RttiTypes::Map) {
+ } else if (type == &RttiTypes::Map) {
return toMap(var, innerType, logger, mode);
- } else if (&type == &RttiTypes::Cardinality) {
+ } else if (type == &RttiTypes::Cardinality) {
return toCardinality(var, logger, mode);
- } else if (&type == &RttiTypes::Function) {
+ } else if (type == &RttiTypes::Function) {
return toFunction(var, logger);
}
@@ -559,19 +559,19 @@ bool VariantConverter::convert(Variant &var, const Rtti &type,
}
// Make sure the object type is correct
- if (!var.getRtti().isa(type)) {
- logger.error(std::string("Expected object of type ") + type.name +
- " but got object of type " + var.getRtti().name);
+ if (!var.getRtti()->isa(type)) {
+ logger.error(std::string("Expected object of type ") + type->name +
+ " but got object of type " + var.getRtti()->name);
var.setObject(nullptr);
return false;
}
return true;
}
-bool VariantConverter::convert(Variant &var, const Rtti &type, Logger &logger,
+bool VariantConverter::convert(Variant &var, const Rtti *type, Logger &logger,
Mode mode)
{
- return convert(var, type, RttiTypes::None, logger, mode);
+ return convert(var, type, &RttiTypes::None, logger, mode);
}
}
diff --git a/src/core/common/VariantConverter.hpp b/src/core/common/VariantConverter.hpp
index 92cc40a..26278eb 100644
--- a/src/core/common/VariantConverter.hpp
+++ b/src/core/common/VariantConverter.hpp
@@ -161,7 +161,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 Rtti &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 Rtti &innerType, Logger &logger,
+ static bool toMap(Variant &var, const Rtti *innerType, Logger &logger,
Mode mode = Mode::SAFE);
/**
@@ -242,7 +242,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 Rtti &type, const Rtti &innerType,
+ static bool convert(Variant &var, const Rtti *type, const Rtti *innerType,
Logger &logger, Mode mode = Mode::SAFE);
/**
@@ -261,7 +261,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 Rtti &type, Logger &logger,
+ static bool convert(Variant &var, const Rtti *type, Logger &logger,
Mode mode = Mode::SAFE);
};
}