# Any.hpp
This File On Github
Ask A Question
API: latest
module: oatpp
#include "oatpp/core/data/mapping/type/Any.hpp"
# Any
Any class.
namespace oatpp { namespace data { namespace mapping { namespace type { namespace __class {
class Any {}
}}}}}
# Fields
Type | Name | Summary |
---|---|---|
const ClassId | CLASS_ID | Class Id. |
# Any::CLASS_ID
Class Id.
static const ClassId CLASS_ID
# Any
Any - ObjectWrapper to hold Any oatpp mapping-enabled type.
namespace oatpp { namespace data { namespace mapping { namespace type {
class Any : public ObjectWrapper<AnyHandle, __class::Any> {}
}}}}
# Methods
Return Type | Name | Summary |
---|---|---|
[none] | Any | Multiple implementations:
|
void | store | Store any ObjectWrapper in Any. |
const Type* | getStoredType | Get Type of the stored object. |
Void | retrieve | Multiple implementations:
|
# Any::Any
- Default constructor.
Any()
- Nullptr constructor.
Any(std::nullptr_t)
- Copy constructor.
- @param other - other Any.
Any(const Any& other)
- Move constructor.
- @param other
Any(Any&& other)
- Constructor.
- @tparam T - Underlying type of ObjectWrapper.
- @tparam C - __class of ObjectWrapper.
- @param polymorph - any ObjectWrapper.
template<class T, class C> Any(const ObjectWrapper<T, C>& polymorph) : ObjectWrapper(std::make_shared<AnyHandle>(polymorph.getPtr(), polymorph.getValueType()), __class::Any::getType())
# Any::store
Store any ObjectWrapper in Any.
- @tparam T
- @tparam C
- @param polymorph - ObjectWrapper. Ex.:
oatpp::String
,oatpp::List<...>
, etc.
template<class T, class C>
void store(const ObjectWrapper<T, C>& polymorph)
# Any::getStoredType
Get Type
of the stored object.
- @return - oatpp::data::mapping::type::Type.
const Type* getStoredType() const
# Any::retrieve
- Retrieve stored object of type
type
.- @param type - oatpp::Type
- @return - oatpp::Void.
- @throws -
std::runtime_error
- if stored type and type requested do not match.
Void retrieve(const Type* type) const
- Retrieve stored object.
- @tparam WrapperType - type of the object to retrieve.
- @return - ObjectWrapper of type -
WrapperType
. - @throws -
std::runtime_error
- if stored type and type requested (WrapperType
) do not match.
template<class WrapperType> WrapperType retrieve() const