mirror of
https://gitee.com/zyjblog/oatpp.git
synced 2024-12-21 16:15:13 +08:00
refactor: move oatpp/data/mapping/type/* --> oatpp/data/type/*
This commit is contained in:
parent
bdcad18ddb
commit
8ae59cdba1
@ -69,14 +69,16 @@ OATPP_ASSERT(decoded == data)
|
||||
| `oatpp/core/concurrency/*` | `oatpp/concurrency/*` |
|
||||
| `oatpp/core/provider/*` | `oatpp/provider/*` |
|
||||
| `oatpp/core/data/*` | `oatpp/data/*` |
|
||||
| `oatpp/core/parser/*` | `oatpp/utils/parser*` |
|
||||
| `oatpp/core/parser/*` | `oatpp/utils/parser/*` |
|
||||
| `oatpp/data/mapping/type/*` | `oatpp/data/type/*` |
|
||||
|
||||
### Namespaces
|
||||
|
||||
| old namespace | new namespace |
|
||||
|-----------------------------------|----------------------|
|
||||
| `oatpp::parser::json::*` | `oatpp::json::*` |
|
||||
| `oatpp::parser::json::mapping::*` | `oatpp::json::*` |
|
||||
| `oatpp::algorithm::CRC` | `oatpp::utils::CRC32`|
|
||||
| old namespace | new namespace |
|
||||
|-----------------------------------|------------------------|
|
||||
| `oatpp::parser::json::*` | `oatpp::json::*` |
|
||||
| `oatpp::parser::json::mapping::*` | `oatpp::json::*` |
|
||||
| `oatpp::algorithm::CRC` | `oatpp::utils::CRC32` |
|
||||
| `oatpp::data::mapping::type::*` | `oatpp::data::type::*` |
|
||||
|
||||
|
||||
|
@ -78,28 +78,6 @@ add_library(oatpp
|
||||
oatpp/data/mapping/TreeToObjectMapper.hpp
|
||||
oatpp/data/mapping/TypeResolver.cpp
|
||||
oatpp/data/mapping/TypeResolver.hpp
|
||||
oatpp/data/mapping/type/Any.cpp
|
||||
oatpp/data/mapping/type/Any.hpp
|
||||
oatpp/data/mapping/type/Collection.hpp
|
||||
oatpp/data/mapping/type/Enum.cpp
|
||||
oatpp/data/mapping/type/Enum.hpp
|
||||
oatpp/data/mapping/type/List.cpp
|
||||
oatpp/data/mapping/type/List.hpp
|
||||
oatpp/data/mapping/type/Map.hpp
|
||||
oatpp/data/mapping/type/Object.cpp
|
||||
oatpp/data/mapping/type/Object.hpp
|
||||
oatpp/data/mapping/type/PairList.cpp
|
||||
oatpp/data/mapping/type/PairList.hpp
|
||||
oatpp/data/mapping/type/Primitive.cpp
|
||||
oatpp/data/mapping/type/Primitive.hpp
|
||||
oatpp/data/mapping/type/Type.cpp
|
||||
oatpp/data/mapping/type/Type.hpp
|
||||
oatpp/data/mapping/type/UnorderedMap.cpp
|
||||
oatpp/data/mapping/type/UnorderedMap.hpp
|
||||
oatpp/data/mapping/type/UnorderedSet.cpp
|
||||
oatpp/data/mapping/type/UnorderedSet.hpp
|
||||
oatpp/data/mapping/type/Vector.cpp
|
||||
oatpp/data/mapping/type/Vector.hpp
|
||||
oatpp/data/resource/File.cpp
|
||||
oatpp/data/resource/File.hpp
|
||||
oatpp/data/resource/InMemoryData.cpp
|
||||
@ -122,6 +100,28 @@ add_library(oatpp
|
||||
oatpp/data/stream/Stream.hpp
|
||||
oatpp/data/stream/StreamBufferedProxy.cpp
|
||||
oatpp/data/stream/StreamBufferedProxy.hpp
|
||||
oatpp/data/type/Any.cpp
|
||||
oatpp/data/type/Any.hpp
|
||||
oatpp/data/type/Collection.hpp
|
||||
oatpp/data/type/Enum.cpp
|
||||
oatpp/data/type/Enum.hpp
|
||||
oatpp/data/type/List.cpp
|
||||
oatpp/data/type/List.hpp
|
||||
oatpp/data/type/Map.hpp
|
||||
oatpp/data/type/Object.cpp
|
||||
oatpp/data/type/Object.hpp
|
||||
oatpp/data/type/PairList.cpp
|
||||
oatpp/data/type/PairList.hpp
|
||||
oatpp/data/type/Primitive.cpp
|
||||
oatpp/data/type/Primitive.hpp
|
||||
oatpp/data/type/Type.cpp
|
||||
oatpp/data/type/Type.hpp
|
||||
oatpp/data/type/UnorderedMap.cpp
|
||||
oatpp/data/type/UnorderedMap.hpp
|
||||
oatpp/data/type/UnorderedSet.cpp
|
||||
oatpp/data/type/UnorderedSet.hpp
|
||||
oatpp/data/type/Vector.cpp
|
||||
oatpp/data/type/Vector.hpp
|
||||
oatpp/encoding/Base64.cpp
|
||||
oatpp/encoding/Base64.hpp
|
||||
oatpp/encoding/Hex.cpp
|
||||
|
@ -25,161 +25,161 @@
|
||||
#ifndef oatpp_Types_hpp
|
||||
#define oatpp_Types_hpp
|
||||
|
||||
#include "oatpp/data/mapping/type/Object.hpp"
|
||||
#include "oatpp/data/type/Object.hpp"
|
||||
|
||||
namespace oatpp {
|
||||
|
||||
/**
|
||||
* &id:oatpp::data::mapping::type::Type;.
|
||||
* &id:oatpp::data::type::Type;.
|
||||
*/
|
||||
typedef oatpp::data::mapping::type::Type Type;
|
||||
typedef oatpp::data::type::Type Type;
|
||||
|
||||
/**
|
||||
* &id:oatpp::data::mapping::type::ClassId;.
|
||||
* &id:oatpp::data::type::ClassId;.
|
||||
*/
|
||||
typedef oatpp::data::mapping::type::ClassId ClassId;
|
||||
typedef oatpp::data::type::ClassId ClassId;
|
||||
|
||||
/**
|
||||
* ObjectWrapper.
|
||||
*/
|
||||
template <class T, class Clazz = oatpp::data::mapping::type::__class::Void>
|
||||
using ObjectWrapper = oatpp::data::mapping::type::ObjectWrapper<T, Clazz>;
|
||||
template <class T, class Clazz = oatpp::data::type::__class::Void>
|
||||
using ObjectWrapper = oatpp::data::type::ObjectWrapper<T, Clazz>;
|
||||
|
||||
/**
|
||||
* ObjectWrapper over the `void*`.
|
||||
*/
|
||||
typedef oatpp::data::mapping::type::Void Void;
|
||||
typedef oatpp::data::type::Void Void;
|
||||
|
||||
/**
|
||||
* `Any` - container for mapping-enabled types.
|
||||
* &id:oatpp::data::mapping::type::Any;
|
||||
* &id:oatpp::data::type::Any;
|
||||
*/
|
||||
typedef oatpp::data::mapping::type::Any Any;
|
||||
typedef oatpp::data::type::Any Any;
|
||||
|
||||
/**
|
||||
* Mapping-Enabled String type. &id:oatpp::data::mapping::type::String; <br>
|
||||
* Mapping-Enabled String type. &id:oatpp::data::type::String; <br>
|
||||
* For `oatpp::String` methods see `std::string`
|
||||
*/
|
||||
typedef oatpp::data::mapping::type::String String;
|
||||
typedef oatpp::data::type::String String;
|
||||
|
||||
/**
|
||||
* Mapping-Enabled 8-bits int. Can hold nullptr value. &id:oatpp::data::mapping::type::Int8;
|
||||
* Mapping-Enabled 8-bits int. Can hold nullptr value. &id:oatpp::data::type::Int8;
|
||||
*/
|
||||
typedef oatpp::data::mapping::type::Int8 Int8;
|
||||
typedef oatpp::data::type::Int8 Int8;
|
||||
|
||||
/**
|
||||
* Mapping-Enabled 8-bits unsigned int. Can hold nullptr value. &id:oatpp::data::mapping::type::UInt8;
|
||||
* Mapping-Enabled 8-bits unsigned int. Can hold nullptr value. &id:oatpp::data::type::UInt8;
|
||||
*/
|
||||
typedef oatpp::data::mapping::type::UInt8 UInt8;
|
||||
typedef oatpp::data::type::UInt8 UInt8;
|
||||
|
||||
/**
|
||||
* Mapping-Enabled 16-bits int. Can hold nullptr value. &id:oatpp::data::mapping::type::Int16;
|
||||
* Mapping-Enabled 16-bits int. Can hold nullptr value. &id:oatpp::data::type::Int16;
|
||||
*/
|
||||
typedef oatpp::data::mapping::type::Int16 Int16;
|
||||
typedef oatpp::data::type::Int16 Int16;
|
||||
|
||||
/**
|
||||
* Mapping-Enabled 16-bits unsigned int. Can hold nullptr value. &id:oatpp::data::mapping::type::UInt16;
|
||||
* Mapping-Enabled 16-bits unsigned int. Can hold nullptr value. &id:oatpp::data::type::UInt16;
|
||||
*/
|
||||
typedef oatpp::data::mapping::type::UInt16 UInt16;
|
||||
typedef oatpp::data::type::UInt16 UInt16;
|
||||
|
||||
/**
|
||||
* Mapping-Enabled 32-bits int. Can hold nullptr value. &id:oatpp::data::mapping::type::Int32;
|
||||
* Mapping-Enabled 32-bits int. Can hold nullptr value. &id:oatpp::data::type::Int32;
|
||||
*/
|
||||
typedef oatpp::data::mapping::type::Int32 Int32;
|
||||
typedef oatpp::data::type::Int32 Int32;
|
||||
|
||||
/**
|
||||
* Mapping-Enabled 32-bits unsigned int. Can hold nullptr value. &id:oatpp::data::mapping::type::UInt32;
|
||||
* Mapping-Enabled 32-bits unsigned int. Can hold nullptr value. &id:oatpp::data::type::UInt32;
|
||||
*/
|
||||
typedef oatpp::data::mapping::type::UInt32 UInt32;
|
||||
typedef oatpp::data::type::UInt32 UInt32;
|
||||
|
||||
/**
|
||||
* Mapping-Enabled 64-bits int. Can hold nullptr value. &id:oatpp::data::mapping::type::Int64;
|
||||
* Mapping-Enabled 64-bits int. Can hold nullptr value. &id:oatpp::data::type::Int64;
|
||||
*/
|
||||
typedef oatpp::data::mapping::type::Int64 Int64;
|
||||
typedef oatpp::data::type::Int64 Int64;
|
||||
|
||||
/**
|
||||
* Mapping-Enabled 64-bits unsigned int. Can hold nullptr value. &id:oatpp::data::mapping::type::UInt64;
|
||||
* Mapping-Enabled 64-bits unsigned int. Can hold nullptr value. &id:oatpp::data::type::UInt64;
|
||||
*/
|
||||
typedef oatpp::data::mapping::type::UInt64 UInt64;
|
||||
typedef oatpp::data::type::UInt64 UInt64;
|
||||
|
||||
/**
|
||||
* Mapping-Enabled 32-bits float. Can hold nullptr value. &id:oatpp::data::mapping::type::Float32;
|
||||
* Mapping-Enabled 32-bits float. Can hold nullptr value. &id:oatpp::data::type::Float32;
|
||||
*/
|
||||
typedef oatpp::data::mapping::type::Float32 Float32;
|
||||
typedef oatpp::data::type::Float32 Float32;
|
||||
|
||||
/**
|
||||
* Mapping-Enabled 64-bits float (double). Can hold nullptr value. &id:oatpp::data::mapping::type::Float64;
|
||||
* Mapping-Enabled 64-bits float (double). Can hold nullptr value. &id:oatpp::data::type::Float64;
|
||||
*/
|
||||
typedef oatpp::data::mapping::type::Float64 Float64;
|
||||
typedef oatpp::data::type::Float64 Float64;
|
||||
|
||||
/**
|
||||
* Mapping-Enabled Boolean. Can hold nullptr value. &id:oatpp::data::mapping::type::Boolean;
|
||||
* Mapping-Enabled Boolean. Can hold nullptr value. &id:oatpp::data::type::Boolean;
|
||||
*/
|
||||
typedef oatpp::data::mapping::type::Boolean Boolean;
|
||||
typedef oatpp::data::type::Boolean Boolean;
|
||||
|
||||
/**
|
||||
* Base class for all Object-like Mapping-enabled structures. &id:oatpp::data::mapping::type::BaseObject;
|
||||
* Base class for all Object-like Mapping-enabled structures. &id:oatpp::data::type::BaseObject;
|
||||
*/
|
||||
typedef oatpp::data::mapping::type::BaseObject BaseObject;
|
||||
typedef oatpp::data::type::BaseObject BaseObject;
|
||||
|
||||
/**
|
||||
* Base class for all DTO objects. &id:oatpp::data::mapping::type::DTO;
|
||||
* Base class for all DTO objects. &id:oatpp::data::type::DTO;
|
||||
*/
|
||||
typedef oatpp::data::mapping::type::DTO DTO;
|
||||
typedef oatpp::data::type::DTO DTO;
|
||||
|
||||
/**
|
||||
* Mapping-Enabled DTO Object. &id:oatpp::data::mapping::type::DTOWrapper;
|
||||
* Mapping-Enabled DTO Object. &id:oatpp::data::type::DTOWrapper;
|
||||
*/
|
||||
template <class T>
|
||||
using Object = oatpp::data::mapping::type::DTOWrapper<T>;
|
||||
using Object = oatpp::data::type::DTOWrapper<T>;
|
||||
|
||||
/**
|
||||
* Mapping-Enabled Enum. &id:oatpp::data::mapping::type::Enum;
|
||||
* Mapping-Enabled Enum. &id:oatpp::data::type::Enum;
|
||||
*/
|
||||
template <class T>
|
||||
using Enum = oatpp::data::mapping::type::Enum<T>;
|
||||
using Enum = oatpp::data::type::Enum<T>;
|
||||
|
||||
/**
|
||||
* Mapping-Enabled Vector. &id:oatpp::data::mapping::type::Vector;
|
||||
* Mapping-Enabled Vector. &id:oatpp::data::type::Vector;
|
||||
*/
|
||||
template <class T>
|
||||
using Vector = oatpp::data::mapping::type::Vector<T>;
|
||||
using Vector = oatpp::data::type::Vector<T>;
|
||||
|
||||
/**
|
||||
* Abstract Vector.
|
||||
*/
|
||||
typedef oatpp::data::mapping::type::AbstractVector AbstractVector;
|
||||
typedef oatpp::data::type::AbstractVector AbstractVector;
|
||||
|
||||
/**
|
||||
* Mapping-Enabled List. &id:oatpp::data::mapping::type::List;
|
||||
* Mapping-Enabled List. &id:oatpp::data::type::List;
|
||||
*/
|
||||
template <class T>
|
||||
using List = oatpp::data::mapping::type::List<T>;
|
||||
using List = oatpp::data::type::List<T>;
|
||||
|
||||
/**
|
||||
* Abstract List.
|
||||
*/
|
||||
typedef oatpp::data::mapping::type::AbstractList AbstractList;
|
||||
typedef oatpp::data::type::AbstractList AbstractList;
|
||||
|
||||
/**
|
||||
* Mapping-Enabled UnorderedSet. &id:oatpp::data::mapping::type::UnorderedSet;
|
||||
* Mapping-Enabled UnorderedSet. &id:oatpp::data::type::UnorderedSet;
|
||||
*/
|
||||
template <class T>
|
||||
using UnorderedSet = oatpp::data::mapping::type::UnorderedSet<T>;
|
||||
using UnorderedSet = oatpp::data::type::UnorderedSet<T>;
|
||||
|
||||
/**
|
||||
* Abstract UnorderedSet.
|
||||
*/
|
||||
typedef oatpp::data::mapping::type::AbstractUnorderedSet AbstractUnorderedSet;
|
||||
typedef oatpp::data::type::AbstractUnorderedSet AbstractUnorderedSet;
|
||||
|
||||
/**
|
||||
* Mapping-Enabled PairList<Key, Value>. &id:oatpp::data::mapping::type::PairList;
|
||||
* Mapping-Enabled PairList<Key, Value>. &id:oatpp::data::type::PairList;
|
||||
*/
|
||||
template <class Key, class Value>
|
||||
using PairList = oatpp::data::mapping::type::PairList<Key, Value>;
|
||||
using PairList = oatpp::data::type::PairList<Key, Value>;
|
||||
|
||||
/**
|
||||
* Mapping-Enabled PairList<String, Value>. &id:oatpp::data::mapping::type::PairList;
|
||||
* Mapping-Enabled PairList<String, Value>. &id:oatpp::data::type::PairList;
|
||||
*/
|
||||
template <class Value>
|
||||
using Fields = oatpp::PairList<String, Value>;
|
||||
@ -190,13 +190,13 @@ namespace oatpp {
|
||||
typedef Fields<oatpp::Void> AbstractFields;
|
||||
|
||||
/**
|
||||
* Mapping-Enabled UnorderedMap<Key, Value>. &id:oatpp::data::mapping::type::UnorderedMap;.
|
||||
* Mapping-Enabled UnorderedMap<Key, Value>. &id:oatpp::data::type::UnorderedMap;.
|
||||
*/
|
||||
template <class Key, class Value>
|
||||
using UnorderedMap = oatpp::data::mapping::type::UnorderedMap<Key, Value>;
|
||||
using UnorderedMap = oatpp::data::type::UnorderedMap<Key, Value>;
|
||||
|
||||
/**
|
||||
* Mapping-Enabled UnorderedMap<String, Value>. &id:oatpp::data::mapping::type::UnorderedMap;.
|
||||
* Mapping-Enabled UnorderedMap<String, Value>. &id:oatpp::data::type::UnorderedMap;.
|
||||
*/
|
||||
template <class Value>
|
||||
using UnorderedFields = oatpp::UnorderedMap<String, Value>;
|
||||
|
@ -38,7 +38,7 @@
|
||||
* *For details see:*
|
||||
* <ul>
|
||||
* <li>[Data Transfer Object(DTO) component](https://oatpp.io/docs/components/dto/)</li>
|
||||
* <li>&id:oatpp::data::mapping::type::Object;</li>
|
||||
* <li>&id:oatpp::data::type::Object;</li>
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
* *For details see:*
|
||||
* <ul>
|
||||
* <li>[Data Transfer Object(DTO) component](https://oatpp.io/docs/components/dto/)</li>
|
||||
* <li>&id:oatpp::data::mapping::type::Object;</li>
|
||||
* <li>&id:oatpp::data::type::Object;</li>
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
|
@ -227,7 +227,7 @@ const auto& OATPP_MACRO_FIRSTARG PARAM_LIST = __request->readBodyToString();
|
||||
#define OATPP_MACRO_API_CONTROLLER_BODY_STRING_INFO(TYPE, PARAM_LIST) \
|
||||
info->body.name = OATPP_MACRO_FIRSTARG_STR PARAM_LIST; \
|
||||
info->body.required = true; \
|
||||
info->body.type = oatpp::data::mapping::type::__class::String::getType(); \
|
||||
info->body.type = oatpp::data::type::__class::String::getType(); \
|
||||
if(getDefaultObjectMapper()) { \
|
||||
info->bodyContentType = getDefaultObjectMapper()->getInfo().http_content_type; \
|
||||
}
|
||||
|
@ -26,17 +26,17 @@
|
||||
// Defaults
|
||||
|
||||
/**
|
||||
* Codegen macro to be used in classes extending &id:oatpp::data::mapping::type::Object; to generate required fields/methods/constructors for DTO object.
|
||||
* Codegen macro to be used in classes extending &id:oatpp::data::type::Object; to generate required fields/methods/constructors for DTO object.
|
||||
* @param TYPE_NAME - name of the DTO class.
|
||||
* @param TYPE_EXTEND - name of the parent DTO class. If DTO extends &id:oatpp::data::mapping::type::Object; TYPE_EXETENDS should be `Object`.
|
||||
* @param TYPE_EXTEND - name of the parent DTO class. If DTO extends &id:oatpp::data::type::Object; TYPE_EXETENDS should be `Object`.
|
||||
*/
|
||||
#define DTO_INIT(TYPE_NAME, TYPE_EXTEND) \
|
||||
template<class __Z__T__PARAM> \
|
||||
friend class oatpp::data::mapping::type::__class::Object; \
|
||||
friend class oatpp::data::type::__class::Object; \
|
||||
public: \
|
||||
typedef TYPE_NAME Z__CLASS; \
|
||||
typedef TYPE_EXTEND Z__CLASS_EXTENDED; \
|
||||
typedef oatpp::data::mapping::type::DTOWrapper<Z__CLASS> Wrapper; \
|
||||
typedef oatpp::data::type::DTOWrapper<Z__CLASS> Wrapper; \
|
||||
private: \
|
||||
\
|
||||
static const oatpp::Type* getParentType() { \
|
||||
@ -47,8 +47,8 @@ private: \
|
||||
return #TYPE_NAME; \
|
||||
} \
|
||||
\
|
||||
static oatpp::data::mapping::type::BaseObject::Properties* Z__CLASS_GET_FIELDS_MAP(){ \
|
||||
static oatpp::data::mapping::type::BaseObject::Properties map = oatpp::data::mapping::type::BaseObject::Properties(); \
|
||||
static oatpp::data::type::BaseObject::Properties* Z__CLASS_GET_FIELDS_MAP(){ \
|
||||
static oatpp::data::type::BaseObject::Properties map = oatpp::data::type::BaseObject::Properties(); \
|
||||
return ↦ \
|
||||
} \
|
||||
\
|
||||
@ -70,9 +70,9 @@ static v_int64 Z__PROPERTY_OFFSET_##NAME() { \
|
||||
return reinterpret_cast<v_int64>(ptr) - reinterpret_cast<v_int64>(buffer); \
|
||||
} \
|
||||
\
|
||||
static oatpp::data::mapping::type::BaseObject::Property* Z__PROPERTY_SINGLETON_##NAME() { \
|
||||
static oatpp::data::mapping::type::BaseObject::Property* property = \
|
||||
new oatpp::data::mapping::type::BaseObject::Property(Z__PROPERTY_OFFSET_##NAME(), \
|
||||
static oatpp::data::type::BaseObject::Property* Z__PROPERTY_SINGLETON_##NAME() { \
|
||||
static oatpp::data::type::BaseObject::Property* property = \
|
||||
new oatpp::data::type::BaseObject::Property(Z__PROPERTY_OFFSET_##NAME(), \
|
||||
#NAME, \
|
||||
TYPE::Class::getType()); \
|
||||
return property; \
|
||||
@ -101,9 +101,9 @@ static v_int64 Z__PROPERTY_OFFSET_##NAME() { \
|
||||
return reinterpret_cast<v_int64>(ptr) - reinterpret_cast<v_int64>(buffer); \
|
||||
} \
|
||||
\
|
||||
static oatpp::data::mapping::type::BaseObject::Property* Z__PROPERTY_SINGLETON_##NAME() { \
|
||||
static oatpp::data::mapping::type::BaseObject::Property* property = \
|
||||
new oatpp::data::mapping::type::BaseObject::Property(Z__PROPERTY_OFFSET_##NAME(), \
|
||||
static oatpp::data::type::BaseObject::Property* Z__PROPERTY_SINGLETON_##NAME() { \
|
||||
static oatpp::data::type::BaseObject::Property* property = \
|
||||
new oatpp::data::type::BaseObject::Property(Z__PROPERTY_OFFSET_##NAME(), \
|
||||
QUALIFIER, \
|
||||
TYPE::Class::getType()); \
|
||||
return property; \
|
||||
@ -142,7 +142,7 @@ static bool Z__PROPERTY_INIT_##NAME(int, ...) { \
|
||||
return true; \
|
||||
} \
|
||||
\
|
||||
static void Z__PROPERTY_ADD_INFO_##NAME(oatpp::data::mapping::type::BaseObject::Property::Info* info)
|
||||
static void Z__PROPERTY_ADD_INFO_##NAME(oatpp::data::type::BaseObject::Property::Info* info)
|
||||
|
||||
|
||||
#define DTO_FIELD_TYPE_SELECTOR(NAME) \
|
||||
|
@ -52,7 +52,7 @@ OATPP_MACRO_EXPAND(OATPP_MACRO_MACRO_SELECTOR(MACRO, (__VA_ARGS__)) (NAME, __VA_
|
||||
|
||||
#define OATPP_MACRO_DTO_ENUM_VALUE_1(NAME, VAL) \
|
||||
{ \
|
||||
oatpp::data::mapping::type::EnumValueInfo<EnumType> entry = {EnumType::NAME, index ++, #NAME, nullptr}; \
|
||||
oatpp::data::type::EnumValueInfo<EnumType> entry = {EnumType::NAME, index ++, #NAME, nullptr}; \
|
||||
info.byName.insert({#NAME, entry}); \
|
||||
info.byValue.insert({static_cast<v_uint64>(EnumType::NAME), entry}); \
|
||||
info.byIndex.push_back(entry); \
|
||||
@ -60,7 +60,7 @@ OATPP_MACRO_EXPAND(OATPP_MACRO_MACRO_SELECTOR(MACRO, (__VA_ARGS__)) (NAME, __VA_
|
||||
|
||||
#define OATPP_MACRO_DTO_ENUM_VALUE_2(NAME, VAL, QUALIFIER) \
|
||||
{ \
|
||||
oatpp::data::mapping::type::EnumValueInfo<EnumType> entry = {EnumType::NAME, index ++, QUALIFIER, nullptr}; \
|
||||
oatpp::data::type::EnumValueInfo<EnumType> entry = {EnumType::NAME, index ++, QUALIFIER, nullptr}; \
|
||||
info.byName.insert({QUALIFIER, entry}); \
|
||||
info.byValue.insert({static_cast<v_uint64>(EnumType::NAME), entry}); \
|
||||
info.byIndex.push_back(entry); \
|
||||
@ -68,7 +68,7 @@ OATPP_MACRO_EXPAND(OATPP_MACRO_MACRO_SELECTOR(MACRO, (__VA_ARGS__)) (NAME, __VA_
|
||||
|
||||
#define OATPP_MACRO_DTO_ENUM_VALUE_3(NAME, VAL, QUALIFIER, DESCRIPTION) \
|
||||
{ \
|
||||
oatpp::data::mapping::type::EnumValueInfo<EnumType> entry = {EnumType::NAME, index ++, QUALIFIER, DESCRIPTION}; \
|
||||
oatpp::data::type::EnumValueInfo<EnumType> entry = {EnumType::NAME, index ++, QUALIFIER, DESCRIPTION}; \
|
||||
info.byName.insert({QUALIFIER, entry}); \
|
||||
info.byValue.insert({static_cast<v_uint64>(EnumType::NAME), entry}); \
|
||||
info.byIndex.push_back(entry); \
|
||||
@ -95,7 +95,7 @@ enum class NAME : ORDINAL_TYPE {}; \
|
||||
\
|
||||
namespace { \
|
||||
\
|
||||
class Z__OATPP_ENUM_META_##NAME : public oatpp::data::mapping::type::EnumMeta<NAME> { \
|
||||
class Z__OATPP_ENUM_META_##NAME : public oatpp::data::type::EnumMeta<NAME> { \
|
||||
private: \
|
||||
\
|
||||
static bool init() { \
|
||||
@ -128,7 +128,7 @@ enum class NAME : ORDINAL_TYPE { \
|
||||
) \
|
||||
}; \
|
||||
\
|
||||
class Z__OATPP_ENUM_META_##NAME : public oatpp::data::mapping::type::EnumMeta<NAME> { \
|
||||
class Z__OATPP_ENUM_META_##NAME : public oatpp::data::type::EnumMeta<NAME> { \
|
||||
private: \
|
||||
\
|
||||
static bool init() { \
|
||||
|
@ -25,8 +25,7 @@
|
||||
#ifndef oatpp_data_mapping_ObjectMapper_hpp
|
||||
#define oatpp_data_mapping_ObjectMapper_hpp
|
||||
|
||||
#include "type/Object.hpp"
|
||||
#include "type/Type.hpp"
|
||||
#include "oatpp/Types.hpp"
|
||||
|
||||
#include "oatpp/data/stream/Stream.hpp"
|
||||
|
||||
@ -153,16 +152,16 @@ public:
|
||||
* @param errorStack - See &id:oatpp::data::mapping::ErrorStack;.
|
||||
* @param variant - Object to serialize.
|
||||
*/
|
||||
virtual void write(data::stream::ConsistentOutputStream* stream, const type::Void& variant, ErrorStack& errorStack) const = 0;
|
||||
virtual void write(data::stream::ConsistentOutputStream* stream, const oatpp::Void& variant, ErrorStack& errorStack) const = 0;
|
||||
|
||||
/**
|
||||
* Deserialize object. Implement this method.
|
||||
* @param caret - &id:oatpp::utils::parser::Caret; over serialized buffer.
|
||||
* @param type - pointer to object type. See &id:oatpp::data::mapping::type::Type;.
|
||||
* @param type - pointer to object type. See &id:oatpp::data::type::Type;.
|
||||
* @param errorStack - See &id:oatpp::data::mapping::ErrorStack;.
|
||||
* @return - deserialized object wrapped in &id:oatpp::Void;.
|
||||
*/
|
||||
virtual mapping::type::Void read(oatpp::utils::parser::Caret& caret, const mapping::type::Type* type, ErrorStack& errorStack) const = 0;
|
||||
virtual oatpp::Void read(oatpp::utils::parser::Caret& caret, const oatpp::Type* type, ErrorStack& errorStack) const = 0;
|
||||
|
||||
/**
|
||||
* Serialize object to String.
|
||||
@ -171,7 +170,7 @@ public:
|
||||
* @throws - &id:oatpp::data::mapping::MappingError;
|
||||
* @throws - depends on implementation.
|
||||
*/
|
||||
oatpp::String writeToString(const type::Void& variant) const;
|
||||
oatpp::String writeToString(const oatpp::Void& variant) const;
|
||||
|
||||
/**
|
||||
* Deserialize object.
|
||||
|
@ -31,40 +31,40 @@ namespace oatpp { namespace data { namespace mapping {
|
||||
|
||||
ObjectToTreeMapper::ObjectToTreeMapper() {
|
||||
|
||||
m_methods.resize(static_cast<size_t>(data::mapping::type::ClassId::getClassCount()), nullptr);
|
||||
m_methods.resize(static_cast<size_t>(data::type::ClassId::getClassCount()), nullptr);
|
||||
|
||||
setMapperMethod(data::mapping::type::__class::String::CLASS_ID, &ObjectToTreeMapper::mapString);
|
||||
setMapperMethod(data::mapping::type::__class::Any::CLASS_ID, &ObjectToTreeMapper::mapAny);
|
||||
setMapperMethod(data::type::__class::String::CLASS_ID, &ObjectToTreeMapper::mapString);
|
||||
setMapperMethod(data::type::__class::Any::CLASS_ID, &ObjectToTreeMapper::mapAny);
|
||||
|
||||
setMapperMethod(data::mapping::type::__class::Int8::CLASS_ID, &ObjectToTreeMapper::mapPrimitive<oatpp::Int8>);
|
||||
setMapperMethod(data::mapping::type::__class::UInt8::CLASS_ID, &ObjectToTreeMapper::mapPrimitive<oatpp::UInt8>);
|
||||
setMapperMethod(data::type::__class::Int8::CLASS_ID, &ObjectToTreeMapper::mapPrimitive<oatpp::Int8>);
|
||||
setMapperMethod(data::type::__class::UInt8::CLASS_ID, &ObjectToTreeMapper::mapPrimitive<oatpp::UInt8>);
|
||||
|
||||
setMapperMethod(data::mapping::type::__class::Int16::CLASS_ID, &ObjectToTreeMapper::mapPrimitive<oatpp::Int16>);
|
||||
setMapperMethod(data::mapping::type::__class::UInt16::CLASS_ID, &ObjectToTreeMapper::mapPrimitive<oatpp::UInt16>);
|
||||
setMapperMethod(data::type::__class::Int16::CLASS_ID, &ObjectToTreeMapper::mapPrimitive<oatpp::Int16>);
|
||||
setMapperMethod(data::type::__class::UInt16::CLASS_ID, &ObjectToTreeMapper::mapPrimitive<oatpp::UInt16>);
|
||||
|
||||
setMapperMethod(data::mapping::type::__class::Int32::CLASS_ID, &ObjectToTreeMapper::mapPrimitive<oatpp::Int32>);
|
||||
setMapperMethod(data::mapping::type::__class::UInt32::CLASS_ID, &ObjectToTreeMapper::mapPrimitive<oatpp::UInt32>);
|
||||
setMapperMethod(data::type::__class::Int32::CLASS_ID, &ObjectToTreeMapper::mapPrimitive<oatpp::Int32>);
|
||||
setMapperMethod(data::type::__class::UInt32::CLASS_ID, &ObjectToTreeMapper::mapPrimitive<oatpp::UInt32>);
|
||||
|
||||
setMapperMethod(data::mapping::type::__class::Int64::CLASS_ID, &ObjectToTreeMapper::mapPrimitive<oatpp::Int64>);
|
||||
setMapperMethod(data::mapping::type::__class::UInt64::CLASS_ID, &ObjectToTreeMapper::mapPrimitive<oatpp::UInt64>);
|
||||
setMapperMethod(data::type::__class::Int64::CLASS_ID, &ObjectToTreeMapper::mapPrimitive<oatpp::Int64>);
|
||||
setMapperMethod(data::type::__class::UInt64::CLASS_ID, &ObjectToTreeMapper::mapPrimitive<oatpp::UInt64>);
|
||||
|
||||
setMapperMethod(data::mapping::type::__class::Float32::CLASS_ID, &ObjectToTreeMapper::mapPrimitive<oatpp::Float32>);
|
||||
setMapperMethod(data::mapping::type::__class::Float64::CLASS_ID, &ObjectToTreeMapper::mapPrimitive<oatpp::Float64>);
|
||||
setMapperMethod(data::mapping::type::__class::Boolean::CLASS_ID, &ObjectToTreeMapper::mapPrimitive<oatpp::Boolean>);
|
||||
setMapperMethod(data::type::__class::Float32::CLASS_ID, &ObjectToTreeMapper::mapPrimitive<oatpp::Float32>);
|
||||
setMapperMethod(data::type::__class::Float64::CLASS_ID, &ObjectToTreeMapper::mapPrimitive<oatpp::Float64>);
|
||||
setMapperMethod(data::type::__class::Boolean::CLASS_ID, &ObjectToTreeMapper::mapPrimitive<oatpp::Boolean>);
|
||||
|
||||
setMapperMethod(data::mapping::type::__class::AbstractObject::CLASS_ID, &ObjectToTreeMapper::mapObject);
|
||||
setMapperMethod(data::mapping::type::__class::AbstractEnum::CLASS_ID, &ObjectToTreeMapper::mapEnum);
|
||||
setMapperMethod(data::type::__class::AbstractObject::CLASS_ID, &ObjectToTreeMapper::mapObject);
|
||||
setMapperMethod(data::type::__class::AbstractEnum::CLASS_ID, &ObjectToTreeMapper::mapEnum);
|
||||
|
||||
setMapperMethod(data::mapping::type::__class::AbstractVector::CLASS_ID, &ObjectToTreeMapper::mapCollection);
|
||||
setMapperMethod(data::mapping::type::__class::AbstractList::CLASS_ID, &ObjectToTreeMapper::mapCollection);
|
||||
setMapperMethod(data::mapping::type::__class::AbstractUnorderedSet::CLASS_ID, &ObjectToTreeMapper::mapCollection);
|
||||
setMapperMethod(data::type::__class::AbstractVector::CLASS_ID, &ObjectToTreeMapper::mapCollection);
|
||||
setMapperMethod(data::type::__class::AbstractList::CLASS_ID, &ObjectToTreeMapper::mapCollection);
|
||||
setMapperMethod(data::type::__class::AbstractUnorderedSet::CLASS_ID, &ObjectToTreeMapper::mapCollection);
|
||||
|
||||
setMapperMethod(data::mapping::type::__class::AbstractPairList::CLASS_ID, &ObjectToTreeMapper::mapMap);
|
||||
setMapperMethod(data::mapping::type::__class::AbstractUnorderedMap::CLASS_ID, &ObjectToTreeMapper::mapMap);
|
||||
setMapperMethod(data::type::__class::AbstractPairList::CLASS_ID, &ObjectToTreeMapper::mapMap);
|
||||
setMapperMethod(data::type::__class::AbstractUnorderedMap::CLASS_ID, &ObjectToTreeMapper::mapMap);
|
||||
|
||||
}
|
||||
|
||||
void ObjectToTreeMapper::setMapperMethod(const data::mapping::type::ClassId& classId, MapperMethod method) {
|
||||
void ObjectToTreeMapper::setMapperMethod(const data::type::ClassId& classId, MapperMethod method) {
|
||||
const auto id = static_cast<v_uint32>(classId.id);
|
||||
if(id >= m_methods.size()) {
|
||||
m_methods.resize(id + 1, nullptr);
|
||||
@ -106,31 +106,31 @@ void ObjectToTreeMapper::mapAny(const ObjectToTreeMapper* mapper, MappingState&
|
||||
state.tree->setNull();
|
||||
return;
|
||||
}
|
||||
auto anyHandle = static_cast<data::mapping::type::AnyHandle*>(polymorph.get());
|
||||
auto anyHandle = static_cast<data::type::AnyHandle*>(polymorph.get());
|
||||
mapper->map(state, oatpp::Void(anyHandle->ptr, anyHandle->type));
|
||||
}
|
||||
|
||||
void ObjectToTreeMapper::mapEnum(const ObjectToTreeMapper* mapper, MappingState& state, const oatpp::Void& polymorph) {
|
||||
|
||||
auto polymorphicDispatcher = static_cast<const data::mapping::type::__class::AbstractEnum::PolymorphicDispatcher*>(
|
||||
auto polymorphicDispatcher = static_cast<const data::type::__class::AbstractEnum::PolymorphicDispatcher*>(
|
||||
polymorph.getValueType()->polymorphicDispatcher
|
||||
);
|
||||
|
||||
data::mapping::type::EnumInterpreterError e = data::mapping::type::EnumInterpreterError::OK;
|
||||
data::type::EnumInterpreterError e = data::type::EnumInterpreterError::OK;
|
||||
mapper->map(state, polymorphicDispatcher->toInterpretation(polymorph, e));
|
||||
|
||||
if(e == data::mapping::type::EnumInterpreterError::OK) {
|
||||
if(e == data::type::EnumInterpreterError::OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch(e) {
|
||||
case data::mapping::type::EnumInterpreterError::CONSTRAINT_NOT_NULL:
|
||||
case data::type::EnumInterpreterError::CONSTRAINT_NOT_NULL:
|
||||
state.errorStack.push("[oatpp::data::mapping::ObjectToTreeMapper::mapEnum()]: Error. Enum constraint violated - 'NotNull'.");
|
||||
break;
|
||||
case data::mapping::type::EnumInterpreterError::OK:
|
||||
case data::mapping::type::EnumInterpreterError::TYPE_MISMATCH_ENUM:
|
||||
case data::mapping::type::EnumInterpreterError::TYPE_MISMATCH_ENUM_VALUE:
|
||||
case data::mapping::type::EnumInterpreterError::ENTRY_NOT_FOUND:
|
||||
case data::type::EnumInterpreterError::OK:
|
||||
case data::type::EnumInterpreterError::TYPE_MISMATCH_ENUM:
|
||||
case data::type::EnumInterpreterError::TYPE_MISMATCH_ENUM_VALUE:
|
||||
case data::type::EnumInterpreterError::ENTRY_NOT_FOUND:
|
||||
default:
|
||||
state.errorStack.push("[oatpp::data::mapping::ObjectToTreeMapper::mapEnum()]: Error. Can't serialize Enum.");
|
||||
}
|
||||
@ -144,7 +144,7 @@ void ObjectToTreeMapper::mapCollection(const ObjectToTreeMapper* mapper, Mapping
|
||||
return;
|
||||
}
|
||||
|
||||
auto dispatcher = static_cast<const data::mapping::type::__class::Collection::PolymorphicDispatcher*>(
|
||||
auto dispatcher = static_cast<const data::type::__class::Collection::PolymorphicDispatcher*>(
|
||||
polymorph.getValueType()->polymorphicDispatcher
|
||||
);
|
||||
|
||||
@ -190,7 +190,7 @@ void ObjectToTreeMapper::mapMap(const ObjectToTreeMapper* mapper, MappingState&
|
||||
return;
|
||||
}
|
||||
|
||||
auto dispatcher = static_cast<const data::mapping::type::__class::Map::PolymorphicDispatcher*>(
|
||||
auto dispatcher = static_cast<const data::type::__class::Map::PolymorphicDispatcher*>(
|
||||
polymorph.getValueType()->polymorphicDispatcher
|
||||
);
|
||||
|
||||
@ -238,7 +238,7 @@ void ObjectToTreeMapper::mapObject(const ObjectToTreeMapper* mapper, MappingStat
|
||||
}
|
||||
|
||||
auto type = polymorph.getValueType();
|
||||
auto dispatcher = static_cast<const oatpp::data::mapping::type::__class::AbstractObject::PolymorphicDispatcher*>(
|
||||
auto dispatcher = static_cast<const oatpp::data::type::__class::AbstractObject::PolymorphicDispatcher*>(
|
||||
type->polymorphicDispatcher
|
||||
);
|
||||
auto fields = dispatcher->getProperties()->getList();
|
||||
|
@ -79,7 +79,7 @@ public:
|
||||
|
||||
ObjectToTreeMapper();
|
||||
|
||||
void setMapperMethod(const data::mapping::type::ClassId& classId, MapperMethod method);
|
||||
void setMapperMethod(const data::type::ClassId& classId, MapperMethod method);
|
||||
|
||||
void map(MappingState& state, const oatpp::Void& polymorph) const;
|
||||
|
||||
|
@ -31,40 +31,40 @@ namespace oatpp { namespace data { namespace mapping {
|
||||
|
||||
TreeToObjectMapper::TreeToObjectMapper() {
|
||||
|
||||
m_methods.resize(static_cast<size_t>(data::mapping::type::ClassId::getClassCount()), nullptr);
|
||||
m_methods.resize(static_cast<size_t>(data::type::ClassId::getClassCount()), nullptr);
|
||||
|
||||
setMapperMethod(data::mapping::type::__class::String::CLASS_ID, &TreeToObjectMapper::mapString);
|
||||
setMapperMethod(data::mapping::type::__class::Any::CLASS_ID, &TreeToObjectMapper::mapAny);
|
||||
setMapperMethod(data::type::__class::String::CLASS_ID, &TreeToObjectMapper::mapString);
|
||||
setMapperMethod(data::type::__class::Any::CLASS_ID, &TreeToObjectMapper::mapAny);
|
||||
|
||||
setMapperMethod(data::mapping::type::__class::Int8::CLASS_ID, &TreeToObjectMapper::mapPrimitive<oatpp::Int8>);
|
||||
setMapperMethod(data::mapping::type::__class::UInt8::CLASS_ID, &TreeToObjectMapper::mapPrimitive<oatpp::UInt8>);
|
||||
setMapperMethod(data::type::__class::Int8::CLASS_ID, &TreeToObjectMapper::mapPrimitive<oatpp::Int8>);
|
||||
setMapperMethod(data::type::__class::UInt8::CLASS_ID, &TreeToObjectMapper::mapPrimitive<oatpp::UInt8>);
|
||||
|
||||
setMapperMethod(data::mapping::type::__class::Int16::CLASS_ID, &TreeToObjectMapper::mapPrimitive<oatpp::Int16>);
|
||||
setMapperMethod(data::mapping::type::__class::UInt16::CLASS_ID, &TreeToObjectMapper::mapPrimitive<oatpp::UInt16>);
|
||||
setMapperMethod(data::type::__class::Int16::CLASS_ID, &TreeToObjectMapper::mapPrimitive<oatpp::Int16>);
|
||||
setMapperMethod(data::type::__class::UInt16::CLASS_ID, &TreeToObjectMapper::mapPrimitive<oatpp::UInt16>);
|
||||
|
||||
setMapperMethod(data::mapping::type::__class::Int32::CLASS_ID, &TreeToObjectMapper::mapPrimitive<oatpp::Int32>);
|
||||
setMapperMethod(data::mapping::type::__class::UInt32::CLASS_ID, &TreeToObjectMapper::mapPrimitive<oatpp::UInt32>);
|
||||
setMapperMethod(data::type::__class::Int32::CLASS_ID, &TreeToObjectMapper::mapPrimitive<oatpp::Int32>);
|
||||
setMapperMethod(data::type::__class::UInt32::CLASS_ID, &TreeToObjectMapper::mapPrimitive<oatpp::UInt32>);
|
||||
|
||||
setMapperMethod(data::mapping::type::__class::Int64::CLASS_ID, &TreeToObjectMapper::mapPrimitive<oatpp::Int64>);
|
||||
setMapperMethod(data::mapping::type::__class::UInt64::CLASS_ID, &TreeToObjectMapper::mapPrimitive<oatpp::UInt64>);
|
||||
setMapperMethod(data::type::__class::Int64::CLASS_ID, &TreeToObjectMapper::mapPrimitive<oatpp::Int64>);
|
||||
setMapperMethod(data::type::__class::UInt64::CLASS_ID, &TreeToObjectMapper::mapPrimitive<oatpp::UInt64>);
|
||||
|
||||
setMapperMethod(data::mapping::type::__class::Float32::CLASS_ID, &TreeToObjectMapper::mapPrimitive<oatpp::Float32>);
|
||||
setMapperMethod(data::mapping::type::__class::Float64::CLASS_ID, &TreeToObjectMapper::mapPrimitive<oatpp::Float64>);
|
||||
setMapperMethod(data::mapping::type::__class::Boolean::CLASS_ID, &TreeToObjectMapper::mapPrimitive<oatpp::Boolean>);
|
||||
setMapperMethod(data::type::__class::Float32::CLASS_ID, &TreeToObjectMapper::mapPrimitive<oatpp::Float32>);
|
||||
setMapperMethod(data::type::__class::Float64::CLASS_ID, &TreeToObjectMapper::mapPrimitive<oatpp::Float64>);
|
||||
setMapperMethod(data::type::__class::Boolean::CLASS_ID, &TreeToObjectMapper::mapPrimitive<oatpp::Boolean>);
|
||||
|
||||
setMapperMethod(data::mapping::type::__class::AbstractObject::CLASS_ID, &TreeToObjectMapper::mapObject);
|
||||
setMapperMethod(data::mapping::type::__class::AbstractEnum::CLASS_ID, &TreeToObjectMapper::mapEnum);
|
||||
setMapperMethod(data::type::__class::AbstractObject::CLASS_ID, &TreeToObjectMapper::mapObject);
|
||||
setMapperMethod(data::type::__class::AbstractEnum::CLASS_ID, &TreeToObjectMapper::mapEnum);
|
||||
|
||||
setMapperMethod(data::mapping::type::__class::AbstractVector::CLASS_ID, &TreeToObjectMapper::mapCollection);
|
||||
setMapperMethod(data::mapping::type::__class::AbstractList::CLASS_ID, &TreeToObjectMapper::mapCollection);
|
||||
setMapperMethod(data::mapping::type::__class::AbstractUnorderedSet::CLASS_ID, &TreeToObjectMapper::mapCollection);
|
||||
setMapperMethod(data::type::__class::AbstractVector::CLASS_ID, &TreeToObjectMapper::mapCollection);
|
||||
setMapperMethod(data::type::__class::AbstractList::CLASS_ID, &TreeToObjectMapper::mapCollection);
|
||||
setMapperMethod(data::type::__class::AbstractUnorderedSet::CLASS_ID, &TreeToObjectMapper::mapCollection);
|
||||
|
||||
setMapperMethod(data::mapping::type::__class::AbstractPairList::CLASS_ID, &TreeToObjectMapper::mapMap);
|
||||
setMapperMethod(data::mapping::type::__class::AbstractUnorderedMap::CLASS_ID, &TreeToObjectMapper::mapMap);
|
||||
setMapperMethod(data::type::__class::AbstractPairList::CLASS_ID, &TreeToObjectMapper::mapMap);
|
||||
setMapperMethod(data::type::__class::AbstractUnorderedMap::CLASS_ID, &TreeToObjectMapper::mapMap);
|
||||
|
||||
}
|
||||
|
||||
void TreeToObjectMapper::setMapperMethod(const data::mapping::type::ClassId& classId, MapperMethod method) {
|
||||
void TreeToObjectMapper::setMapperMethod(const data::type::ClassId& classId, MapperMethod method) {
|
||||
const auto id = static_cast<v_uint32>(classId.id);
|
||||
if(id >= m_methods.size()) {
|
||||
m_methods.resize(id + 1, nullptr);
|
||||
@ -150,7 +150,7 @@ oatpp::Void TreeToObjectMapper::mapAny(const TreeToObjectMapper* mapper, Mapping
|
||||
const Type* const fieldType = guessType(*state.tree);
|
||||
if(fieldType != nullptr) {
|
||||
auto fieldValue = mapper->map(state, fieldType);
|
||||
auto anyHandle = std::make_shared<data::mapping::type::AnyHandle>(fieldValue.getPtr(), fieldValue.getValueType());
|
||||
auto anyHandle = std::make_shared<data::type::AnyHandle>(fieldValue.getPtr(), fieldValue.getValueType());
|
||||
return oatpp::Void(anyHandle, Any::Class::getType());
|
||||
}
|
||||
}
|
||||
@ -159,11 +159,11 @@ oatpp::Void TreeToObjectMapper::mapAny(const TreeToObjectMapper* mapper, Mapping
|
||||
|
||||
oatpp::Void TreeToObjectMapper::mapEnum(const TreeToObjectMapper* mapper, MappingState& state, const Type* type) {
|
||||
|
||||
auto polymorphicDispatcher = static_cast<const data::mapping::type::__class::AbstractEnum::PolymorphicDispatcher*>(
|
||||
auto polymorphicDispatcher = static_cast<const data::type::__class::AbstractEnum::PolymorphicDispatcher*>(
|
||||
type->polymorphicDispatcher
|
||||
);
|
||||
|
||||
data::mapping::type::EnumInterpreterError e = data::mapping::type::EnumInterpreterError::OK;
|
||||
data::type::EnumInterpreterError e = data::type::EnumInterpreterError::OK;
|
||||
const auto& value = mapper->map(state, polymorphicDispatcher->getInterpretationType());
|
||||
if(!state.errorStack.empty()) {
|
||||
state.errorStack.push("[oatpp::data::mapping::TreeToObjectMapper::mapEnum()]");
|
||||
@ -171,18 +171,18 @@ oatpp::Void TreeToObjectMapper::mapEnum(const TreeToObjectMapper* mapper, Mappin
|
||||
}
|
||||
const auto& result = polymorphicDispatcher->fromInterpretation(value, e);
|
||||
|
||||
if(e == data::mapping::type::EnumInterpreterError::OK) {
|
||||
if(e == data::type::EnumInterpreterError::OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
switch(e) {
|
||||
case data::mapping::type::EnumInterpreterError::CONSTRAINT_NOT_NULL:
|
||||
case data::type::EnumInterpreterError::CONSTRAINT_NOT_NULL:
|
||||
state.errorStack.push("[oatpp::data::mapping::TreeToObjectMapper::mapEnum()]: Error. Enum constraint violated - 'NotNull'.");
|
||||
break;
|
||||
case data::mapping::type::EnumInterpreterError::OK:
|
||||
case data::mapping::type::EnumInterpreterError::TYPE_MISMATCH_ENUM:
|
||||
case data::mapping::type::EnumInterpreterError::TYPE_MISMATCH_ENUM_VALUE:
|
||||
case data::mapping::type::EnumInterpreterError::ENTRY_NOT_FOUND:
|
||||
case data::type::EnumInterpreterError::OK:
|
||||
case data::type::EnumInterpreterError::TYPE_MISMATCH_ENUM:
|
||||
case data::type::EnumInterpreterError::TYPE_MISMATCH_ENUM_VALUE:
|
||||
case data::type::EnumInterpreterError::ENTRY_NOT_FOUND:
|
||||
default:
|
||||
state.errorStack.push("[oatpp::data::mapping::TreeToObjectMapper::mapEnum()]: Error. Can't map Enum.");
|
||||
}
|
||||
@ -201,7 +201,7 @@ oatpp::Void TreeToObjectMapper::mapCollection(const TreeToObjectMapper* mapper,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto dispatcher = static_cast<const data::mapping::type::__class::Collection::PolymorphicDispatcher*>(type->polymorphicDispatcher);
|
||||
auto dispatcher = static_cast<const data::type::__class::Collection::PolymorphicDispatcher*>(type->polymorphicDispatcher);
|
||||
auto collection = dispatcher->createObject();
|
||||
|
||||
auto itemType = dispatcher->getItemType();
|
||||
@ -244,7 +244,7 @@ oatpp::Void TreeToObjectMapper::mapMap(const TreeToObjectMapper* mapper, Mapping
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto dispatcher = static_cast<const data::mapping::type::__class::Map::PolymorphicDispatcher*>(type->polymorphicDispatcher);
|
||||
auto dispatcher = static_cast<const data::type::__class::Map::PolymorphicDispatcher*>(type->polymorphicDispatcher);
|
||||
auto map = dispatcher->createObject();
|
||||
|
||||
auto keyType = dispatcher->getKeyType();
|
||||
@ -292,7 +292,7 @@ oatpp::Void TreeToObjectMapper::mapObject(const TreeToObjectMapper* mapper, Mapp
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto dispatcher = static_cast<const oatpp::data::mapping::type::__class::AbstractObject::PolymorphicDispatcher*>(type->polymorphicDispatcher);
|
||||
auto dispatcher = static_cast<const oatpp::data::type::__class::AbstractObject::PolymorphicDispatcher*>(type->polymorphicDispatcher);
|
||||
auto object = dispatcher->createObject();
|
||||
const auto& fieldsMap = dispatcher->getProperties()->getMap();
|
||||
|
||||
|
@ -83,7 +83,7 @@ public:
|
||||
|
||||
TreeToObjectMapper();
|
||||
|
||||
void setMapperMethod(const data::mapping::type::ClassId& classId, MapperMethod method);
|
||||
void setMapperMethod(const data::type::ClassId& classId, MapperMethod method);
|
||||
|
||||
oatpp::Void map(MappingState& state, const Type* type) const;
|
||||
|
||||
|
@ -28,37 +28,37 @@ namespace oatpp { namespace data { namespace mapping {
|
||||
|
||||
TypeResolver::TypeResolver() {
|
||||
|
||||
m_knownClasses.resize(static_cast<size_t>(data::mapping::type::ClassId::getClassCount()), false);
|
||||
m_knownClasses.resize(static_cast<size_t>(data::type::ClassId::getClassCount()), false);
|
||||
|
||||
addKnownClasses({
|
||||
data::mapping::type::__class::String::CLASS_ID,
|
||||
data::mapping::type::__class::Any::CLASS_ID,
|
||||
data::type::__class::String::CLASS_ID,
|
||||
data::type::__class::Any::CLASS_ID,
|
||||
|
||||
data::mapping::type::__class::Int8::CLASS_ID,
|
||||
data::mapping::type::__class::UInt8::CLASS_ID,
|
||||
data::type::__class::Int8::CLASS_ID,
|
||||
data::type::__class::UInt8::CLASS_ID,
|
||||
|
||||
data::mapping::type::__class::Int16::CLASS_ID,
|
||||
data::mapping::type::__class::UInt16::CLASS_ID,
|
||||
data::type::__class::Int16::CLASS_ID,
|
||||
data::type::__class::UInt16::CLASS_ID,
|
||||
|
||||
data::mapping::type::__class::Int32::CLASS_ID,
|
||||
data::mapping::type::__class::UInt32::CLASS_ID,
|
||||
data::type::__class::Int32::CLASS_ID,
|
||||
data::type::__class::UInt32::CLASS_ID,
|
||||
|
||||
data::mapping::type::__class::Int64::CLASS_ID,
|
||||
data::mapping::type::__class::UInt64::CLASS_ID,
|
||||
data::type::__class::Int64::CLASS_ID,
|
||||
data::type::__class::UInt64::CLASS_ID,
|
||||
|
||||
data::mapping::type::__class::Float32::CLASS_ID,
|
||||
data::mapping::type::__class::Float64::CLASS_ID,
|
||||
data::mapping::type::__class::Boolean::CLASS_ID,
|
||||
data::type::__class::Float32::CLASS_ID,
|
||||
data::type::__class::Float64::CLASS_ID,
|
||||
data::type::__class::Boolean::CLASS_ID,
|
||||
|
||||
data::mapping::type::__class::AbstractObject::CLASS_ID,
|
||||
data::mapping::type::__class::AbstractEnum::CLASS_ID,
|
||||
data::type::__class::AbstractObject::CLASS_ID,
|
||||
data::type::__class::AbstractEnum::CLASS_ID,
|
||||
|
||||
data::mapping::type::__class::AbstractVector::CLASS_ID,
|
||||
data::mapping::type::__class::AbstractList::CLASS_ID,
|
||||
data::mapping::type::__class::AbstractUnorderedSet::CLASS_ID,
|
||||
data::type::__class::AbstractVector::CLASS_ID,
|
||||
data::type::__class::AbstractList::CLASS_ID,
|
||||
data::type::__class::AbstractUnorderedSet::CLASS_ID,
|
||||
|
||||
data::mapping::type::__class::AbstractPairList::CLASS_ID,
|
||||
data::mapping::type::__class::AbstractUnorderedMap::CLASS_ID
|
||||
data::type::__class::AbstractPairList::CLASS_ID,
|
||||
data::type::__class::AbstractUnorderedMap::CLASS_ID
|
||||
});
|
||||
|
||||
}
|
||||
@ -85,7 +85,7 @@ bool TypeResolver::isKnownClass(const type::ClassId& classId) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TypeResolver::isKnownType(const type::Type* type) const {
|
||||
bool TypeResolver::isKnownType(const oatpp::Type* type) const {
|
||||
if (type != nullptr) {
|
||||
return isKnownClass(type->classId);
|
||||
}
|
||||
@ -100,7 +100,7 @@ const std::vector<std::string>& TypeResolver::getEnabledInterpretations() const
|
||||
return m_enabledInterpretations;
|
||||
}
|
||||
|
||||
const type::Type* TypeResolver::resolveType(const type::Type* type, Cache& cache) const {
|
||||
const oatpp::Type* TypeResolver::resolveType(const oatpp::Type* type, Cache& cache) const {
|
||||
|
||||
if(type == nullptr) {
|
||||
return nullptr;
|
||||
@ -155,7 +155,7 @@ type::Void TypeResolver::resolveValue(const type::Void& value, Cache& cache) con
|
||||
|
||||
}
|
||||
|
||||
const type::Type* TypeResolver::findPropertyType(const type::Type* baseType,
|
||||
const oatpp::Type* TypeResolver::findPropertyType(const oatpp::Type* baseType,
|
||||
const std::vector<std::string>& path,
|
||||
v_uint32 pathPosition,
|
||||
Cache& cache) const
|
||||
@ -228,7 +228,7 @@ type::Void TypeResolver::findPropertyValue(const type::Void& baseObject,
|
||||
|
||||
}
|
||||
|
||||
const type::Type* TypeResolver::resolveObjectPropertyType(const type::Type* objectType,
|
||||
const oatpp::Type* TypeResolver::resolveObjectPropertyType(const oatpp::Type* objectType,
|
||||
const std::vector<std::string>& path,
|
||||
Cache& cache) const
|
||||
{
|
||||
|
@ -25,7 +25,7 @@
|
||||
#ifndef oatpp_data_mapping_TypeResolver_hpp
|
||||
#define oatpp_data_mapping_TypeResolver_hpp
|
||||
|
||||
#include "type/Object.hpp"
|
||||
#include "oatpp/Types.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping {
|
||||
|
||||
@ -42,25 +42,25 @@ public:
|
||||
/**
|
||||
* types map.
|
||||
*/
|
||||
std::unordered_map<const type::Type*, const type::Type*> types;
|
||||
std::unordered_map<const oatpp::Type*, const oatpp::Type*> types;
|
||||
|
||||
/**
|
||||
* values by type map.
|
||||
*/
|
||||
std::unordered_map<const type::Type*, std::unordered_map<type::Void, type::Void>> values;
|
||||
std::unordered_map<const oatpp::Type*, std::unordered_map<oatpp::Void, oatpp::Void>> values;
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
const type::Type* findPropertyType(const type::Type* baseType,
|
||||
const std::vector<std::string>& path,
|
||||
v_uint32 pathPosition,
|
||||
Cache& cache) const;
|
||||
const oatpp::Type* findPropertyType(const oatpp::Type* baseType,
|
||||
const std::vector<std::string>& path,
|
||||
v_uint32 pathPosition,
|
||||
Cache& cache) const;
|
||||
|
||||
type::Void findPropertyValue(const type::Void& baseObject,
|
||||
const std::vector<std::string>& path,
|
||||
v_uint32 pathPosition,
|
||||
Cache& cache) const;
|
||||
oatpp::Void findPropertyValue(const oatpp::Void& baseObject,
|
||||
const std::vector<std::string>& path,
|
||||
v_uint32 pathPosition,
|
||||
Cache& cache) const;
|
||||
|
||||
private:
|
||||
std::vector<bool> m_knownClasses;
|
||||
@ -82,27 +82,27 @@ public:
|
||||
* @param classId
|
||||
* @param isKnown
|
||||
*/
|
||||
void setKnownClass(const type::ClassId& classId, bool isKnown);
|
||||
void setKnownClass(const oatpp::ClassId& classId, bool isKnown);
|
||||
|
||||
/**
|
||||
* Set all mentioned type classes as known.
|
||||
* @param knownClasses
|
||||
*/
|
||||
void addKnownClasses(const std::vector<type::ClassId>& knownClasses);
|
||||
void addKnownClasses(const std::vector<oatpp::ClassId>& knownClasses);
|
||||
|
||||
/**
|
||||
* Check if type class is known.
|
||||
* @param classId
|
||||
* @return
|
||||
*/
|
||||
bool isKnownClass(const type::ClassId& classId) const;
|
||||
bool isKnownClass(const oatpp::ClassId& classId) const;
|
||||
|
||||
/**
|
||||
* Check if type is known.
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
bool isKnownType(const type::Type* type) const;
|
||||
bool isKnownType(const oatpp::Type* type) const;
|
||||
|
||||
/**
|
||||
* Set enabled type interpretations.
|
||||
@ -122,7 +122,7 @@ public:
|
||||
* @param cache - local cache.
|
||||
* @return
|
||||
*/
|
||||
const type::Type* resolveType(const type::Type* type, Cache& cache) const;
|
||||
const oatpp::Type* resolveType(const oatpp::Type* type, Cache& cache) const;
|
||||
|
||||
/**
|
||||
* Resolve unknown value according to enabled interpretations.
|
||||
@ -130,7 +130,7 @@ public:
|
||||
* @param cache - local cache.
|
||||
* @return
|
||||
*/
|
||||
type::Void resolveValue(const type::Void& value, Cache& cache) const;
|
||||
oatpp::Void resolveValue(const oatpp::Void& value, Cache& cache) const;
|
||||
|
||||
/**
|
||||
* Traverse object property tree resolving unknown types according to enabled interpretations.
|
||||
@ -139,7 +139,7 @@ public:
|
||||
* @param cache - local cache.
|
||||
* @return - &id:oatpp::Type;. `nullptr` - if couldn't resolve.
|
||||
*/
|
||||
const type::Type* resolveObjectPropertyType(const type::Type* objectType,
|
||||
const oatpp::Type* resolveObjectPropertyType(const oatpp::Type* objectType,
|
||||
const std::vector<std::string>& path,
|
||||
Cache& cache) const;
|
||||
|
||||
@ -151,9 +151,9 @@ public:
|
||||
* @return - value as &id:oatpp::Void;. The `valueType` will be set to resolved type
|
||||
* or to `oatpp::Void::Class::getType()` if couldn't resolve.
|
||||
*/
|
||||
type::Void resolveObjectPropertyValue(const type::Void& object,
|
||||
const std::vector<std::string>& path,
|
||||
Cache& cache) const;
|
||||
oatpp::Void resolveObjectPropertyValue(const oatpp::Void& object,
|
||||
const std::vector<std::string>& path,
|
||||
Cache& cache) const;
|
||||
|
||||
};
|
||||
|
||||
|
@ -41,7 +41,7 @@ namespace oatpp { namespace data { namespace share {
|
||||
template<typename Key, typename MapType>
|
||||
class LazyStringMapTemplate {
|
||||
public:
|
||||
typedef oatpp::data::mapping::type::String String;
|
||||
typedef oatpp::data::type::String String;
|
||||
private:
|
||||
mutable concurrency::SpinLock m_lock;
|
||||
mutable bool m_fullyInitialized;
|
||||
|
@ -25,7 +25,7 @@
|
||||
#ifndef oatpp_data_share_MemoryLabel_hpp
|
||||
#define oatpp_data_share_MemoryLabel_hpp
|
||||
|
||||
#include "oatpp/data/mapping/type/Primitive.hpp"
|
||||
#include "oatpp/data/type/Primitive.hpp"
|
||||
#include "oatpp/utils/String.hpp"
|
||||
|
||||
#include <cstring>
|
||||
@ -40,7 +40,7 @@ namespace oatpp { namespace data { namespace share {
|
||||
*/
|
||||
class MemoryLabel {
|
||||
public:
|
||||
typedef oatpp::data::mapping::type::String String;
|
||||
typedef oatpp::data::type::String String;
|
||||
protected:
|
||||
mutable std::shared_ptr<std::string> m_memoryHandle;
|
||||
mutable const void* m_data;
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include "Any.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
namespace __class {
|
||||
const ClassId Any::CLASS_ID("Any");
|
||||
@ -71,7 +71,7 @@ const Type* Any::getStoredType() const {
|
||||
Void Any::retrieve(const Type* type) const {
|
||||
if(m_ptr) {
|
||||
if(!m_ptr->type->extends(type)) {
|
||||
throw std::runtime_error("[oatpp::data::mapping::type::Any::retrieve()]: Error. The value type doesn't match.");
|
||||
throw std::runtime_error("[oatpp::data::type::Any::retrieve()]: Error. The value type doesn't match.");
|
||||
}
|
||||
return Void(m_ptr->ptr, type);
|
||||
}
|
||||
@ -115,4 +115,4 @@ bool Any::operator != (const Any& other) const {
|
||||
return !operator == (other);
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
@ -22,14 +22,14 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef oatpp_data_mapping_type_Any_hpp
|
||||
#define oatpp_data_mapping_type_Any_hpp
|
||||
#ifndef oatpp_data_type_Any_hpp
|
||||
#define oatpp_data_type_Any_hpp
|
||||
|
||||
#include "./Type.hpp"
|
||||
|
||||
#include "oatpp/base/Countable.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
namespace __class {
|
||||
|
||||
@ -117,7 +117,7 @@ public:
|
||||
|
||||
/**
|
||||
* Get `Type` of the stored object.
|
||||
* @return - &id:oatpp::data::mapping::type::Type;.
|
||||
* @return - &id:oatpp::data::type::Type;.
|
||||
*/
|
||||
const Type* getStoredType() const;
|
||||
|
||||
@ -160,6 +160,6 @@ public:
|
||||
|
||||
};
|
||||
|
||||
}}}}
|
||||
}}}
|
||||
|
||||
#endif //oatpp_data_mapping_type_Any_hpp
|
||||
#endif //oatpp_data_type_Any_hpp
|
@ -22,13 +22,13 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef oatpp_data_mapping_type_Collection_hpp
|
||||
#define oatpp_data_mapping_type_Collection_hpp
|
||||
#ifndef oatpp_data_type_Collection_hpp
|
||||
#define oatpp_data_type_Collection_hpp
|
||||
|
||||
#include "./Type.hpp"
|
||||
#include <unordered_set>
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
namespace __class {
|
||||
|
||||
@ -196,6 +196,6 @@ struct Collection::Inserter<std::unordered_set<ItemType>, ItemType> {
|
||||
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
||||
|
||||
#endif //oatpp_data_mapping_type_Collection_hpp
|
||||
#endif //oatpp_data_type_Collection_hpp
|
@ -24,10 +24,10 @@
|
||||
|
||||
#include "Enum.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
namespace __class {
|
||||
const ClassId AbstractEnum::CLASS_ID("Enum");
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
@ -22,8 +22,8 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef oatpp_data_mapping_type_Enum_hpp
|
||||
#define oatpp_data_mapping_type_Enum_hpp
|
||||
#ifndef oatpp_data_type_Enum_hpp
|
||||
#define oatpp_data_type_Enum_hpp
|
||||
|
||||
#include "./Any.hpp"
|
||||
#include "./Primitive.hpp"
|
||||
@ -33,7 +33,7 @@
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
/**
|
||||
* Errors of enum interpretation.
|
||||
@ -53,7 +53,7 @@ enum class EnumInterpreterError : v_int32 {
|
||||
TYPE_MISMATCH_ENUM = 1,
|
||||
|
||||
/**
|
||||
* Wrong &id:oatpp::data::mapping::type::Primitive; is passed to interpreter.
|
||||
* Wrong &id:oatpp::data::type::Primitive; is passed to interpreter.
|
||||
*/
|
||||
TYPE_MISMATCH_ENUM_VALUE = 2,
|
||||
|
||||
@ -395,7 +395,7 @@ public:
|
||||
if(it != EnumMeta<T>::getInfo()->byName.end()) {
|
||||
return it->second;
|
||||
}
|
||||
throw std::runtime_error("[oatpp::data::mapping::type::Enum::getEntryByName()]: Error. Entry not found.");
|
||||
throw std::runtime_error("[oatpp::data::type::Enum::getEntryByName()]: Error. Entry not found.");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -409,7 +409,7 @@ public:
|
||||
if(it != EnumMeta<T>::getInfo()->byValue.end()) {
|
||||
return it->second;
|
||||
}
|
||||
throw std::runtime_error("[oatpp::data::mapping::type::Enum::getEntryByValue()]: Error. Entry not found.");
|
||||
throw std::runtime_error("[oatpp::data::type::Enum::getEntryByValue()]: Error. Entry not found.");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -423,7 +423,7 @@ public:
|
||||
if(it != EnumMeta<T>::getInfo()->byValue.end()) {
|
||||
return it->second;
|
||||
}
|
||||
throw std::runtime_error("[oatpp::data::mapping::type::Enum::getEntryByUnderlyingValue()]: Error. Entry not found.");
|
||||
throw std::runtime_error("[oatpp::data::type::Enum::getEntryByUnderlyingValue()]: Error. Entry not found.");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -436,7 +436,7 @@ public:
|
||||
if(index >= 0 && index < EnumMeta<T>::getInfo()->byIndex.size()) {
|
||||
return EnumMeta<T>::getInfo()->byIndex[index];
|
||||
}
|
||||
throw std::runtime_error("[oatpp::data::mapping::type::Enum::getEntryByIndex()]: Error. Entry not found.");
|
||||
throw std::runtime_error("[oatpp::data::type::Enum::getEntryByIndex()]: Error. Entry not found.");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -608,7 +608,7 @@ namespace __class {
|
||||
type::EnumInterpreterError error = type::EnumInterpreterError::OK;
|
||||
result.push_back(type::Any(toInterpretation(EnumOW(e.value), error)));
|
||||
if(error != type::EnumInterpreterError::OK) {
|
||||
throw std::runtime_error("[oatpp::data::mapping::type::__class::Enum<T, Interpreter>::getInterpretedEnum()]: Unknown error.");
|
||||
throw std::runtime_error("[oatpp::data::type::__class::Enum<T, Interpreter>::getInterpretedEnum()]: Unknown error.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -638,14 +638,14 @@ namespace __class {
|
||||
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
||||
|
||||
namespace std {
|
||||
|
||||
template<class T, class I>
|
||||
struct hash <oatpp::data::mapping::type::EnumObjectWrapper<T, I>> {
|
||||
struct hash <oatpp::data::type::EnumObjectWrapper<T, I>> {
|
||||
|
||||
typedef oatpp::data::mapping::type::EnumObjectWrapper<T, I> argument_type;
|
||||
typedef oatpp::data::type::EnumObjectWrapper<T, I> argument_type;
|
||||
typedef v_uint64 result_type;
|
||||
|
||||
result_type operator()(argument_type const &e) const noexcept {
|
||||
@ -657,4 +657,4 @@ namespace std {
|
||||
|
||||
}
|
||||
|
||||
#endif // oatpp_data_mapping_type_Enum_hpp
|
||||
#endif // oatpp_data_type_Enum_hpp
|
@ -24,10 +24,10 @@
|
||||
|
||||
#include "./List.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
namespace __class {
|
||||
const ClassId AbstractList::CLASS_ID("List");
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
@ -22,8 +22,8 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef oatpp_data_mapping_type_List_hpp
|
||||
#define oatpp_data_mapping_type_List_hpp
|
||||
#ifndef oatpp_data_type_List_hpp
|
||||
#define oatpp_data_type_List_hpp
|
||||
|
||||
#include "./Collection.hpp"
|
||||
#include "./Type.hpp"
|
||||
@ -31,7 +31,7 @@
|
||||
#include <list>
|
||||
#include <initializer_list>
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
namespace __class {
|
||||
|
||||
@ -125,6 +125,6 @@ namespace __class {
|
||||
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
||||
|
||||
#endif // oatpp_data_mapping_type_List_hpp
|
||||
#endif // oatpp_data_type_List_hpp
|
@ -22,13 +22,13 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef oatpp_data_mapping_type_Map_hpp
|
||||
#define oatpp_data_mapping_type_Map_hpp
|
||||
#ifndef oatpp_data_type_Map_hpp
|
||||
#define oatpp_data_type_Map_hpp
|
||||
|
||||
#include "./Type.hpp"
|
||||
#include <list>
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
namespace __class {
|
||||
|
||||
@ -219,6 +219,6 @@ struct Map::Inserter<std::list<std::pair<KeyType, ValueType>>, KeyType, ValueTyp
|
||||
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
||||
|
||||
#endif //oatpp_data_mapping_type_Map_hpp
|
||||
#endif //oatpp_data_type_Map_hpp
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include "./Object.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// BaseObject
|
||||
@ -97,7 +97,7 @@ namespace __class {
|
||||
|
||||
}
|
||||
|
||||
const mapping::type::Type* DTO::getParentType() {
|
||||
const type::Type* DTO::getParentType() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -105,8 +105,8 @@ const char* DTO::Z__CLASS_TYPE_NAME() {
|
||||
return "DTO";
|
||||
}
|
||||
|
||||
oatpp::data::mapping::type::BaseObject::Properties* DTO::Z__CLASS_GET_FIELDS_MAP() {
|
||||
static data::mapping::type::BaseObject::Properties map;
|
||||
oatpp::data::type::BaseObject::Properties* DTO::Z__CLASS_GET_FIELDS_MAP() {
|
||||
static data::type::BaseObject::Properties map;
|
||||
return ↦
|
||||
}
|
||||
|
||||
@ -115,4 +115,4 @@ BaseObject::Properties* DTO::Z__CLASS_EXTEND(BaseObject::Properties* properties,
|
||||
return properties;
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
@ -40,7 +40,7 @@
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
/**
|
||||
* Base class of all object-like mapping-enabled structures ex.: oatpp::DTO.
|
||||
@ -188,7 +188,7 @@ public:
|
||||
|
||||
/**
|
||||
* Get properties as unordered map for random access.
|
||||
* @return reference to std::unordered_map of std::string to &id:oatpp::data::mapping::type::BaseObject::Property;*.
|
||||
* @return reference to std::unordered_map of std::string to &id:oatpp::data::type::BaseObject::Property;*.
|
||||
*/
|
||||
const std::unordered_map<std::string, Property*>& getMap() const {
|
||||
return m_map;
|
||||
@ -196,7 +196,7 @@ public:
|
||||
|
||||
/**
|
||||
* Get properties in ordered way.
|
||||
* @return std::list of &id:oatpp::data::mapping::type::BaseObject::Property;*.
|
||||
* @return std::list of &id:oatpp::data::type::BaseObject::Property;*.
|
||||
*/
|
||||
const std::list<Property*>& getList() const {
|
||||
return m_list;
|
||||
@ -302,7 +302,7 @@ namespace __class {
|
||||
|
||||
/**
|
||||
* Get type describing this class.
|
||||
* @return - &id:oatpp::data::mapping::type::Type;
|
||||
* @return - &id:oatpp::data::type::Type;
|
||||
*/
|
||||
static Type* getType() {
|
||||
static Type* type = createType();
|
||||
@ -422,46 +422,46 @@ private:
|
||||
typedef DTO Z__CLASS;
|
||||
typedef DTO Z__CLASS_EXTENDED;
|
||||
public:
|
||||
typedef oatpp::data::mapping::type::Void Void;
|
||||
typedef oatpp::data::mapping::type::Any Any;
|
||||
typedef oatpp::data::mapping::type::String String;
|
||||
typedef oatpp::data::mapping::type::Int8 Int8;
|
||||
typedef oatpp::data::mapping::type::UInt8 UInt8;
|
||||
typedef oatpp::data::mapping::type::Int16 Int16;
|
||||
typedef oatpp::data::mapping::type::UInt16 UInt16;
|
||||
typedef oatpp::data::mapping::type::Int32 Int32;
|
||||
typedef oatpp::data::mapping::type::UInt32 UInt32;
|
||||
typedef oatpp::data::mapping::type::Int64 Int64;
|
||||
typedef oatpp::data::mapping::type::UInt64 UInt64;
|
||||
typedef oatpp::data::mapping::type::Float32 Float32;
|
||||
typedef oatpp::data::mapping::type::Float64 Float64;
|
||||
typedef oatpp::data::mapping::type::Boolean Boolean;
|
||||
typedef oatpp::data::type::Void Void;
|
||||
typedef oatpp::data::type::Any Any;
|
||||
typedef oatpp::data::type::String String;
|
||||
typedef oatpp::data::type::Int8 Int8;
|
||||
typedef oatpp::data::type::UInt8 UInt8;
|
||||
typedef oatpp::data::type::Int16 Int16;
|
||||
typedef oatpp::data::type::UInt16 UInt16;
|
||||
typedef oatpp::data::type::Int32 Int32;
|
||||
typedef oatpp::data::type::UInt32 UInt32;
|
||||
typedef oatpp::data::type::Int64 Int64;
|
||||
typedef oatpp::data::type::UInt64 UInt64;
|
||||
typedef oatpp::data::type::Float32 Float32;
|
||||
typedef oatpp::data::type::Float64 Float64;
|
||||
typedef oatpp::data::type::Boolean Boolean;
|
||||
|
||||
template <class T>
|
||||
using Object = DTOWrapper<T>;
|
||||
|
||||
template <class T>
|
||||
using Enum = oatpp::data::mapping::type::Enum<T>;
|
||||
using Enum = oatpp::data::type::Enum<T>;
|
||||
|
||||
template <class T>
|
||||
using Vector = oatpp::data::mapping::type::Vector<T>;
|
||||
using Vector = oatpp::data::type::Vector<T>;
|
||||
|
||||
template <class T>
|
||||
using UnorderedSet = oatpp::data::mapping::type::UnorderedSet<T>;
|
||||
using UnorderedSet = oatpp::data::type::UnorderedSet<T>;
|
||||
|
||||
template <class T>
|
||||
using List = oatpp::data::mapping::type::List<T>;
|
||||
using List = oatpp::data::type::List<T>;
|
||||
|
||||
template <class Value>
|
||||
using Fields = oatpp::data::mapping::type::PairList<String, Value>;
|
||||
using Fields = oatpp::data::type::PairList<String, Value>;
|
||||
|
||||
template <class Value>
|
||||
using UnorderedFields = oatpp::data::mapping::type::UnorderedMap<String, Value>;
|
||||
using UnorderedFields = oatpp::data::type::UnorderedMap<String, Value>;
|
||||
|
||||
private:
|
||||
static const mapping::type::Type* getParentType();
|
||||
static const type::Type* getParentType();
|
||||
static const char* Z__CLASS_TYPE_NAME();
|
||||
static data::mapping::type::BaseObject::Properties* Z__CLASS_GET_FIELDS_MAP();
|
||||
static data::type::BaseObject::Properties* Z__CLASS_GET_FIELDS_MAP();
|
||||
static BaseObject::Properties* Z__CLASS_EXTEND(BaseObject::Properties* properties, BaseObject::Properties* extensionProperties);
|
||||
public:
|
||||
|
||||
@ -483,14 +483,14 @@ public:
|
||||
|
||||
};
|
||||
|
||||
}}}}
|
||||
}}}
|
||||
|
||||
namespace std {
|
||||
|
||||
template<class T>
|
||||
struct hash<oatpp::data::mapping::type::DTOWrapper<T>> {
|
||||
struct hash<oatpp::data::type::DTOWrapper<T>> {
|
||||
|
||||
typedef oatpp::data::mapping::type::DTOWrapper<T> argument_type;
|
||||
typedef oatpp::data::type::DTOWrapper<T> argument_type;
|
||||
typedef v_uint64 result_type;
|
||||
|
||||
result_type operator()(argument_type const &ow) const noexcept {
|
@ -24,10 +24,10 @@
|
||||
|
||||
#include "PairList.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
namespace __class {
|
||||
const ClassId AbstractPairList::CLASS_ID("PairList");
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
@ -22,8 +22,8 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef oatpp_data_mapping_type_PairList_hpp
|
||||
#define oatpp_data_mapping_type_PairList_hpp
|
||||
#ifndef oatpp_data_type_PairList_hpp
|
||||
#define oatpp_data_type_PairList_hpp
|
||||
|
||||
#include "./Map.hpp"
|
||||
#include "./Type.hpp"
|
||||
@ -32,7 +32,7 @@
|
||||
#include <initializer_list>
|
||||
#include <utility>
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
namespace __class {
|
||||
|
||||
@ -150,6 +150,6 @@ public:
|
||||
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
||||
|
||||
#endif // oatpp_data_mapping_type_PairList_hpp
|
||||
#endif // oatpp_data_type_PairList_hpp
|
@ -30,10 +30,10 @@
|
||||
|
||||
#include <fstream>
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
String::String(const std::shared_ptr<std::string>& ptr, const type::Type* const valueType)
|
||||
: oatpp::data::mapping::type::ObjectWrapper<std::string, __class::String>(ptr)
|
||||
: oatpp::data::type::ObjectWrapper<std::string, __class::String>(ptr)
|
||||
{
|
||||
if(type::__class::String::getType() != valueType) {
|
||||
throw std::runtime_error("Value type does not match");
|
||||
@ -43,7 +43,7 @@ String::String(const std::shared_ptr<std::string>& ptr, const type::Type* const
|
||||
String String::loadFromFile(const char* filename) {
|
||||
std::ifstream file (filename, std::ios::in|std::ios::binary|std::ios::ate);
|
||||
if (file.is_open()) {
|
||||
auto result = data::mapping::type::String(file.tellg());
|
||||
auto result = data::type::String(file.tellg());
|
||||
file.seekg(0, std::ios::beg);
|
||||
file.read(const_cast<char*>(result->data()), static_cast<std::streamsize>(result->size()));
|
||||
file.close();
|
||||
@ -186,4 +186,4 @@ namespace __class {
|
||||
}
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
@ -33,7 +33,7 @@
|
||||
#include <cctype>
|
||||
#include <iterator>
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
namespace __class {
|
||||
|
||||
@ -139,7 +139,7 @@ public:
|
||||
|
||||
operator std::string() const {
|
||||
if (this->m_ptr == nullptr) {
|
||||
throw std::runtime_error("[oatpp::data::mapping::type::String::operator std::string() const]: "
|
||||
throw std::runtime_error("[oatpp::data::type::String::operator std::string() const]: "
|
||||
"Error. Null pointer.");
|
||||
}
|
||||
return this->m_ptr.operator*();
|
||||
@ -640,14 +640,14 @@ namespace __class {
|
||||
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
||||
|
||||
namespace std {
|
||||
|
||||
template<>
|
||||
struct hash<oatpp::data::mapping::type::String> {
|
||||
struct hash<oatpp::data::type::String> {
|
||||
|
||||
typedef oatpp::data::mapping::type::String argument_type;
|
||||
typedef oatpp::data::type::String argument_type;
|
||||
typedef v_uint64 result_type;
|
||||
|
||||
result_type operator()(argument_type const& s) const noexcept {
|
||||
@ -658,9 +658,9 @@ namespace std {
|
||||
};
|
||||
|
||||
template<>
|
||||
struct hash<oatpp::data::mapping::type::Boolean> {
|
||||
struct hash<oatpp::data::type::Boolean> {
|
||||
|
||||
typedef oatpp::data::mapping::type::Boolean argument_type;
|
||||
typedef oatpp::data::type::Boolean argument_type;
|
||||
typedef v_uint64 result_type;
|
||||
|
||||
result_type operator()(argument_type const& v) const noexcept {
|
||||
@ -671,9 +671,9 @@ namespace std {
|
||||
};
|
||||
|
||||
template<>
|
||||
struct hash<oatpp::data::mapping::type::Int8> {
|
||||
struct hash<oatpp::data::type::Int8> {
|
||||
|
||||
typedef oatpp::data::mapping::type::Int8 argument_type;
|
||||
typedef oatpp::data::type::Int8 argument_type;
|
||||
typedef v_uint64 result_type;
|
||||
|
||||
result_type operator()(argument_type const& v) const noexcept {
|
||||
@ -684,9 +684,9 @@ namespace std {
|
||||
};
|
||||
|
||||
template<>
|
||||
struct hash<oatpp::data::mapping::type::UInt8> {
|
||||
struct hash<oatpp::data::type::UInt8> {
|
||||
|
||||
typedef oatpp::data::mapping::type::UInt8 argument_type;
|
||||
typedef oatpp::data::type::UInt8 argument_type;
|
||||
typedef v_uint64 result_type;
|
||||
|
||||
result_type operator()(argument_type const& v) const noexcept {
|
||||
@ -697,9 +697,9 @@ namespace std {
|
||||
};
|
||||
|
||||
template<>
|
||||
struct hash<oatpp::data::mapping::type::Int16> {
|
||||
struct hash<oatpp::data::type::Int16> {
|
||||
|
||||
typedef oatpp::data::mapping::type::Int16 argument_type;
|
||||
typedef oatpp::data::type::Int16 argument_type;
|
||||
typedef v_uint64 result_type;
|
||||
|
||||
result_type operator()(argument_type const& v) const noexcept {
|
||||
@ -710,9 +710,9 @@ namespace std {
|
||||
};
|
||||
|
||||
template<>
|
||||
struct hash<oatpp::data::mapping::type::UInt16> {
|
||||
struct hash<oatpp::data::type::UInt16> {
|
||||
|
||||
typedef oatpp::data::mapping::type::UInt16 argument_type;
|
||||
typedef oatpp::data::type::UInt16 argument_type;
|
||||
typedef v_uint64 result_type;
|
||||
|
||||
result_type operator()(argument_type const& v) const noexcept {
|
||||
@ -723,9 +723,9 @@ namespace std {
|
||||
};
|
||||
|
||||
template<>
|
||||
struct hash<oatpp::data::mapping::type::Int32> {
|
||||
struct hash<oatpp::data::type::Int32> {
|
||||
|
||||
typedef oatpp::data::mapping::type::Int32 argument_type;
|
||||
typedef oatpp::data::type::Int32 argument_type;
|
||||
typedef v_uint64 result_type;
|
||||
|
||||
result_type operator()(argument_type const& v) const noexcept {
|
||||
@ -736,9 +736,9 @@ namespace std {
|
||||
};
|
||||
|
||||
template<>
|
||||
struct hash<oatpp::data::mapping::type::UInt32> {
|
||||
struct hash<oatpp::data::type::UInt32> {
|
||||
|
||||
typedef oatpp::data::mapping::type::UInt32 argument_type;
|
||||
typedef oatpp::data::type::UInt32 argument_type;
|
||||
typedef v_uint64 result_type;
|
||||
|
||||
result_type operator()(argument_type const& v) const noexcept {
|
||||
@ -749,9 +749,9 @@ namespace std {
|
||||
};
|
||||
|
||||
template<>
|
||||
struct hash<oatpp::data::mapping::type::Int64> {
|
||||
struct hash<oatpp::data::type::Int64> {
|
||||
|
||||
typedef oatpp::data::mapping::type::Int64 argument_type;
|
||||
typedef oatpp::data::type::Int64 argument_type;
|
||||
typedef v_uint64 result_type;
|
||||
|
||||
result_type operator()(argument_type const& v) const noexcept {
|
||||
@ -762,9 +762,9 @@ namespace std {
|
||||
};
|
||||
|
||||
template<>
|
||||
struct hash<oatpp::data::mapping::type::UInt64> {
|
||||
struct hash<oatpp::data::type::UInt64> {
|
||||
|
||||
typedef oatpp::data::mapping::type::UInt64 argument_type;
|
||||
typedef oatpp::data::type::UInt64 argument_type;
|
||||
typedef v_uint64 result_type;
|
||||
|
||||
result_type operator()(argument_type const& v) const noexcept {
|
||||
@ -775,9 +775,9 @@ namespace std {
|
||||
};
|
||||
|
||||
template<>
|
||||
struct hash<oatpp::data::mapping::type::Float32> {
|
||||
struct hash<oatpp::data::type::Float32> {
|
||||
|
||||
typedef oatpp::data::mapping::type::Float32 argument_type;
|
||||
typedef oatpp::data::type::Float32 argument_type;
|
||||
typedef v_uint64 result_type;
|
||||
|
||||
result_type operator()(argument_type const& v) const noexcept {
|
||||
@ -788,9 +788,9 @@ namespace std {
|
||||
};
|
||||
|
||||
template<>
|
||||
struct hash<oatpp::data::mapping::type::Float64> {
|
||||
struct hash<oatpp::data::type::Float64> {
|
||||
|
||||
typedef oatpp::data::mapping::type::Float64 argument_type;
|
||||
typedef oatpp::data::type::Float64 argument_type;
|
||||
typedef v_uint64 result_type;
|
||||
|
||||
result_type operator()(argument_type const& v) const noexcept {
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include "Type.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
namespace __class {
|
||||
|
||||
@ -106,4 +106,4 @@ bool Type::extends(const Type* other) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
@ -33,7 +33,7 @@
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
class Type; // FWD
|
||||
|
||||
@ -472,12 +472,12 @@ public:
|
||||
const Type* parent = nullptr;
|
||||
|
||||
/**
|
||||
* polymorphicDispatcher extends &id:oatpp::data::mapping::type::__class::Collection::PolymorphicDispatcher;.
|
||||
* polymorphicDispatcher extends &id:oatpp::data::type::__class::Collection::PolymorphicDispatcher;.
|
||||
*/
|
||||
bool isCollection = false;
|
||||
|
||||
/**
|
||||
* polymorphicDispatcher extends &id:oatpp::data::mapping::type::__class::Map::PolymorphicDispatcher;.
|
||||
* polymorphicDispatcher extends &id:oatpp::data::type::__class::Map::PolymorphicDispatcher;.
|
||||
*/
|
||||
bool isMap = false;
|
||||
};
|
||||
@ -525,12 +525,12 @@ public:
|
||||
const Type* const parent;
|
||||
|
||||
/**
|
||||
* polymorphicDispatcher extends &id:oatpp::data::mapping::type::__class::Collection::PolymorphicDispatcher;.
|
||||
* polymorphicDispatcher extends &id:oatpp::data::type::__class::Collection::PolymorphicDispatcher;.
|
||||
*/
|
||||
const bool isCollection;
|
||||
|
||||
/**
|
||||
* polymorphicDispatcher extends &id:oatpp::data::mapping::type::__class::Map::PolymorphicDispatcher;.
|
||||
* polymorphicDispatcher extends &id:oatpp::data::type::__class::Map::PolymorphicDispatcher;.
|
||||
*/
|
||||
const bool isMap;
|
||||
|
||||
@ -558,7 +558,7 @@ template<class Wrapper>
|
||||
Wrapper ObjectWrapper<T, Clazz>::cast() const {
|
||||
if(!Wrapper::Class::getType()->extends(m_valueType)) {
|
||||
if(Wrapper::Class::getType() != __class::Void::getType() && m_valueType != __class::Void::getType()) {
|
||||
throw std::runtime_error("[oatpp::data::mapping::type::ObjectWrapper::cast()]: Error. Invalid cast "
|
||||
throw std::runtime_error("[oatpp::data::type::ObjectWrapper::cast()]: Error. Invalid cast "
|
||||
"from '" + std::string(m_valueType->classId.name) + "' to '" +
|
||||
std::string(Wrapper::Class::getType()->classId.name) + "'.");
|
||||
}
|
||||
@ -569,7 +569,7 @@ Wrapper ObjectWrapper<T, Clazz>::cast() const {
|
||||
template <class T, class Clazz>
|
||||
void ObjectWrapper<T, Clazz>::checkType(const Type* _this, const Type* other) {
|
||||
if(!_this->extends(other)) {
|
||||
throw std::runtime_error("[oatpp::data::mapping::type::ObjectWrapper::checkType()]: Error. "
|
||||
throw std::runtime_error("[oatpp::data::type::ObjectWrapper::checkType()]: Error. "
|
||||
"Type mismatch: stored '" + std::string(_this->classId.name) + "' vs "
|
||||
"assigned '" + std::string(other->classId.name) + "'.");
|
||||
}
|
||||
@ -618,14 +618,14 @@ public: \
|
||||
} \
|
||||
|
||||
|
||||
}}}}
|
||||
}}}
|
||||
|
||||
namespace std {
|
||||
|
||||
template<>
|
||||
struct hash<oatpp::data::mapping::type::ClassId> {
|
||||
struct hash<oatpp::data::type::ClassId> {
|
||||
|
||||
typedef oatpp::data::mapping::type::ClassId argument_type;
|
||||
typedef oatpp::data::type::ClassId argument_type;
|
||||
typedef v_uint64 result_type;
|
||||
|
||||
result_type operator()(argument_type const& v) const noexcept {
|
||||
@ -635,9 +635,9 @@ struct hash<oatpp::data::mapping::type::ClassId> {
|
||||
};
|
||||
|
||||
template<>
|
||||
struct hash<oatpp::data::mapping::type::Void> {
|
||||
struct hash<oatpp::data::type::Void> {
|
||||
|
||||
typedef oatpp::data::mapping::type::Void argument_type;
|
||||
typedef oatpp::data::type::Void argument_type;
|
||||
typedef v_uint64 result_type;
|
||||
|
||||
result_type operator()(argument_type const& v) const noexcept {
|
@ -24,10 +24,10 @@
|
||||
|
||||
#include "UnorderedMap.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
namespace __class {
|
||||
const ClassId AbstractUnorderedMap::CLASS_ID("UnorderedMap");
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
@ -22,8 +22,8 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef oatpp_data_mapping_type_UnorderedMap_hpp
|
||||
#define oatpp_data_mapping_type_UnorderedMap_hpp
|
||||
#ifndef oatpp_data_type_UnorderedMap_hpp
|
||||
#define oatpp_data_type_UnorderedMap_hpp
|
||||
|
||||
#include "./Map.hpp"
|
||||
#include "./Type.hpp"
|
||||
@ -32,7 +32,7 @@
|
||||
#include <initializer_list>
|
||||
#include <utility>
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
namespace __class {
|
||||
|
||||
@ -123,6 +123,6 @@ namespace __class {
|
||||
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
||||
|
||||
#endif // oatpp_data_mapping_type_UnorderedMap_hpp
|
||||
#endif // oatpp_data_type_UnorderedMap_hpp
|
@ -24,10 +24,10 @@
|
||||
|
||||
#include "UnorderedSet.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
namespace __class {
|
||||
const ClassId AbstractUnorderedSet::CLASS_ID("UnorderedSet");
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
@ -22,8 +22,8 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef oatpp_data_mapping_type_UnorderedSet_hpp
|
||||
#define oatpp_data_mapping_type_UnorderedSet_hpp
|
||||
#ifndef oatpp_data_type_UnorderedSet_hpp
|
||||
#define oatpp_data_type_UnorderedSet_hpp
|
||||
|
||||
#include "./Collection.hpp"
|
||||
#include "./Type.hpp"
|
||||
@ -31,7 +31,7 @@
|
||||
#include <unordered_set>
|
||||
#include <initializer_list>
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
namespace __class {
|
||||
|
||||
@ -125,6 +125,6 @@ public:
|
||||
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
||||
|
||||
#endif // oatpp_data_mapping_type_UnorderedSet_hpp
|
||||
#endif // oatpp_data_type_UnorderedSet_hpp
|
@ -24,10 +24,10 @@
|
||||
|
||||
#include "Vector.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
namespace __class {
|
||||
const ClassId AbstractVector::CLASS_ID("Vector");
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
@ -22,8 +22,8 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef oatpp_data_mapping_type_Vector_hpp
|
||||
#define oatpp_data_mapping_type_Vector_hpp
|
||||
#ifndef oatpp_data_type_Vector_hpp
|
||||
#define oatpp_data_type_Vector_hpp
|
||||
|
||||
#include "./Collection.hpp"
|
||||
#include "./Type.hpp"
|
||||
@ -31,7 +31,7 @@
|
||||
#include <vector>
|
||||
#include <initializer_list>
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
namespace __class {
|
||||
|
||||
@ -121,6 +121,6 @@ namespace __class {
|
||||
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
||||
|
||||
#endif // oatpp_data_mapping_type_Vector_hpp
|
||||
#endif // oatpp_data_type_Vector_hpp
|
@ -59,7 +59,7 @@ void ObjectMapper::write(data::stream::ConsistentOutputStream* stream, const oat
|
||||
|
||||
}
|
||||
|
||||
oatpp::Void ObjectMapper::read(utils::parser::Caret& caret, const data::mapping::type::Type* type, data::mapping::ErrorStack& errorStack) const {
|
||||
oatpp::Void ObjectMapper::read(utils::parser::Caret& caret, const data::type::Type* type, data::mapping::ErrorStack& errorStack) const {
|
||||
|
||||
data::mapping::Tree tree;
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "QueryResult.hpp"
|
||||
|
||||
#include "oatpp/data/mapping/TypeResolver.hpp"
|
||||
#include "oatpp/data/mapping/type/Type.hpp"
|
||||
#include "oatpp/data/type/Type.hpp"
|
||||
#include "oatpp/data/share/MemoryLabel.hpp"
|
||||
#include "oatpp/data/share/StringTemplate.hpp"
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
#ifndef oatpp_utils_Conversion_hpp
|
||||
#define oatpp_utils_Conversion_hpp
|
||||
|
||||
#include "oatpp/data/mapping/type/Primitive.hpp"
|
||||
#include "oatpp/data/type/Primitive.hpp"
|
||||
#include "oatpp/Types.hpp"
|
||||
|
||||
|
||||
|
@ -63,67 +63,67 @@ public:
|
||||
public:
|
||||
|
||||
/**
|
||||
* Convenience typedef for &id:oatpp::data::mapping::type::String;.
|
||||
* Convenience typedef for &id:oatpp::data::type::String;.
|
||||
*/
|
||||
typedef oatpp::String String;
|
||||
|
||||
/**
|
||||
* Convenience typedef for &id:oatpp::data::mapping::type::Int8;.
|
||||
* Convenience typedef for &id:oatpp::data::type::Int8;.
|
||||
*/
|
||||
typedef oatpp::Int8 Int8;
|
||||
|
||||
/**
|
||||
* Convenience typedef for &id:oatpp::data::mapping::type::UInt8;.
|
||||
* Convenience typedef for &id:oatpp::data::type::UInt8;.
|
||||
*/
|
||||
typedef oatpp::UInt8 UInt8;
|
||||
|
||||
/**
|
||||
* Convenience typedef for &id:oatpp::data::mapping::type::Int16;.
|
||||
* Convenience typedef for &id:oatpp::data::type::Int16;.
|
||||
*/
|
||||
typedef oatpp::Int16 Int16;
|
||||
|
||||
/**
|
||||
* Convenience typedef for &id:oatpp::data::mapping::type::UInt16;.
|
||||
* Convenience typedef for &id:oatpp::data::type::UInt16;.
|
||||
*/
|
||||
typedef oatpp::UInt16 UInt16;
|
||||
|
||||
/**
|
||||
* Convenience typedef for &id:oatpp::data::mapping::type::Int32;.
|
||||
* Convenience typedef for &id:oatpp::data::type::Int32;.
|
||||
*/
|
||||
typedef oatpp::Int32 Int32;
|
||||
|
||||
/**
|
||||
* Convenience typedef for &id:oatpp::data::mapping::type::UInt32;.
|
||||
* Convenience typedef for &id:oatpp::data::type::UInt32;.
|
||||
*/
|
||||
typedef oatpp::UInt32 UInt32;
|
||||
|
||||
/**
|
||||
* Convenience typedef for &id:oatpp::data::mapping::type::Int64;.
|
||||
* Convenience typedef for &id:oatpp::data::type::Int64;.
|
||||
*/
|
||||
typedef oatpp::Int64 Int64;
|
||||
|
||||
/**
|
||||
* Convenience typedef for &id:oatpp::data::mapping::type::UInt64;.
|
||||
* Convenience typedef for &id:oatpp::data::type::UInt64;.
|
||||
*/
|
||||
typedef oatpp::UInt64 UInt64;
|
||||
|
||||
/**
|
||||
* Convenience typedef for &id:oatpp::data::mapping::type::Float32;.
|
||||
* Convenience typedef for &id:oatpp::data::type::Float32;.
|
||||
*/
|
||||
typedef oatpp::Float32 Float32;
|
||||
|
||||
/**
|
||||
* Convenience typedef for &id:atpp::data::mapping::type::Float64;.
|
||||
* Convenience typedef for &id:atpp::data::type::Float64;.
|
||||
*/
|
||||
typedef oatpp::Float64 Float64;
|
||||
|
||||
/**
|
||||
* Convenience typedef for &id:oatpp::data::mapping::type::Boolean;.
|
||||
* Convenience typedef for &id:oatpp::data::type::Boolean;.
|
||||
*/
|
||||
typedef oatpp::Boolean Boolean;
|
||||
|
||||
template <class T>
|
||||
using Enum = oatpp::data::mapping::type::Enum<T>;
|
||||
using Enum = oatpp::data::type::Enum<T>;
|
||||
|
||||
template <class T>
|
||||
using Object = oatpp::Object<T>;
|
||||
@ -375,25 +375,25 @@ struct ApiClient::TypeInterpretation<oatpp::Boolean> {
|
||||
};
|
||||
|
||||
template<class T, class I>
|
||||
struct ApiClient::TypeInterpretation<data::mapping::type::EnumObjectWrapper<T, I>> {
|
||||
struct ApiClient::TypeInterpretation<data::type::EnumObjectWrapper<T, I>> {
|
||||
|
||||
typedef data::mapping::type::EnumObjectWrapper<T, I> EnumOW;
|
||||
typedef data::type::EnumObjectWrapper<T, I> EnumOW;
|
||||
typedef typename I::UnderlyingTypeObjectWrapper UTOW;
|
||||
|
||||
static oatpp::String toString(const oatpp::String &typeName, const EnumOW ¶meter) {
|
||||
|
||||
data::mapping::type::EnumInterpreterError error = data::mapping::type::EnumInterpreterError::OK;
|
||||
data::type::EnumInterpreterError error = data::type::EnumInterpreterError::OK;
|
||||
const auto& value = I::toInterpretation(parameter, error);
|
||||
|
||||
switch(error){
|
||||
case data::mapping::type::EnumInterpreterError::OK: break;
|
||||
case data::mapping::type::EnumInterpreterError::CONSTRAINT_NOT_NULL:
|
||||
case data::type::EnumInterpreterError::OK: break;
|
||||
case data::type::EnumInterpreterError::CONSTRAINT_NOT_NULL:
|
||||
throw std::runtime_error(
|
||||
"[oatpp::web::client::ApiClient::TypeInterpretation::toString()]: Error. Enum constraint violation - NotNull."
|
||||
);
|
||||
case data::mapping::type::EnumInterpreterError::TYPE_MISMATCH_ENUM:
|
||||
case data::mapping::type::EnumInterpreterError::TYPE_MISMATCH_ENUM_VALUE:
|
||||
case data::mapping::type::EnumInterpreterError::ENTRY_NOT_FOUND:
|
||||
case data::type::EnumInterpreterError::TYPE_MISMATCH_ENUM:
|
||||
case data::type::EnumInterpreterError::TYPE_MISMATCH_ENUM_VALUE:
|
||||
case data::type::EnumInterpreterError::ENTRY_NOT_FOUND:
|
||||
default:
|
||||
throw std::runtime_error(
|
||||
"[oatpp::web::client::ApiClient::TypeInterpretation::toString()]: Error. Can't interpret Enum."
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "./Response.hpp"
|
||||
|
||||
#include "oatpp/data/mapping/ObjectMapper.hpp"
|
||||
#include "oatpp/data/mapping/type/Type.hpp"
|
||||
#include "oatpp/data/type/Type.hpp"
|
||||
|
||||
namespace oatpp { namespace web { namespace protocol { namespace http { namespace outgoing {
|
||||
|
||||
|
@ -108,62 +108,62 @@ public:
|
||||
typedef oatpp::data::mapping::ObjectMapper ObjectMapper;
|
||||
|
||||
/**
|
||||
* Convenience typedef for &id:oatpp::data::mapping::type::String;.
|
||||
* Convenience typedef for &id:oatpp::data::type::String;.
|
||||
*/
|
||||
typedef oatpp::String String;
|
||||
|
||||
/**
|
||||
* Convenience typedef for &id:oatpp::data::mapping::type::Int8;.
|
||||
* Convenience typedef for &id:oatpp::data::type::Int8;.
|
||||
*/
|
||||
typedef oatpp::Int8 Int8;
|
||||
|
||||
/**
|
||||
* Convenience typedef for &id:oatpp::data::mapping::type::UInt8;.
|
||||
* Convenience typedef for &id:oatpp::data::type::UInt8;.
|
||||
*/
|
||||
typedef oatpp::UInt8 UInt8;
|
||||
|
||||
/**
|
||||
* Convenience typedef for &id:oatpp::data::mapping::type::Int16;.
|
||||
* Convenience typedef for &id:oatpp::data::type::Int16;.
|
||||
*/
|
||||
typedef oatpp::Int16 Int16;
|
||||
|
||||
/**
|
||||
* Convenience typedef for &id:oatpp::data::mapping::type::UInt16;.
|
||||
* Convenience typedef for &id:oatpp::data::type::UInt16;.
|
||||
*/
|
||||
typedef oatpp::UInt16 UInt16;
|
||||
|
||||
/**
|
||||
* Convenience typedef for &id:oatpp::data::mapping::type::Int32;.
|
||||
* Convenience typedef for &id:oatpp::data::type::Int32;.
|
||||
*/
|
||||
typedef oatpp::Int32 Int32;
|
||||
|
||||
/**
|
||||
* Convenience typedef for &id:oatpp::data::mapping::type::UInt32;.
|
||||
* Convenience typedef for &id:oatpp::data::type::UInt32;.
|
||||
*/
|
||||
typedef oatpp::UInt32 UInt32;
|
||||
|
||||
/**
|
||||
* Convenience typedef for &id:oatpp::data::mapping::type::Int64;.
|
||||
* Convenience typedef for &id:oatpp::data::type::Int64;.
|
||||
*/
|
||||
typedef oatpp::Int64 Int64;
|
||||
|
||||
/**
|
||||
* Convenience typedef for &id:oatpp::data::mapping::type::UInt64;.
|
||||
* Convenience typedef for &id:oatpp::data::type::UInt64;.
|
||||
*/
|
||||
typedef oatpp::UInt64 UInt64;
|
||||
|
||||
/**
|
||||
* Convenience typedef for &id:oatpp::data::mapping::type::Float32;.
|
||||
* Convenience typedef for &id:oatpp::data::type::Float32;.
|
||||
*/
|
||||
typedef oatpp::Float32 Float32;
|
||||
|
||||
/**
|
||||
* Convenience typedef for &id:atpp::data::mapping::type::Float64;.
|
||||
* Convenience typedef for &id:atpp::data::type::Float64;.
|
||||
*/
|
||||
typedef oatpp::Float64 Float64;
|
||||
|
||||
/**
|
||||
* Convenience typedef for &id:oatpp::data::mapping::type::Boolean;.
|
||||
* Convenience typedef for &id:oatpp::data::type::Boolean;.
|
||||
*/
|
||||
typedef oatpp::Boolean Boolean;
|
||||
|
||||
@ -182,7 +182,7 @@ public:
|
||||
using Fields = oatpp::Fields<Value>;
|
||||
|
||||
template <class T>
|
||||
using Enum = oatpp::data::mapping::type::Enum<T>;
|
||||
using Enum = oatpp::data::type::Enum<T>;
|
||||
|
||||
protected:
|
||||
|
||||
@ -549,17 +549,17 @@ struct ApiController::TypeInterpretation <oatpp::Boolean> {
|
||||
};
|
||||
|
||||
template<class T, class I>
|
||||
struct ApiController::TypeInterpretation <data::mapping::type::EnumObjectWrapper<T, I>> {
|
||||
struct ApiController::TypeInterpretation <data::type::EnumObjectWrapper<T, I>> {
|
||||
|
||||
typedef data::mapping::type::EnumObjectWrapper<T, I> EnumOW;
|
||||
typedef data::type::EnumObjectWrapper<T, I> EnumOW;
|
||||
typedef typename I::UnderlyingTypeObjectWrapper UTOW;
|
||||
|
||||
static EnumOW fromString(const oatpp::String& typeName, const oatpp::String& text, bool& success) {
|
||||
const auto& parsedValue = ApiController::TypeInterpretation<UTOW>::fromString(typeName, text, success);
|
||||
if(success) {
|
||||
data::mapping::type::EnumInterpreterError error = data::mapping::type::EnumInterpreterError::OK;
|
||||
data::type::EnumInterpreterError error = data::type::EnumInterpreterError::OK;
|
||||
const auto& result = I::fromInterpretation(parsedValue, error);
|
||||
if(error == data::mapping::type::EnumInterpreterError::OK) {
|
||||
if(error == data::type::EnumInterpreterError::OK) {
|
||||
return result.template cast<EnumOW>();
|
||||
}
|
||||
success = false;
|
||||
|
@ -32,7 +32,7 @@ Endpoint::Info::Param::Param()
|
||||
{}
|
||||
|
||||
Endpoint::Info::Param::Param(const oatpp::String& pName,
|
||||
oatpp::data::mapping::type::Type* pType)
|
||||
oatpp::data::type::Type* pType)
|
||||
: name(pName)
|
||||
, type(pType)
|
||||
{}
|
||||
@ -41,7 +41,7 @@ const std::list<oatpp::String>& Endpoint::Info::Params::getOrder() const {
|
||||
return m_order;
|
||||
}
|
||||
|
||||
Endpoint::Info::Param& Endpoint::Info::Params::add(const oatpp::String& aname, oatpp::data::mapping::type::Type* type) {
|
||||
Endpoint::Info::Param& Endpoint::Info::Params::add(const oatpp::String& aname, oatpp::data::type::Type* type) {
|
||||
m_order.push_back(aname);
|
||||
Endpoint::Info::Param& param = operator [](aname);
|
||||
param.name = aname;
|
||||
|
@ -58,10 +58,10 @@ public:
|
||||
struct Param {
|
||||
|
||||
Param();
|
||||
Param(const oatpp::String& pName, oatpp::data::mapping::type::Type* pType);
|
||||
Param(const oatpp::String& pName, oatpp::data::type::Type* pType);
|
||||
|
||||
oatpp::String name;
|
||||
oatpp::data::mapping::type::Type* type;
|
||||
oatpp::data::type::Type* type;
|
||||
|
||||
oatpp::String description;
|
||||
oatpp::Boolean required = true;
|
||||
@ -92,7 +92,7 @@ public:
|
||||
* @param name
|
||||
* @return new or existing parameter
|
||||
*/
|
||||
Param& add(const oatpp::String& name, oatpp::data::mapping::type::Type* type);
|
||||
Param& add(const oatpp::String& name, oatpp::data::type::Type* type);
|
||||
|
||||
/**
|
||||
* Add parameter name to list order
|
||||
@ -119,7 +119,7 @@ public:
|
||||
*/
|
||||
struct ContentHints {
|
||||
oatpp::String contentType;
|
||||
oatpp::data::mapping::type::Type* schema;
|
||||
oatpp::data::type::Type* schema;
|
||||
oatpp::String description;
|
||||
std::list<std::pair<oatpp::String, oatpp::Any>> examples;
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include <oatpp/web/protocol/http/incoming/Request.hpp>
|
||||
#include "oatpp/web/protocol/http/Http.hpp"
|
||||
#include "oatpp/macro/codegen.hpp"
|
||||
#include "oatpp/data/mapping/type/Type.hpp"
|
||||
#include "oatpp/data/type/Type.hpp"
|
||||
|
||||
namespace oatpp { namespace web { namespace server { namespace handler {
|
||||
|
||||
|
@ -8,32 +8,6 @@ add_executable(oatppAllTests
|
||||
oatpp/base/CommandLineArgumentsTest.hpp
|
||||
oatpp/data/buffer/ProcessorTest.cpp
|
||||
oatpp/data/buffer/ProcessorTest.hpp
|
||||
oatpp/data/mapping/type/AnyTest.cpp
|
||||
oatpp/data/mapping/type/AnyTest.hpp
|
||||
oatpp/data/mapping/type/EnumTest.cpp
|
||||
oatpp/data/mapping/type/EnumTest.hpp
|
||||
oatpp/data/mapping/type/InterpretationTest.cpp
|
||||
oatpp/data/mapping/type/InterpretationTest.hpp
|
||||
oatpp/data/mapping/type/ListTest.cpp
|
||||
oatpp/data/mapping/type/ListTest.hpp
|
||||
oatpp/data/mapping/type/ObjectTest.cpp
|
||||
oatpp/data/mapping/type/ObjectTest.hpp
|
||||
oatpp/data/mapping/type/ObjectWrapperTest.cpp
|
||||
oatpp/data/mapping/type/ObjectWrapperTest.hpp
|
||||
oatpp/data/mapping/type/PairListTest.cpp
|
||||
oatpp/data/mapping/type/PairListTest.hpp
|
||||
oatpp/data/mapping/type/PrimitiveTest.cpp
|
||||
oatpp/data/mapping/type/PrimitiveTest.hpp
|
||||
oatpp/data/mapping/type/StringTest.cpp
|
||||
oatpp/data/mapping/type/StringTest.hpp
|
||||
oatpp/data/mapping/type/TypeTest.cpp
|
||||
oatpp/data/mapping/type/TypeTest.hpp
|
||||
oatpp/data/mapping/type/UnorderedMapTest.cpp
|
||||
oatpp/data/mapping/type/UnorderedMapTest.hpp
|
||||
oatpp/data/mapping/type/UnorderedSetTest.cpp
|
||||
oatpp/data/mapping/type/UnorderedSetTest.hpp
|
||||
oatpp/data/mapping/type/VectorTest.cpp
|
||||
oatpp/data/mapping/type/VectorTest.hpp
|
||||
oatpp/data/mapping/TreeTest.cpp
|
||||
oatpp/data/mapping/TreeTest.hpp
|
||||
oatpp/data/mapping/TreeToObjectMapperTest.cpp
|
||||
@ -50,6 +24,32 @@ add_executable(oatppAllTests
|
||||
oatpp/data/share/StringTemplateTest.hpp
|
||||
oatpp/data/stream/BufferStreamTest.cpp
|
||||
oatpp/data/stream/BufferStreamTest.hpp
|
||||
oatpp/data/type/AnyTest.cpp
|
||||
oatpp/data/type/AnyTest.hpp
|
||||
oatpp/data/type/EnumTest.cpp
|
||||
oatpp/data/type/EnumTest.hpp
|
||||
oatpp/data/type/InterpretationTest.cpp
|
||||
oatpp/data/type/InterpretationTest.hpp
|
||||
oatpp/data/type/ListTest.cpp
|
||||
oatpp/data/type/ListTest.hpp
|
||||
oatpp/data/type/ObjectTest.cpp
|
||||
oatpp/data/type/ObjectTest.hpp
|
||||
oatpp/data/type/ObjectWrapperTest.cpp
|
||||
oatpp/data/type/ObjectWrapperTest.hpp
|
||||
oatpp/data/type/PairListTest.cpp
|
||||
oatpp/data/type/PairListTest.hpp
|
||||
oatpp/data/type/PrimitiveTest.cpp
|
||||
oatpp/data/type/PrimitiveTest.hpp
|
||||
oatpp/data/type/StringTest.cpp
|
||||
oatpp/data/type/StringTest.hpp
|
||||
oatpp/data/type/TypeTest.cpp
|
||||
oatpp/data/type/TypeTest.hpp
|
||||
oatpp/data/type/UnorderedMapTest.cpp
|
||||
oatpp/data/type/UnorderedMapTest.hpp
|
||||
oatpp/data/type/UnorderedSetTest.cpp
|
||||
oatpp/data/type/UnorderedSetTest.hpp
|
||||
oatpp/data/type/VectorTest.cpp
|
||||
oatpp/data/type/VectorTest.hpp
|
||||
oatpp/encoding/Base64Test.cpp
|
||||
oatpp/encoding/Base64Test.hpp
|
||||
oatpp/encoding/UnicodeTest.cpp
|
||||
|
@ -35,19 +35,19 @@
|
||||
#include "oatpp/async/ConditionVariableTest.hpp"
|
||||
#include "oatpp/async/LockTest.hpp"
|
||||
|
||||
#include "oatpp/data/mapping/type/UnorderedMapTest.hpp"
|
||||
#include "oatpp/data/mapping/type/PairListTest.hpp"
|
||||
#include "oatpp/data/mapping/type/VectorTest.hpp"
|
||||
#include "oatpp/data/mapping/type/UnorderedSetTest.hpp"
|
||||
#include "oatpp/data/mapping/type/ListTest.hpp"
|
||||
#include "oatpp/data/mapping/type/ObjectTest.hpp"
|
||||
#include "oatpp/data/mapping/type/StringTest.hpp"
|
||||
#include "oatpp/data/mapping/type/PrimitiveTest.hpp"
|
||||
#include "oatpp/data/mapping/type/ObjectWrapperTest.hpp"
|
||||
#include "oatpp/data/mapping/type/TypeTest.hpp"
|
||||
#include "oatpp/data/mapping/type/AnyTest.hpp"
|
||||
#include "oatpp/data/mapping/type/EnumTest.hpp"
|
||||
#include "oatpp/data/mapping/type/InterpretationTest.hpp"
|
||||
#include "oatpp/data/type/UnorderedMapTest.hpp"
|
||||
#include "oatpp/data/type/PairListTest.hpp"
|
||||
#include "oatpp/data/type/VectorTest.hpp"
|
||||
#include "oatpp/data/type/UnorderedSetTest.hpp"
|
||||
#include "oatpp/data/type/ListTest.hpp"
|
||||
#include "oatpp/data/type/ObjectTest.hpp"
|
||||
#include "oatpp/data/type/StringTest.hpp"
|
||||
#include "oatpp/data/type/PrimitiveTest.hpp"
|
||||
#include "oatpp/data/type/ObjectWrapperTest.hpp"
|
||||
#include "oatpp/data/type/TypeTest.hpp"
|
||||
#include "oatpp/data/type/AnyTest.hpp"
|
||||
#include "oatpp/data/type/EnumTest.hpp"
|
||||
#include "oatpp/data/type/InterpretationTest.hpp"
|
||||
#include "oatpp/data/mapping/TypeResolverTest.hpp"
|
||||
|
||||
#include "oatpp/data/resource/InMemoryDataTest.hpp"
|
||||
@ -90,19 +90,19 @@ void runTests() {
|
||||
|
||||
//return;
|
||||
|
||||
//
|
||||
// OATPP_LOGD("Tests", "coroutine handle size=%lu", sizeof(oatpp::async::CoroutineHandle))
|
||||
// OATPP_LOGD("Tests", "coroutine size=%lu", sizeof(oatpp::async::AbstractCoroutine))
|
||||
// OATPP_LOGD("Tests", "action size=%lu", sizeof(oatpp::async::Action))
|
||||
// OATPP_LOGD("Tests", "class count=%d", oatpp::data::mapping::type::ClassId::getClassCount())
|
||||
//
|
||||
// auto names = oatpp::data::mapping::type::ClassId::getRegisteredClassNames();
|
||||
// v_int32 i = 0;
|
||||
// for(auto& name : names) {
|
||||
// OATPP_LOGD("CLASS", "%d --> '%s'", i, name)
|
||||
// i ++;
|
||||
// }
|
||||
/*
|
||||
|
||||
OATPP_LOGD("Tests", "coroutine handle size=%lu", sizeof(oatpp::async::CoroutineHandle))
|
||||
OATPP_LOGD("Tests", "coroutine size=%lu", sizeof(oatpp::async::AbstractCoroutine))
|
||||
OATPP_LOGD("Tests", "action size=%lu", sizeof(oatpp::async::Action))
|
||||
OATPP_LOGD("Tests", "class count=%d", oatpp::data::type::ClassId::getClassCount())
|
||||
|
||||
auto names = oatpp::data::type::ClassId::getRegisteredClassNames();
|
||||
v_int32 i = 0;
|
||||
for(auto& name : names) {
|
||||
OATPP_LOGD("CLASS", "%d --> '%s'", i, name)
|
||||
i ++;
|
||||
}
|
||||
|
||||
OATPP_RUN_TEST(oatpp::test::LoggerTest);
|
||||
OATPP_RUN_TEST(oatpp::base::CommandLineArgumentsTest);
|
||||
|
||||
@ -113,40 +113,40 @@ void runTests() {
|
||||
OATPP_RUN_TEST(oatpp::data::buffer::ProcessorTest);
|
||||
|
||||
OATPP_RUN_TEST(oatpp::data::stream::BufferStreamTest);
|
||||
*/
|
||||
|
||||
|
||||
OATPP_RUN_TEST(oatpp::data::mapping::TreeTest);
|
||||
OATPP_RUN_TEST(oatpp::data::mapping::TreeToObjectMapperTest);
|
||||
|
||||
|
||||
// OATPP_RUN_TEST(oatpp::data::mapping::type::ObjectWrapperTest);
|
||||
// OATPP_RUN_TEST(oatpp::data::mapping::type::TypeTest);
|
||||
//
|
||||
// OATPP_RUN_TEST(oatpp::data::mapping::type::StringTest);
|
||||
//
|
||||
// OATPP_RUN_TEST(oatpp::data::mapping::type::PrimitiveTest);
|
||||
// OATPP_RUN_TEST(oatpp::data::mapping::type::ListTest);
|
||||
// OATPP_RUN_TEST(oatpp::data::mapping::type::VectorTest);
|
||||
// OATPP_RUN_TEST(oatpp::data::mapping::type::UnorderedSetTest);
|
||||
// OATPP_RUN_TEST(oatpp::data::mapping::type::PairListTest);
|
||||
// OATPP_RUN_TEST(oatpp::data::mapping::type::UnorderedMapTest);
|
||||
// OATPP_RUN_TEST(oatpp::data::mapping::type::AnyTest);
|
||||
// OATPP_RUN_TEST(oatpp::data::mapping::type::EnumTest);
|
||||
//
|
||||
// OATPP_RUN_TEST(oatpp::data::mapping::type::ObjectTest);
|
||||
//
|
||||
// OATPP_RUN_TEST(oatpp::data::mapping::type::InterpretationTest);
|
||||
// OATPP_RUN_TEST(oatpp::data::mapping::TypeResolverTest);
|
||||
//
|
||||
// OATPP_RUN_TEST(oatpp::data::resource::InMemoryDataTest);
|
||||
//
|
||||
// OATPP_RUN_TEST(oatpp::async::ConditionVariableTest);
|
||||
// OATPP_RUN_TEST(oatpp::async::LockTest);
|
||||
//
|
||||
// OATPP_RUN_TEST(oatpp::utils::parser::CaretTest);
|
||||
//
|
||||
// OATPP_RUN_TEST(oatpp::provider::PoolTest);
|
||||
// OATPP_RUN_TEST(oatpp::provider::PoolTemplateTest);
|
||||
OATPP_RUN_TEST(oatpp::data::type::ObjectWrapperTest);
|
||||
OATPP_RUN_TEST(oatpp::data::type::TypeTest);
|
||||
|
||||
OATPP_RUN_TEST(oatpp::data::type::StringTest);
|
||||
|
||||
OATPP_RUN_TEST(oatpp::data::type::PrimitiveTest);
|
||||
OATPP_RUN_TEST(oatpp::data::type::ListTest);
|
||||
OATPP_RUN_TEST(oatpp::data::type::VectorTest);
|
||||
OATPP_RUN_TEST(oatpp::data::type::UnorderedSetTest);
|
||||
OATPP_RUN_TEST(oatpp::data::type::PairListTest);
|
||||
OATPP_RUN_TEST(oatpp::data::type::UnorderedMapTest);
|
||||
OATPP_RUN_TEST(oatpp::data::type::AnyTest);
|
||||
OATPP_RUN_TEST(oatpp::data::type::EnumTest);
|
||||
|
||||
OATPP_RUN_TEST(oatpp::data::type::ObjectTest);
|
||||
|
||||
OATPP_RUN_TEST(oatpp::data::type::InterpretationTest);
|
||||
OATPP_RUN_TEST(oatpp::data::mapping::TypeResolverTest);
|
||||
|
||||
OATPP_RUN_TEST(oatpp::data::resource::InMemoryDataTest);
|
||||
|
||||
OATPP_RUN_TEST(oatpp::async::ConditionVariableTest);
|
||||
OATPP_RUN_TEST(oatpp::async::LockTest);
|
||||
|
||||
OATPP_RUN_TEST(oatpp::utils::parser::CaretTest);
|
||||
|
||||
OATPP_RUN_TEST(oatpp::provider::PoolTest);
|
||||
OATPP_RUN_TEST(oatpp::provider::PoolTemplateTest);
|
||||
|
||||
OATPP_RUN_TEST(oatpp::json::EnumTest);
|
||||
OATPP_RUN_TEST(oatpp::json::BooleanTest);
|
||||
@ -156,7 +156,7 @@ void runTests() {
|
||||
OATPP_RUN_TEST(oatpp::json::DeserializerTest);
|
||||
|
||||
OATPP_RUN_TEST(oatpp::json::DTOMapperPerfTest);
|
||||
/*
|
||||
|
||||
OATPP_RUN_TEST(oatpp::json::DTOMapperTest);
|
||||
OATPP_RUN_TEST(oatpp::test::encoding::Base64Test);
|
||||
OATPP_RUN_TEST(oatpp::test::encoding::UnicodeTest);
|
||||
@ -246,7 +246,7 @@ void runTests() {
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ namespace oatpp { namespace data { namespace mapping {
|
||||
class TypeResolverTest : public oatpp::test::UnitTest{
|
||||
public:
|
||||
|
||||
TypeResolverTest():UnitTest("TEST[data::mapping::type::TypeResolverTest]"){}
|
||||
TypeResolverTest():UnitTest("TEST[data::type::TypeResolverTest]"){}
|
||||
void onRun() override;
|
||||
|
||||
};
|
||||
|
@ -24,12 +24,12 @@
|
||||
|
||||
#include "AnyTest.hpp"
|
||||
|
||||
#include "oatpp/data/mapping/type/Any.hpp"
|
||||
#include "oatpp/data/type/Any.hpp"
|
||||
|
||||
#include "oatpp/json/ObjectMapper.hpp"
|
||||
#include "oatpp/macro/codegen.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
namespace {
|
||||
|
||||
@ -61,7 +61,7 @@ void AnyTest::onRun() {
|
||||
OATPP_LOGI(TAG, "Test default constructor...")
|
||||
oatpp::Any any;
|
||||
OATPP_ASSERT(!any)
|
||||
OATPP_ASSERT(any.getValueType() == oatpp::data::mapping::type::__class::Any::getType())
|
||||
OATPP_ASSERT(any.getValueType() == oatpp::data::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.getValueType() == oatpp::data::mapping::type::__class::Any::getType())
|
||||
OATPP_ASSERT(any.getValueType() == oatpp::data::type::__class::Any::getType())
|
||||
OATPP_ASSERT(any.getStoredType() == nullptr)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
@ -79,8 +79,8 @@ void AnyTest::onRun() {
|
||||
OATPP_LOGI(TAG, "Test retrieve()...")
|
||||
oatpp::Any any(oatpp::String("Hello Any!"));
|
||||
OATPP_ASSERT(any)
|
||||
OATPP_ASSERT(any.getValueType() == oatpp::data::mapping::type::__class::Any::getType())
|
||||
OATPP_ASSERT(any.getStoredType() == oatpp::data::mapping::type::__class::String::getType())
|
||||
OATPP_ASSERT(any.getValueType() == oatpp::data::type::__class::Any::getType())
|
||||
OATPP_ASSERT(any.getStoredType() == oatpp::data::type::__class::String::getType())
|
||||
auto str = any.retrieve<oatpp::String>();
|
||||
OATPP_ASSERT(str == "Hello Any!")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
@ -91,14 +91,14 @@ void AnyTest::onRun() {
|
||||
oatpp::Any any(oatpp::Int32(32));
|
||||
|
||||
OATPP_ASSERT(any)
|
||||
OATPP_ASSERT(any.getValueType() == oatpp::data::mapping::type::__class::Any::getType())
|
||||
OATPP_ASSERT(any.getStoredType() == oatpp::data::mapping::type::__class::Int32::getType())
|
||||
OATPP_ASSERT(any.getValueType() == oatpp::data::type::__class::Any::getType())
|
||||
OATPP_ASSERT(any.getStoredType() == oatpp::data::type::__class::Int32::getType())
|
||||
|
||||
any.store(oatpp::String("Hello Any!"));
|
||||
|
||||
OATPP_ASSERT(any)
|
||||
OATPP_ASSERT(any.getValueType() == oatpp::data::mapping::type::__class::Any::getType())
|
||||
OATPP_ASSERT(any.getStoredType() == oatpp::data::mapping::type::__class::String::getType())
|
||||
OATPP_ASSERT(any.getValueType() == oatpp::data::type::__class::Any::getType())
|
||||
OATPP_ASSERT(any.getStoredType() == oatpp::data::type::__class::String::getType())
|
||||
|
||||
auto str = any.retrieve<oatpp::String>();
|
||||
OATPP_ASSERT(str == "Hello Any!")
|
||||
@ -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.getValueType() == oatpp::data::mapping::type::__class::Any::getType())
|
||||
OATPP_ASSERT(any.getValueType() == oatpp::data::type::__class::Any::getType())
|
||||
OATPP_ASSERT(any.getStoredType() == Object<Dto1>::Class::getType())
|
||||
|
||||
bool wasError = false;
|
||||
@ -134,11 +134,11 @@ void AnyTest::onRun() {
|
||||
OATPP_ASSERT(any1)
|
||||
OATPP_ASSERT(any2)
|
||||
|
||||
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.getValueType() == oatpp::data::type::__class::Any::getType())
|
||||
OATPP_ASSERT(any2.getValueType() == oatpp::data::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())
|
||||
OATPP_ASSERT(any1.getStoredType() == oatpp::data::type::__class::String::getType())
|
||||
OATPP_ASSERT(any2.getStoredType() == oatpp::data::type::__class::String::getType())
|
||||
|
||||
OATPP_ASSERT(any1 == any2)
|
||||
OATPP_ASSERT(any1.getPtr().get() != any2.getPtr().get())
|
||||
@ -161,11 +161,11 @@ void AnyTest::onRun() {
|
||||
OATPP_ASSERT(!any1)
|
||||
OATPP_ASSERT(any2)
|
||||
|
||||
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.getValueType() == oatpp::data::type::__class::Any::getType())
|
||||
OATPP_ASSERT(any2.getValueType() == oatpp::data::type::__class::Any::getType())
|
||||
|
||||
OATPP_ASSERT(any1.getStoredType() == nullptr)
|
||||
OATPP_ASSERT(any2.getStoredType() == oatpp::data::mapping::type::__class::String::getType())
|
||||
OATPP_ASSERT(any2.getStoredType() == oatpp::data::type::__class::String::getType())
|
||||
|
||||
OATPP_ASSERT(any1 != any2)
|
||||
OATPP_ASSERT(any1.getPtr().get() != any2.getPtr().get())
|
||||
@ -180,4 +180,4 @@ void AnyTest::onRun() {
|
||||
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
@ -22,21 +22,21 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef oatpp_data_mapping_type_AnyTest_hpp
|
||||
#define oatpp_data_mapping_type_AnyTest_hpp
|
||||
#ifndef oatpp_data_type_AnyTest_hpp
|
||||
#define oatpp_data_type_AnyTest_hpp
|
||||
|
||||
#include "oatpp-test/UnitTest.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
class AnyTest : public oatpp::test::UnitTest {
|
||||
public:
|
||||
|
||||
AnyTest():UnitTest("TEST[data::mapping::type::AnyTest]"){}
|
||||
AnyTest():UnitTest("TEST[data::type::AnyTest]"){}
|
||||
void onRun() override;
|
||||
|
||||
};
|
||||
|
||||
}}}}
|
||||
}}}
|
||||
|
||||
#endif /* oatpp_data_mapping_type_AnyTest_hpp */
|
||||
#endif /* oatpp_data_type_AnyTest_hpp */
|
@ -29,7 +29,7 @@
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
#include OATPP_CODEGEN_BEGIN(DTO)
|
||||
|
||||
@ -142,11 +142,11 @@ void EnumTest::onRun() {
|
||||
OATPP_ASSERT(oatpp::Enum<Enum2>::NotNull::AsString::Interpreter::notNull == true)
|
||||
OATPP_ASSERT(oatpp::Enum<Enum2>::NotNull::AsNumber::Interpreter::notNull == true)
|
||||
|
||||
auto pd1 = static_cast<const oatpp::data::mapping::type::__class::AbstractEnum::PolymorphicDispatcher*>(
|
||||
auto pd1 = static_cast<const oatpp::data::type::__class::AbstractEnum::PolymorphicDispatcher*>(
|
||||
oatpp::Enum<Enum2>::Class::getType()->polymorphicDispatcher
|
||||
);
|
||||
|
||||
auto pd2 = static_cast<const oatpp::data::mapping::type::__class::AbstractEnum::PolymorphicDispatcher*>(
|
||||
auto pd2 = static_cast<const oatpp::data::type::__class::AbstractEnum::PolymorphicDispatcher*>(
|
||||
oatpp::Enum<Enum2>::NotNull::Class::getType()->polymorphicDispatcher
|
||||
);
|
||||
|
||||
@ -164,17 +164,17 @@ void EnumTest::onRun() {
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test Interpreter AsString...")
|
||||
oatpp::data::mapping::type::EnumInterpreterError e = oatpp::data::mapping::type::EnumInterpreterError::OK;
|
||||
oatpp::data::type::EnumInterpreterError e = oatpp::data::type::EnumInterpreterError::OK;
|
||||
auto inter = oatpp::Enum<Enum2>::AsString::Interpreter::toInterpretation(oatpp::Enum<Enum2>::AsString(Enum2::NAME_1), e);
|
||||
OATPP_ASSERT(inter.getValueType() == oatpp::String::Class::getType())
|
||||
OATPP_ASSERT(e == oatpp::data::mapping::type::EnumInterpreterError::OK)
|
||||
OATPP_ASSERT(e == oatpp::data::type::EnumInterpreterError::OK)
|
||||
|
||||
auto interValue = inter.cast<oatpp::String>();
|
||||
OATPP_ASSERT(interValue == "name-1")
|
||||
|
||||
oatpp::Void voidValue = oatpp::Enum<Enum2>::AsString::Interpreter::fromInterpretation(interValue, e);
|
||||
OATPP_ASSERT(voidValue.getValueType() == oatpp::Enum<Enum2>::AsString::Class::getType())
|
||||
OATPP_ASSERT(e == oatpp::data::mapping::type::EnumInterpreterError::OK)
|
||||
OATPP_ASSERT(e == oatpp::data::type::EnumInterpreterError::OK)
|
||||
|
||||
auto value = voidValue.cast<oatpp::Enum<Enum2>::AsString>();
|
||||
OATPP_ASSERT(value == Enum2::NAME_1)
|
||||
@ -183,17 +183,17 @@ void EnumTest::onRun() {
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test Interpreter AsNumber...")
|
||||
oatpp::data::mapping::type::EnumInterpreterError e = oatpp::data::mapping::type::EnumInterpreterError::OK;
|
||||
oatpp::data::type::EnumInterpreterError e = oatpp::data::type::EnumInterpreterError::OK;
|
||||
auto inter = oatpp::Enum<Enum2>::AsNumber::Interpreter::toInterpretation(oatpp::Enum<Enum2>::AsNumber(Enum2::NAME_1), e);
|
||||
OATPP_ASSERT(inter.getValueType() == oatpp::Int32::Class::getType())
|
||||
OATPP_ASSERT(e == oatpp::data::mapping::type::EnumInterpreterError::OK)
|
||||
OATPP_ASSERT(e == oatpp::data::type::EnumInterpreterError::OK)
|
||||
|
||||
auto interValue = inter.cast<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.getValueType() == oatpp::Enum<Enum2>::AsNumber::Class::getType())
|
||||
OATPP_ASSERT(e == oatpp::data::mapping::type::EnumInterpreterError::OK)
|
||||
OATPP_ASSERT(e == oatpp::data::type::EnumInterpreterError::OK)
|
||||
|
||||
auto value = voidValue.cast<oatpp::Enum<Enum2>::AsNumber>();
|
||||
OATPP_ASSERT(value == Enum2::NAME_1)
|
||||
@ -303,4 +303,4 @@ void EnumTest::onRun() {
|
||||
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
@ -22,21 +22,21 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef oatpp_data_mapping_type_EnumTest_hpp
|
||||
#define oatpp_data_mapping_type_EnumTest_hpp
|
||||
#ifndef oatpp_data_type_EnumTest_hpp
|
||||
#define oatpp_data_type_EnumTest_hpp
|
||||
|
||||
#include "oatpp-test/UnitTest.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
class EnumTest : public oatpp::test::UnitTest {
|
||||
public:
|
||||
|
||||
EnumTest():UnitTest("TEST[data::mapping::type::EnumTest]"){}
|
||||
EnumTest():UnitTest("TEST[data::type::EnumTest]"){}
|
||||
void onRun() override;
|
||||
|
||||
};
|
||||
|
||||
}}}}
|
||||
}}}
|
||||
|
||||
#endif /* oatpp_data_mapping_type_EnumTest_hpp */
|
||||
#endif /* oatpp_data_type_EnumTest_hpp */
|
@ -29,7 +29,7 @@
|
||||
#include "oatpp/Types.hpp"
|
||||
#include "oatpp/macro/codegen.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
namespace {
|
||||
|
||||
@ -51,8 +51,8 @@ namespace __class {
|
||||
class LineClass;
|
||||
}
|
||||
|
||||
typedef oatpp::data::mapping::type::Primitive<VPoint, __class::PointClass> Point;
|
||||
typedef oatpp::data::mapping::type::Primitive<VLine, __class::LineClass> Line;
|
||||
typedef oatpp::data::type::Primitive<VPoint, __class::PointClass> Point;
|
||||
typedef oatpp::data::type::Primitive<VLine, __class::LineClass> Line;
|
||||
|
||||
namespace __class {
|
||||
|
||||
@ -243,4 +243,4 @@ void InterpretationTest::onRun() {
|
||||
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
@ -22,21 +22,21 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef oatpp_data_mapping_type_InterpretationTest_hpp
|
||||
#define oatpp_data_mapping_type_InterpretationTest_hpp
|
||||
#ifndef oatpp_data_type_InterpretationTest_hpp
|
||||
#define oatpp_data_type_InterpretationTest_hpp
|
||||
|
||||
#include "oatpp-test/UnitTest.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
class InterpretationTest : public oatpp::test::UnitTest {
|
||||
public:
|
||||
|
||||
InterpretationTest():UnitTest("TEST[data::mapping::type::InterpretationTest]"){}
|
||||
InterpretationTest():UnitTest("TEST[data::type::InterpretationTest]"){}
|
||||
void onRun() override;
|
||||
|
||||
};
|
||||
|
||||
}}}}
|
||||
}}}
|
||||
|
||||
#endif // oatpp_data_mapping_type_InterpretationTest_hpp
|
||||
#endif // oatpp_data_type_InterpretationTest_hpp
|
@ -26,7 +26,7 @@
|
||||
|
||||
#include "oatpp/Types.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
void ListTest::onRun() {
|
||||
|
||||
@ -38,7 +38,7 @@ void ListTest::onRun() {
|
||||
OATPP_ASSERT(list == nullptr)
|
||||
|
||||
OATPP_ASSERT(list.get() == nullptr)
|
||||
OATPP_ASSERT(list.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id)
|
||||
OATPP_ASSERT(list.getValueType()->classId.id == oatpp::data::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,7 +53,7 @@ void ListTest::onRun() {
|
||||
OATPP_ASSERT(list->size() == 0)
|
||||
|
||||
OATPP_ASSERT(list.get() != nullptr)
|
||||
OATPP_ASSERT(list.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id)
|
||||
OATPP_ASSERT(list.getValueType()->classId.id == oatpp::data::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.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id)
|
||||
OATPP_ASSERT(list.getValueType()->classId.id == oatpp::data::type::__class::AbstractList::CLASS_ID.id)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ void ListTest::onRun() {
|
||||
OATPP_LOGI(TAG, "test polymorphicDispatcher...")
|
||||
oatpp::List<oatpp::String> list = {"a", "b", "c"};
|
||||
|
||||
auto polymorphicDispatcher = static_cast<const oatpp::data::mapping::type::__class::Collection::PolymorphicDispatcher*>(
|
||||
auto polymorphicDispatcher = static_cast<const oatpp::data::type::__class::Collection::PolymorphicDispatcher*>(
|
||||
list.getValueType()->polymorphicDispatcher
|
||||
);
|
||||
|
||||
@ -157,4 +157,4 @@ void ListTest::onRun() {
|
||||
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
@ -22,21 +22,21 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef oatpp_data_mapping_type_ListTest_hpp
|
||||
#define oatpp_data_mapping_type_ListTest_hpp
|
||||
#ifndef oatpp_data_type_ListTest_hpp
|
||||
#define oatpp_data_type_ListTest_hpp
|
||||
|
||||
#include "oatpp-test/UnitTest.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
class ListTest : public oatpp::test::UnitTest {
|
||||
public:
|
||||
|
||||
ListTest():UnitTest("TEST[data::mapping::type::ListTest]"){}
|
||||
ListTest():UnitTest("TEST[data::type::ListTest]"){}
|
||||
void onRun() override;
|
||||
|
||||
};
|
||||
|
||||
}}}}
|
||||
}}}
|
||||
|
||||
#endif /* oatpp_data_mapping_type_ListTest_hpp */
|
||||
#endif /* oatpp_data_type_ListTest_hpp */
|
@ -33,7 +33,7 @@
|
||||
|
||||
#include <thread>
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
namespace {
|
||||
|
||||
@ -200,7 +200,7 @@ void ObjectTest::onRun() {
|
||||
OATPP_LOGI(TAG, "Test Meta 1...")
|
||||
|
||||
auto type = Object<DtoA>::Class::getType();
|
||||
auto dispatcher = static_cast<const oatpp::data::mapping::type::__class::AbstractObject::PolymorphicDispatcher*>(type->polymorphicDispatcher);
|
||||
auto dispatcher = static_cast<const oatpp::data::type::__class::AbstractObject::PolymorphicDispatcher*>(type->polymorphicDispatcher);
|
||||
const auto& propsMap = dispatcher->getProperties()->getMap();
|
||||
|
||||
OATPP_ASSERT(propsMap.size() == 1)
|
||||
@ -217,7 +217,7 @@ void ObjectTest::onRun() {
|
||||
OATPP_LOGI(TAG, "Test Meta 2...")
|
||||
|
||||
auto type = Object<DtoB>::Class::getType();
|
||||
auto dispatcher = static_cast<const oatpp::data::mapping::type::__class::AbstractObject::PolymorphicDispatcher*>(type->polymorphicDispatcher);
|
||||
auto dispatcher = static_cast<const oatpp::data::type::__class::AbstractObject::PolymorphicDispatcher*>(type->polymorphicDispatcher);
|
||||
const auto& propsMap = dispatcher->getProperties()->getMap();
|
||||
|
||||
OATPP_ASSERT(propsMap.size() == 2)
|
||||
@ -242,7 +242,7 @@ void ObjectTest::onRun() {
|
||||
Object<DtoA> a;
|
||||
OATPP_ASSERT(!a)
|
||||
OATPP_ASSERT(a == nullptr)
|
||||
OATPP_ASSERT(a.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractObject::CLASS_ID.id)
|
||||
OATPP_ASSERT(a.getValueType()->classId.id == oatpp::data::type::__class::AbstractObject::CLASS_ID.id)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
@ -574,4 +574,4 @@ void ObjectTest::onRun() {
|
||||
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
@ -22,21 +22,21 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef oatpp_data_mapping_type_ObjectTest_hpp
|
||||
#define oatpp_data_mapping_type_ObjectTest_hpp
|
||||
#ifndef oatpp_data_type_ObjectTest_hpp
|
||||
#define oatpp_data_type_ObjectTest_hpp
|
||||
|
||||
#include "oatpp-test/UnitTest.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
class ObjectTest : public oatpp::test::UnitTest {
|
||||
public:
|
||||
|
||||
ObjectTest():UnitTest("TEST[data::mapping::type::ObjectTest]"){}
|
||||
ObjectTest():UnitTest("TEST[data::type::ObjectTest]"){}
|
||||
void onRun() override;
|
||||
|
||||
};
|
||||
|
||||
}}}}
|
||||
}}}
|
||||
|
||||
#endif /* oatpp_data_mapping_type_ObjectTest_hpp */
|
||||
#endif /* oatpp_data_type_ObjectTest_hpp */
|
@ -25,12 +25,12 @@
|
||||
#include "ObjectWrapperTest.hpp"
|
||||
#include "oatpp/Types.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
namespace {
|
||||
|
||||
template<class T, class Clazz = oatpp::data::mapping::type::__class::Void>
|
||||
using TestWrapper = oatpp::data::mapping::type::ObjectWrapper<T, Clazz>;
|
||||
template<class T, class Clazz = oatpp::data::type::__class::Void>
|
||||
using TestWrapper = oatpp::data::type::ObjectWrapper<T, Clazz>;
|
||||
|
||||
}
|
||||
|
||||
@ -41,47 +41,47 @@ void ObjectWrapperTest::onRun() {
|
||||
TestWrapper<std::string> pw;
|
||||
OATPP_ASSERT(!pw)
|
||||
OATPP_ASSERT(pw == nullptr)
|
||||
OATPP_ASSERT(pw.getValueType() == oatpp::data::mapping::type::__class::Void::getType())
|
||||
OATPP_ASSERT(pw.getValueType() == oatpp::data::type::__class::Void::getType())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Check default valueType is assigned (specified tparam Clazz)...")
|
||||
TestWrapper<std::string, oatpp::data::mapping::type::__class::String> pw;
|
||||
TestWrapper<std::string, oatpp::data::type::__class::String> pw;
|
||||
OATPP_ASSERT(!pw)
|
||||
OATPP_ASSERT(pw == nullptr)
|
||||
OATPP_ASSERT(pw.getValueType() == oatpp::data::mapping::type::__class::String::getType())
|
||||
OATPP_ASSERT(pw.getValueType() == oatpp::data::type::__class::String::getType())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Check valueType is assigned from constructor...")
|
||||
TestWrapper<std::string> pw(oatpp::data::mapping::type::__class::String::getType());
|
||||
TestWrapper<std::string> pw(oatpp::data::type::__class::String::getType());
|
||||
OATPP_ASSERT(!pw)
|
||||
OATPP_ASSERT(pw == nullptr)
|
||||
OATPP_ASSERT(pw.getValueType() == oatpp::data::mapping::type::__class::String::getType())
|
||||
OATPP_ASSERT(pw.getValueType() == oatpp::data::type::__class::String::getType())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Check valueType is assigned from copy constructor...")
|
||||
TestWrapper<std::string> pw1(oatpp::data::mapping::type::__class::String::getType());
|
||||
TestWrapper<std::string> pw1(oatpp::data::type::__class::String::getType());
|
||||
TestWrapper<std::string> pw2(pw1);
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::String::getType())
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::type::__class::String::getType())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Check valueType is assigned from move constructor...")
|
||||
TestWrapper<std::string> pw1(oatpp::data::mapping::type::__class::String::getType());
|
||||
TestWrapper<std::string> pw1(oatpp::data::type::__class::String::getType());
|
||||
TestWrapper<std::string> pw2(std::move(pw1));
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::String::getType())
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::type::__class::String::getType())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Check valueType is NOT assigned from copy-assign operator...")
|
||||
TestWrapper<std::string> pw1(oatpp::data::mapping::type::__class::String::getType());
|
||||
TestWrapper<std::string> pw1(oatpp::data::type::__class::String::getType());
|
||||
TestWrapper<std::string> pw2;
|
||||
bool throws = false;
|
||||
try {
|
||||
@ -89,14 +89,14 @@ void ObjectWrapperTest::onRun() {
|
||||
} catch (std::runtime_error&) {
|
||||
throws = true;
|
||||
}
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::Void::getType())
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::type::__class::Void::getType())
|
||||
OATPP_ASSERT(throws)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Check valueType is NOT assigned from move-assign operator...")
|
||||
TestWrapper<std::string> pw1(oatpp::data::mapping::type::__class::String::getType());
|
||||
TestWrapper<std::string> pw1(oatpp::data::type::__class::String::getType());
|
||||
TestWrapper<std::string> pw2;
|
||||
bool throws = false;
|
||||
try {
|
||||
@ -104,7 +104,7 @@ void ObjectWrapperTest::onRun() {
|
||||
} catch (std::runtime_error&) {
|
||||
throws = true;
|
||||
}
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::Void::getType())
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::type::__class::Void::getType())
|
||||
OATPP_ASSERT(throws)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
@ -114,12 +114,12 @@ void ObjectWrapperTest::onRun() {
|
||||
TestWrapper<std::string> pw1;
|
||||
OATPP_ASSERT(!pw1)
|
||||
OATPP_ASSERT(pw1 == nullptr)
|
||||
OATPP_ASSERT(pw1.getValueType() == oatpp::data::mapping::type::__class::Void::getType())
|
||||
OATPP_ASSERT(pw1.getValueType() == oatpp::data::type::__class::Void::getType())
|
||||
|
||||
TestWrapper<std::string> pw2 = std::make_shared<std::string>("Hello!");
|
||||
OATPP_ASSERT(pw2)
|
||||
OATPP_ASSERT(pw2 != nullptr)
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::Void::getType())
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::type::__class::Void::getType())
|
||||
|
||||
pw1 = pw2;
|
||||
|
||||
@ -136,15 +136,15 @@ void ObjectWrapperTest::onRun() {
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Check != operator...")
|
||||
TestWrapper<std::string, oatpp::data::mapping::type::__class::String> pw1(std::make_shared<std::string>("Hello!"));
|
||||
TestWrapper<std::string, oatpp::data::type::__class::String> pw1(std::make_shared<std::string>("Hello!"));
|
||||
OATPP_ASSERT(pw1)
|
||||
OATPP_ASSERT(pw1 != nullptr)
|
||||
OATPP_ASSERT(pw1.getValueType() == oatpp::data::mapping::type::__class::String::getType())
|
||||
OATPP_ASSERT(pw1.getValueType() == oatpp::data::type::__class::String::getType())
|
||||
|
||||
TestWrapper<std::string, oatpp::data::mapping::type::__class::String> pw2(std::make_shared<std::string>("Hello!"));
|
||||
TestWrapper<std::string, oatpp::data::type::__class::String> pw2(std::make_shared<std::string>("Hello!"));
|
||||
OATPP_ASSERT(pw2)
|
||||
OATPP_ASSERT(pw2 != nullptr)
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::String::getType())
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::type::__class::String::getType())
|
||||
|
||||
OATPP_ASSERT(pw1 != pw2)
|
||||
OATPP_ASSERT(pw1.get() != pw2.get())
|
||||
@ -156,12 +156,12 @@ void ObjectWrapperTest::onRun() {
|
||||
TestWrapper<std::string> pw1;
|
||||
OATPP_ASSERT(!pw1)
|
||||
OATPP_ASSERT(pw1 == nullptr)
|
||||
OATPP_ASSERT(pw1.getValueType() == oatpp::data::mapping::type::__class::Void::getType())
|
||||
OATPP_ASSERT(pw1.getValueType() == oatpp::data::type::__class::Void::getType())
|
||||
|
||||
TestWrapper<std::string> pw2 = std::make_shared<std::string>("Hello!");
|
||||
OATPP_ASSERT(pw2)
|
||||
OATPP_ASSERT(pw2 != nullptr)
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::Void::getType())
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::type::__class::Void::getType())
|
||||
|
||||
pw1 = std::move(pw2);
|
||||
|
||||
@ -197,4 +197,4 @@ void ObjectWrapperTest::onRun() {
|
||||
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
@ -22,21 +22,21 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef oatpp_data_mapping_type_ObjectWrapperTest_hpp
|
||||
#define oatpp_data_mapping_type_ObjectWrapperTest_hpp
|
||||
#ifndef oatpp_data_type_ObjectWrapperTest_hpp
|
||||
#define oatpp_data_type_ObjectWrapperTest_hpp
|
||||
|
||||
#include "oatpp-test/UnitTest.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
class ObjectWrapperTest : public oatpp::test::UnitTest {
|
||||
public:
|
||||
|
||||
ObjectWrapperTest():UnitTest("TEST[data::mapping::type::ObjectWrapperTest]"){}
|
||||
ObjectWrapperTest():UnitTest("TEST[data::type::ObjectWrapperTest]"){}
|
||||
void onRun() override;
|
||||
|
||||
};
|
||||
|
||||
}}}}
|
||||
}}}
|
||||
|
||||
#endif /* oatpp_data_mapping_type_ObjectWrapperTest_hpp */
|
||||
#endif /* oatpp_data_type_ObjectWrapperTest_hpp */
|
@ -26,7 +26,7 @@
|
||||
|
||||
#include "oatpp/Types.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
void PairListTest::onRun() {
|
||||
|
||||
@ -38,7 +38,7 @@ void PairListTest::onRun() {
|
||||
OATPP_ASSERT(map == nullptr)
|
||||
|
||||
OATPP_ASSERT(map.get() == nullptr)
|
||||
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractPairList::CLASS_ID.id)
|
||||
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::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())
|
||||
@ -55,7 +55,7 @@ void PairListTest::onRun() {
|
||||
OATPP_ASSERT(map->size() == 0)
|
||||
|
||||
OATPP_ASSERT(map.get() != nullptr)
|
||||
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractPairList::CLASS_ID.id)
|
||||
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::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())
|
||||
@ -72,7 +72,7 @@ void PairListTest::onRun() {
|
||||
OATPP_ASSERT(map->size() == 0)
|
||||
|
||||
OATPP_ASSERT(map.get() != nullptr)
|
||||
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractPairList::CLASS_ID.id)
|
||||
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::type::__class::AbstractPairList::CLASS_ID.id)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ void PairListTest::onRun() {
|
||||
OATPP_LOGI(TAG, "test polymorphicDispatcher...")
|
||||
oatpp::Fields<String> map = {{"key1", "a"}, {"key2", "b"}, {"key3", "c"}};
|
||||
|
||||
auto polymorphicDispatcher = static_cast<const typename oatpp::data::mapping::type::__class::Map::PolymorphicDispatcher*>(
|
||||
auto polymorphicDispatcher = static_cast<const typename oatpp::data::type::__class::Map::PolymorphicDispatcher*>(
|
||||
map.getValueType()->polymorphicDispatcher
|
||||
);
|
||||
|
||||
@ -165,4 +165,4 @@ void PairListTest::onRun() {
|
||||
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
@ -22,21 +22,21 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef oatpp_data_mapping_type_PairListTest_hpp
|
||||
#define oatpp_data_mapping_type_PairListTest_hpp
|
||||
#ifndef oatpp_data_type_PairListTest_hpp
|
||||
#define oatpp_data_type_PairListTest_hpp
|
||||
|
||||
#include "oatpp-test/UnitTest.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
class PairListTest : public oatpp::test::UnitTest {
|
||||
public:
|
||||
|
||||
PairListTest():UnitTest("TEST[data::mapping::type::PairListTest]"){}
|
||||
PairListTest():UnitTest("TEST[data::type::PairListTest]"){}
|
||||
void onRun() override;
|
||||
|
||||
};
|
||||
|
||||
}}}}
|
||||
}}}
|
||||
|
||||
#endif /* oatpp_data_mapping_type_PairListTest_hpp */
|
||||
#endif /* oatpp_data_type_PairListTest_hpp */
|
@ -26,7 +26,7 @@
|
||||
|
||||
#include "oatpp/Types.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
namespace {
|
||||
|
||||
@ -254,4 +254,4 @@ void PrimitiveTest::onRun() {
|
||||
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
@ -22,21 +22,21 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef oatpp_data_mapping_type_PrimitiveTest_hpp
|
||||
#define oatpp_data_mapping_type_PrimitiveTest_hpp
|
||||
#ifndef oatpp_data_type_PrimitiveTest_hpp
|
||||
#define oatpp_data_type_PrimitiveTest_hpp
|
||||
|
||||
#include "oatpp-test/UnitTest.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
class PrimitiveTest : public oatpp::test::UnitTest {
|
||||
public:
|
||||
|
||||
PrimitiveTest():UnitTest("TEST[data::mapping::type::PrimitiveTest]"){}
|
||||
PrimitiveTest():UnitTest("TEST[data::type::PrimitiveTest]"){}
|
||||
void onRun() override;
|
||||
|
||||
};
|
||||
|
||||
}}}}
|
||||
}}}
|
||||
|
||||
#endif /* oatpp_data_mapping_type_PrimitiveTest_hpp */
|
||||
#endif /* oatpp_data_type_PrimitiveTest_hpp */
|
@ -28,7 +28,7 @@
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
void StringTest::onRun() {
|
||||
|
||||
@ -316,4 +316,4 @@ void StringTest::onRun() {
|
||||
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
@ -22,21 +22,21 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef oatpp_data_mapping_type_StringTest_hpp
|
||||
#define oatpp_data_mapping_type_StringTest_hpp
|
||||
#ifndef oatpp_data_type_StringTest_hpp
|
||||
#define oatpp_data_type_StringTest_hpp
|
||||
|
||||
#include "oatpp-test/UnitTest.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
class StringTest : public oatpp::test::UnitTest {
|
||||
public:
|
||||
|
||||
StringTest():UnitTest("TEST[data::mapping::type::StringTest]"){}
|
||||
StringTest():UnitTest("TEST[data::type::StringTest]"){}
|
||||
void onRun() override;
|
||||
|
||||
};
|
||||
|
||||
}}}}
|
||||
}}}
|
||||
|
||||
#endif /* oatpp_data_mapping_type_StringTest_hpp */
|
||||
#endif /* oatpp_data_type_StringTest_hpp */
|
@ -27,7 +27,7 @@
|
||||
#include "oatpp/macro/codegen.hpp"
|
||||
#include "oatpp/Types.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
namespace {
|
||||
|
||||
@ -68,52 +68,52 @@ void TypeTest::onRun() {
|
||||
auto obj = TestDto::createShared();
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_string.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_string.getValueType()->classId == oatpp::data::mapping::type::__class::String::CLASS_ID)
|
||||
OATPP_ASSERT(obj->field_string.getValueType()->classId == oatpp::data::type::__class::String::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_int8.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_int8.getValueType()->classId == oatpp::data::mapping::type::__class::Int8::CLASS_ID)
|
||||
OATPP_ASSERT(obj->field_int8.getValueType()->classId == oatpp::data::type::__class::Int8::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_int16.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_int16.getValueType()->classId == oatpp::data::mapping::type::__class::Int16::CLASS_ID)
|
||||
OATPP_ASSERT(obj->field_int16.getValueType()->classId == oatpp::data::type::__class::Int16::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_int32.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_int32.getValueType()->classId == oatpp::data::mapping::type::__class::Int32::CLASS_ID)
|
||||
OATPP_ASSERT(obj->field_int32.getValueType()->classId == oatpp::data::type::__class::Int32::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_int64.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_int64.getValueType()->classId == oatpp::data::mapping::type::__class::Int64::CLASS_ID)
|
||||
OATPP_ASSERT(obj->field_int64.getValueType()->classId == oatpp::data::type::__class::Int64::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_float32.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_float32.getValueType()->classId == oatpp::data::mapping::type::__class::Float32::CLASS_ID)
|
||||
OATPP_ASSERT(obj->field_float32.getValueType()->classId == oatpp::data::type::__class::Float32::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_float64.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_float64.getValueType()->classId == oatpp::data::mapping::type::__class::Float64::CLASS_ID)
|
||||
OATPP_ASSERT(obj->field_float64.getValueType()->classId == oatpp::data::type::__class::Float64::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_boolean.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_boolean.getValueType()->classId == oatpp::data::mapping::type::__class::Boolean::CLASS_ID)
|
||||
OATPP_ASSERT(obj->field_boolean.getValueType()->classId == oatpp::data::type::__class::Boolean::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_string.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_list_string.getValueType()->classId == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID)
|
||||
OATPP_ASSERT(obj->field_list_string.getValueType()->classId == oatpp::data::type::__class::AbstractList::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_int32.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_list_int32.getValueType()->classId == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID)
|
||||
OATPP_ASSERT(obj->field_list_int32.getValueType()->classId == oatpp::data::type::__class::AbstractList::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_int64.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_list_int64.getValueType()->classId == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID)
|
||||
OATPP_ASSERT(obj->field_list_int64.getValueType()->classId == oatpp::data::type::__class::AbstractList::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_float32.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_list_float32.getValueType()->classId == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID)
|
||||
OATPP_ASSERT(obj->field_list_float32.getValueType()->classId == oatpp::data::type::__class::AbstractList::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_float64.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_list_float64.getValueType()->classId == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID)
|
||||
OATPP_ASSERT(obj->field_list_float64.getValueType()->classId == oatpp::data::type::__class::AbstractList::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_boolean.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_list_boolean.getValueType()->classId == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID)
|
||||
OATPP_ASSERT(obj->field_list_boolean.getValueType()->classId == oatpp::data::type::__class::AbstractList::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_map_string_string.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_map_string_string.getValueType()->classId == oatpp::data::mapping::type::__class::AbstractPairList::CLASS_ID)
|
||||
OATPP_ASSERT(obj->field_map_string_string.getValueType()->classId == oatpp::data::type::__class::AbstractPairList::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->obj1.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->obj1.getValueType()->classId == oatpp::data::mapping::type::__class::AbstractObject::CLASS_ID)
|
||||
OATPP_ASSERT(obj->obj1.getValueType()->classId == oatpp::data::type::__class::AbstractObject::CLASS_ID)
|
||||
|
||||
OATPP_ASSERT(oatpp::String::Class::getType()->extends(oatpp::String::Class::getType()))
|
||||
OATPP_ASSERT(oatpp::Int32::Class::getType()->extends(oatpp::Int32::Class::getType()))
|
||||
@ -121,4 +121,4 @@ void TypeTest::onRun() {
|
||||
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
@ -22,21 +22,21 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef oatpp_data_mapping_type_TypeTest_hpp
|
||||
#define oatpp_data_mapping_type_TypeTest_hpp
|
||||
#ifndef oatpp_data_type_TypeTest_hpp
|
||||
#define oatpp_data_type_TypeTest_hpp
|
||||
|
||||
#include "oatpp-test/UnitTest.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
class TypeTest : public oatpp::test::UnitTest {
|
||||
public:
|
||||
|
||||
TypeTest():UnitTest("TEST[data::mapping::type::TypeTest]"){}
|
||||
TypeTest():UnitTest("TEST[data::type::TypeTest]"){}
|
||||
void onRun() override;
|
||||
|
||||
};
|
||||
|
||||
}}}}
|
||||
}}}
|
||||
|
||||
#endif /* oatpp_data_mapping_type_TypeTest_hpp */
|
||||
#endif /* oatpp_data_type_TypeTest_hpp */
|
@ -26,7 +26,7 @@
|
||||
|
||||
#include "oatpp/Types.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
void UnorderedMapTest::onRun() {
|
||||
|
||||
@ -38,7 +38,7 @@ void UnorderedMapTest::onRun() {
|
||||
OATPP_ASSERT(map == nullptr)
|
||||
|
||||
OATPP_ASSERT(map.get() == nullptr)
|
||||
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedMap::CLASS_ID.id)
|
||||
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::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())
|
||||
@ -55,7 +55,7 @@ void UnorderedMapTest::onRun() {
|
||||
OATPP_ASSERT(map->size() == 0)
|
||||
|
||||
OATPP_ASSERT(map.get() != nullptr)
|
||||
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedMap::CLASS_ID.id)
|
||||
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::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())
|
||||
@ -72,7 +72,7 @@ void UnorderedMapTest::onRun() {
|
||||
OATPP_ASSERT(map->size() == 0)
|
||||
|
||||
OATPP_ASSERT(map.get() != nullptr)
|
||||
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedMap::CLASS_ID.id)
|
||||
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::type::__class::AbstractUnorderedMap::CLASS_ID.id)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ void UnorderedMapTest::onRun() {
|
||||
OATPP_LOGI(TAG, "test polymorphicDispatcher...")
|
||||
oatpp::UnorderedFields<String> map = {{"key1", "a"}, {"key2", "b"}, {"key3", "c"}};
|
||||
|
||||
auto polymorphicDispatcher = static_cast<const typename oatpp::data::mapping::type::__class::Map::PolymorphicDispatcher*>(
|
||||
auto polymorphicDispatcher = static_cast<const typename oatpp::data::type::__class::Map::PolymorphicDispatcher*>(
|
||||
map.getValueType()->polymorphicDispatcher
|
||||
);
|
||||
|
||||
@ -160,4 +160,4 @@ void UnorderedMapTest::onRun() {
|
||||
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
@ -22,21 +22,21 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef oatpp_data_mapping_type_UnorderedMapTest_hpp
|
||||
#define oatpp_data_mapping_type_UnorderedMapTest_hpp
|
||||
#ifndef oatpp_data_type_UnorderedMapTest_hpp
|
||||
#define oatpp_data_type_UnorderedMapTest_hpp
|
||||
|
||||
#include "oatpp-test/UnitTest.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
class UnorderedMapTest : public oatpp::test::UnitTest {
|
||||
public:
|
||||
|
||||
UnorderedMapTest():UnitTest("TEST[data::mapping::type::UnorderedMapTest]"){}
|
||||
UnorderedMapTest():UnitTest("TEST[data::type::UnorderedMapTest]"){}
|
||||
void onRun() override;
|
||||
|
||||
};
|
||||
|
||||
}}}}
|
||||
}}}
|
||||
|
||||
#endif /* oatpp_data_mapping_type_UnorderedMapTest_hpp */
|
||||
#endif /* oatpp_data_type_UnorderedMapTest_hpp */
|
@ -26,7 +26,7 @@
|
||||
|
||||
#include "oatpp/Types.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
void UnorderedSetTest::onRun() {
|
||||
|
||||
@ -39,7 +39,7 @@ void UnorderedSetTest::onRun() {
|
||||
OATPP_ASSERT(set == nullptr)
|
||||
|
||||
OATPP_ASSERT(set.get() == nullptr)
|
||||
OATPP_ASSERT(set.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedSet::CLASS_ID.id)
|
||||
OATPP_ASSERT(set.getValueType()->classId.id == oatpp::data::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,7 +54,7 @@ void UnorderedSetTest::onRun() {
|
||||
OATPP_ASSERT(set->size() == 0)
|
||||
|
||||
OATPP_ASSERT(set.get() != nullptr)
|
||||
OATPP_ASSERT(set.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedSet::CLASS_ID.id)
|
||||
OATPP_ASSERT(set.getValueType()->classId.id == oatpp::data::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.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedSet::CLASS_ID.id)
|
||||
OATPP_ASSERT(set.getValueType()->classId.id == oatpp::data::type::__class::AbstractUnorderedSet::CLASS_ID.id)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
@ -120,7 +120,7 @@ void UnorderedSetTest::onRun() {
|
||||
OATPP_LOGI(TAG, "test polymorphicDispatcher...")
|
||||
oatpp::UnorderedSet<oatpp::String> set = {"a", "b", "c"};
|
||||
|
||||
auto polymorphicDispatcher = static_cast<const typename oatpp::data::mapping::type::__class::Collection::PolymorphicDispatcher*>(
|
||||
auto polymorphicDispatcher = static_cast<const typename oatpp::data::type::__class::Collection::PolymorphicDispatcher*>(
|
||||
set.getValueType()->polymorphicDispatcher
|
||||
);
|
||||
|
||||
@ -141,4 +141,4 @@ void UnorderedSetTest::onRun() {
|
||||
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
@ -22,21 +22,21 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef oatpp_data_mapping_type_UnorderedSetTest_hpp
|
||||
#define oatpp_data_mapping_type_UnorderedSetTest_hpp
|
||||
#ifndef oatpp_data_type_UnorderedSetTest_hpp
|
||||
#define oatpp_data_type_UnorderedSetTest_hpp
|
||||
|
||||
#include "oatpp-test/UnitTest.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
class UnorderedSetTest : public oatpp::test::UnitTest {
|
||||
public:
|
||||
|
||||
UnorderedSetTest():UnitTest("TEST[data::mapping::type::UnorderedSetTest]"){}
|
||||
UnorderedSetTest():UnitTest("TEST[data::type::UnorderedSetTest]"){}
|
||||
void onRun() override;
|
||||
|
||||
};
|
||||
|
||||
}}}}
|
||||
}}}
|
||||
|
||||
#endif /* oatpp_data_mapping_type_UnorderedSetTest_hpp */
|
||||
#endif /* oatpp_data_type_UnorderedSetTest_hpp */
|
@ -26,7 +26,7 @@
|
||||
|
||||
#include "oatpp/Types.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
void VectorTest::onRun() {
|
||||
|
||||
@ -38,7 +38,7 @@ void VectorTest::onRun() {
|
||||
OATPP_ASSERT(vector == nullptr)
|
||||
|
||||
OATPP_ASSERT(vector.get() == nullptr)
|
||||
OATPP_ASSERT(vector.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractVector::CLASS_ID.id)
|
||||
OATPP_ASSERT(vector.getValueType()->classId.id == oatpp::data::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,7 +53,7 @@ void VectorTest::onRun() {
|
||||
OATPP_ASSERT(vector->size() == 0)
|
||||
|
||||
OATPP_ASSERT(vector.get() != nullptr)
|
||||
OATPP_ASSERT(vector.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractVector::CLASS_ID.id)
|
||||
OATPP_ASSERT(vector.getValueType()->classId.id == oatpp::data::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.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractVector::CLASS_ID.id)
|
||||
OATPP_ASSERT(vector.getValueType()->classId.id == oatpp::data::type::__class::AbstractVector::CLASS_ID.id)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ void VectorTest::onRun() {
|
||||
OATPP_LOGI(TAG, "test polymorphicDispatcher...")
|
||||
oatpp::Vector<oatpp::String> vector = {"a", "b", "c"};
|
||||
|
||||
auto polymorphicDispatcher = static_cast<const oatpp::data::mapping::type::__class::Collection::PolymorphicDispatcher*>(
|
||||
auto polymorphicDispatcher = static_cast<const oatpp::data::type::__class::Collection::PolymorphicDispatcher*>(
|
||||
vector.getValueType()->polymorphicDispatcher
|
||||
);
|
||||
|
||||
@ -157,4 +157,4 @@ void VectorTest::onRun() {
|
||||
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}
|
@ -22,21 +22,21 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef oatpp_data_mapping_type_VectorTest_hpp
|
||||
#define oatpp_data_mapping_type_VectorTest_hpp
|
||||
#ifndef oatpp_data_type_VectorTest_hpp
|
||||
#define oatpp_data_type_VectorTest_hpp
|
||||
|
||||
#include "oatpp-test/UnitTest.hpp"
|
||||
|
||||
namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
namespace oatpp { namespace data { namespace type {
|
||||
|
||||
class VectorTest : public oatpp::test::UnitTest {
|
||||
public:
|
||||
|
||||
VectorTest():UnitTest("TEST[data::mapping::type::VectorTest]"){}
|
||||
VectorTest():UnitTest("TEST[data::type::VectorTest]"){}
|
||||
void onRun() override;
|
||||
|
||||
};
|
||||
|
||||
}}}}
|
||||
}}}
|
||||
|
||||
#endif /* oatpp_data_mapping_type_VectorTest_hpp */
|
||||
#endif /* oatpp_data_type_VectorTest_hpp */
|
@ -28,9 +28,9 @@
|
||||
|
||||
#include "oatpp/json/ObjectMapper.hpp"
|
||||
|
||||
#include "oatpp/data/mapping/type/Object.hpp"
|
||||
#include "oatpp/data/mapping/type/List.hpp"
|
||||
#include "oatpp/data/mapping/type/Primitive.hpp"
|
||||
#include "oatpp/data/type/Object.hpp"
|
||||
#include "oatpp/data/type/List.hpp"
|
||||
#include "oatpp/data/type/Primitive.hpp"
|
||||
|
||||
#include "oatpp/utils/Conversion.hpp"
|
||||
|
||||
|
@ -237,7 +237,7 @@ void DeserializerTest::onRun(){
|
||||
OATPP_ASSERT(obj4->list->size() == 0)
|
||||
OATPP_ASSERT(obj4->map->size() == 0)
|
||||
|
||||
data::mapping::type::DTOWrapper<Test5> obj5;
|
||||
data::type::DTOWrapper<Test5> obj5;
|
||||
try {
|
||||
obj5 = mapper.readFromString<oatpp::Object<Test5>>(R"({"strF":null})");
|
||||
} catch (std::runtime_error& e) {
|
||||
@ -251,7 +251,7 @@ void DeserializerTest::onRun(){
|
||||
OATPP_ASSERT(false)
|
||||
}
|
||||
|
||||
data::mapping::type::DTOWrapper<Test7> obj7;
|
||||
data::type::DTOWrapper<Test7> obj7;
|
||||
try {
|
||||
obj7 = mapper.readFromString<oatpp::Object<Test7>>(R"({"strF":"value1", "child":{"name":null}})");
|
||||
} catch (std::runtime_error& e) {
|
||||
|
Loading…
Reference in New Issue
Block a user