# Object.hpp
This File On Github
Ask A Question
API: latest
module: oatpp
#include "oatpp/core/data/mapping/type/Object.hpp"
# BaseObject
Base class of all object-like mapping-enabled structures ex.: oatpp::DTO.
namespace oatpp { namespace data { namespace mapping { namespace type {
class BaseObject : public oatpp::base::Countable {}
}}}}
# BaseObject::Property
Class to map object properties.
namespace oatpp { namespace data { namespace mapping { namespace type {
class BaseObject : public oatpp::base::Countable {
class Property {}
};
}}}}
# Fields
Type | Name | Summary |
---|---|---|
const char* const | name | Property name. |
const Type* const | type | Property type. |
Info | info | Property additional info. |
# Methods
Return Type | Name | Summary |
---|---|---|
[none] | Property | Constructor. |
void | set | Set value of object field mapped by this property. |
Void | get | Get value of object field mapped by this property. |
Void& | getAsRef | Get reference to ObjectWrapper of the object field. |
# BaseObject::Property::name
Property name.
const char* const name
# BaseObject::Property::type
Property type.
const Type* const type
# BaseObject::Property::info
Property additional info.
Info info
# BaseObject::Property::Property
Constructor.
- @param pOffset - memory offset of object field from object start address.
- @param pName - name of the property.
- @param pType - Type of the property.
Property(v_int64 pOffset, const char* pName, const Type* pType)
# BaseObject::Property::set
Set value of object field mapped by this property.
- @param object - object address.
- @param value - value to set.
void set(BaseObject* object, const Void& value)
# BaseObject::Property::get
Get value of object field mapped by this property.
- @param object - object address.
- @return - value of the field.
Void get(BaseObject* object)
# BaseObject::Property::getAsRef
Get reference to ObjectWrapper of the object field.
- @param object - object address.
- @return - reference to ObjectWrapper of the object field.
Void& getAsRef(BaseObject* object)
# BaseObject::Property::Info
Editional Info about Property.
namespace oatpp { namespace data { namespace mapping { namespace type {
class BaseObject : public oatpp::base::Countable {
class Property {
struct Info {}
};
};
}}}}
# Fields
Type | Name | Summary |
---|---|---|
std::string | description | Description. |
std::string | pattern | Pattern. |
bool | required | Required. |
TypeSelector* | typeSelector | Type selector. Property::TypeSelector. |
# BaseObject::Property::Info::description
Description.
std::string description = ""
# BaseObject::Property::Info::pattern
Pattern.
std::string pattern = ""
# BaseObject::Property::Info::required
Required.
bool required = false
# BaseObject::Property::Info::typeSelector
Type selector. Property::TypeSelector.
TypeSelector* typeSelector = nullptr
# BaseObject::Property::TypeSelector
Property Type Selector.
namespace oatpp { namespace data { namespace mapping { namespace type {
class BaseObject : public oatpp::base::Countable {
class Property {
class TypeSelector {}
};
};
}}}}
# Methods
Return Type | Name | Summary |
---|---|---|
[none] | ~TypeSelector | Default destructor. |
const type::Type* | selectType | Select property type. |
# BaseObject::Property::TypeSelector::~TypeSelector
Default destructor.
virtual ~TypeSelector() = default
# BaseObject::Property::TypeSelector::selectType
Select property type.
- @param self - pointer to
this
object. - @return - oatpp::Type.
virtual const type::Type* selectType(BaseObject* self) = 0
# BaseObject::Properties
Object type properties table.
namespace oatpp { namespace data { namespace mapping { namespace type {
class BaseObject : public oatpp::base::Countable {
class Properties {}
};
}}}}
# Methods
Return Type | Name | Summary |
---|---|---|
Property* | pushBack | Add property to the end of the list. |
void | pushFrontAll | Add all properties to the beginning of the list. |
const std::unordered_map<std::string, Property*>& | getMap | Get properties as unordered map for random access. |
const std::list<Property*>& | getList | Get properties in ordered way. |
# BaseObject::Properties::pushBack
Add property to the end of the list.
- @param property
Property* pushBack(Property* property)
# BaseObject::Properties::pushFrontAll
Add all properties to the beginning of the list.
- @param properties
void pushFrontAll(Properties* properties)
# BaseObject::Properties::getMap
Get properties as unordered map for random access.
- @return reference to std::unordered_map of std::string to oatpp::data::mapping::type::BaseObject::Property*.
const std::unordered_map<std::string, Property*>& getMap() const
# BaseObject::Properties::getList
Get properties in ordered way.
- @return std::list of oatpp::data::mapping::type::BaseObject::Property*.
const std::list<Property*>& getList() const
# AbstractObject
AbstractObject class.
namespace oatpp { namespace data { namespace mapping { namespace type { namespace __class {
class AbstractObject {}
}}}}}
# Fields
Type | Name | Summary |
---|---|---|
const ClassId | CLASS_ID | Class id. |
# AbstractObject::CLASS_ID
Class id.
static const ClassId CLASS_ID
# Object
Template for Object class of type T.
- @tparam T - object type.
namespace oatpp { namespace data { namespace mapping { namespace type { namespace __class {
template<class T>
class Object : public AbstractObject {}
}}}}}
# Methods
Return Type | Name | Summary |
---|---|---|
Type* | getType | Get type describing this class. |
# Object::getType
Get type describing this class.
- @return - oatpp::data::mapping::type::Type
static Type* getType()
# DTOWrapper
ObjectWrapper for DTO. AKA oatpp::Object<T>
.
- @tparam ObjT - class extended from DTO.
namespace oatpp { namespace data { namespace mapping { namespace type {
template<class ObjT>
class DTOWrapper : public ObjectWrapper<ObjT, __class::Object<ObjT>> {}
}}}}
# DTO
Base class for all DTO objects. For more info about Data Transfer Object (DTO) see Data Transfer Object (DTO).
namespace oatpp { namespace data { namespace mapping { namespace type {
class DTO : public BaseObject {}
}}}}