Tizen Native API  5.5
Dali::Any Class Reference

Stores a value of any type. More...

Classes

struct  AnyContainerBase
 Base container to hold type for match verification and instance cloning function. More...
class  AnyContainerImpl
 Templated class to hold value for type. More...
struct  AnyContainerImplCloner
 Templated Clone function from container base. More...
struct  AnyContainerImplDelete
 Templated Delete function from container base. More...

Public Member Functions

DALI_CORE_API Any ()
 Default constructor.
DALI_CORE_API ~Any ()
 Destructor. Free resources.
template<typename Type >
 Any (const Type &value)
 Constructs a Any type with the given value.
 Any (const Any &any)
 Copy Constructor.
template<typename Type >
Anyoperator= (const Type &value)
 Assigns a given value to the Any type.
DALI_CORE_API Anyoperator= (const Any &any)
 Assignment operator.
template<typename Type >
void Get (Type &type) const
 Gets a value of type Type from container.
DALI_CORE_API const
std::type_info & 
GetType () const
 Returns the type info of the stored value.
template<typename Type >
const Type & Get () const
 Retrieves the stored value in the Any type.
template<typename Type >
Type * GetPointer ()
 Returns pointer of Type to the value stored.
template<typename Type >
const Type * GetPointer () const
 Returns pointer of Type to the value stored.
bool Empty () const
 Returns whether container holds a value.

Static Public Member Functions

static DALI_CORE_API void AssertAlways (const char *assertMessage)
 Passes Assert message.

Detailed Description

Stores a value of any type.

Examples of use:

 {.cpp}
 Any uintVariable = 5u;
 Any floatVariable( 4.5f );
 Any strVariable( std::string( "Hello world" ) );
 uintVariable = 1u;
 uint32_t variable = AnyCast< uint32_t >( uintVariable );
 if ( typeid( int ) == uintVariable.GetType() )
Since:
2.4, DALi version 1.0.0

Constructor & Destructor Documentation

DALI_CORE_API Dali::Any::Any ( )

Default constructor.

Since:
2.4, DALi version 1.0.0
DALI_CORE_API Dali::Any::~Any ( )

Destructor. Free resources.

Since:
2.4, DALi version 1.0.0
template<typename Type >
Dali::Any::Any ( const Type &  value)

Constructs a Any type with the given value.

Since:
2.4, DALi version 1.0.0
Parameters:
[in]valueThe given value
Dali::Any::Any ( const Any any)

Copy Constructor.

Since:
2.4, DALi version 1.0.0
Parameters:
[in]anyAny to be copied

Member Function Documentation

static DALI_CORE_API void Dali::Any::AssertAlways ( const char *  assertMessage) [static]

Passes Assert message.

Since:
2.4, DALi version 1.0.0
Parameters:
[in]assertMessageAssert message to report
bool Dali::Any::Empty ( ) const

Returns whether container holds a value.

Since:
2.4, DALi version 1.0.0
Returns:
true if the container is empty, else false
template<typename Type >
void Dali::Any::Get ( Type &  type) const

Gets a value of type Type from container.

Since:
2.4, DALi version 1.0.0
Parameters:
[in]typedestination of type Type to write to
template<typename Type >
const Type& Dali::Any::Get ( ) const

Retrieves the stored value in the Any type.

Since:
2.4, DALi version 1.0.0
Returns:
The stored value
template<typename Type >
Type* Dali::Any::GetPointer ( )

Returns pointer of Type to the value stored.

Since:
2.4, DALi version 1.0.0
Returns:
pointer to the value, or NULL if no value is contained
template<typename Type >
const Type* Dali::Any::GetPointer ( ) const

Returns pointer of Type to the value stored.

Since:
2.4, DALi version 1.0.0
Returns:
pointer to the value, or NULL if no value is contained
DALI_CORE_API const std::type_info& Dali::Any::GetType ( ) const

Returns the type info of the stored value.

Since:
2.4, DALi version 1.0.0
Returns:
The std::type_info of the stored value or the type info of the void type if there is no value stored
template<typename Type >
Any& Dali::Any::operator= ( const Type &  value)

Assigns a given value to the Any type.

Since:
2.4, DALi version 1.0.0
Parameters:
[in]valueThe given value
Returns:
A reference to this
Note:
If the types are different, then the current container will be re-created.
DALI_CORE_API Any& Dali::Any::operator= ( const Any any)

Assignment operator.

Since:
2.4, DALi version 1.0.0
Parameters:
[in]anyAny to be assigned which contains a value of identical type to current contents.
Returns:
A reference to this
Exceptions:
DaliExceptionIf parameter any is of a different type.