#include <datatypebase.h>
General Data class. An object of this class can store every type of data as long as that type has been registered (see DataType).
Public Member Functions | |
Data ()=default | |
Result< void > | Init (const DataType &type) |
~Data () | |
Bool | IsEmpty () const |
Bool | IsPopulated () const |
const DataType & | GetType () const |
void | Reset () |
template<typename T > | |
Data (T &&data, typename std::enable_if< !STD_IS_REPLACEMENT(same, typename std::decay< T >::type, Data), DummyParamType * >::type=(DummyParamType *) nullptr) | |
Data (Data &&src) | |
Data & | operator= (Data &&src) |
Result< Data > | GetCopy () const |
Result< void > | CopyFrom (const Data &src) |
Result< void > | CopyFrom (const ConstDataPtr &src) |
Result< void > | MoveFrom (MoveDataPtr &&src) |
Result< void > | CopyFrom (ForwardingDataPtr &&src) |
template<typename T > | |
Result< void > | Set (T &&data) |
template<typename T > | |
Result< typename std::conditional< GetCollectionKind< T >::value==COLLECTION_KIND::ARRAY, T, typename ByValueParam< T >::type >::type > | Get () const |
template<typename T > | |
Result< typename std::conditional< STD_IS_REPLACEMENT(void, T)||(GetCollectionKind< T >::value==COLLECTION_KIND::ARRAY), T, T & >::type > | Get () |
template<typename T > | |
ByValueParam< T >::type | GetOrDefault () const |
template<typename T > | |
MAXON_ATTRIBUTE_FORCE_INLINE ByValueParam< T >::type | GetOrNull () const |
template<typename T > | |
T | Get (const T &defaultValue) const |
template<typename T > | |
Result< T > | Convert () const |
template<typename T > | |
T | ConvertOrDefault () const |
template<typename T > | |
T | Convert (const T &defaultValue) const |
Result< Data > | ConvertData (const DataType &destType) const |
template<typename T > | |
T * | GetPtr () |
template<typename T > | |
const T * | GetPtr () const |
Generic * | GetPtr (const DataType &type) |
const Generic * | GetPtr (const DataType &type) const |
const Generic * | PrivateGetPtr () const |
const Generic * | PrivateGetPtr (const DataType &type) const |
TupleValue * | GetTuple () |
const TupleValue * | GetTuple () const |
String | ToString (const FormatStatement *formatStatement=nullptr) const |
COMPARERESULT | Compare (const Data &c) const |
HashInt | GetHashCode () const |
UniqueHash | GetUniqueHashCode () const |
Bool | IsEqual (const Data &other, EQUALITY equality=EQUALITY::DEEP) const |
Bool | operator== (const Data &other) const |
Bool | operator!= (const Data &other) const |
Bool | operator== (const ConstDataPtr &other) const |
Bool | operator!= (const ConstDataPtr &other) const |
Bool | operator< (const Data &other) const |
Bool | operator<= (const Data &other) const |
Bool | operator> (const Data &other) const |
Bool | operator>= (const Data &other) const |
ConstDataPtr | ToConstDataPtr (const DataType &expectedType) const |
template<typename DEST , typename SRC > | |
Result< void > | SetImpl (SRC &&data, OverloadRank0) |
template<typename DEST > | |
Result< void > | SetImpl (const Data &data, OverloadRank1) |
template<typename DEST > | |
Result< void > | SetImpl (Data &data, OverloadRank1) |
template<typename DEST > | |
Result< void > | SetImpl (Data &&data, OverloadRank1) |
template<typename DEST , typename SRC > | |
std::enable_if< GetCollectionKind< SRC >::value==COLLECTION_KIND::ARRAY, Result< void > >::type | SetImpl (SRC &&data, OverloadRank1) |
template<> | |
void | InitSet (Data &&data) |
template<> | |
Data * | GetPtr () |
template<> | |
Result< void > | Get () const |
template<> | |
Result< void > | Set (const Data &value) |
template<> | |
Result< void > | Set (Data &value) |
template<> | |
Result< void > | Set (Data &&value) |
template<> | |
void | InitSet (HTTPREQUESTTYPE &&d) |
Static Public Member Functions | |
template<typename T > | |
static Result< Data > | Create () |
Private Member Functions | |
MAXON_DISALLOW_COPY_AND_ASSIGN (Data) | |
template<typename T > | |
Result< typename ByValueParam< T >::type > | GetImpl (OverloadRank0) const |
template<typename T > | |
std::enable_if< GetCollectionKind< T >::value==COLLECTION_KIND::ARRAY, Result< T > >::type | GetImpl (OverloadRank1) const |
template<typename T > | |
Result< typename std::conditional< STD_IS_REPLACEMENT(void, T), void, T & >::type > | GetImpl (OverloadRank0) |
template<typename T > | |
std::enable_if< GetCollectionKind< T >::value==COLLECTION_KIND::ARRAY, Result< T > >::type | GetImpl (OverloadRank1) |
template<typename T > | |
SFINAEHelper< Result< T >, typename T::IsBlock >::type | GetImpl (OverloadRank2) |
template<typename T > | |
SFINAEHelper< Result< T >, typename T::IsBlock >::type | GetImpl (OverloadRank2) const |
template<typename T > | |
void | InitSet (T &&data) |
Static Private Member Functions | |
static const ObjectInterface * | CheckInstanceOf (const ObjectInterface *obj, const DataType &type) |
static const ObjectRef * | CheckInstanceOf (const ObjectRef *obj, const DataType &type) |
Private Attributes | |
DataType | _typeInfo |
DataMemBlock | _memBlock |
Friends | |
class | DataDictionaryInterface |
class | DataDictionaryObjectInterface |
class | Url |
class | ConstDataPtr |
class | TrivialDataPtr |
class | COWData |
|
default |
constructor initializes the data with an nullptr type.
~Data | ( | ) |
|
explicit |
Template class to construct a Data object from a value. The value has to fit in DataMemBlock, i.e., this constructor can only be used when SIZEOF(T) <= SIZEOF(DataMemBlock). Otherwise, you have to use Set which might return an error.
T | Type of data. This constructor only works if SIZEOF(T) <= SIZEOF(DataMemBlock). |
|
private |
Initializes this data to the given type. If this data already has the given type, nothing happens, i.e., the value is not reset. Otherwise, the current value is freed, and the data is initialized with a new default value of the given type.
[in] | type | Type to which this data shall be set. |
const DataType& GetType | ( | ) | const |
Returns the DataType of the Data. you can compare this value to GetDataType<Int32>() or GetDataType<String>().
void Reset | ( | ) |
Frees the wrapped data and resetd the Data object to its initial state.
Result<void> CopyFrom | ( | const ConstDataPtr & | src | ) |
Copies data described by a ConstDataPtr.
[in] | src | ConstDataPtr to copy data from. |
Result<void> MoveFrom | ( | MoveDataPtr && | src | ) |
Moves data described by a MoveDataPtr.
[in] | src | MoveDataPtr to move data from. |
Result<void> CopyFrom | ( | ForwardingDataPtr && | src | ) |
Copies or moves data described by a ForwardingDataPtr.
[in] | src | ForwardingDataPtr to copy or move data from. |
Result<void> Set | ( | T && | data | ) |
Result<typename std::conditional<GetCollectionKind<T>::value == COLLECTION_KIND::ARRAY, T, typename ByValueParam<T>::type>::type> Get | ( | ) | const |
Result<typename std::conditional<STD_IS_REPLACEMENT(void, T) || (GetCollectionKind<T>::value == COLLECTION_KIND::ARRAY), T, T&>::type> Get | ( | ) |
ByValueParam<T>::type GetOrDefault | ( | ) | const |
MAXON_ATTRIBUTE_FORCE_INLINE ByValueParam<T>::type GetOrNull | ( | ) | const |
T Get | ( | const T & | defaultValue | ) | const |
Result<T> Convert | ( | ) | const |
Returns the value of this Data, converted to T.
T | The type to convert to. |
T ConvertOrDefault | ( | ) | const |
Returns the value of this Data, converted to T.
T | The type to convert to. |
T Convert | ( | const T & | defaultValue | ) | const |
Returns the value of this Data, converted to T.
[in] | defaultValue | If this Data doesn't store a value or the value cannot converted to T, the default value will be returned. |
T | The type to convert to. |
Returns the value of this Data, converted to destType.
[in] | destType | The type to convert to. |
const T* GetPtr | ( | ) | const |
Returns the pointer of the native data if its type matches the given type T, otherwise nullptr.
T | The desired type. |
Generic* GetPtr | ( | const DataType & | type | ) |
Returns the pointer of the native data if its type matches the given type, otherwise nullptr.
[in] | type | The desired type. |
const Generic* GetPtr | ( | const DataType & | type | ) | const |
const Generic* PrivateGetPtr | ( | ) | const |
Returns the pointer to the native data.
const Generic* PrivateGetPtr | ( | const DataType & | type | ) | const |
Returns the pointer to the native data. It is not checked if its type matches the given type, the only purpose of the parameter is to enable a special behavior when type is the type Data: Then a pointer to this Data object itself is returned.
[in] | type | The desired type. |
TupleValue* GetTuple | ( | ) |
Returns the value of this Data object as a TupleValue. If this object doesn't hold a tuple value, nullptr is returned.
const TupleValue* GetTuple | ( | ) | const |
Returns the value of this Data object as a TupleValue. If this object doesn't hold a tuple value, nullptr is returned.
String ToString | ( | const FormatStatement * | formatStatement = nullptr | ) | const |
Returns a readable string of the content.
[in] | formatStatement | Nullptr or additional formatting instruction. See also Formatting Mixed types. |
COMPARERESULT Compare | ( | const Data & | c | ) | const |
HashInt GetHashCode | ( | ) | const |
Returns the hash code of the wrapped object. If the object's type doesn't provide a hash code function, this function returns DefaultHasher::EMPTY_HASH.
UniqueHash GetUniqueHashCode | ( | ) | const |
Returns the hash value of the wrapped object. If the object's type doesn't provide a hash value function, this function returns a default-constructed UniqueHash.
Bool IsEqual | ( | const Data & | other, |
EQUALITY | equality = EQUALITY::DEEP |
||
) | const |
Bool operator!= | ( | const ConstDataPtr & | other | ) | const |
ConstDataPtr ToConstDataPtr | ( | const DataType & | expectedType | ) | const |
std::enable_if< GetCollectionKind< SRC >::value==COLLECTION_KIND::ARRAY, Result< void > >::type SetImpl | ( | SRC && | data, |
OverloadRank1 | |||
) |
|
staticprivate |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
void InitSet | ( | HTTPREQUESTTYPE && | d | ) |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
private |
placeholder for embedded data. this size must stay for compatibility reasons.