-#ifndef __DALI_BASE_HANDLE_H__
-#define __DALI_BASE_HANDLE_H__
+#ifndef DALI_BASE_HANDLE_H
+#define DALI_BASE_HANDLE_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*
* @SINCE_1_0.0
*/
-class DALI_IMPORT_API BaseHandle
+class DALI_CORE_API BaseHandle
{
public:
-
/**
* @brief This constructor is used by Dali New() methods.
*
BaseHandle& operator=(const BaseHandle& rhs);
/**
+ * @brief Move constructor.
+ *
+ * @SINCE_1_9.22
+ * @param[in] rhs A reference to the moved handle
+ */
+ BaseHandle(BaseHandle&& rhs);
+
+ /**
+ * @brief Move assignment operator.
+ *
+ * @SINCE_1_9.22
+ * @param[in] rhs A reference to the moved handle
+ * @return A reference to this handle
+ */
+ BaseHandle& operator=(BaseHandle&& rhs);
+
+ /**
* @brief Connects a void() functor to a specified signal.
*
* @SINCE_1_0.0
* @return True if the signal was available
* @pre The signal must be available in this object.
*/
- template <class T>
- bool ConnectSignal( ConnectionTrackerInterface* connectionTracker, const std::string& signalName, const T& functor )
+ template<class T>
+ bool ConnectSignal(ConnectionTrackerInterface* connectionTracker, const std::string& signalName, const T& functor)
{
- return DoConnectSignal( connectionTracker, signalName, FunctorDelegate::New( functor ) );
+ return DoConnectSignal(connectionTracker, signalName, FunctorDelegate::New(functor));
}
/**
* @brief Returns the type info for the Handle.
*
* @SINCE_1_0.0
- * @param[in] info The type information
- * @return The type info
+ * @param[out] info The type information
+ * @return true if the type info exists
*/
bool GetTypeInfo(Dali::TypeInfo& info) const;
public:
-
// BaseHandle accessors
/**
*/
void Reset();
- // BaseHandle comparisons - This is a variation of the safe bool idiom
-
- /**
- * @brief Pointer-to-member type.
- * Objects can be implicitly converted to this for validity checks.
- */
- typedef void (BaseHandle::*BooleanType)() const;
+ // BaseHandle comparisons
/**
- * @brief Converts an handle to a BooleanType.
+ * @brief Converts an handle to a bool.
*
* This is useful for checking whether the handle is empty.
* @SINCE_1_0.0
*/
- operator BooleanType() const;
+ explicit operator bool() const;
/**
* @brief Equality operator overload.
Dali::RefObject* GetObjectPtr() const;
private:
-
/**
* @brief Not intended for application developers.
*
* @param[in] functorDelegate A newly allocated functor delegate (takes ownership)
* @return True if the signal was available
*/
- bool DoConnectSignal( ConnectionTrackerInterface* connectionTracker, const std::string& signalName, FunctorDelegate* functorDelegate );
-
-protected:
-
- /**
- * @brief Used by the safe bool idiom.
- *
- * The safe bool idiom basically provides a Boolean test for classes. It validates objects
- * in a boolean context without the usual harmful side effects.
- * @SINCE_1_0.0
- */
- void ThisIsSaferThanReturningVoidStar() const {}
+ bool DoConnectSignal(ConnectionTrackerInterface* connectionTracker, const std::string& signalName, FunctorDelegate* functorDelegate);
private:
-
IntrusivePtr<Dali::RefObject> mObjectHandle; ///< Object this handle points at.
-
};
/**
* @return Handle pointer to either a valid deriving handle or an uninitialized handle
* @pre The BaseHandle has been initialized.
*/
-template< class T >
-inline T DownCast( BaseHandle handle )
+template<class T>
+inline T DownCast(BaseHandle handle)
{
- return T::DownCast( handle );
+ return T::DownCast(handle);
}
-// See also BaseHandle::BooleanType() conversion
-
/**
* @brief Equality operator.
* @SINCE_1_0.0
* @param[in] rhs A reference to compare to
* @return True if the handle handles point to the same Dali resource, or if both are NULL
*/
-template <typename T>
+template<typename T>
inline bool operator==(const BaseHandle& lhs, const T& rhs)
{
- // We depart from the safe bool idiom to allow Dali::BaseHandle derived classes to be compared
return lhs == static_cast<const BaseHandle&>(rhs);
}
* @param[in] rhs A reference to compare to
* @return True if the handle handles point to the different Dali resources
*/
-template <typename T>
+template<typename T>
inline bool operator!=(const BaseHandle& lhs, const T& rhs)
{
- // We depart from the safe bool idiom to allow Dali::BaseHandle derived classes to be compared
return lhs != static_cast<const BaseHandle&>(rhs);
}
*/
} // namespace Dali
-#endif // __DALI_BASE_HANDLE_H__
+#endif // DALI_BASE_HANDLE_H