Changed const variables to constexpr where possible. 12/242412/3
authorDavid Steele <david.steele@samsung.com>
Wed, 26 Aug 2020 17:28:55 +0000 (18:28 +0100)
committerDavid Steele <david.steele@samsung.com>
Thu, 27 Aug 2020 15:02:55 +0000 (16:02 +0100)
Some const variables can't be changed, such as class members that
require that class's constructor.

Change-Id: I4f60b58220b069265de81fa59ba9405b2754db56
Signed-off-by: David Steele <david.steele@samsung.com>
16 files changed:
automated-tests/CMakeLists.txt
automated-tests/src/dali/CMakeLists.txt
automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.cpp
automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.h
dali/public-api/actors/custom-actor-impl.h
dali/public-api/common/constants.cpp [deleted file]
dali/public-api/common/constants.h
dali/public-api/file.list
dali/public-api/math/degree.cpp
dali/public-api/math/degree.h
dali/public-api/math/radian.h
dali/public-api/math/vector2.h
dali/public-api/math/vector3.h
dali/public-api/math/vector4.h
dali/public-api/object/property.cpp
dali/public-api/object/property.h

index c27852a..a3cef24 100644 (file)
@@ -1,5 +1,6 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+CMAKE_MINIMUM_REQUIRED(VERSION 3.8.2)
 PROJECT(tct_coreapi_utc)
+SET(CMAKE_CXX_STANDARD 17)
 
 INCLUDE(FindPkgConfig)
 SET(BIN_DIR "/opt/usr/bin")
index 30fffe6..afa6443 100644 (file)
@@ -126,6 +126,7 @@ PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED
      dali2-core
 )
 
+ADD_COMPILE_OPTIONS( -rdynamic )
 ADD_COMPILE_OPTIONS( -O0 -ggdb --coverage -Wall -Werror )
 ADD_COMPILE_OPTIONS( ${${CAPI_LIB}_CFLAGS_OTHER} )
 
@@ -144,7 +145,7 @@ ADD_DEFINITIONS( -DADDON_LIBS_PATH=\"${CMAKE_CURRENT_BINARY_DIR}\" )
 ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.cpp ${TC_SOURCES})
 TARGET_LINK_LIBRARIES(${EXEC_NAME}
     ${${CAPI_LIB}_LIBRARIES}
-    -lpthread -ldl --coverage
+    -lpthread -ldl --coverage -rdynamic
 )
 
 # Path to installed precompiled addons
index 4a4ac81..87750e2 100644 (file)
@@ -40,6 +40,8 @@ void tet_result(int32_t value)
 #define END_TEST \
   return ((test_return_value>0)?1:0)
 
+extern "C"
+{
 
 void tet_infoline(const char* str)
 {
@@ -53,6 +55,8 @@ void tet_printf(const char *format, ...)
   vfprintf(stderr, format, arg);
   va_end(arg);
 }
+}
+
 
 bool operator==(TimePeriod a, TimePeriod b)
 {
index ac9b214..7ba3196 100644 (file)
 #include <dali/public-api/dali-core.h>
 #include <test-compare-types.h>
 
+extern "C"
+{
 void tet_infoline(const char*str);
 void tet_printf(const char *format, ...);
+}
 
 #include "test-application.h"
 #include "test-actor-utils.h"
index 6860db6..4714bc2 100644 (file)
@@ -326,7 +326,7 @@ protected: // For derived classes
     LAST_ACTOR_FLAG                             ///< Special marker for last actor flag @SINCE_1_0.0
   };
 
-  static const int32_t ACTOR_FLAG_COUNT = Log< LAST_ACTOR_FLAG - 1 >::value + 1;      ///< Value for deriving classes to continue on the flag enum
+  static constexpr int32_t ACTOR_FLAG_COUNT = Log< LAST_ACTOR_FLAG - 1 >::value + 1;      ///< Value for deriving classes to continue on the flag enum
 
   /**
    * @brief Creates a CustomActorImpl.
diff --git a/dali/public-api/common/constants.cpp b/dali/public-api/common/constants.cpp
deleted file mode 100644 (file)
index ca1d222..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/public-api/common/constants.h>
-
-// EXTERNAL INCLUDES
-#include <string>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/math/compile-time-math.h>
-#include <dali/public-api/math/degree.h>
-
-namespace Dali
-{
-
-const Vector3 ParentOrigin::TOP_LEFT     (0.0f, 0.0f, 0.5f);
-const Vector3 ParentOrigin::TOP_CENTER   (0.5f, 0.0f, 0.5f);
-const Vector3 ParentOrigin::TOP_RIGHT    (1.0f, 0.0f, 0.5f);
-const Vector3 ParentOrigin::CENTER_LEFT  (0.0f, 0.5f, 0.5f);
-const Vector3 ParentOrigin::CENTER       (0.5f, 0.5f, 0.5f);
-const Vector3 ParentOrigin::CENTER_RIGHT (1.0f, 0.5f, 0.5f);
-const Vector3 ParentOrigin::BOTTOM_LEFT  (0.0f, 1.0f, 0.5f);
-const Vector3 ParentOrigin::BOTTOM_CENTER(0.5f, 1.0f, 0.5f);
-const Vector3 ParentOrigin::BOTTOM_RIGHT (1.0f, 1.0f, 0.5f);
-
-const Vector3 ParentOrigin::DEFAULT( ParentOrigin::TOP_LEFT );
-
-const Vector3 AnchorPoint::TOP_LEFT     (0.0f, 0.0f, 0.5f);
-const Vector3 AnchorPoint::TOP_CENTER   (0.5f, 0.0f, 0.5f);
-const Vector3 AnchorPoint::TOP_RIGHT    (1.0f, 0.0f, 0.5f);
-const Vector3 AnchorPoint::CENTER_LEFT  (0.0f, 0.5f, 0.5f);
-const Vector3 AnchorPoint::CENTER       (0.5f, 0.5f, 0.5f);
-const Vector3 AnchorPoint::CENTER_RIGHT (1.0f, 0.5f, 0.5f);
-const Vector3 AnchorPoint::BOTTOM_LEFT  (0.0f, 1.0f, 0.5f);
-const Vector3 AnchorPoint::BOTTOM_CENTER(0.5f, 1.0f, 0.5f);
-const Vector3 AnchorPoint::BOTTOM_RIGHT (1.0f, 1.0f, 0.5f);
-
-const Vector3 AnchorPoint::DEFAULT( AnchorPoint::CENTER );
-
-const Vector4 Color::BLACK( 0.0f, 0.0f, 0.0f, 1.0f );
-const Vector4 Color::WHITE( 1.0f, 1.0f, 1.0f, 1.0f );
-
-const Vector4 Color::RED(   1.0f, 0.0f, 0.0f, 1.0f );
-const Vector4 Color::GREEN( 0.0f, 1.0f, 0.0f, 1.0f );
-const Vector4 Color::BLUE(  0.0f, 0.0f, 1.0f, 1.0f );
-
-const Vector4 Color::YELLOW(  1.0f, 1.0f, 0.0f, 1.0f );
-const Vector4 Color::MAGENTA( 1.0f, 0.0f, 1.0f, 1.0f );
-const Vector4 Color::CYAN(    0.0f, 1.0f, 1.0f, 1.0f );
-
-const Vector4 Color::TRANSPARENT( 0.0f, 0.0f, 0.0f, 0.0f );
-
-// epsilon constants
-const float Math::MACHINE_EPSILON_0     = Epsilon<0>::value;
-const float Math::MACHINE_EPSILON_1     = Epsilon<1>::value;
-const float Math::MACHINE_EPSILON_10    = Epsilon<10>::value;
-const float Math::MACHINE_EPSILON_100   = Epsilon<100>::value;
-const float Math::MACHINE_EPSILON_1000  = Epsilon<1000>::value;
-const float Math::MACHINE_EPSILON_10000 = Epsilon<10000>::value;
-
-} // namespace Dali
index 9750c43..f2a7007 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_CONSTANTS_H
 
 /*
- * Copyright (c) 2019 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.
@@ -22,6 +22,7 @@
 #include <math.h> // M_PI
 
 // INTERNAL INCLUDES
+#include <dali/public-api/math/compile-time-math.h>
 #include <dali/public-api/math/vector3.h>
 #include <dali/public-api/math/vector4.h>
 
@@ -40,23 +41,21 @@ namespace Dali
  */
 namespace ParentOrigin
 {
-extern const Vector3 DEFAULT; ///< TOP_LEFT
-static const float TOP = 0.0f;
-static const float BOTTOM = 1.0f;
-static const float LEFT = 0.0f;
-static const float RIGHT = 1.0f;
-static const float MIDDLE = 0.5f;
-
-DALI_CORE_API extern const Vector3 TOP_LEFT;           ///< 0.0f, 0.0f, 0.5f
-DALI_CORE_API extern const Vector3 TOP_CENTER;         ///< 0.5f, 0.0f, 0.5f
-DALI_CORE_API extern const Vector3 TOP_RIGHT;          ///< 1.0f, 0.0f, 0.5f
-DALI_CORE_API extern const Vector3 CENTER_LEFT;        ///< 0.0f, 0.5f, 0.5f
-DALI_CORE_API extern const Vector3 CENTER;             ///< 0.5f, 0.5f, 0.5f
-DALI_CORE_API extern const Vector3 CENTER_RIGHT;       ///< 1.0f, 0.5f, 0.5f
-DALI_CORE_API extern const Vector3 BOTTOM_LEFT;        ///< 0.0f, 1.0f, 0.5f
-DALI_CORE_API extern const Vector3 BOTTOM_CENTER;      ///< 0.5f, 1.0f, 0.5f
-DALI_CORE_API extern const Vector3 BOTTOM_RIGHT;       ///< 1.0f, 1.0f, 0.5f
-
+static constexpr float TOP = 0.0f;
+static constexpr float BOTTOM = 1.0f;
+static constexpr float LEFT = 0.0f;
+static constexpr float RIGHT = 1.0f;
+static constexpr float MIDDLE = 0.5f;
+static constexpr Vector3 TOP_LEFT     (0.0f, 0.0f, 0.5f);
+static constexpr Vector3 TOP_CENTER   (0.5f, 0.0f, 0.5f);
+static constexpr Vector3 TOP_RIGHT    (1.0f, 0.0f, 0.5f);
+static constexpr Vector3 CENTER_LEFT  (0.0f, 0.5f, 0.5f);
+static constexpr Vector3 CENTER       (0.5f, 0.5f, 0.5f);
+static constexpr Vector3 CENTER_RIGHT (1.0f, 0.5f, 0.5f);
+static constexpr Vector3 BOTTOM_LEFT  (0.0f, 1.0f, 0.5f);
+static constexpr Vector3 BOTTOM_CENTER(0.5f, 1.0f, 0.5f);
+static constexpr Vector3 BOTTOM_RIGHT (1.0f, 1.0f, 0.5f);
+static constexpr Vector3 DEFAULT( TOP_LEFT );
 }
 
 /**
@@ -67,23 +66,21 @@ DALI_CORE_API extern const Vector3 BOTTOM_RIGHT;       ///< 1.0f, 1.0f, 0.5f
  */
 namespace AnchorPoint
 {
-static const float TOP = 0.0f;
-static const float BOTTOM = 1.0f;
-static const float LEFT = 0.0f;
-static const float RIGHT = 1.0f;
-static const float MIDDLE = 0.5f;
-
-extern const Vector3 DEFAULT; ///< CENTER
-DALI_CORE_API extern const Vector3 TOP_LEFT;           ///< 0.0f, 0.0f, 0.5f
-DALI_CORE_API extern const Vector3 TOP_CENTER;         ///< 0.5f, 0.0f, 0.5f
-DALI_CORE_API extern const Vector3 TOP_RIGHT;          ///< 1.0f, 0.0f, 0.5f
-DALI_CORE_API extern const Vector3 CENTER_LEFT;        ///< 0.0f, 0.5f, 0.5f
-DALI_CORE_API extern const Vector3 CENTER;             ///< 0.5f, 0.5f, 0.5f
-DALI_CORE_API extern const Vector3 CENTER_RIGHT;       ///< 1.0f, 0.5f, 0.5f
-DALI_CORE_API extern const Vector3 BOTTOM_LEFT;        ///< 0.0f, 1.0f, 0.5f
-DALI_CORE_API extern const Vector3 BOTTOM_CENTER;      ///< 0.5f, 1.0f, 0.5f
-DALI_CORE_API extern const Vector3 BOTTOM_RIGHT;       ///< 1.0f, 1.0f, 0.5f
-
+static constexpr float TOP = 0.0f;
+static constexpr float BOTTOM = 1.0f;
+static constexpr float LEFT = 0.0f;
+static constexpr float RIGHT = 1.0f;
+static constexpr float MIDDLE = 0.5f;
+static constexpr Vector3 TOP_LEFT     (0.0f, 0.0f, 0.5f);
+static constexpr Vector3 TOP_CENTER   (0.5f, 0.0f, 0.5f);
+static constexpr Vector3 TOP_RIGHT    (1.0f, 0.0f, 0.5f);
+static constexpr Vector3 CENTER_LEFT  (0.0f, 0.5f, 0.5f);
+static constexpr Vector3 CENTER       (0.5f, 0.5f, 0.5f);
+static constexpr Vector3 CENTER_RIGHT (1.0f, 0.5f, 0.5f);
+static constexpr Vector3 BOTTOM_LEFT  (0.0f, 1.0f, 0.5f);
+static constexpr Vector3 BOTTOM_CENTER(0.5f, 1.0f, 0.5f);
+static constexpr Vector3 BOTTOM_RIGHT (1.0f, 1.0f, 0.5f);
+static constexpr Vector3 DEFAULT( CENTER );
 }
 
 
@@ -95,18 +92,15 @@ DALI_CORE_API extern const Vector3 BOTTOM_RIGHT;       ///< 1.0f, 1.0f, 0.5f
  */
 namespace Color
 {
-DALI_CORE_API extern const Vector4 BLACK;       ///< Pure black (0.0f, 0.0f, 0.0f, 1.0f);
-DALI_CORE_API extern const Vector4 WHITE;       ///< Pure white (1.0f, 1.0f, 1.0f, 1.0f);
-
-DALI_CORE_API extern const Vector4 RED;         ///< Pure red   (1.0f, 0.0f, 0.0f, 1.0f);
-DALI_CORE_API extern const Vector4 GREEN;       ///< Pure green (0.0f, 1.0f, 0.0f, 1.0f);
-DALI_CORE_API extern const Vector4 BLUE;        ///< Pure blue  (0.0f, 0.0f, 1.0f, 1.0f);
-
-DALI_CORE_API extern const Vector4 YELLOW;      ///< Pure yellow  (1.0f, 1.0f, 0.0f, 1.0f);
-DALI_CORE_API extern const Vector4 MAGENTA;     ///< Pure magenta (1.0f, 0.0f, 1.0f, 1.0f);
-DALI_CORE_API extern const Vector4 CYAN;        ///< Pure cyan    (0.0f, 1.0f, 1.0f, 1.0f);
-
-DALI_CORE_API extern const Vector4 TRANSPARENT; ///< Black transparent (0.0f, 0.0f, 0.0f, 0.0f);
+static constexpr Vector4 BLACK( 0.0f, 0.0f, 0.0f, 1.0f );
+static constexpr Vector4 WHITE( 1.0f, 1.0f, 1.0f, 1.0f );
+static constexpr Vector4 RED(   1.0f, 0.0f, 0.0f, 1.0f );
+static constexpr Vector4 GREEN( 0.0f, 1.0f, 0.0f, 1.0f );
+static constexpr Vector4 BLUE(  0.0f, 0.0f, 1.0f, 1.0f );
+static constexpr Vector4 YELLOW(  1.0f, 1.0f, 0.0f, 1.0f );
+static constexpr Vector4 MAGENTA( 1.0f, 0.0f, 1.0f, 1.0f );
+static constexpr Vector4 CYAN(    0.0f, 1.0f, 1.0f, 1.0f );
+static constexpr Vector4 TRANSPARENT( 0.0f, 0.0f, 0.0f, 0.0f );
 
 } // namespace Color
 
@@ -116,19 +110,19 @@ DALI_CORE_API extern const Vector4 TRANSPARENT; ///< Black transparent (0.0f, 0.
  */
 namespace Math
 {
-DALI_CORE_API extern const float MACHINE_EPSILON_0;      ///< Epsilon for values near zero
-DALI_CORE_API extern const float MACHINE_EPSILON_1;      ///< Epsilon for values near 1
-DALI_CORE_API extern const float MACHINE_EPSILON_10;     ///< Epsilon for values near 10
-DALI_CORE_API extern const float MACHINE_EPSILON_100;    ///< Epsilon for values near 100
-DALI_CORE_API extern const float MACHINE_EPSILON_1000;   ///< Epsilon for values near 1000
-DALI_CORE_API extern const float MACHINE_EPSILON_10000;  ///< Epsilon for values near 10000
+static constexpr float MACHINE_EPSILON_0     = Epsilon<0>::value;
+static constexpr float MACHINE_EPSILON_1     = Epsilon<1>::value;
+static constexpr float MACHINE_EPSILON_10    = Epsilon<10>::value;
+static constexpr float MACHINE_EPSILON_100   = Epsilon<100>::value;
+static constexpr float MACHINE_EPSILON_1000  = Epsilon<1000>::value;
+static constexpr float MACHINE_EPSILON_10000 = Epsilon<10000>::value;
 
 // float is preferred to double for performance on ARM targets
-static const float PI   = static_cast<float>(M_PI);       ///< Constant representing PI
-static const float PI_2 = static_cast<float>(M_PI_2);     ///< Constant representing PI/2
-static const float PI_4 = static_cast<float>(M_PI_4);     ///< Constant representing PI/4
-static const float PI_OVER_180 = Dali::Math::PI/180.0f;   ///< Constant used to convert degree to radian
-static const float ONE80_OVER_PI = 180.0f/Dali::Math::PI; ///< Constant used to convert radian to degree
+static constexpr float PI   = static_cast<float>(M_PI);       ///< Pi
+static constexpr float PI_2 = static_cast<float>(M_PI_2);     ///< Pi/2
+static constexpr float PI_4 = static_cast<float>(M_PI_4);     ///< Pi/4
+static constexpr float PI_OVER_180 = Dali::Math::PI/180.0f;   ///< Constant used to convert degree to radian
+static constexpr float ONE80_OVER_PI = 180.0f/Dali::Math::PI; ///< Constant used to convert radian to degree
 
 } // namespace Math
 
index b24f3c5..9675830 100644 (file)
@@ -16,7 +16,6 @@ SET( public_api_src_files
   ${public_api_src_dir}/animation/linear-constrainer.cpp
   ${public_api_src_dir}/animation/path.cpp
   ${public_api_src_dir}/animation/time-period.cpp
-  ${public_api_src_dir}/common/constants.cpp
   ${public_api_src_dir}/common/dali-common.cpp
   ${public_api_src_dir}/common/dali-vector.cpp
   ${public_api_src_dir}/common/extents.cpp
index cf695dd..e2bfca9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -29,17 +29,4 @@ Degree::Degree( Radian radian )
 {
 }
 
-const Radian ANGLE_360 = Radian( Math::PI * 2.f     ); ///< 360 degree turn in radians
-const Radian ANGLE_315 = Radian( Math::PI * 1.75f   ); ///< 315 degree turn in radians
-const Radian ANGLE_270 = Radian( Math::PI * 1.5f    ); ///< 270 degree turn in radians
-const Radian ANGLE_225 = Radian( Math::PI * 1.25f   ); ///< 225 degree turn in radians
-const Radian ANGLE_180 = Radian( Math::PI           ); ///< 180 degree turn in radians
-const Radian ANGLE_135 = Radian( Math::PI * 0.75f   ); ///< 135 degree turn in radians
-const Radian ANGLE_120 = Radian( Math::PI * 2.f/3.f ); ///< 120 degree turn in radians
-const Radian ANGLE_90  = Radian( Math::PI_2         ); ///< 90 degree turn in radians
-const Radian ANGLE_60  = Radian( Math::PI / 3.f     ); ///< 60 degree turn in radians
-const Radian ANGLE_45  = Radian( Math::PI_4         ); ///< 45 degree turn in radians
-const Radian ANGLE_30  = Radian( Math::PI / 6.f     ); ///< 30 degree turn in radians
-const Radian ANGLE_0   = Radian( 0.0f               ); ///< 0 degree turn in radians
-
 } // namespace Dali
index f7d900f..cefaa98 100644 (file)
@@ -54,7 +54,7 @@ struct Degree
    * @SINCE_1_0.0
    * @param[in] value The initial value in degrees
    */
-  explicit Degree( float value )
+  explicit constexpr Degree( float value )
   : degree( value )
   { }
 
@@ -82,19 +82,6 @@ public:
 
 // 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.
index 8f1af8a..6c16482 100644 (file)
@@ -53,7 +53,7 @@ struct Radian
    * @SINCE_1_0.0
    * @param[in] value The initial value in radians
    */
-  explicit Radian( float value )
+  explicit constexpr Radian( float value )
   : radian( value )
   { }
 
@@ -312,6 +312,20 @@ inline Radian Clamp( Radian angle, float min, float max )
   return Radian( Clamp<float>( angle.radian, min, max ) );
 }
 
+// useful constant angles
+inline constexpr Radian ANGLE_360( Math::PI * 2.f     );
+inline constexpr Radian ANGLE_315( Math::PI * 1.75f   );
+inline constexpr Radian ANGLE_270( Math::PI * 1.5f    );
+inline constexpr Radian ANGLE_225( Math::PI * 1.25f   );
+inline constexpr Radian ANGLE_180( Math::PI           );
+inline constexpr Radian ANGLE_135( Math::PI * 0.75f   );
+inline constexpr Radian ANGLE_120( Math::PI * 2.f/3.f );
+inline constexpr Radian ANGLE_90 ( Math::PI_2         );
+inline constexpr Radian ANGLE_60 ( Math::PI / 3.f     );
+inline constexpr Radian ANGLE_45 ( Math::PI_4         );
+inline constexpr Radian ANGLE_30 ( Math::PI / 6.f     );
+inline constexpr Radian ANGLE_0  ( 0.0f               );
+
 /**
  * @}
  */
index ab72e66..200230a 100644 (file)
@@ -68,7 +68,7 @@ public:
    * @param[in] x x or width component
    * @param[in] y y or height component
    */
-  explicit Vector2(float x, float y)
+  explicit constexpr Vector2(float x, float y)
   : x(x), y(y)
   {
   }
index 8232a43..97775f0 100644 (file)
@@ -68,7 +68,7 @@ struct DALI_CORE_API Vector3
    * @param[in] y (or height) component
    * @param[in] z (or depth) component
    */
-  explicit Vector3(float x, float y, float z)
+  explicit constexpr Vector3(float x, float y, float z)
   : x(x),
     y(y),
     z(z)
index eab78ca..9af98e3 100644 (file)
@@ -72,7 +72,7 @@ struct DALI_CORE_API Vector4
    * @param[in] z z (or b/p) component
    * @param[in] w w (or a/q) component
    */
-  explicit Vector4(float x, float y, float z, float w)
+  explicit constexpr Vector4(float x, float y, float z, float w)
   : x(x),
     y(y),
     z(z),
index ce2b458..c80524e 100644 (file)
 namespace Dali
 {
 
-const int32_t Property::INVALID_INDEX           = -1;
-const int32_t Property::INVALID_KEY             = -1;
-const int32_t Property::INVALID_COMPONENT_INDEX = -1;
-
 Property::Property(Handle& obj, Property::Index propIndex)
 : object(obj),
   propertyIndex(propIndex),
index 6553591..bf48f5c 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_PROPERTY_H
 
 /*
- * Copyright (c) 2019 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.
@@ -48,9 +48,9 @@ struct DALI_CORE_API Property
    */
   typedef int32_t Index;
 
-  static const int32_t INVALID_INDEX; ///< -1 is not a valid property index
-  static const int32_t INVALID_KEY;   ///< -1 is not a valid property key
-  static const int32_t INVALID_COMPONENT_INDEX; ///< -1 is not a valid property index
+  static constexpr int32_t INVALID_INDEX{-1}; ///< -1 is not a valid property index
+  static constexpr int32_t INVALID_KEY{-1};   ///< -1 is not a valid property key
+  static constexpr int32_t INVALID_COMPONENT_INDEX{-1}; ///< -1 is not a valid property index
 
   typedef Dali::Vector< Index > IndexContainer; ///< A vector of property indices @SINCE_1_0.0