X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fpublic-api%2Fobject%2Fany.h;h=67cd73f8d4c5ba3d0a04af1dc9e25e3b4163ff98;hb=refs%2Ftags%2Faccepted%2Ftizen%2F3.0%2Fivi%2F20170118.041123;hp=de661e27ff5e3c586a03a8d470ed1aed6b4d7728;hpb=a27a45d023322e1be5f8f4de2db78a312a506d58;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/public-api/object/any.h b/dali/public-api/object/any.h index de661e2..67cd73f 100644 --- a/dali/public-api/object/any.h +++ b/dali/public-api/object/any.h @@ -2,7 +2,7 @@ #define __DALI_ANY_TYPE_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2015 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,12 +20,17 @@ // EXTERNAL INCLUDES #include // operator typeid +#include // NULL // INTERNAL INCLUDES #include namespace Dali { +/** + * @addtogroup dali_core_object + * @{ + */ /** * @brief Stores a value of any type. @@ -39,30 +44,35 @@ namespace Dali * unsigned int variable = AnyCast< unsigned int >( uintVariable ); * if ( typeid( int ) == uintVariable.GetType() ) * \endcode + * @SINCE_1_0.0 */ class Any { public: /** - * Default constructor. + * @brief Default constructor. + * @SINCE_1_0.0 */ DALI_IMPORT_API Any(); /** - * Destructor. Free resources. + * @brief Destructor. Free resources. + * @SINCE_1_0.0 */ DALI_IMPORT_API ~Any(); /** * @brief Pass Assert message * - * @param assertMessage Assert message to report + * @SINCE_1_0.0 + * @param[in] assertMessage Assert message to report */ DALI_IMPORT_API static void AssertAlways( const char* assertMessage ); /** * @brief Constructs a Any type with the given value. * + * @SINCE_1_0.0 * @param[in] value The given value. */ template @@ -72,35 +82,38 @@ public: } /** - * Copy Constructor. - * @param [in] any Any to be copied. + * @brief Copy Constructor. + * @SINCE_1_0.0 + * @param[in] any Any to be copied. */ Any( const Any& any ) { // If container isn't empty then copy the container? - if ( 0 != any.mContainer ) + if ( NULL != any.mContainer ) { mContainer = any.mContainer->mCloneFunc( *any.mContainer ); } else { // Otherwise mark new container as empty - mContainer = 0; + mContainer = NULL; } } /** * @brief Assigns a given value to the Any type. * + * @SINCE_1_0.0 + * @param[in] value The given value + * @return A reference to this * @note If the types are different, then the current container will be re-created. * - * @param[in] value The given value. */ template Any& operator=( const Type& value ) { // If the container is empty then assign the new value - if ( 0 == mContainer ) + if ( NULL == mContainer ) { mContainer = new AnyContainerImpl< Type >( value ); } @@ -125,16 +138,19 @@ public: /** * @brief Assignment operator. * + * @SINCE_1_0.0 + * @param [in] any Any to be assigned which contains a value of identical type to current contents. + * @return A reference to this * @exception DaliException If parameter any is of a different type. * - * @param [in] any Any to be assigned which contains a value of identical type to current contents. */ DALI_IMPORT_API Any& operator=( const Any& any ); /** * @brief Get a value of type Type from container * - * @param type destination of type Type to write to + * @SINCE_1_0.0 + * @param[in] type destination of type Type to write to */ template void Get( Type& type ) const @@ -145,6 +161,7 @@ public: /** * @brief Returns the type info of the stored value. * + * @SINCE_1_0.0 * @return The std::type_info of the stored value or the type info of the void * type if there is no value stored. */ @@ -153,15 +170,16 @@ public: /** * @brief Retrieves the stored value in the Any type. * + * @SINCE_1_0.0 * @return The stored value. */ template const Type& Get() const { - if ( 0 == mContainer ) + if ( NULL == mContainer ) { - AssertAlways( "Any::Get(). mContainer is null" ); + AssertAlways( "Any::Get(). mContainer is NULL" ); } // Check if the value has the same value than the Any type. @@ -175,14 +193,15 @@ public: /** * @brief Return pointer of Type to the value stored * - * @return pointer to the value or null if no value is contained + * @SINCE_1_0.0 + * @return pointer to the value or NULL if no value is contained */ template Type* GetPointer() { - if( 0 == mContainer ) + if( NULL == mContainer ) { - return 0; + return NULL; } // Check if the value has the same value than the Any type. if( mContainer->GetType() != typeid( Type ) ) @@ -195,14 +214,15 @@ public: /** * @brief Return pointer of Type to the value stored * - * @return pointer to the value or null if no value is contained + * @SINCE_1_0.0 + * @return pointer to the value or NULL if no value is contained */ template const Type* GetPointer() const { - if( 0 == mContainer ) + if( NULL == mContainer ) { - return 0; + return NULL; } // Check if the value has the same value than the Any type. if( mContainer->GetType() != typeid( Type ) ) @@ -215,11 +235,12 @@ public: /** * @brief Returns whether container holds a value * + * @SINCE_1_0.0 * @return true if the container is empty, else false. */ bool Empty() const { - return ( 0 == mContainer ) ? true : false; + return ( NULL == mContainer ) ? true : false; } struct AnyContainerBase; // Forward declaration for typedef @@ -227,17 +248,19 @@ public: typedef void (*DeleteFunc)( const AnyContainerBase* base ); /** - * Base container to hold type for match verification and instance cloning function + * @brief Base container to hold type for match verification and instance cloning function * + * @SINCE_1_0.0 */ struct AnyContainerBase { /** * @brief Constructor of base container * - * @param type typeid of container - * @param cloneFunc Cloning function to replicate this container type - * @param deleteFunc Deleting function to destroy this container type + * @SINCE_1_0.0 + * @param[in] type typeid of container + * @param[in] cloneFunc Cloning function to replicate this container type + * @param[in] deleteFunc Deleting function to destroy this container type */ AnyContainerBase( const std::type_info& type, CloneFunc cloneFunc, DeleteFunc deleteFunc ) : mType( type ), @@ -248,6 +271,7 @@ public: /** * @brief Get the typeid of this container * + * @SINCE_1_0.0 * @return type */ const std::type_info& GetType() const @@ -264,7 +288,8 @@ public: /** * @brief Templated Clone function from container base * - * @param base reference to container + * @SINCE_1_0.0 + * @param[in] base reference to container */ template struct AnyContainerImplCloner @@ -278,7 +303,8 @@ public: /** * @brief Templated Delete function from container base * - * @param base pointer to container + * @SINCE_1_0.0 + * @param[in] base pointer to container */ template struct AnyContainerImplDelete @@ -292,6 +318,7 @@ public: /** * @brief Templated class to hold value for type * + * @SINCE_1_0.0 */ template class AnyContainerImpl : public AnyContainerBase @@ -301,7 +328,8 @@ public: /** * @brief Constructor to create container holding value of type Type * - * @param value Value of Type + * @SINCE_1_0.0 + * @param[in] value Value of Type */ AnyContainerImpl( const Type& value ) : AnyContainerBase( typeid( Type ), @@ -313,7 +341,8 @@ public: /** * @brief Constructor to create new container of type from and existing container (cloning) * - * @param base reference to base container to copy from + * @SINCE_1_0.0 + * @param[in] base reference to base container to copy from */ AnyContainerImpl( const AnyContainerBase& base ) : AnyContainerBase( typeid( Type ), @@ -326,6 +355,7 @@ public: /** * @brief Get the container's stored value * + * @SINCE_1_0.0 * @return value of type Type */ const Type& GetValue() const @@ -336,7 +366,8 @@ public: /** * @brief Set the container's stored value * - * @param value of type Type + * @SINCE_1_0.0 + * @param[in] value of type Type */ void SetValue( const Type& value ) { @@ -346,6 +377,7 @@ public: /** * @brief Get a pointer to the value held * + * @SINCE_1_0.0 * @return pointer to the value of type Type */ Type* GetPointerToValue() @@ -356,6 +388,7 @@ public: /** * @brief Get a pointer to the value held * + * @SINCE_1_0.0 * @return pointer to the value of type Type */ const Type* GetPointerToValue() const @@ -376,9 +409,10 @@ public: */ /** - * @brief Extract a pointer to the held type of an Any object from a pointer to that Any object (null if empty ) + * @brief Extract a pointer to the held type of an Any object from a pointer to that Any object (NULL if empty ) * - * @param any Pointer to an Any object + * @SINCE_1_0.0 + * @param[in] any Pointer to an Any object * * @return Pointer to the Type held */ @@ -389,9 +423,10 @@ inline Type* AnyCast( Any* any ) } /** - * @brief Extract a const pointer to the held type of an Any object from a pointer to that Any object (null if empty ) + * @brief Extract a const pointer to the held type of an Any object from a pointer to that Any object (NULL if empty ) * - * @param any const Pointer to an Any object + * @SINCE_1_0.0 + * @param[in] any const Pointer to an Any object * * @return const Pointer to the Type held */ @@ -404,7 +439,8 @@ inline const Type* AnyCast( const Any* any ) /** * @brief Extract a held value of type Type from an Any object from a reference to that Any object * - * @param any reference to an Any object + * @SINCE_1_0.0 + * @param[in] any reference to an Any object * * @return Type value of type Type */ @@ -417,7 +453,8 @@ inline Type AnyCast( Any& any ) /** * @brief Extract a held value of type Type from an Any object from a const reference to that Any object * - * @param any reference to an Any object + * @SINCE_1_0.0 + * @param[in] any reference to an Any object * * @return Type value of type Type */ @@ -430,7 +467,8 @@ inline Type AnyCast( const Any& any ) /** * @brief Extract a reference to the held value of type Type from an Any object from a reference to that Any object * - * @param any reference to an Any object + * @SINCE_1_0.0 + * @param[in] any reference to an Any object * * @return A reference to the Type value of type Type */ @@ -443,7 +481,8 @@ inline Type& AnyCastReference( Any& any ) /** * @brief Extract a const reference to the held value of type Type from an Any object from a const reference to that Any object * - * @param any reference to an Any object + * @SINCE_1_0.0 + * @param[in] any reference to an Any object * * @return A const reference to the Type value of type Type */ @@ -453,6 +492,9 @@ inline const Type& AnyCastReference( const Any& any ) return any.Get(); } +/** + * @} + */ } // namespace Dali #endif // __DALI_ANY_TYPE_H__