Tizen Native API

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

 Any ()
 Default constructor.
 ~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.
Anyoperator= (const Any &any)
 Assignment operator.
template<typename Type >
void Get (Type &type) const
 Get a value of type Type from container.
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 ()
 Return pointer of Type to the value stored.
template<typename Type >
const Type * GetPointer () const
 Return pointer of Type to the value stored.
bool Empty () const
 Returns whether container holds a value.

Static Public Member Functions

static void AssertAlways (const char *assertMessage)
 Pass 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;
 unsigned int variable = AnyCast< unsigned int >( uintVariable );
 if ( typeid( int ) == uintVariable.GetType() )
Since :
2.4

Constructor & Destructor Documentation

Default constructor.

Since :
2.4

Destructor. Free resources.

Since :
2.4
template<typename Type >
Dali::Any::Any ( const Type &  value)

Constructs a Any type with the given value.

Since :
2.4
Parameters:
[in]valueThe given value.
Dali::Any::Any ( const Any any)

Copy Constructor.

Since :
2.4
Parameters:
[in]anyAny to be copied.

Member Function Documentation

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

Pass Assert message.

Since :
2.4
Parameters:
assertMessageAssert message to report
bool Dali::Any::Empty ( ) const

Returns whether container holds a value.

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

Get a value of type Type from container.

Since :
2.4
Parameters:
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
Returns:
The stored value.
template<typename Type >
Type* Dali::Any::GetPointer ( )

Return pointer of Type to the value stored.

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

Return pointer of Type to the value stored.

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

Returns the type info of the stored value.

Since :
2.4
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
Parameters:
[in]valueThe given value.
Note:
If the types are different, then the current container will be re-created.
Any& Dali::Any::operator= ( const Any any)

Assignment operator.

Since :
2.4
Parameters:
[in]anyAny to be assigned which contains a value of identical type to current contents.
Exceptions:
DaliExceptionIf parameter any is of a different type.