Represent an immutable meta information value as a type-id and type-erased data. More...
#include <MetainfoValueImpl.h>
Public Member Functions | |
MetainfoValueImpl () | |
Default constructor. | |
MetainfoValueImpl (const MetainfoValueImpl &)=default | |
Copy constructor. | |
MetainfoValueImpl (MetainfoValueImpl &&)=default | |
Move constructor. | |
MetainfoValueImpl & | operator= (const MetainfoValueImpl &)=default |
Copy assignment. | |
MetainfoValueImpl & | operator= (MetainfoValueImpl &&)=default |
Move assignment. | |
template<class ValueType , class DecayedValueType = typename std::decay<ValueType>::type, class PrimitiveType = typename MakePrimitive<DecayedValueType>::type, class = typename std::enable_if< !std::is_same<DecayedValueType, MetainfoValueImpl>::value>::type> | |
MetainfoValueImpl (ValueType &&value) | |
Construct with given value. More... | |
MetainfoValueImpl (const char *value) | |
template<class T > | |
T | as () const |
Convert the value to type T More... | |
template<class T > | |
operator T () const | |
Implicitly convert value to type T More... | |
void | swap (MetainfoValueImpl &other) noexcept |
Swap with other. | |
bool | operator== (const MetainfoValueImpl &right) const noexcept |
Test for equality. | |
bool | operator!= (const MetainfoValueImpl &right) const noexcept |
Test for inequality. | |
TypeID | type () const noexcept |
Get TypeID. | |
boost::any & | any () noexcept |
Get boost::any. | |
const boost::any & | any () const noexcept |
std::string | toString () const |
Convert to string. | |
template<> | |
bool | as () const |
template<> | |
int | as () const |
template<> | |
std::int64_t | as () const |
template<> | |
float | as () const |
template<> | |
double | as () const |
template<> | |
std::string | as () const |
template<> | |
Array< bool > | as () const |
template<> | |
Array< int > | as () const |
template<> | |
Array< std::int64_t > | as () const |
template<> | |
Array< float > | as () const |
template<> | |
Array< double > | as () const |
template<> | |
Array< std::string > | as () const |
Represent an immutable meta information value as a type-id and type-erased data.
The MetainfoValueImpl can be implicitly casted to the supported types.
Definition at line 33 of file MetainfoValueImpl.h.
|
inlineexplicit |
Construct with given value.
ValueType | Type of the captured value (needs to be supported) |
value | Value to capture |
Definition at line 58 of file MetainfoValueImpl.h.
|
inline |
Convert the value to type T
If the type T
is different than the internally stored type, the function does its best to convert the value to T
in a meaningful way.
T
Exception | Conversion error: Conversion would result in truncation of the value or conversions from primitive to array type |
Definition at line 76 of file MetainfoValueImpl.h.
|
inline |
Implicitly convert value to type T
Definition at line 86 of file MetainfoValueImpl.h.