Merge pull request #491 from oatpp/refactor_object_wrapper

Refactor object wrapper
This commit is contained in:
Leonid Stryzhevskyi 2021-10-14 02:17:49 +03:00 committed by GitHub
commit 842f62a7c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 333 additions and 211 deletions

View File

@ -129,15 +129,15 @@ const type::Type* TypeResolver::resolveType(const type::Type* type, Cache& cache
type::Void TypeResolver::resolveValue(const type::Void& value, Cache& cache) const {
if(value.valueType == nullptr) {
if(value.getValueType() == nullptr) {
return nullptr;
}
if(isKnownClass(value.valueType->classId)) {
if(isKnownClass(value.getValueType()->classId)) {
return value;
}
auto typeIt = cache.values.find(value.valueType);
auto typeIt = cache.values.find(value.getValueType());
if(typeIt != cache.values.end()) {
auto valueIt = typeIt->second.find(value);
if(valueIt != typeIt->second.end()) {
@ -145,10 +145,10 @@ type::Void TypeResolver::resolveValue(const type::Void& value, Cache& cache) con
}
}
auto interpretation = value.valueType->findInterpretation(m_enabledInterpretations);
auto interpretation = value.getValueType()->findInterpretation(m_enabledInterpretations);
if(interpretation) {
auto resolution = resolveValue(interpretation->toInterpretation(value), cache);
cache.values[value.valueType].insert({value, resolution});
cache.values[value.getValueType()].insert({value, resolution});
return resolution;
}
@ -197,7 +197,7 @@ type::Void TypeResolver::findPropertyValue(const type::Void& baseObject,
Cache& cache) const
{
auto baseType = baseObject.valueType;
auto baseType = baseObject.getValueType();
if(isKnownType(baseType)) {
if(pathPosition == path.size()) {
@ -221,7 +221,7 @@ type::Void TypeResolver::findPropertyValue(const type::Void& baseObject,
}
const auto& resolution = resolveValue(baseObject, cache);
if(resolution.valueType->classId.id != type::Void::Class::CLASS_ID.id) {
if(resolution.getValueType()->classId.id != type::Void::Class::CLASS_ID.id) {
return findPropertyValue(resolution, path, pathPosition, cache);
}

View File

@ -105,7 +105,7 @@ public:
*/
template<class T, class C>
Any(const ObjectWrapper<T, C>& polymorph)
: ObjectWrapper(std::make_shared<AnyHandle>(polymorph.getPtr(), polymorph.valueType), __class::Any::getType())
: ObjectWrapper(std::make_shared<AnyHandle>(polymorph.getPtr(), polymorph.getValueType()), __class::Any::getType())
{}
/**
@ -116,7 +116,7 @@ public:
*/
template<class T, class C>
void store(const ObjectWrapper<T, C>& polymorph) {
m_ptr = std::make_shared<AnyHandle>(polymorph.getPtr(), polymorph.valueType);
m_ptr = std::make_shared<AnyHandle>(polymorph.getPtr(), polymorph.getValueType());
}
/**
@ -155,7 +155,7 @@ public:
template<class T, class C>
Any& operator=(const ObjectWrapper<T, C>& polymorph) {
m_ptr = std::make_shared<AnyHandle>(polymorph.getPtr(), polymorph.valueType);
m_ptr = std::make_shared<AnyHandle>(polymorph.getPtr(), polymorph.getValueType());
return *this;
}

View File

@ -459,7 +459,7 @@ template<class T, bool notnull>
Void EnumInterpreterAsString<T, notnull>::toInterpretation(const Void& enumValue, EnumInterpreterError& error) {
typedef EnumObjectWrapper<T, EnumInterpreterAsString<T, notnull>> EnumOW;
if(enumValue.valueType != EnumOW::Class::getType()) {
if(enumValue.getValueType() != EnumOW::Class::getType()) {
error = EnumInterpreterError::TYPE_MISMATCH_ENUM;
return Void(nullptr, String::Class::getType());
}
@ -481,7 +481,7 @@ template<class T, bool notnull>
Void EnumInterpreterAsString<T, notnull>::fromInterpretation(const Void& interValue, EnumInterpreterError& error) {
typedef EnumObjectWrapper<T, EnumInterpreterAsString<T, notnull>> EnumOW;
if(interValue.valueType != String::Class::getType()) {
if(interValue.getValueType() != String::Class::getType()) {
error = EnumInterpreterError::TYPE_MISMATCH_ENUM_VALUE;
return Void(nullptr, EnumOW::Class::getType());
}
@ -515,7 +515,7 @@ Void EnumInterpreterAsNumber<T, notnull>::toInterpretation(const Void& enumValue
typedef typename std::underlying_type<T>::type EnumUT;
typedef typename ObjectWrapperByUnderlyingType<EnumUT>::ObjectWrapper UTOW;
if(enumValue.valueType != EnumOW::Class::getType()) {
if(enumValue.getValueType() != EnumOW::Class::getType()) {
error = EnumInterpreterError::TYPE_MISMATCH_ENUM;
return Void(nullptr, UTOW::Class::getType());
}
@ -540,7 +540,7 @@ Void EnumInterpreterAsNumber<T, notnull>::fromInterpretation(const Void& interVa
typedef typename std::underlying_type<T>::type EnumUT;
typedef typename ObjectWrapperByUnderlyingType<EnumUT>::ObjectWrapper OW;
if(interValue.valueType != OW::Class::getType()) {
if(interValue.getValueType() != OW::Class::getType()) {
error = EnumInterpreterError::TYPE_MISMATCH_ENUM_VALUE;
return Void(nullptr, EnumOW::Class::getType());
}

View File

@ -34,7 +34,7 @@
#include <string>
namespace oatpp { namespace data { namespace mapping { namespace type {
class Type; // FWD
/**
@ -90,6 +90,8 @@ namespace __class {
}
class Void; // FWD
/**
* ObjectWrapper holds std::shared_ptr to object, object static type, plus object dynamic type information.
* @tparam T - Object Type.
@ -97,8 +99,10 @@ namespace __class {
*/
template <class T, class Clazz = __class::Void>
class ObjectWrapper {
friend Void;
protected:
std::shared_ptr<T> m_ptr;
const Type* m_valueType;
public:
/**
@ -114,41 +118,41 @@ public:
ObjectWrapper(const std::shared_ptr<T>& ptr)
: m_ptr(ptr)
, valueType(Class::getType())
, m_valueType(Class::getType())
{}
ObjectWrapper(const std::shared_ptr<T>& ptr, const Type* const type)
: m_ptr(ptr)
, valueType(type)
, m_valueType(type)
{}
ObjectWrapper(std::shared_ptr<T>&& ptr, const Type* const type)
: m_ptr(std::move(ptr))
, valueType(type)
, m_valueType(type)
{}
public:
ObjectWrapper()
: valueType(Class::getType())
: m_valueType(Class::getType())
{}
ObjectWrapper(std::nullptr_t)
: valueType(Class::getType())
: m_valueType(Class::getType())
{}
ObjectWrapper(const Type* const type)
: valueType(type)
: m_valueType(type)
{}
ObjectWrapper(const ObjectWrapper& other)
: m_ptr(other.m_ptr)
, valueType(other.valueType)
, m_valueType(other.m_valueType)
{}
ObjectWrapper(ObjectWrapper&& other)
: m_ptr(std::move(other.m_ptr))
, valueType(other.valueType)
, m_valueType(other.m_valueType)
{}
inline ObjectWrapper& operator=(const ObjectWrapper& other){
@ -160,14 +164,10 @@ public:
m_ptr = std::move(other.m_ptr);
return *this;
}
inline operator ObjectWrapper<void>() const {
return ObjectWrapper<void>(this->m_ptr, valueType);
}
template<class Wrapper>
Wrapper staticCast() const {
return Wrapper(std::static_pointer_cast<typename Wrapper::ObjectType>(m_ptr), valueType);
return Wrapper(std::static_pointer_cast<typename Wrapper::ObjectType>(m_ptr), m_valueType);
}
inline T* operator->() const {
@ -207,14 +207,97 @@ public:
}
/**
* Value type information.
* See &l:Type;.
* Get value type
* @return
*/
const Type* const valueType;
const Type* getValueType() const {
return m_valueType;
}
};
typedef ObjectWrapper<void, __class::Void> Void;
class Void : public ObjectWrapper<void, __class::Void> {
public:
Void(const std::shared_ptr<void>& ptr, const type::Type* const valueType)
: ObjectWrapper<void, __class::Void>(ptr, valueType)
{}
public:
Void() {}
template<typename T,
typename enabled = typename std::enable_if<std::is_same<T, std::nullptr_t>::value, void>::type
>
Void(T) {}
Void(const Type* const type)
: ObjectWrapper<void, __class::Void>(type)
{}
Void(const std::shared_ptr<void>& ptr)
: type::ObjectWrapper<void, __class::Void>(ptr)
{}
Void(std::shared_ptr<void>&& ptr)
: type::ObjectWrapper<void, __class::Void>(std::forward<std::shared_ptr<void>>(ptr))
{}
template<typename T, typename C>
Void(const ObjectWrapper<T, C>& other)
: type::ObjectWrapper<void, __class::Void>(other.getPtr(), other.getValueType())
{}
template<typename T, typename C>
Void(ObjectWrapper<T, C>&& other)
: type::ObjectWrapper<void, __class::Void>(std::move(other.getPtr()), other.getValueType())
{}
template<typename T,
typename enabled = typename std::enable_if<std::is_same<T, std::nullptr_t>::value, void>::type
>
inline Void& operator = (std::nullptr_t) {
m_ptr.reset();
return *this;
}
template<typename T, typename C>
inline Void& operator = (const ObjectWrapper<T, C>& other){
m_ptr = other.m_ptr;
m_valueType = other.getValueType();
return *this;
}
template<typename T, typename C>
inline Void& operator = (ObjectWrapper<T, C>&& other){
m_ptr = std::move(other.m_ptr);
m_valueType = other.getValueType();
return *this;
}
template<typename T,
typename enabled = typename std::enable_if<std::is_same<T, std::nullptr_t>::value, void>::type
>
inline bool operator == (T) const {
return m_ptr.get() == nullptr;
}
template<typename T,
typename enabled = typename std::enable_if<std::is_same<T, std::nullptr_t>::value, void>::type
>
inline bool operator != (T) const {
return m_ptr.get() != nullptr;
}
template<typename T, typename C>
inline bool operator == (const ObjectWrapper<T, C> &other) const {
return m_ptr.get() == other.get();
}
template<typename T, typename C>
inline bool operator != (const ObjectWrapper<T, C> &other) const {
return m_ptr.get() != other.get();
}
};
template <typename T>
struct ObjectWrapperByUnderlyingType {};

View File

@ -252,7 +252,7 @@ oatpp::Void Deserializer::deserializeAny(Deserializer* deserializer, parser::Car
const Type* const fieldType = guessType(caret);
if(fieldType != nullptr) {
auto fieldValue = deserializer->deserialize(caret, fieldType);
auto anyHandle = std::make_shared<data::mapping::type::AnyHandle>(fieldValue.getPtr(), fieldValue.valueType);
auto anyHandle = std::make_shared<data::mapping::type::AnyHandle>(fieldValue.getPtr(), fieldValue.getValueType());
return oatpp::Void(anyHandle, Any::Class::getType());
}
}

View File

@ -202,7 +202,7 @@ private:
return nullptr;
};
return oatpp::Void(list.getPtr(), list.valueType);
return oatpp::Void(list.getPtr(), list.getValueType());
} else {
caret.setError("[oatpp::parser::json::mapping::Deserializer::deserializeList()]: Error. '[' - expected", ERROR_CODE_ARRAY_SCOPE_OPEN);
return nullptr;
@ -266,7 +266,7 @@ private:
return nullptr;
}
return oatpp::Void(map.getPtr(), map.valueType);
return oatpp::Void(map.getPtr(), map.getValueType());
} else {
caret.setError("[oatpp::parser::json::mapping::Deserializer::deserializeKeyValue()]: Error. '{' - expected", ERROR_CODE_OBJECT_SCOPE_OPEN);

View File

@ -118,7 +118,7 @@ void Serializer::serializeEnum(Serializer* serializer,
const oatpp::Void& polymorph)
{
auto polymorphicDispatcher = static_cast<const data::mapping::type::__class::AbstractEnum::PolymorphicDispatcher*>(
polymorph.valueType->polymorphicDispatcher
polymorph.getValueType()->polymorphicDispatcher
);
data::mapping::type::EnumInterpreterError e = data::mapping::type::EnumInterpreterError::OK;
@ -150,7 +150,9 @@ void Serializer::serializeObject(Serializer* serializer,
stream->writeCharSimple('{');
bool first = true;
auto dispatcher = static_cast<const oatpp::data::mapping::type::__class::AbstractObject::PolymorphicDispatcher*>(polymorph.valueType->polymorphicDispatcher);
auto dispatcher = static_cast<const oatpp::data::mapping::type::__class::AbstractObject::PolymorphicDispatcher*>(
polymorph.getValueType()->polymorphicDispatcher
);
auto fields = dispatcher->getProperties()->getList();
auto object = static_cast<oatpp::BaseObject*>(polymorph.get());
@ -173,19 +175,19 @@ void Serializer::serializeObject(Serializer* serializer,
void Serializer::serialize(data::stream::ConsistentOutputStream* stream,
const oatpp::Void& polymorph)
{
auto id = polymorph.valueType->classId.id;
auto id = polymorph.getValueType()->classId.id;
auto& method = m_methods[id];
if(method) {
(*method)(this, stream, polymorph);
} else {
auto* interpretation = polymorph.valueType->findInterpretation(m_config->enabledInterpretations);
auto* interpretation = polymorph.getValueType()->findInterpretation(m_config->enabledInterpretations);
if(interpretation) {
serialize(stream, interpretation->toInterpretation(polymorph));
} else {
throw std::runtime_error("[oatpp::parser::json::mapping::Serializer::serialize()]: "
"Error. No serialize method for type '" +
std::string(polymorph.valueType->classId.name) + "'");
std::string(polymorph.getValueType()->classId.name) + "'");
}
}

View File

@ -94,7 +94,9 @@ void runTests() {
OATPP_RUN_TEST(oatpp::test::core::data::mapping::type::ObjectWrapperTest);
OATPP_RUN_TEST(oatpp::test::core::data::mapping::type::TypeTest);
OATPP_RUN_TEST(oatpp::test::core::data::mapping::type::StringTest);
OATPP_RUN_TEST(oatpp::test::core::data::mapping::type::PrimitiveTest);
OATPP_RUN_TEST(oatpp::test::core::data::mapping::type::ListTest);
OATPP_RUN_TEST(oatpp::test::core::data::mapping::type::VectorTest);
@ -103,6 +105,7 @@ void runTests() {
OATPP_RUN_TEST(oatpp::test::core::data::mapping::type::UnorderedMapTest);
OATPP_RUN_TEST(oatpp::test::core::data::mapping::type::AnyTest);
OATPP_RUN_TEST(oatpp::test::core::data::mapping::type::EnumTest);
OATPP_RUN_TEST(oatpp::test::core::data::mapping::type::ObjectTest);
OATPP_RUN_TEST(oatpp::test::core::data::mapping::type::InterpretationTest);

View File

@ -119,7 +119,7 @@ void TypeResolverTest::onRun() {
OATPP_ASSERT(type->classId.id == oatpp::String::Class::CLASS_ID.id);
auto val = tr.resolveObjectPropertyValue(dto1, {"f_str"}, cache);
OATPP_ASSERT(val.valueType->classId.id == oatpp::String::Class::CLASS_ID.id);
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::String::Class::CLASS_ID.id);
OATPP_ASSERT(val.get() == dto1->f_str.get());
}
@ -131,7 +131,7 @@ void TypeResolverTest::onRun() {
OATPP_ASSERT(type->classId.id == oatpp::String::Class::CLASS_ID.id);
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_str"}, cache);
OATPP_ASSERT(val.valueType->classId.id == oatpp::String::Class::CLASS_ID.id);
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::String::Class::CLASS_ID.id);
OATPP_ASSERT(val.get() == dto1->f_dto->f_str.get());
}
@ -147,7 +147,7 @@ void TypeResolverTest::onRun() {
OATPP_ASSERT(type->classId.id == oatpp::Int8::Class::CLASS_ID.id);
auto val = tr.resolveObjectPropertyValue(dto1, {"f_int8"}, cache);
OATPP_ASSERT(val.valueType->classId.id == oatpp::Int8::Class::CLASS_ID.id);
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Int8::Class::CLASS_ID.id);
OATPP_ASSERT(val.get() == dto1->f_int8.get());
}
@ -159,7 +159,7 @@ void TypeResolverTest::onRun() {
OATPP_ASSERT(type->classId.id == oatpp::Int8::Class::CLASS_ID.id);
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_int8"}, cache);
OATPP_ASSERT(val.valueType->classId.id == oatpp::Int8::Class::CLASS_ID.id);
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Int8::Class::CLASS_ID.id);
OATPP_ASSERT(val.get() == dto1->f_dto->f_int8.get());
}
@ -171,7 +171,7 @@ void TypeResolverTest::onRun() {
OATPP_ASSERT(type->classId.id == oatpp::UInt8::Class::CLASS_ID.id);
auto val = tr.resolveObjectPropertyValue(dto1, {"f_uint8"}, cache);
OATPP_ASSERT(val.valueType->classId.id == oatpp::UInt8::Class::CLASS_ID.id);
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::UInt8::Class::CLASS_ID.id);
OATPP_ASSERT(val.get() == dto1->f_uint8.get());
}
@ -183,7 +183,7 @@ void TypeResolverTest::onRun() {
OATPP_ASSERT(type->classId.id == oatpp::UInt8::Class::CLASS_ID.id);
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_uint8"}, cache);
OATPP_ASSERT(val.valueType->classId.id == oatpp::UInt8::Class::CLASS_ID.id);
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::UInt8::Class::CLASS_ID.id);
OATPP_ASSERT(val.get() == dto1->f_dto->f_uint8.get());
}
@ -198,7 +198,7 @@ void TypeResolverTest::onRun() {
OATPP_ASSERT(type->classId.id == oatpp::Int16::Class::CLASS_ID.id);
auto val = tr.resolveObjectPropertyValue(dto1, {"f_int16"}, cache);
OATPP_ASSERT(val.valueType->classId.id == oatpp::Int16::Class::CLASS_ID.id);
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Int16::Class::CLASS_ID.id);
OATPP_ASSERT(val.get() == dto1->f_int16.get());
}
@ -210,7 +210,7 @@ void TypeResolverTest::onRun() {
OATPP_ASSERT(type->classId.id == oatpp::Int16::Class::CLASS_ID.id);
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_int16"}, cache);
OATPP_ASSERT(val.valueType->classId.id == oatpp::Int16::Class::CLASS_ID.id);
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Int16::Class::CLASS_ID.id);
OATPP_ASSERT(val.get() == dto1->f_dto->f_int16.get());
}
@ -222,7 +222,7 @@ void TypeResolverTest::onRun() {
OATPP_ASSERT(type->classId.id == oatpp::UInt16::Class::CLASS_ID.id);
auto val = tr.resolveObjectPropertyValue(dto1, {"f_uint16"}, cache);
OATPP_ASSERT(val.valueType->classId.id == oatpp::UInt16::Class::CLASS_ID.id);
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::UInt16::Class::CLASS_ID.id);
OATPP_ASSERT(val.get() == dto1->f_uint16.get());
}
@ -234,7 +234,7 @@ void TypeResolverTest::onRun() {
OATPP_ASSERT(type->classId.id == oatpp::UInt16::Class::CLASS_ID.id);
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_uint16"}, cache);
OATPP_ASSERT(val.valueType->classId.id == oatpp::UInt16::Class::CLASS_ID.id);
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::UInt16::Class::CLASS_ID.id);
OATPP_ASSERT(val.get() == dto1->f_dto->f_uint16.get());
}
@ -249,7 +249,7 @@ void TypeResolverTest::onRun() {
OATPP_ASSERT(type->classId.id == oatpp::Int32::Class::CLASS_ID.id);
auto val = tr.resolveObjectPropertyValue(dto1, {"f_int32"}, cache);
OATPP_ASSERT(val.valueType->classId.id == oatpp::Int32::Class::CLASS_ID.id);
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Int32::Class::CLASS_ID.id);
OATPP_ASSERT(val.get() == dto1->f_int32.get());
}
@ -261,7 +261,7 @@ void TypeResolverTest::onRun() {
OATPP_ASSERT(type->classId.id == oatpp::Int32::Class::CLASS_ID.id);
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_int32"}, cache);
OATPP_ASSERT(val.valueType->classId.id == oatpp::Int32::Class::CLASS_ID.id);
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Int32::Class::CLASS_ID.id);
OATPP_ASSERT(val.get() == dto1->f_dto->f_int32.get());
}
@ -273,7 +273,7 @@ void TypeResolverTest::onRun() {
OATPP_ASSERT(type->classId.id == oatpp::UInt32::Class::CLASS_ID.id);
auto val = tr.resolveObjectPropertyValue(dto1, {"f_uint32"}, cache);
OATPP_ASSERT(val.valueType->classId.id == oatpp::UInt32::Class::CLASS_ID.id);
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::UInt32::Class::CLASS_ID.id);
OATPP_ASSERT(val.get() == dto1->f_uint32.get());
}
@ -285,7 +285,7 @@ void TypeResolverTest::onRun() {
OATPP_ASSERT(type->classId.id == oatpp::UInt32::Class::CLASS_ID.id);
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_uint32"}, cache);
OATPP_ASSERT(val.valueType->classId.id == oatpp::UInt32::Class::CLASS_ID.id);
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::UInt32::Class::CLASS_ID.id);
OATPP_ASSERT(val.get() == dto1->f_dto->f_uint32.get());
}
@ -300,7 +300,7 @@ void TypeResolverTest::onRun() {
OATPP_ASSERT(type->classId.id == oatpp::Int64::Class::CLASS_ID.id);
auto val = tr.resolveObjectPropertyValue(dto1, {"f_int64"}, cache);
OATPP_ASSERT(val.valueType->classId.id == oatpp::Int64::Class::CLASS_ID.id);
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Int64::Class::CLASS_ID.id);
OATPP_ASSERT(val.get() == dto1->f_int64.get());
}
@ -312,7 +312,7 @@ void TypeResolverTest::onRun() {
OATPP_ASSERT(type->classId.id == oatpp::Int64::Class::CLASS_ID.id);
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_int64"}, cache);
OATPP_ASSERT(val.valueType->classId.id == oatpp::Int64::Class::CLASS_ID.id);
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Int64::Class::CLASS_ID.id);
OATPP_ASSERT(val.get() == dto1->f_dto->f_int64.get());
}
@ -324,7 +324,7 @@ void TypeResolverTest::onRun() {
OATPP_ASSERT(type->classId.id == oatpp::UInt64::Class::CLASS_ID.id);
auto val = tr.resolveObjectPropertyValue(dto1, {"f_uint64"}, cache);
OATPP_ASSERT(val.valueType->classId.id == oatpp::UInt64::Class::CLASS_ID.id);
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::UInt64::Class::CLASS_ID.id);
OATPP_ASSERT(val.get() == dto1->f_uint64.get());
}
@ -336,7 +336,7 @@ void TypeResolverTest::onRun() {
OATPP_ASSERT(type->classId.id == oatpp::UInt64::Class::CLASS_ID.id);
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_uint64"}, cache);
OATPP_ASSERT(val.valueType->classId.id == oatpp::UInt64::Class::CLASS_ID.id);
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::UInt64::Class::CLASS_ID.id);
OATPP_ASSERT(val.get() == dto1->f_dto->f_uint64.get());
}
@ -353,7 +353,7 @@ void TypeResolverTest::onRun() {
OATPP_ASSERT(type->classId.id == oatpp::Float32::Class::CLASS_ID.id);
auto val = tr.resolveObjectPropertyValue(dto1, {"f_float32"}, cache);
OATPP_ASSERT(val.valueType->classId.id == oatpp::Float32::Class::CLASS_ID.id);
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Float32::Class::CLASS_ID.id);
OATPP_ASSERT(val.get() == dto1->f_float32.get());
}
@ -365,7 +365,7 @@ void TypeResolverTest::onRun() {
OATPP_ASSERT(type->classId.id == oatpp::Float32::Class::CLASS_ID.id);
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_float32"}, cache);
OATPP_ASSERT(val.valueType->classId.id == oatpp::Float32::Class::CLASS_ID.id);
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Float32::Class::CLASS_ID.id);
OATPP_ASSERT(val.get() == dto1->f_dto->f_float32.get());
}
@ -380,7 +380,7 @@ void TypeResolverTest::onRun() {
OATPP_ASSERT(type->classId.id == oatpp::Float64::Class::CLASS_ID.id);
auto val = tr.resolveObjectPropertyValue(dto1, {"f_float64"}, cache);
OATPP_ASSERT(val.valueType->classId.id == oatpp::Float64::Class::CLASS_ID.id);
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Float64::Class::CLASS_ID.id);
OATPP_ASSERT(val.get() == dto1->f_float64.get());
}
@ -392,7 +392,7 @@ void TypeResolverTest::onRun() {
OATPP_ASSERT(type->classId.id == oatpp::Float64::Class::CLASS_ID.id);
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_float64"}, cache);
OATPP_ASSERT(val.valueType->classId.id == oatpp::Float64::Class::CLASS_ID.id);
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Float64::Class::CLASS_ID.id);
OATPP_ASSERT(val.get() == dto1->f_dto->f_float64.get());
}
@ -407,7 +407,7 @@ void TypeResolverTest::onRun() {
OATPP_ASSERT(type->classId.id == oatpp::Boolean::Class::CLASS_ID.id);
auto val = tr.resolveObjectPropertyValue(dto1, {"f_bool"}, cache);
OATPP_ASSERT(val.valueType->classId.id == oatpp::Boolean::Class::CLASS_ID.id);
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Boolean::Class::CLASS_ID.id);
OATPP_ASSERT(val.get() == dto1->f_bool.get());
}
@ -419,7 +419,7 @@ void TypeResolverTest::onRun() {
OATPP_ASSERT(type->classId.id == oatpp::Boolean::Class::CLASS_ID.id);
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_bool"}, cache);
OATPP_ASSERT(val.valueType->classId.id == oatpp::Boolean::Class::CLASS_ID.id);
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Boolean::Class::CLASS_ID.id);
OATPP_ASSERT(val.get() == dto1->f_dto->f_bool.get());
}
@ -430,10 +430,10 @@ void TypeResolverTest::onRun() {
{
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_vector"}, cache);
OATPP_ASSERT(type == dto1->f_vector.valueType);
OATPP_ASSERT(type == dto1->f_vector.getValueType());
auto val = tr.resolveObjectPropertyValue(dto1, {"f_vector"}, cache);
OATPP_ASSERT(val.valueType == dto1->f_vector.valueType);
OATPP_ASSERT(val.getValueType() == dto1->f_vector.getValueType());
OATPP_ASSERT(val.get() == dto1->f_vector.get());
}
@ -441,10 +441,10 @@ void TypeResolverTest::onRun() {
{
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto", "f_vector"}, cache);
OATPP_ASSERT(type == dto1->f_dto->f_vector.valueType);
OATPP_ASSERT(type == dto1->f_dto->f_vector.getValueType());
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_vector"}, cache);
OATPP_ASSERT(val.valueType == dto1->f_dto->f_vector.valueType);
OATPP_ASSERT(val.getValueType() == dto1->f_dto->f_vector.getValueType());
OATPP_ASSERT(val.get() == dto1->f_dto->f_vector.get());
}
@ -455,10 +455,10 @@ void TypeResolverTest::onRun() {
{
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_list"}, cache);
OATPP_ASSERT(type == dto1->f_list.valueType);
OATPP_ASSERT(type == dto1->f_list.getValueType());
auto val = tr.resolveObjectPropertyValue(dto1, {"f_list"}, cache);
OATPP_ASSERT(val.valueType == dto1->f_list.valueType);
OATPP_ASSERT(val.getValueType() == dto1->f_list.getValueType());
OATPP_ASSERT(val.get() == dto1->f_list.get());
}
@ -466,10 +466,10 @@ void TypeResolverTest::onRun() {
{
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto", "f_list"}, cache);
OATPP_ASSERT(type == dto1->f_dto->f_list.valueType);
OATPP_ASSERT(type == dto1->f_dto->f_list.getValueType());
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_list"}, cache);
OATPP_ASSERT(val.valueType == dto1->f_dto->f_list.valueType);
OATPP_ASSERT(val.getValueType() == dto1->f_dto->f_list.getValueType());
OATPP_ASSERT(val.get() == dto1->f_dto->f_list.get());
}
@ -480,10 +480,10 @@ void TypeResolverTest::onRun() {
{
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_set"}, cache);
OATPP_ASSERT(type == dto1->f_set.valueType);
OATPP_ASSERT(type == dto1->f_set.getValueType());
auto val = tr.resolveObjectPropertyValue(dto1, {"f_set"}, cache);
OATPP_ASSERT(val.valueType == dto1->f_set.valueType);
OATPP_ASSERT(val.getValueType() == dto1->f_set.getValueType());
OATPP_ASSERT(val.get() == dto1->f_set.get());
}
@ -491,10 +491,10 @@ void TypeResolverTest::onRun() {
{
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto", "f_set"}, cache);
OATPP_ASSERT(type == dto1->f_dto->f_set.valueType);
OATPP_ASSERT(type == dto1->f_dto->f_set.getValueType());
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_set"}, cache);
OATPP_ASSERT(val.valueType == dto1->f_dto->f_set.valueType);
OATPP_ASSERT(val.getValueType() == dto1->f_dto->f_set.getValueType());
OATPP_ASSERT(val.get() == dto1->f_dto->f_set.get());
}
@ -505,10 +505,10 @@ void TypeResolverTest::onRun() {
{
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_fields"}, cache);
OATPP_ASSERT(type == dto1->f_fields.valueType);
OATPP_ASSERT(type == dto1->f_fields.getValueType());
auto val = tr.resolveObjectPropertyValue(dto1, {"f_fields"}, cache);
OATPP_ASSERT(val.valueType == dto1->f_fields.valueType);
OATPP_ASSERT(val.getValueType() == dto1->f_fields.getValueType());
OATPP_ASSERT(val.get() == dto1->f_fields.get());
}
@ -516,10 +516,10 @@ void TypeResolverTest::onRun() {
{
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto", "f_fields"}, cache);
OATPP_ASSERT(type == dto1->f_dto->f_fields.valueType);
OATPP_ASSERT(type == dto1->f_dto->f_fields.getValueType());
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_fields"}, cache);
OATPP_ASSERT(val.valueType == dto1->f_dto->f_fields.valueType);
OATPP_ASSERT(val.getValueType() == dto1->f_dto->f_fields.getValueType());
OATPP_ASSERT(val.get() == dto1->f_dto->f_fields.get());
}
@ -530,10 +530,10 @@ void TypeResolverTest::onRun() {
{
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_unordered_fields"}, cache);
OATPP_ASSERT(type == dto1->f_unordered_fields.valueType);
OATPP_ASSERT(type == dto1->f_unordered_fields.getValueType());
auto val = tr.resolveObjectPropertyValue(dto1, {"f_unordered_fields"}, cache);
OATPP_ASSERT(val.valueType == dto1->f_unordered_fields.valueType);
OATPP_ASSERT(val.getValueType() == dto1->f_unordered_fields.getValueType());
OATPP_ASSERT(val.get() == dto1->f_unordered_fields.get());
}
@ -541,10 +541,10 @@ void TypeResolverTest::onRun() {
{
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto", "f_unordered_fields"}, cache);
OATPP_ASSERT(type == dto1->f_dto->f_unordered_fields.valueType);
OATPP_ASSERT(type == dto1->f_dto->f_unordered_fields.getValueType());
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_unordered_fields"}, cache);
OATPP_ASSERT(val.valueType == dto1->f_dto->f_unordered_fields.valueType);
OATPP_ASSERT(val.getValueType() == dto1->f_dto->f_unordered_fields.getValueType());
OATPP_ASSERT(val.get() == dto1->f_dto->f_unordered_fields.get());
}
@ -555,10 +555,10 @@ void TypeResolverTest::onRun() {
{
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_any"}, cache);
OATPP_ASSERT(type == dto1->f_any.valueType);
OATPP_ASSERT(type == dto1->f_any.getValueType());
auto val = tr.resolveObjectPropertyValue(dto1, {"f_any"}, cache);
OATPP_ASSERT(val.valueType == dto1->f_any.valueType);
OATPP_ASSERT(val.getValueType() == dto1->f_any.getValueType());
OATPP_ASSERT(val.get() == dto1->f_any.get());
}
@ -566,10 +566,10 @@ void TypeResolverTest::onRun() {
{
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto", "f_any"}, cache);
OATPP_ASSERT(type == dto1->f_dto->f_any.valueType);
OATPP_ASSERT(type == dto1->f_dto->f_any.getValueType());
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_any"}, cache);
OATPP_ASSERT(val.valueType == dto1->f_dto->f_any.valueType);
OATPP_ASSERT(val.getValueType() == dto1->f_dto->f_any.getValueType());
OATPP_ASSERT(val.get() == dto1->f_dto->f_any.get());
}
@ -580,10 +580,10 @@ void TypeResolverTest::onRun() {
{
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto"}, cache);
OATPP_ASSERT(type == dto1->f_dto.valueType);
OATPP_ASSERT(type == dto1->f_dto.getValueType());
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto"}, cache);
OATPP_ASSERT(val.valueType == dto1->f_dto.valueType);
OATPP_ASSERT(val.getValueType() == dto1->f_dto.getValueType());
OATPP_ASSERT(val.get() == dto1->f_dto.get());
}
@ -591,10 +591,10 @@ void TypeResolverTest::onRun() {
{
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto", "f_dto"}, cache);
OATPP_ASSERT(type == dto1->f_dto->f_dto.valueType);
OATPP_ASSERT(type == dto1->f_dto->f_dto.getValueType());
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_dto"}, cache);
OATPP_ASSERT(val.valueType == dto1->f_dto->f_dto.valueType);
OATPP_ASSERT(val.getValueType() == dto1->f_dto->f_dto.getValueType());
OATPP_ASSERT(val.get() == dto1->f_dto->f_dto.get());
}
@ -608,7 +608,7 @@ void TypeResolverTest::onRun() {
OATPP_ASSERT(type == nullptr);
auto val = tr.resolveObjectPropertyValue(dto1, {"f_non_existing"}, cache);
OATPP_ASSERT(val.valueType == oatpp::Void::Class::getType());
OATPP_ASSERT(val.getValueType() == oatpp::Void::Class::getType());
OATPP_ASSERT(val == nullptr);
}
@ -619,7 +619,7 @@ void TypeResolverTest::onRun() {
OATPP_ASSERT(type == nullptr);
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_non_existing"}, cache);
OATPP_ASSERT(val.valueType == oatpp::Void::Class::getType());
OATPP_ASSERT(val.getValueType() == oatpp::Void::Class::getType());
OATPP_ASSERT(val == nullptr);
}

View File

@ -61,7 +61,7 @@ void AnyTest::onRun() {
OATPP_LOGI(TAG, "Test default constructor...");
oatpp::Any any;
OATPP_ASSERT(!any);
OATPP_ASSERT(any.valueType == oatpp::data::mapping::type::__class::Any::getType());
OATPP_ASSERT(any.getValueType() == oatpp::data::mapping::type::__class::Any::getType());
OATPP_ASSERT(any.getStoredType() == nullptr);
OATPP_LOGI(TAG, "OK");
}
@ -70,7 +70,7 @@ void AnyTest::onRun() {
OATPP_LOGI(TAG, "Test nullptr constructor...");
oatpp::Any any(nullptr);
OATPP_ASSERT(!any);
OATPP_ASSERT(any.valueType == oatpp::data::mapping::type::__class::Any::getType());
OATPP_ASSERT(any.getValueType() == oatpp::data::mapping::type::__class::Any::getType());
OATPP_ASSERT(any.getStoredType() == nullptr);
OATPP_LOGI(TAG, "OK");
}
@ -79,7 +79,7 @@ void AnyTest::onRun() {
OATPP_LOGI(TAG, "Test retrieve()...");
oatpp::Any any(oatpp::String("Hello Any!"));
OATPP_ASSERT(any);
OATPP_ASSERT(any.valueType == oatpp::data::mapping::type::__class::Any::getType());
OATPP_ASSERT(any.getValueType() == oatpp::data::mapping::type::__class::Any::getType());
OATPP_ASSERT(any.getStoredType() == oatpp::data::mapping::type::__class::String::getType());
auto str = any.retrieve<oatpp::String>();
OATPP_ASSERT(str == "Hello Any!");
@ -91,13 +91,13 @@ void AnyTest::onRun() {
oatpp::Any any(oatpp::Int32(32));
OATPP_ASSERT(any);
OATPP_ASSERT(any.valueType == oatpp::data::mapping::type::__class::Any::getType());
OATPP_ASSERT(any.getValueType() == oatpp::data::mapping::type::__class::Any::getType());
OATPP_ASSERT(any.getStoredType() == oatpp::data::mapping::type::__class::Int32::getType());
any.store(oatpp::String("Hello Any!"));
OATPP_ASSERT(any);
OATPP_ASSERT(any.valueType == oatpp::data::mapping::type::__class::Any::getType());
OATPP_ASSERT(any.getValueType() == oatpp::data::mapping::type::__class::Any::getType());
OATPP_ASSERT(any.getStoredType() == oatpp::data::mapping::type::__class::String::getType());
auto str = any.retrieve<oatpp::String>();
@ -109,7 +109,7 @@ void AnyTest::onRun() {
OATPP_LOGI(TAG, "Test retrieve() class check...");
oatpp::Any any(Dto1::createShared());
OATPP_ASSERT(any);
OATPP_ASSERT(any.valueType == oatpp::data::mapping::type::__class::Any::getType());
OATPP_ASSERT(any.getValueType() == oatpp::data::mapping::type::__class::Any::getType());
OATPP_ASSERT(any.getStoredType() == Object<Dto1>::Class::getType());
bool wasError = false;
@ -134,8 +134,8 @@ void AnyTest::onRun() {
OATPP_ASSERT(any1);
OATPP_ASSERT(any2);
OATPP_ASSERT(any1.valueType == oatpp::data::mapping::type::__class::Any::getType());
OATPP_ASSERT(any2.valueType == oatpp::data::mapping::type::__class::Any::getType());
OATPP_ASSERT(any1.getValueType() == oatpp::data::mapping::type::__class::Any::getType());
OATPP_ASSERT(any2.getValueType() == oatpp::data::mapping::type::__class::Any::getType());
OATPP_ASSERT(any1.getStoredType() == oatpp::data::mapping::type::__class::String::getType());
OATPP_ASSERT(any2.getStoredType() == oatpp::data::mapping::type::__class::String::getType());
@ -161,8 +161,8 @@ void AnyTest::onRun() {
OATPP_ASSERT(!any1);
OATPP_ASSERT(any2);
OATPP_ASSERT(any1.valueType == oatpp::data::mapping::type::__class::Any::getType());
OATPP_ASSERT(any2.valueType == oatpp::data::mapping::type::__class::Any::getType());
OATPP_ASSERT(any1.getValueType() == oatpp::data::mapping::type::__class::Any::getType());
OATPP_ASSERT(any2.getValueType() == oatpp::data::mapping::type::__class::Any::getType());
OATPP_ASSERT(any1.getStoredType() == nullptr);
OATPP_ASSERT(any2.getStoredType() == oatpp::data::mapping::type::__class::String::getType());

View File

@ -166,14 +166,14 @@ void EnumTest::onRun() {
OATPP_LOGI(TAG, "Test Interpreter AsString...");
oatpp::data::mapping::type::EnumInterpreterError e = oatpp::data::mapping::type::EnumInterpreterError::OK;
auto inter = oatpp::Enum<Enum2>::AsString::Interpreter::toInterpretation(oatpp::Enum<Enum2>::AsString(Enum2::NAME_1), e);
OATPP_ASSERT(inter.valueType == oatpp::String::Class::getType());
OATPP_ASSERT(inter.getValueType() == oatpp::String::Class::getType());
OATPP_ASSERT(e == oatpp::data::mapping::type::EnumInterpreterError::OK);
auto interValue = inter.staticCast<oatpp::String>();
OATPP_ASSERT(interValue == "name-1");
oatpp::Void voidValue = oatpp::Enum<Enum2>::AsString::Interpreter::fromInterpretation(interValue, e);
OATPP_ASSERT(voidValue.valueType == oatpp::Enum<Enum2>::AsString::Class::getType());
OATPP_ASSERT(voidValue.getValueType() == oatpp::Enum<Enum2>::AsString::Class::getType());
OATPP_ASSERT(e == oatpp::data::mapping::type::EnumInterpreterError::OK);
auto value = voidValue.staticCast<oatpp::Enum<Enum2>::AsString>();
@ -185,14 +185,14 @@ void EnumTest::onRun() {
OATPP_LOGI(TAG, "Test Interpreter AsNumber...");
oatpp::data::mapping::type::EnumInterpreterError e = oatpp::data::mapping::type::EnumInterpreterError::OK;
auto inter = oatpp::Enum<Enum2>::AsNumber::Interpreter::toInterpretation(oatpp::Enum<Enum2>::AsNumber(Enum2::NAME_1), e);
OATPP_ASSERT(inter.valueType == oatpp::Int32::Class::getType());
OATPP_ASSERT(inter.getValueType() == oatpp::Int32::Class::getType());
OATPP_ASSERT(e == oatpp::data::mapping::type::EnumInterpreterError::OK);
auto interValue = inter.staticCast<oatpp::Int32>();
OATPP_ASSERT(interValue == static_cast<v_int32>(Enum2::NAME_1));
oatpp::Void voidValue = oatpp::Enum<Enum2>::AsNumber::Interpreter::fromInterpretation(interValue, e);
OATPP_ASSERT(voidValue.valueType == oatpp::Enum<Enum2>::AsNumber::Class::getType());
OATPP_ASSERT(voidValue.getValueType() == oatpp::Enum<Enum2>::AsNumber::Class::getType());
OATPP_ASSERT(e == oatpp::data::mapping::type::EnumInterpreterError::OK);
auto value = voidValue.staticCast<oatpp::Enum<Enum2>::AsNumber>();
@ -220,8 +220,8 @@ void EnumTest::onRun() {
OATPP_ASSERT(e1 == e4);
OATPP_ASSERT(e4 == e1);
OATPP_ASSERT(e1.valueType != e4.valueType); // Types are not equal because interpreters are different
OATPP_ASSERT(e1.valueType->classId.id == e4.valueType->classId.id); // But classId is the same
OATPP_ASSERT(e1.getValueType() != e4.getValueType()); // Types are not equal because interpreters are different
OATPP_ASSERT(e1.getValueType()->classId.id == e4.getValueType()->classId.id); // But classId is the same
OATPP_LOGI(TAG, "OK");
}
@ -251,15 +251,15 @@ void EnumTest::onRun() {
oatpp::Enum<Enum2>::AsNumber e2(Enum2::NAME_1);
Enum2 ve;
OATPP_ASSERT(e1.valueType == oatpp::Enum<Enum2>::AsString::Class::getType());
OATPP_ASSERT(e2.valueType == oatpp::Enum<Enum2>::AsNumber::Class::getType());
OATPP_ASSERT(e1.valueType != e2.valueType);
OATPP_ASSERT(e1.getValueType() == oatpp::Enum<Enum2>::AsString::Class::getType());
OATPP_ASSERT(e2.getValueType() == oatpp::Enum<Enum2>::AsNumber::Class::getType());
OATPP_ASSERT(e1.getValueType() != e2.getValueType());
e1 = e2;
OATPP_ASSERT(e1.valueType == oatpp::Enum<Enum2>::AsString::Class::getType());
OATPP_ASSERT(e2.valueType == oatpp::Enum<Enum2>::AsNumber::Class::getType());
OATPP_ASSERT(e1.valueType != e2.valueType);
OATPP_ASSERT(e1.getValueType() == oatpp::Enum<Enum2>::AsString::Class::getType());
OATPP_ASSERT(e2.getValueType() == oatpp::Enum<Enum2>::AsNumber::Class::getType());
OATPP_ASSERT(e1.getValueType() != e2.getValueType());
OATPP_ASSERT(e1 == e2);
OATPP_ASSERT(e2 == e1);

View File

@ -203,7 +203,7 @@ void InterpretationTest::onRun() {
auto v = tr.resolveObjectPropertyValue(l, {"p1", "x"}, cache);
OATPP_ASSERT(v);
OATPP_ASSERT(v.valueType == oatpp::Int32::Class::getType());
OATPP_ASSERT(v.getValueType() == oatpp::Int32::Class::getType());
OATPP_ASSERT(v.staticCast<oatpp::Int32>() == 1);
}
@ -215,7 +215,7 @@ void InterpretationTest::onRun() {
auto v = tr.resolveObjectPropertyValue(l, {"p1", "y"}, cache);
OATPP_ASSERT(v);
OATPP_ASSERT(v.valueType == oatpp::Int32::Class::getType());
OATPP_ASSERT(v.getValueType() == oatpp::Int32::Class::getType());
OATPP_ASSERT(v.staticCast<oatpp::Int32>() == 2);
}
@ -227,7 +227,7 @@ void InterpretationTest::onRun() {
auto v = tr.resolveObjectPropertyValue(l, {"p1", "z"}, cache);
OATPP_ASSERT(v);
OATPP_ASSERT(v.valueType == oatpp::Int32::Class::getType());
OATPP_ASSERT(v.getValueType() == oatpp::Int32::Class::getType());
OATPP_ASSERT(v.staticCast<oatpp::Int32>() == 3);
}

View File

@ -38,9 +38,9 @@ void ListTest::onRun() {
OATPP_ASSERT(list == nullptr);
OATPP_ASSERT(list.get() == nullptr);
OATPP_ASSERT(list.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id);
OATPP_ASSERT(list.valueType->params.size() == 1);
OATPP_ASSERT(list.valueType->params.front() == oatpp::String::Class::getType());
OATPP_ASSERT(list.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id);
OATPP_ASSERT(list.getValueType()->params.size() == 1);
OATPP_ASSERT(list.getValueType()->params.front() == oatpp::String::Class::getType());
OATPP_LOGI(TAG, "OK");
}
@ -53,9 +53,9 @@ void ListTest::onRun() {
OATPP_ASSERT(list->size() == 0);
OATPP_ASSERT(list.get() != nullptr);
OATPP_ASSERT(list.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id);
OATPP_ASSERT(list.valueType->params.size() == 1);
OATPP_ASSERT(list.valueType->params.front() == oatpp::String::Class::getType());
OATPP_ASSERT(list.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id);
OATPP_ASSERT(list.getValueType()->params.size() == 1);
OATPP_ASSERT(list.getValueType()->params.front() == oatpp::String::Class::getType());
OATPP_LOGI(TAG, "OK");
}
@ -68,7 +68,7 @@ void ListTest::onRun() {
OATPP_ASSERT(list->size() == 0);
OATPP_ASSERT(list.get() != nullptr);
OATPP_ASSERT(list.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id);
OATPP_ASSERT(list.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id);
OATPP_LOGI(TAG, "OK");
}
@ -141,7 +141,7 @@ void ListTest::onRun() {
oatpp::List<oatpp::String> list = {"a", "b", "c"};
auto polymorphicDispatcher = static_cast<const typename oatpp::List<oatpp::String>::Class::PolymorphicDispatcher*>(
list.valueType->polymorphicDispatcher
list.getValueType()->polymorphicDispatcher
);
polymorphicDispatcher->addPolymorphicItem(list, oatpp::String("d"));

View File

@ -86,6 +86,14 @@ class DtoC : public DtoA {
};
class DtoD : public DtoA {
DTO_INIT(DtoD, DtoA)
DTO_FIELD(Int32, a) = Int64(64);
};
#include OATPP_CODEGEN_END(DTO)
void runDtoInitializations() {
@ -167,7 +175,7 @@ void ObjectTest::onRun() {
Object<DtoA> a;
OATPP_ASSERT(!a);
OATPP_ASSERT(a == nullptr);
OATPP_ASSERT(a.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractObject::CLASS_ID.id);
OATPP_ASSERT(a.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractObject::CLASS_ID.id);
OATPP_LOGI(TAG, "OK");
}
@ -302,6 +310,13 @@ void ObjectTest::onRun() {
OATPP_LOGI(TAG, "OK");
}
{
auto dto = DtoD::createShared();
OATPP_ASSERT(dto->a.getValueType() == oatpp::Int32::Class::getType());
OATPP_ASSERT(dto->a);
OATPP_ASSERT(dto->a == 64);
}
}
}}}}}}

View File

@ -41,7 +41,7 @@ void ObjectWrapperTest::onRun() {
ObjectWrapper<std::string> pw;
OATPP_ASSERT(!pw);
OATPP_ASSERT(pw == nullptr);
OATPP_ASSERT(pw.valueType == oatpp::data::mapping::type::__class::Void::getType());
OATPP_ASSERT(pw.getValueType() == oatpp::data::mapping::type::__class::Void::getType());
OATPP_LOGI(TAG, "OK");
}
@ -50,7 +50,7 @@ void ObjectWrapperTest::onRun() {
ObjectWrapper<std::string, oatpp::data::mapping::type::__class::String> pw;
OATPP_ASSERT(!pw);
OATPP_ASSERT(pw == nullptr);
OATPP_ASSERT(pw.valueType == oatpp::data::mapping::type::__class::String::getType());
OATPP_ASSERT(pw.getValueType() == oatpp::data::mapping::type::__class::String::getType());
OATPP_LOGI(TAG, "OK");
}
@ -59,7 +59,7 @@ void ObjectWrapperTest::onRun() {
ObjectWrapper<std::string> pw(oatpp::data::mapping::type::__class::String::getType());
OATPP_ASSERT(!pw);
OATPP_ASSERT(pw == nullptr);
OATPP_ASSERT(pw.valueType == oatpp::data::mapping::type::__class::String::getType());
OATPP_ASSERT(pw.getValueType() == oatpp::data::mapping::type::__class::String::getType());
OATPP_LOGI(TAG, "OK");
}
@ -67,7 +67,7 @@ void ObjectWrapperTest::onRun() {
OATPP_LOGI(TAG, "Check valueType is assigned from copy constructor...");
ObjectWrapper<std::string> pw1(oatpp::data::mapping::type::__class::String::getType());
ObjectWrapper<std::string> pw2(pw1);
OATPP_ASSERT(pw2.valueType == oatpp::data::mapping::type::__class::String::getType());
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::String::getType());
OATPP_LOGI(TAG, "OK");
}
@ -75,7 +75,7 @@ void ObjectWrapperTest::onRun() {
OATPP_LOGI(TAG, "Check valueType is assigned from move constructor...");
ObjectWrapper<std::string> pw1(oatpp::data::mapping::type::__class::String::getType());
ObjectWrapper<std::string> pw2(std::move(pw1));
OATPP_ASSERT(pw2.valueType == oatpp::data::mapping::type::__class::String::getType());
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::String::getType());
OATPP_LOGI(TAG, "OK");
}
@ -84,7 +84,7 @@ void ObjectWrapperTest::onRun() {
ObjectWrapper<std::string> pw1(oatpp::data::mapping::type::__class::String::getType());
ObjectWrapper<std::string> pw2;
pw2 = pw1;
OATPP_ASSERT(pw2.valueType == oatpp::data::mapping::type::__class::Void::getType());
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::Void::getType());
OATPP_LOGI(TAG, "OK");
}
@ -93,7 +93,7 @@ void ObjectWrapperTest::onRun() {
ObjectWrapper<std::string> pw1(oatpp::data::mapping::type::__class::String::getType());
ObjectWrapper<std::string> pw2;
pw2 = std::move(pw1);
OATPP_ASSERT(pw2.valueType == oatpp::data::mapping::type::__class::Void::getType());
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::Void::getType());
OATPP_LOGI(TAG, "OK");
}
@ -102,12 +102,12 @@ void ObjectWrapperTest::onRun() {
ObjectWrapper<std::string> pw1;
OATPP_ASSERT(!pw1);
OATPP_ASSERT(pw1 == nullptr);
OATPP_ASSERT(pw1.valueType == oatpp::data::mapping::type::__class::Void::getType());
OATPP_ASSERT(pw1.getValueType() == oatpp::data::mapping::type::__class::Void::getType());
ObjectWrapper<std::string> pw2 = std::make_shared<std::string>("Hello!");
OATPP_ASSERT(pw2);
OATPP_ASSERT(pw2 != nullptr);
OATPP_ASSERT(pw2.valueType == oatpp::data::mapping::type::__class::Void::getType());
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::Void::getType());
pw1 = pw2;
@ -127,12 +127,12 @@ void ObjectWrapperTest::onRun() {
ObjectWrapper<std::string, oatpp::data::mapping::type::__class::String> pw1(std::make_shared<std::string>("Hello!"));
OATPP_ASSERT(pw1);
OATPP_ASSERT(pw1 != nullptr);
OATPP_ASSERT(pw1.valueType == oatpp::data::mapping::type::__class::String::getType());
OATPP_ASSERT(pw1.getValueType() == oatpp::data::mapping::type::__class::String::getType());
ObjectWrapper<std::string, oatpp::data::mapping::type::__class::String> pw2(std::make_shared<std::string>("Hello!"));
OATPP_ASSERT(pw2);
OATPP_ASSERT(pw2 != nullptr);
OATPP_ASSERT(pw2.valueType == oatpp::data::mapping::type::__class::String::getType());
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::String::getType());
OATPP_ASSERT(pw1 != pw2);
OATPP_ASSERT(pw1.get() != pw2.get());
@ -144,12 +144,12 @@ void ObjectWrapperTest::onRun() {
ObjectWrapper<std::string> pw1;
OATPP_ASSERT(!pw1);
OATPP_ASSERT(pw1 == nullptr);
OATPP_ASSERT(pw1.valueType == oatpp::data::mapping::type::__class::Void::getType());
OATPP_ASSERT(pw1.getValueType() == oatpp::data::mapping::type::__class::Void::getType());
ObjectWrapper<std::string> pw2 = std::make_shared<std::string>("Hello!");
OATPP_ASSERT(pw2);
OATPP_ASSERT(pw2 != nullptr);
OATPP_ASSERT(pw2.valueType == oatpp::data::mapping::type::__class::Void::getType());
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::Void::getType());
pw1 = std::move(pw2);
@ -164,6 +164,25 @@ void ObjectWrapperTest::onRun() {
OATPP_LOGI(TAG, "OK");
}
{
OATPP_LOGI(TAG, "Check oatpp::Void type reassigned");
oatpp::Void v;
v = oatpp::String("test");
OATPP_ASSERT(v.getValueType() == oatpp::String::Class::getType());
v = oatpp::Int32(32);
OATPP_ASSERT(v.getValueType() == oatpp::Int32::Class::getType());
oatpp::Int32 i = v.staticCast<oatpp::Int32>();
OATPP_ASSERT(i.getValueType() == oatpp::Int32::Class::getType());
OATPP_ASSERT(i == 32);
}
}
}}}}}}

View File

@ -38,9 +38,9 @@ void PairListTest::onRun() {
OATPP_ASSERT(map == nullptr);
OATPP_ASSERT(map.get() == nullptr);
OATPP_ASSERT(map.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractPairList::CLASS_ID.id);
OATPP_ASSERT(map.valueType->params.size() == 2);
auto it = map.valueType->params.begin();
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractPairList::CLASS_ID.id);
OATPP_ASSERT(map.getValueType()->params.size() == 2);
auto it = map.getValueType()->params.begin();
OATPP_ASSERT(*it++ == oatpp::String::Class::getType());
OATPP_ASSERT(*it++ == oatpp::String::Class::getType());
OATPP_LOGI(TAG, "OK");
@ -55,9 +55,9 @@ void PairListTest::onRun() {
OATPP_ASSERT(map->size() == 0);
OATPP_ASSERT(map.get() != nullptr);
OATPP_ASSERT(map.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractPairList::CLASS_ID.id);
OATPP_ASSERT(map.valueType->params.size() == 2);
auto it = map.valueType->params.begin();
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractPairList::CLASS_ID.id);
OATPP_ASSERT(map.getValueType()->params.size() == 2);
auto it = map.getValueType()->params.begin();
OATPP_ASSERT(*it++ == oatpp::String::Class::getType());
OATPP_ASSERT(*it++ == oatpp::String::Class::getType());
OATPP_LOGI(TAG, "OK");
@ -72,7 +72,7 @@ void PairListTest::onRun() {
OATPP_ASSERT(map->size() == 0);
OATPP_ASSERT(map.get() != nullptr);
OATPP_ASSERT(map.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractPairList::CLASS_ID.id);
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractPairList::CLASS_ID.id);
OATPP_LOGI(TAG, "OK");
}
@ -149,7 +149,7 @@ void PairListTest::onRun() {
oatpp::Fields<String> map = {{"key1", "a"}, {"key2", "b"}, {"key3", "c"}};
auto polymorphicDispatcher = static_cast<const typename oatpp::Fields<String>::Class::PolymorphicDispatcher*>(
map.valueType->polymorphicDispatcher
map.getValueType()->polymorphicDispatcher
);
polymorphicDispatcher->addPolymorphicItem(map, oatpp::String("key1"), oatpp::String("d"));

View File

@ -33,7 +33,7 @@ namespace {
template<class T>
void checkHash(const T& val) {
auto h = std::hash<T>{}(val);
OATPP_LOGI("HASH", "type='%s', hash=%llu", val.valueType->classId.name, h);
OATPP_LOGI("HASH", "type='%s', hash=%llu", val.getValueType()->classId.name, h);
}
}
@ -59,7 +59,7 @@ void PrimitiveTest::onRun() {
oatpp::Int32 i;
OATPP_ASSERT(!i);
OATPP_ASSERT(i == nullptr);
OATPP_ASSERT(i.valueType == oatpp::Int32::Class::getType());
OATPP_ASSERT(i.getValueType() == oatpp::Int32::Class::getType());
OATPP_LOGI(TAG, "OK");
}
@ -69,7 +69,7 @@ void PrimitiveTest::onRun() {
OATPP_ASSERT(i);
OATPP_ASSERT(i != nullptr);
OATPP_ASSERT(i == 0);
OATPP_ASSERT(i.valueType == oatpp::Int32::Class::getType());
OATPP_ASSERT(i.getValueType() == oatpp::Int32::Class::getType());
OATPP_LOGI(TAG, "OK");
}
@ -79,7 +79,7 @@ void PrimitiveTest::onRun() {
OATPP_ASSERT(i);
OATPP_ASSERT(i != nullptr);
OATPP_ASSERT(i == 0);
OATPP_ASSERT(i.valueType == oatpp::Int32::Class::getType());
OATPP_ASSERT(i.getValueType() == oatpp::Int32::Class::getType());
OATPP_LOGI(TAG, "OK");
}

View File

@ -43,7 +43,7 @@ void StringTest::onRun() {
OATPP_ASSERT(!s);
OATPP_ASSERT(s == nullptr);
OATPP_ASSERT(s == (const char*) nullptr);
OATPP_ASSERT(s.valueType == oatpp::String::Class::getType());
OATPP_ASSERT(s.getValueType() == oatpp::String::Class::getType());
OATPP_LOGI(TAG, "OK");
}
@ -53,7 +53,7 @@ void StringTest::onRun() {
OATPP_ASSERT(!s);
OATPP_ASSERT(s == nullptr);
OATPP_ASSERT(s == (const char*) nullptr);
OATPP_ASSERT(s.valueType == oatpp::String::Class::getType());
OATPP_ASSERT(s.getValueType() == oatpp::String::Class::getType());
OATPP_LOGI(TAG, "OK");
}

View File

@ -68,53 +68,53 @@ void TypeTest::onRun() {
auto obj = TestDto::createShared();
OATPP_LOGV(TAG, "type: '%s'", obj->field_string.valueType->classId.name);
OATPP_ASSERT(obj->field_string.valueType->classId.id == oatpp::data::mapping::type::__class::String::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_string.getValueType()->classId.name);
OATPP_ASSERT(obj->field_string.getValueType()->classId.id == oatpp::data::mapping::type::__class::String::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_int8.valueType->classId.name);
OATPP_ASSERT(obj->field_int8.valueType->classId.id == oatpp::data::mapping::type::__class::Int8::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_int8.getValueType()->classId.name);
OATPP_ASSERT(obj->field_int8.getValueType()->classId.id == oatpp::data::mapping::type::__class::Int8::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_int16.valueType->classId.name);
OATPP_ASSERT(obj->field_int16.valueType->classId.id == oatpp::data::mapping::type::__class::Int16::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_int16.getValueType()->classId.name);
OATPP_ASSERT(obj->field_int16.getValueType()->classId.id == oatpp::data::mapping::type::__class::Int16::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_int32.valueType->classId.name);
OATPP_ASSERT(obj->field_int32.valueType->classId.id == oatpp::data::mapping::type::__class::Int32::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_int32.getValueType()->classId.name);
OATPP_ASSERT(obj->field_int32.getValueType()->classId.id == oatpp::data::mapping::type::__class::Int32::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_int64.valueType->classId.name);
OATPP_ASSERT(obj->field_int64.valueType->classId.id == oatpp::data::mapping::type::__class::Int64::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_int64.getValueType()->classId.name);
OATPP_ASSERT(obj->field_int64.getValueType()->classId.id == oatpp::data::mapping::type::__class::Int64::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_float32.valueType->classId.name);
OATPP_ASSERT(obj->field_float32.valueType->classId.id == oatpp::data::mapping::type::__class::Float32::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_float32.getValueType()->classId.name);
OATPP_ASSERT(obj->field_float32.getValueType()->classId.id == oatpp::data::mapping::type::__class::Float32::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_float64.valueType->classId.name);
OATPP_ASSERT(obj->field_float64.valueType->classId.id == oatpp::data::mapping::type::__class::Float64::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_float64.getValueType()->classId.name);
OATPP_ASSERT(obj->field_float64.getValueType()->classId.id == oatpp::data::mapping::type::__class::Float64::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_boolean.valueType->classId.name);
OATPP_ASSERT(obj->field_boolean.valueType->classId.id == oatpp::data::mapping::type::__class::Boolean::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_boolean.getValueType()->classId.name);
OATPP_ASSERT(obj->field_boolean.getValueType()->classId.id == oatpp::data::mapping::type::__class::Boolean::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_string.valueType->classId.name);
OATPP_ASSERT(obj->field_list_string.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_string.getValueType()->classId.name);
OATPP_ASSERT(obj->field_list_string.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_int32.valueType->classId.name);
OATPP_ASSERT(obj->field_list_int32.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_int32.getValueType()->classId.name);
OATPP_ASSERT(obj->field_list_int32.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_int64.valueType->classId.name);
OATPP_ASSERT(obj->field_list_int64.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_int64.getValueType()->classId.name);
OATPP_ASSERT(obj->field_list_int64.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_float32.valueType->classId.name);
OATPP_ASSERT(obj->field_list_float32.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_float32.getValueType()->classId.name);
OATPP_ASSERT(obj->field_list_float32.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_float64.valueType->classId.name);
OATPP_ASSERT(obj->field_list_float64.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_float64.getValueType()->classId.name);
OATPP_ASSERT(obj->field_list_float64.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_boolean.valueType->classId.name);
OATPP_ASSERT(obj->field_list_boolean.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_boolean.getValueType()->classId.name);
OATPP_ASSERT(obj->field_list_boolean.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_map_string_string.valueType->classId.name);
OATPP_ASSERT(obj->field_map_string_string.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractPairList::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->field_map_string_string.getValueType()->classId.name);
OATPP_ASSERT(obj->field_map_string_string.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractPairList::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->obj1.valueType->classId.name);
OATPP_ASSERT(obj->obj1.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractObject::CLASS_ID.id);
OATPP_LOGV(TAG, "type: '%s'", obj->obj1.getValueType()->classId.name);
OATPP_ASSERT(obj->obj1.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractObject::CLASS_ID.id);
}

View File

@ -38,9 +38,9 @@ void UnorderedMapTest::onRun() {
OATPP_ASSERT(map == nullptr);
OATPP_ASSERT(map.get() == nullptr);
OATPP_ASSERT(map.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedMap::CLASS_ID.id);
OATPP_ASSERT(map.valueType->params.size() == 2);
auto it = map.valueType->params.begin();
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedMap::CLASS_ID.id);
OATPP_ASSERT(map.getValueType()->params.size() == 2);
auto it = map.getValueType()->params.begin();
OATPP_ASSERT(*it++ == oatpp::String::Class::getType());
OATPP_ASSERT(*it++ == oatpp::String::Class::getType());
OATPP_LOGI(TAG, "OK");
@ -55,9 +55,9 @@ void UnorderedMapTest::onRun() {
OATPP_ASSERT(map->size() == 0);
OATPP_ASSERT(map.get() != nullptr);
OATPP_ASSERT(map.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedMap::CLASS_ID.id);
OATPP_ASSERT(map.valueType->params.size() == 2);
auto it = map.valueType->params.begin();
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedMap::CLASS_ID.id);
OATPP_ASSERT(map.getValueType()->params.size() == 2);
auto it = map.getValueType()->params.begin();
OATPP_ASSERT(*it++ == oatpp::String::Class::getType());
OATPP_ASSERT(*it++ == oatpp::String::Class::getType());
OATPP_LOGI(TAG, "OK");
@ -72,7 +72,7 @@ void UnorderedMapTest::onRun() {
OATPP_ASSERT(map->size() == 0);
OATPP_ASSERT(map.get() != nullptr);
OATPP_ASSERT(map.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedMap::CLASS_ID.id);
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedMap::CLASS_ID.id);
OATPP_LOGI(TAG, "OK");
}
@ -145,7 +145,7 @@ void UnorderedMapTest::onRun() {
oatpp::UnorderedFields<String> map = {{"key1", "a"}, {"key2", "b"}, {"key3", "c"}};
auto polymorphicDispatcher = static_cast<const typename oatpp::UnorderedFields<String>::Class::PolymorphicDispatcher*>(
map.valueType->polymorphicDispatcher
map.getValueType()->polymorphicDispatcher
);
polymorphicDispatcher->addPolymorphicItem(map, oatpp::String("key1"), oatpp::String("d"));

View File

@ -39,9 +39,9 @@ void UnorderedSetTest::onRun() {
OATPP_ASSERT(set == nullptr);
OATPP_ASSERT(set.get() == nullptr);
OATPP_ASSERT(set.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedSet::CLASS_ID.id);
OATPP_ASSERT(set.valueType->params.size() == 1);
OATPP_ASSERT(set.valueType->params.front() == oatpp::String::Class::getType());
OATPP_ASSERT(set.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedSet::CLASS_ID.id);
OATPP_ASSERT(set.getValueType()->params.size() == 1);
OATPP_ASSERT(set.getValueType()->params.front() == oatpp::String::Class::getType());
OATPP_LOGI(TAG, "OK");
}
@ -54,9 +54,9 @@ void UnorderedSetTest::onRun() {
OATPP_ASSERT(set->size() == 0);
OATPP_ASSERT(set.get() != nullptr);
OATPP_ASSERT(set.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedSet::CLASS_ID.id);
OATPP_ASSERT(set.valueType->params.size() == 1);
OATPP_ASSERT(set.valueType->params.front() == oatpp::String::Class::getType());
OATPP_ASSERT(set.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedSet::CLASS_ID.id);
OATPP_ASSERT(set.getValueType()->params.size() == 1);
OATPP_ASSERT(set.getValueType()->params.front() == oatpp::String::Class::getType());
OATPP_LOGI(TAG, "OK");
}
@ -69,7 +69,7 @@ void UnorderedSetTest::onRun() {
OATPP_ASSERT(set->size() == 0);
OATPP_ASSERT(set.get() != nullptr);
OATPP_ASSERT(set.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedSet::CLASS_ID.id);
OATPP_ASSERT(set.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedSet::CLASS_ID.id);
OATPP_LOGI(TAG, "OK");
}
@ -121,7 +121,7 @@ void UnorderedSetTest::onRun() {
oatpp::UnorderedSet<oatpp::String> set = {"a", "b", "c"};
auto polymorphicDispatcher = static_cast<const typename oatpp::UnorderedSet<oatpp::String>::Class::PolymorphicDispatcher*>(
set.valueType->polymorphicDispatcher
set.getValueType()->polymorphicDispatcher
);
polymorphicDispatcher->addPolymorphicItem(set, oatpp::String("a"));

View File

@ -38,9 +38,9 @@ void VectorTest::onRun() {
OATPP_ASSERT(vector == nullptr);
OATPP_ASSERT(vector.get() == nullptr);
OATPP_ASSERT(vector.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractVector::CLASS_ID.id);
OATPP_ASSERT(vector.valueType->params.size() == 1);
OATPP_ASSERT(vector.valueType->params.front() == oatpp::String::Class::getType());
OATPP_ASSERT(vector.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractVector::CLASS_ID.id);
OATPP_ASSERT(vector.getValueType()->params.size() == 1);
OATPP_ASSERT(vector.getValueType()->params.front() == oatpp::String::Class::getType());
OATPP_LOGI(TAG, "OK");
}
@ -53,9 +53,9 @@ void VectorTest::onRun() {
OATPP_ASSERT(vector->size() == 0);
OATPP_ASSERT(vector.get() != nullptr);
OATPP_ASSERT(vector.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractVector::CLASS_ID.id);
OATPP_ASSERT(vector.valueType->params.size() == 1);
OATPP_ASSERT(vector.valueType->params.front() == oatpp::String::Class::getType());
OATPP_ASSERT(vector.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractVector::CLASS_ID.id);
OATPP_ASSERT(vector.getValueType()->params.size() == 1);
OATPP_ASSERT(vector.getValueType()->params.front() == oatpp::String::Class::getType());
OATPP_LOGI(TAG, "OK");
}
@ -68,7 +68,7 @@ void VectorTest::onRun() {
OATPP_ASSERT(vector->size() == 0);
OATPP_ASSERT(vector.get() != nullptr);
OATPP_ASSERT(vector.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractVector::CLASS_ID.id);
OATPP_ASSERT(vector.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractVector::CLASS_ID.id);
OATPP_LOGI(TAG, "OK");
}
@ -141,7 +141,7 @@ void VectorTest::onRun() {
oatpp::Vector<oatpp::String> vector = {"a", "b", "c"};
auto polymorphicDispatcher = static_cast<const typename oatpp::Vector<oatpp::String>::Class::PolymorphicDispatcher*>(
vector.valueType->polymorphicDispatcher
vector.getValueType()->polymorphicDispatcher
);
polymorphicDispatcher->addPolymorphicItem(vector, oatpp::String("d"));