Merge "Add BuildPickingRay to devel api" into devel/master
[platform/core/uifw/dali-core.git] / dali / public-api / object / weak-handle.h
index 47883a8..b64e82c 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_WEAK_HANDLE_H
 
 /*
- * Copyright (c) 2017 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.
@@ -19,8 +19,8 @@
  */
 
 // INTERNAL INCLUDES
-#include <dali/public-api/object/handle.h>
 #include <dali/public-api/actors/custom-actor.h>
+#include <dali/public-api/object/base-handle.h>
 
 namespace Dali
 {
@@ -37,11 +37,9 @@ namespace Dali
  * deleted object will return an empty handle.
  * @SINCE_1_2.60
  */
-class DALI_IMPORT_API WeakHandleBase
+class DALI_CORE_API WeakHandleBase
 {
-
 public:
-
   /**
    * @brief Default constructor which provides an uninitialized Dali::WeakHandleBase.
    * @SINCE_1_2.60
@@ -54,7 +52,7 @@ public:
    * @SINCE_1_2.60
    * @param [in] handle A reference to the handle of the DALi object
    */
-  WeakHandleBase( Handle& handle );
+  WeakHandleBase(BaseHandle& handle);
 
   /**
    * @brief Destructor to free resources.
@@ -78,7 +76,24 @@ public:
    * @param [in] rhs  A reference to the copied WeakHandleBase
    * @return A reference to this WeakHandleBase
    */
-  WeakHandleBase& operator=( const WeakHandleBase& rhs );
+  WeakHandleBase& operator=(const WeakHandleBase& rhs);
+
+  /**
+   * @brief Move constructor.
+   *
+   * @SINCE_1_9.22
+   * @param[in] rhs A reference to the moved handle
+   */
+  WeakHandleBase(WeakHandleBase&& rhs) noexcept;
+
+  /**
+   * @brief Move assignment operator.
+   *
+   * @SINCE_1_9.22
+   * @param[in] rhs A reference to the moved handle
+   * @return A reference to this handle
+   */
+  WeakHandleBase& operator=(WeakHandleBase&& rhs) noexcept;
 
   /**
    * @brief Equality operator overload.
@@ -104,7 +119,7 @@ public:
    * @SINCE_1_2.60
    * @return The handle of the DALi object pointed by this WeakHandleBase or an empty handle if the DALi object doesn't exist
    */
-  Handle GetBaseHandle() const;
+  BaseHandle GetBaseHandle() const;
 
   /**
    * @brief Resets this weak handle to not point to any DALi object
@@ -112,26 +127,22 @@ public:
    */
   void Reset();
 
-
 protected:
-
   /// @cond internal
   struct Impl;
   Impl* mImpl;
   /// @endcond
 };
 
-
 /**
  * @brief Weak handle for the given type of DALi object.
  * @SINCE_1_2.60
  * @see WeakHandleBase
  */
-template < class T >
+template<class T>
 class WeakHandle : public WeakHandleBase
 {
 public:
-
   /**
    * @copydoc Dali::WeakHandleBase::WeakHandleBase()
    */
@@ -141,36 +152,46 @@ public:
   }
 
   /**
-   * @copydoc Dali::WeakHandleBase::WeakHandleBase(Handle&)
+   * @copydoc Dali::WeakHandleBase::WeakHandleBase( BaseHandle& )
    */
-  WeakHandle( T& handle )
-  : WeakHandleBase( handle )
+  WeakHandle(T& handle)
+  : WeakHandleBase(handle)
   {
   }
 
   /**
    * @copydoc Dali::WeakHandleBase::~WeakHandleBase()
    */
-  ~WeakHandle() {}
+  ~WeakHandle() = default;
 
   /**
    * @copydoc Dali::WeakHandleBase::WeakHandleBase(const WeakHandleBase&)
    */
   WeakHandle(const WeakHandle& handle)
-  : WeakHandleBase( handle )
+  : WeakHandleBase(handle)
   {
   }
 
   /**
-   * @copydoc Dali::WeakHandleBase::operator=()
+   * @copydoc Dali::WeakHandleBase::operator=(const WeakHandleBase& rhs)
    */
-  WeakHandle& operator=( const WeakHandle& rhs )
+  WeakHandle& operator=(const WeakHandle& rhs)
   {
     WeakHandleBase::operator=(rhs);
     return *this;
   }
 
   /**
+   * @copydoc Dali::WeakHandleBase::WeakHandleBase(WeakHandleBase&& rhs)
+   */
+  WeakHandle(WeakHandle&& rhs) = default;
+
+  /**
+   * @copydoc Dali::WeakHandleBase::operator=(WeakHandleBase&& rhs)
+   */
+  WeakHandle& operator=(WeakHandle&& rhs) = default;
+
+  /**
    * @copydoc Dali::WeakHandleBase::operator==()
    */
   bool operator==(const WeakHandle& rhs) const
@@ -191,10 +212,10 @@ public:
    */
   T GetHandle() const
   {
-    Handle handle( GetBaseHandle() );
-    if( handle )
+    BaseHandle handle(WeakHandleBase::GetBaseHandle());
+    if(handle)
     {
-      return DownCast< T >( handle );
+      return DownCast<T>(handle);
     }
     else
     {