noexcept move for BaseHandle/InstrusivePtr/Math
[platform/core/uifw/dali-core.git] / dali / public-api / math / degree.h
index a185159..f87888a 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_DEGREE_H__
-#define __DALI_DEGREE_H__
+#ifndef DALI_DEGREE_H
+#define DALI_DEGREE_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.
@@ -45,8 +45,9 @@ struct Degree
    * @SINCE_1_0.0
    */
   Degree()
-  : degree( 0.f )
-  { }
+  : degree(0.f)
+  {
+  }
 
   /**
    * @brief Creates an angle in degrees.
@@ -54,9 +55,10 @@ struct Degree
    * @SINCE_1_0.0
    * @param[in] value The initial value in degrees
    */
-  explicit Degree( float value )
-  : degree( value )
-  { }
+  explicit constexpr Degree(float value)
+  : degree(value)
+  {
+  }
 
   /**
    * @brief Creates an angle in degrees from a Radian.
@@ -64,31 +66,21 @@ struct Degree
    * @SINCE_1_0.0
    * @param[in] value The initial value in Radians
    */
-  DALI_CORE_API Degree( Radian value );
+  DALI_CORE_API Degree(Radian value);
 
 public:
+  Degree(const Degree&)     = default;            ///< Default copy constructor
+  Degree(Degree&&) noexcept = default;            ///< Default move constructor
+  Degree& operator=(const Degree&) = default;     ///< Default copy assignment operator
+  Degree& operator=(Degree&&) noexcept = default; ///< Default move assignment operator
 
+public:
   // member data
   float degree; ///< The value in degrees
-
 };
 
 // compiler generated destructor, copy constructor and assignment operators are ok as this class is POD
 
-// useful constant angles
-DALI_CORE_API extern const Radian ANGLE_360; ///< 360 degree turn in radians
-DALI_CORE_API extern const Radian ANGLE_315; ///< 315 degree turn in radians
-DALI_CORE_API extern const Radian ANGLE_270; ///< 270 degree turn in radians
-DALI_CORE_API extern const Radian ANGLE_225; ///< 225 degree turn in radians
-DALI_CORE_API extern const Radian ANGLE_180; ///< 180 degree turn in radians
-DALI_CORE_API extern const Radian ANGLE_135; ///< 135 degree turn in radians
-DALI_CORE_API extern const Radian ANGLE_120; ///< 120 degree turn in radians
-DALI_CORE_API extern const Radian ANGLE_90;  ///< 90 degree turn in radians
-DALI_CORE_API extern const Radian ANGLE_60;  ///< 60 degree turn in radians
-DALI_CORE_API extern const Radian ANGLE_45;  ///< 45 degree turn in radians
-DALI_CORE_API extern const Radian ANGLE_30;  ///< 30 degree turn in radians
-DALI_CORE_API extern const Radian ANGLE_0;   ///< 0 degree turn in radians
-
 /**
  * @brief Compares equality between two degrees.
  *
@@ -97,9 +89,9 @@ DALI_CORE_API extern const Radian ANGLE_0;   ///< 0 degree turn in radians
  * @param[in] rhs Degree to compare to
  * @return True if the values are identical
  */
-inline bool operator==( const Degree& lhs, const Degree& rhs )
+inline bool operator==(const Degree& lhs, const Degree& rhs)
 {
-  return fabsf( lhs.degree - rhs.degree ) < Math::MACHINE_EPSILON_1000; // expect degree angles to be between 0 and 1000
+  return fabsf(lhs.degree - rhs.degree) < Math::MACHINE_EPSILON_1000; // expect degree angles to be between 0 and 1000
 }
 
 /**
@@ -110,9 +102,9 @@ inline bool operator==( const Degree& lhs, const Degree& rhs )
  * @param[in] rhs Degree to compare to
  * @return True if the values are not identical
  */
-inline bool operator!=( const Degree& lhs, const Degree& rhs )
+inline bool operator!=(const Degree& lhs, const Degree& rhs)
 {
-  return !( operator==( lhs, rhs ) );
+  return !(operator==(lhs, rhs));
 }
 
 /**
@@ -123,9 +115,9 @@ inline bool operator!=( const Degree& lhs, const Degree& rhs )
  * @param max value
  * @return The resulting radian
  */
-inline Degree Clamp( Degree angle, float min, float max )
+inline Degree Clamp(Degree angle, float min, float max)
 {
-  return Degree( Clamp<float>( angle.degree, min, max ) );
+  return Degree(Clamp<float>(angle.degree, min, max));
 }
 
 /**
@@ -133,4 +125,4 @@ inline Degree Clamp( Degree angle, float min, float max )
  */
 } // namespace Dali
 
-#endif // __DALI_DEGREE_H__
+#endif // DALI_DEGREE_H