 |
Gorgon Game Engine
|
Go to the documentation of this file.
4 #include "../Utils/Assert.h"
56 typename std::enable_if<!std::is_pointer<T_>::value,
const typename std::remove_reference<T_>::type &>
::type
60 return *
data.
Get<
typename std::remove_reference<const T_>::type*>();
62 return data.
Get<
typename std::remove_reference<const T_>::type>();
66 return *
data.
Get<
typename std::remove_const<
typename std::remove_reference<T_>::type>::
type*>();
68 return data.
Get<
typename std::remove_const<typename std::remove_reference<T_>::type>
::type>();
74 typename std::enable_if<std::is_pointer<T_>::value && std::is_const<typename std::remove_pointer<T_>::type>::value, T_>
::type
78 return data.
Get<
const typename std::remove_pointer<T_>::type *>();
80 throw CastException(
"Value",
"Reference");
84 return data.
Get<
typename std::remove_const<typename std::remove_pointer<T_>::type>
::type*>();
86 throw CastException(
"Value",
"Reference");
92 typename std::enable_if<std::is_pointer<T_>::value && !std::is_const<typename std::remove_pointer<T_>::type>::value, T_>
::type
96 throw CastException(
"Const reference",
"Reference");
98 throw CastException(
"Value",
"Reference");
102 return data.
Get<
typename std::remove_const<typename std::remove_pointer<T_>::type>
::type*>();
104 throw CastException(
"Value",
"Reference");
111 typename std::enable_if<std::is_pointer<T_>::value, T_>
::type
117 return data.
Get<
typename std::remove_pointer<T_>::type *>();
123 typename std::enable_if<!std::is_pointer<T_>::value, T_>
::type
129 return *
data.
Get<
typename std::remove_reference<T_>::type*>();
153 return type !=
nullptr;
bool isreference
Is a reference, data is a ptr to the original type.
Definition: Data.h:191
Data DeReference()
Definition: Data.cpp:180
std::enable_if< std::is_pointer< T_ >::value &&!std::is_const< typename std::remove_pointer< T_ >::type >::value, T_ >::type GetValue() const
Returns the value of this data in the requested format.
Definition: Data.h:93
Any data
Stored data.
Definition: Data.h:185
virtual ~Data()
Definition: Data.cpp:128
std::enable_if< std::is_pointer< T_ >::value, T_ >::type ReferenceValue() const
Returns the value of this data in the requested format.
Definition: Data.h:112
Data()
Constructs an invalid data.
Definition: Data.h:31
This class can hold any other information providing type erasure.
Definition: Any.h:32
std::enable_if<!std::is_pointer< T_ >::value, const typename std::remove_reference< T_ >::type & >::type GetValue() const
Returns the value of this data in the requested format.
Definition: Data.h:57
Data describes a piece of data.
Definition: Data.h:22
std::string ToString() const
Definition: Data.cpp:90
std::enable_if< std::is_pointer< T_ >::value &&std::is_const< typename std::remove_pointer< T_ >::type >::value, T_ >::type GetValue() const
Returns the value of this data in the requested format.
Definition: Data.h:75
const Type & GetType() const
Returns the type of the data.
Definition: Data.h:173
void MakeConstant()
Makes this data a constant.
Definition: Data.cpp:199
This class stores information about types.
Definition: Reflection.h:1165
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
void RemoveParent()
Definition: Data.h:146
Data GetReference()
Definition: Data.cpp:148
bool IsReference() const
Returns if this data contains a reference.
Definition: Data.cpp:212
#define ASSERT(expression, message,...)
Replaces regular assert to allow messages and backtrace.
Definition: Assert.h:161
static Data Invalid()
Constructs an invalid data object.
Definition: Data.h:27
bool operator==(const Data &r) const
Definition: Data.cpp:218
void SetParent(const Data data)
Definition: Data.h:141
void Delete() const
Attempts to delete the data contained in this data.
Definition: Data.cpp:136
bool IsNull() const
Definition: Data.cpp:118
Any GetData() const
Returns the data contained in this data element.
Definition: Data.h:133
Data & operator=(Data)
Assignment operator.
Definition: Data.cpp:96
Data * parent
Definition: Data.h:196
std::enable_if<!std::is_pointer< T_ >::value, T_ >::type ReferenceValue() const
Returns the value of this data in the requested format.
Definition: Data.h:124
Type
Definition: Shader.h:14
const Type * type
Type of the data.
Definition: Data.h:188
bool IsConstant() const
Returns if this data is constant.
Definition: Data.h:160
Data(const Type &type, const Any &data, bool isreference=false, bool isconstant=false)
Any constructor. Allows both data and type to be specified.
Definition: Data.h:43
Exceptions This file contains string related exceptions.
T_ & Get()
Returns the value contained with this any.
Definition: Any.h:258
bool IsValid() const
Returns if the data is in a valid state.
Definition: Data.h:152
bool isconstant
This data is a constant and should not be changed.
Definition: Data.h:194