Ensure BaseHandle class move noexcept (core public-api)
[platform/core/uifw/dali-core.git] / dali / public-api / events / long-press-gesture-detector.h
index 111bbf2..afdcf40 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_LONG_PRESS_GESTURE_DETECTOR_H__
-#define __DALI_LONG_PRESS_GESTURE_DETECTOR_H__
+#ifndef DALI_LONG_PRESS_GESTURE_DETECTOR_H
+#define DALI_LONG_PRESS_GESTURE_DETECTOR_H
 
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -18,6 +18,9 @@
  *
  */
 
+// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
+
 // INTERNAL INCLUDES
 #include <dali/public-api/events/gesture-detector.h>
 #include <dali/public-api/signals/dali-signal.h>
@@ -34,15 +37,15 @@ namespace Internal DALI_INTERNAL
 class LongPressGestureDetector;
 }
 
-struct LongPressGesture;
+class LongPressGesture;
 
 /**
  * @brief This class emits a signals when a long press gesture occurs that meets the requirements set by the application.
  * @SINCE_1_0.0
  *
  * For any valid long press, two signals will be emitted:
- * - First identifying the beginning (state = Started) i.e. when fingers held down for the required time.
- * - Second identifying the ending (state = Finished) i.e. when fingers are released.
+ * - First identifying the beginning (state = GestureState::STARTED) i.e. when fingers held down for the required time.
+ * - Second identifying the ending (state = GestureState::FINISHED) i.e. when fingers are released.
  *
  * The application programmer can use this gesture detector as follows:
  * @code
@@ -60,12 +63,10 @@ struct LongPressGesture;
  */
 class DALI_CORE_API LongPressGestureDetector : public GestureDetector
 {
-public: // Typedefs
-
-  typedef Signal< void ( Actor, const LongPressGesture& ) > DetectedSignalType; ///< Gesture detected signal type @SINCE_1_0.0
+public:                                                                    // Typedefs
+  using DetectedSignalType = Signal<void(Actor, const LongPressGesture&)>; ///< Gesture detected signal type @SINCE_1_0.0
 
 public: // Creation & Destruction
-
   /**
    * @brief Creates an uninitialized LongPressGestureDetector; this can be initialized with LongPressGestureDetector::New().
    *
@@ -92,7 +93,7 @@ public: // Creation & Destruction
    * @param[in] touchesRequired The number of touches required
    * @return A handle to a newly allocated Dali resource
    */
-  static LongPressGestureDetector New(unsigned int touchesRequired);
+  static LongPressGestureDetector New(uint32_t touchesRequired);
 
   /**
    * @brief Creates an initialized LongPressGestureDetector with the minimum and maximum number of touches required.
@@ -104,7 +105,7 @@ public: // Creation & Destruction
    * @param[in] maxTouches The maximum number of touches required
    * @return A handle to a newly allocated Dali resource
    */
-  static LongPressGestureDetector New(unsigned int minTouches, unsigned int maxTouches);
+  static LongPressGestureDetector New(uint32_t minTouches, uint32_t maxTouches);
 
   /**
    * @brief Downcasts a handle to LongPressGestureDetector handle.
@@ -115,7 +116,7 @@ public: // Creation & Destruction
    * @param[in] handle Handle to an object
    * @return Handle to a LongPressGestureDetector object or an uninitialized handle
    */
-  static LongPressGestureDetector DownCast( BaseHandle handle );
+  static LongPressGestureDetector DownCast(BaseHandle handle);
 
   /**
    * @brief Destructor.
@@ -142,9 +143,25 @@ public: // Creation & Destruction
    */
   LongPressGestureDetector& operator=(const LongPressGestureDetector& rhs);
 
-public: // Setters
+  /**
+   * @brief This move constructor is required for (smart) pointer semantics.
+   *
+   * @SINCE_2_2.4
+   * @param[in] handle A reference to the moved handle
+   */
+  LongPressGestureDetector(LongPressGestureDetector&& handle) noexcept;
 
   /**
+   * @brief This move assignment operator is required for (smart) pointer semantics.
+   *
+   * @SINCE_2_2.4
+   * @param[in] rhs A reference to the moved handle
+   * @return A reference to this
+   */
+  LongPressGestureDetector& operator=(LongPressGestureDetector&& rhs) noexcept;
+
+public: // Setters
+  /**
    * @brief Sets the number of touches required.
    *
    * The number of touches corresponds to the number of fingers a user
@@ -156,7 +173,7 @@ public: // Setters
    * @pre The gesture detector has been initialized.
    * @note The default is '1'.
    */
-  void SetTouchesRequired(unsigned int touches);
+  void SetTouchesRequired(uint32_t touches);
 
   /**
    * @brief Sets the minimum and maximum touches required.
@@ -170,10 +187,9 @@ public: // Setters
    * @pre The gesture detector has been initialized.
    * @note The default is '1'.
    */
-  void SetTouchesRequired(unsigned int minTouches, unsigned int maxTouches);
+  void SetTouchesRequired(uint32_t minTouches, uint32_t maxTouches);
 
 public: // Getters
-
   /**
    * @brief Retrieves the minimum number of touches required.
    *
@@ -181,7 +197,7 @@ public: // Getters
    * @return The minimum number of touches required
    * @pre The gesture detector has been initialized.
    */
-  unsigned int GetMinimumTouchesRequired() const;
+  uint32_t GetMinimumTouchesRequired() const;
 
   /**
    * @brief Retrieves the maximum number of touches required.
@@ -190,10 +206,9 @@ public: // Getters
    * @return The maximum number of touches required
    * @pre The gesture detector has been initialized.
    */
-  unsigned int GetMaximumTouchesRequired() const;
+  uint32_t GetMaximumTouchesRequired() const;
 
 public: // Signals
-
   /**
    * @brief This signal is emitted when the specified long press is detected on the attached actor.
    *
@@ -208,7 +223,6 @@ public: // Signals
   DetectedSignalType& DetectedSignal();
 
 public: // Not intended for Application developers
-
   /// @cond internal
   /**
    * @brief This constructor is used by LongPressGestureDetector::New() methods.
@@ -218,7 +232,6 @@ public: // Not intended for Application developers
    */
   explicit DALI_INTERNAL LongPressGestureDetector(Internal::LongPressGestureDetector* internal);
   /// @endcond
-
 };
 
 /**
@@ -226,4 +239,4 @@ public: // Not intended for Application developers
  */
 } // namespace Dali
 
-#endif // __DALI_LONG_PRESS_GESTURE_DETECTOR_H__
+#endif // DALI_LONG_PRESS_GESTURE_DETECTOR_H