From cbd1c70b6b7d2f395f7d939bc1164ea4372727b1 Mon Sep 17 00:00:00 2001 From: Chu Hoang Date: Fri, 9 Oct 2015 13:47:44 +0100 Subject: [PATCH] Changed WeakHandle::GetHandle() method to use a DownCast instead of a reinterpret_cast. This allows WeakHandle::GetHandle to be usable by non Actor/customActor derived classes. Change-Id: I4a2f2fb143fe6d50e7555846c560ffe4aabc8bc0 --- dali/devel-api/object/weak-handle.h | 40 ++----------------------------------- 1 file changed, 2 insertions(+), 38 deletions(-) diff --git a/dali/devel-api/object/weak-handle.h b/dali/devel-api/object/weak-handle.h index 2e24758..81613f5 100644 --- a/dali/devel-api/object/weak-handle.h +++ b/dali/devel-api/object/weak-handle.h @@ -99,38 +99,6 @@ protected: Impl* mImpl; }; -/** - * @brief Type CustomActors support - */ -template -struct CustomActors -{ - /** - * This flag tells Dali if a class is derived from CustomActor. - */ - enum { IS_CUSTOM_ACTOR = __is_base_of(Dali::CustomActor, Type) }; -}; - -template -struct TypeCustomActors : public CustomActors< Type > -{ -}; - -template < bool CustomActorType > -class InternalTypeName -{ -public: // Typedefs - - typedef Dali::Internal::CustomActor InternalObjectType; -}; - -template <> -class InternalTypeName< false > -{ -public: // Typedefs - - typedef Dali::Internal::Actor InternalObjectType; -}; /** * @brief Weak handle for the given type of Dali object. @@ -138,10 +106,6 @@ public: // Typedefs template < class T > class WeakHandle : public WeakHandleBase { -public: // Typedefs - - typedef typename InternalTypeName< TypeCustomActors::IS_CUSTOM_ACTOR >::InternalObjectType InternalObjectType; - public: /** @@ -201,12 +165,12 @@ public: /** * @copydoc Dali::WeakHandleBase::GetHandle() */ - T GetHandle() + T GetHandle() const { Handle handle( GetBaseHandle() ); if( handle ) { - return T( reinterpret_cast< InternalObjectType* >( handle.GetObjectPtr() ) ); + return DownCast< T >( handle ); } else { -- 2.7.4