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:
  1. Default constructor.
  2. Nullptr constructor.
  3. Copy constructor.
  4. Move constructor.
  5. Constructor.
void store Store any ObjectWrapper in Any.
const Type* getStoredType Get Type of the stored object.
WrapperType retrieve Retrieve stored object.

Any::Any

  1. Default constructor.
    Any()
    
  2. Nullptr constructor.
    Any(std::nullptr_t)
    
  3. Copy constructor.
    • @param other - other Any.
    Any(const Any& other)
    
  4. Move constructor.
    • @param other
    Any(Any&& other)
    
  5. 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.valueType), __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.

const Type* getStoredType() const

Any::retrieve

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