From c775f0873fc43a4e7e980f02376a88c071c1bd2d Mon Sep 17 00:00:00 2001 From: Paul Wisbey Date: Mon, 23 Feb 2015 14:33:31 +0000 Subject: [PATCH] Use for NULL Change-Id: I88562c4de8484da168443731bc06f8bc5db1577f --- dali/internal/common/owner-pointer.h | 21 +++++++++------- .../update/node-attachments/node-attachment.h | 15 ++++++----- dali/public-api/object/any.h | 29 +++++++++++----------- dali/public-api/signals/callback.cpp | 18 +++++++------- dali/public-api/signals/callback.h | 25 +++++++++++-------- .../public-api/signals/signal-slot-connections.cpp | 9 ++++--- 6 files changed, 65 insertions(+), 52 deletions(-) diff --git a/dali/internal/common/owner-pointer.h b/dali/internal/common/owner-pointer.h index 9316845..d8bf7ea 100644 --- a/dali/internal/common/owner-pointer.h +++ b/dali/internal/common/owner-pointer.h @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include // NULL + // INTERNAL INCLUDES #include @@ -36,7 +39,7 @@ public: */ OwnerPointer() { - mObject = 0; + mObject = NULL; } /** @@ -103,7 +106,7 @@ public: */ T& operator*() { - DALI_ASSERT_DEBUG( mObject != 0 ); + DALI_ASSERT_DEBUG( mObject != NULL ); return *mObject; } @@ -114,7 +117,7 @@ public: */ T& operator*() const { - DALI_ASSERT_DEBUG( mObject != 0 ); + DALI_ASSERT_DEBUG( mObject != NULL ); // Pointer semantics: A const pointer does not mean const data. return const_cast< T& >( *mObject ); @@ -153,10 +156,10 @@ public: */ void Reset() { - if ( mObject != 0 ) + if ( mObject != NULL ) { delete mObject; - mObject = 0; + mObject = NULL; } } @@ -167,7 +170,7 @@ public: T* Release() { T* tmp = mObject; - mObject = 0; + mObject = NULL; return tmp; } @@ -189,11 +192,11 @@ public: /** * Converts an object handle to a BooleanType. - * This is useful for checking whether the handle is null. + * This is useful for checking whether the handle is NULL. */ operator BooleanType() const { - return (mObject != 0) ? &OwnerPointer::ThisIsSaferThanReturningVoidStar : 0; + return (mObject != NULL) ? &OwnerPointer::ThisIsSaferThanReturningVoidStar : NULL; } private: @@ -213,7 +216,7 @@ private: void Init( OwnerPointer& ownerPointer ) { mObject = ownerPointer.mObject; - ownerPointer.mObject = 0; + ownerPointer.mObject = NULL; } // data diff --git a/dali/internal/update/node-attachments/node-attachment.h b/dali/internal/update/node-attachments/node-attachment.h index 098aa69..96b0975 100644 --- a/dali/internal/update/node-attachments/node-attachment.h +++ b/dali/internal/update/node-attachments/node-attachment.h @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include // NULL + // INTERNAL INCLUDES #include @@ -71,21 +74,21 @@ public: /** * Retrieve the parent node of a NodeAttachment. - * @return The parent node, or null if the NodeAttachment has not been added to the scene-graph. + * @return The parent node, or NULL if the NodeAttachment has not been added to the scene-graph. */ Node& GetParent() { - DALI_ASSERT_DEBUG( mParent != 0 ); + DALI_ASSERT_DEBUG( mParent != NULL ); return *mParent; } /** * Retrieve the parent node of a NodeAttachment. - * @return The parent node, or null if the NodeAttachment has not been added to the scene-graph. + * @return The parent node, or NULL if the NodeAttachment has not been added to the scene-graph. */ Node& GetParent() const { - DALI_ASSERT_DEBUG( mParent != 0 ); + DALI_ASSERT_DEBUG( mParent != NULL ); return *mParent; } @@ -97,12 +100,12 @@ public: */ bool IsRenderable() { - return (GetRenderable() != 0); + return (GetRenderable() != NULL); } /** * Convert an attachment to a renderable attachment. - * @return A pointer to the renderable attachment, or null. + * @return A pointer to the renderable attachment, or NULL. */ virtual RenderableAttachment* GetRenderable() = 0; diff --git a/dali/public-api/object/any.h b/dali/public-api/object/any.h index de661e2..9e7e13d 100644 --- a/dali/public-api/object/any.h +++ b/dali/public-api/object/any.h @@ -20,6 +20,7 @@ // EXTERNAL INCLUDES #include // operator typeid +#include // NULL // INTERNAL INCLUDES #include @@ -78,14 +79,14 @@ public: 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; } } @@ -100,7 +101,7 @@ public: 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 ); } @@ -159,9 +160,9 @@ public: 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 +176,14 @@ public: /** * @brief Return pointer of Type to the value stored * - * @return pointer to the value or null if no value is contained + * @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 +196,14 @@ public: /** * @brief Return pointer of Type to the value stored * - * @return pointer to the value or null if no value is contained + * @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 ) ) @@ -219,7 +220,7 @@ public: */ bool Empty() const { - return ( 0 == mContainer ) ? true : false; + return ( NULL == mContainer ) ? true : false; } struct AnyContainerBase; // Forward declaration for typedef @@ -376,7 +377,7 @@ 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 * @@ -389,7 +390,7 @@ 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 * diff --git a/dali/public-api/signals/callback.cpp b/dali/public-api/signals/callback.cpp index 7b61117..ca9044d 100644 --- a/dali/public-api/signals/callback.cpp +++ b/dali/public-api/signals/callback.cpp @@ -25,8 +25,8 @@ namespace Dali // CallbackBase CallbackBase::CallbackBase() -: mImpl( 0 ), - mFunction( 0 ) +: mImpl( NULL ), + mFunction( NULL ) { } @@ -36,7 +36,7 @@ CallbackBase::~CallbackBase() } CallbackBase::CallbackBase( Function function ) -: mImpl( 0 ), +: mImpl( NULL ), mFunction( function ) { } @@ -47,7 +47,7 @@ CallbackBase::CallbackBase( void* object, MemberFunction function, Dispatcher di mImpl = new CallbackBase::Impl; mImpl->mObjectPointer = object; mImpl->mMemberFunctionDispatcher = dispatcher; - mImpl->mDestructorDispatcher = 0; // object is not owned + mImpl->mDestructorDispatcher = NULL; // object is not owned } CallbackBase::CallbackBase( void* object, MemberFunction function, Dispatcher dispatcher, Destructor destructor ) @@ -72,18 +72,18 @@ void CallbackBase::Reset() } delete mImpl; - mImpl = 0; + mImpl = NULL; } - mFunction = 0; + mFunction = NULL; } // CallbackBase::Impl CallbackBase::Impl::Impl() -: mObjectPointer( 0 ), - mMemberFunctionDispatcher( 0 ), - mDestructorDispatcher( 0 ) +: mObjectPointer( NULL ), + mMemberFunctionDispatcher( NULL ), + mDestructorDispatcher( NULL ) { } diff --git a/dali/public-api/signals/callback.h b/dali/public-api/signals/callback.h index 5dbb60b..576f88d 100644 --- a/dali/public-api/signals/callback.h +++ b/dali/public-api/signals/callback.h @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include + // INTERNAL INCLUDES #include #include @@ -306,7 +309,7 @@ protected: // Constructors for deriving classes typedef void (*Dispatcher)( CallbackBase& base ); /** - * @brief Used to destroy mObjectPointer (null if not mObjectPointer is not owned) + * @brief Used to destroy mObjectPointer (NULL if not mObjectPointer is not owned) */ typedef void(*Destructor)(void* object); @@ -354,9 +357,9 @@ public: // Data for deriving classes & Dispatchers { Impl(); ///< Default constructor - void* mObjectPointer; ///< Object whose member function will be called. Not owned if mDestructorDispatcher is null. + void* mObjectPointer; ///< Object whose member function will be called. Not owned if mDestructorDispatcher is NULL. Dispatcher mMemberFunctionDispatcher; ///< Dispatcher for member functions - Destructor mDestructorDispatcher; ///< Destructor for owned objects. null if mDestructorDispatcher is not owned. + Destructor mDestructorDispatcher; ///< Destructor for owned objects. NULL if mDestructorDispatcher is not owned. }; Impl* mImpl; ///< Implementation pointer @@ -1081,7 +1084,7 @@ public: */ CallbackFunctor0( const T& object ) : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object - 0, // uses operator() instead of member function + NULL, // uses operator() instead of member function reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcher0::Dispatch ), reinterpret_cast< CallbackBase::Destructor >( &Destroyer::Delete ) ) { } }; @@ -1121,7 +1124,7 @@ public: */ CallbackFunctor1( const T& object ) : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object - 0, // uses operator() instead of member function + NULL, // uses operator() instead of member function reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcher1::Dispatch ), reinterpret_cast< CallbackBase::Destructor >( &Destroyer::Delete ) ) { } }; @@ -1162,7 +1165,7 @@ public: */ CallbackFunctor2( const T& object ) : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object - 0, // uses operator() instead of member function + NULL, // uses operator() instead of member function reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcher2::Dispatch ), reinterpret_cast< CallbackBase::Destructor >( &Destroyer::Delete ) ) { } }; @@ -1203,7 +1206,7 @@ public: */ CallbackFunctor3( const T& object ) : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object - 0, // uses operator() instead of member function + NULL, // uses operator() instead of member function reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcher3::Dispatch ), reinterpret_cast< CallbackBase::Destructor >( &Destroyer::Delete ) ) { } }; @@ -1245,7 +1248,7 @@ public: */ CallbackFunctorReturn0( const T& object ) : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object - 0, // uses operator() instead of member function + NULL, // uses operator() instead of member function reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcherReturn0::Dispatch ), reinterpret_cast< CallbackBase::Destructor >( &Destroyer::Delete ) ) { } }; @@ -1286,7 +1289,7 @@ public: */ CallbackFunctorReturn1( const T& object ) : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object - 0, // uses operator() instead of member function + NULL, // uses operator() instead of member function reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcherReturn1::Dispatch ), reinterpret_cast< CallbackBase::Destructor >( &Destroyer::Delete ) ) { } }; @@ -1327,7 +1330,7 @@ public: */ CallbackFunctorReturn2( const T& object ) : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object - 0, // uses operator() instead of member function + NULL, // uses operator() instead of member function reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcherReturn2::Dispatch ), reinterpret_cast< CallbackBase::Destructor >( &Destroyer::Delete ) ) { } }; @@ -1368,7 +1371,7 @@ public: */ CallbackFunctorReturn3( const T& object ) : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object - 0, // uses operator() instead of member function + NULL, // uses operator() instead of member function reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcherReturn3::Dispatch ), reinterpret_cast< CallbackBase::Destructor >( &Destroyer::Delete ) ) { } }; diff --git a/dali/public-api/signals/signal-slot-connections.cpp b/dali/public-api/signals/signal-slot-connections.cpp index 6007f69..43dd4fd 100644 --- a/dali/public-api/signals/signal-slot-connections.cpp +++ b/dali/public-api/signals/signal-slot-connections.cpp @@ -18,6 +18,9 @@ // CLASS HEADER #include +// EXTERNAL INCLUDES +#include + // INTERNAL INCLUDES #include @@ -45,7 +48,7 @@ SlotObserver* SlotConnection::GetSlotObserver() } SignalConnection::SignalConnection( CallbackBase* callback ) -: mSignalObserver( 0 ), +: mSignalObserver( NULL ), mCallback( callback ) { } @@ -68,12 +71,12 @@ void SignalConnection::Disconnect( SlotObserver* slotObserver ) { // tell the slot the signal wants to disconnect mSignalObserver->SignalDisconnected( slotObserver, mCallback ); - mSignalObserver = 0; + mSignalObserver = NULL; } // we own the callback, SignalObserver is expected to delete the SlotConnection on Disconnected so its pointer to our mCallback is no longer used delete mCallback; - mCallback = 0; + mCallback = NULL; } CallbackBase* SignalConnection::GetCallback() -- 2.7.4