[dali_1.0.15] Merge branch 'tizen'
[platform/core/uifw/dali-core.git] / dali / public-api / math / degree.h
1 #ifndef __DALI_DEGREE_H__
2 #define __DALI_DEGREE_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/common/dali-common.h>
23
24 namespace Dali
25 {
26
27 struct Radian;
28
29 /**
30  * @brief An angle in degrees.
31  *
32  * This reduces ambiguity when using methods which accept angles in degrees or radians.
33  */
34 struct DALI_IMPORT_API Degree
35 {
36   /**
37    * @brief Create an angle in degrees.
38    *
39    * @param[in] value The initial value in degrees.
40    */
41   explicit Degree( float value );
42
43   /**
44    * @brief Create an angle in degrees from an angle in radians.
45    *
46    * @param[in] value The initial value in radians.
47    */
48   Degree( const Radian& value );
49
50   /**
51    * @brief Compare equality between two degrees.
52    *
53    * @param[in] rhs Degree to compare to
54    * @return true if the value is identical
55    */
56   bool operator==( const Degree& rhs ) const;
57
58   /**
59    * @brief Compare inequality between two degrees.
60    *
61    * @param[in] rhs Degree to compare to
62    * @return true if the value is not identical
63    */
64   bool operator!=( const Degree& rhs ) const;
65
66   /**
67    * @brief Compare two degrees.
68    *
69    * @param[in] rhs Degree to compare to
70    * @return true if this is less than the value
71    */
72   bool operator<( const Degree& rhs ) const;
73
74   /**
75    * @brief Assign an angle from a float value.
76    *
77    * @param[in] value Float value in degrees
78    * @return a reference to this
79    */
80   Degree& operator=( const float value );
81
82   /**
83    * @brief Assign an angle in radians to a Degree.
84    *
85    * @param[in] rhs Radian to get the value from
86    * @return a reference to this
87    */
88   Degree& operator=( const Radian& rhs );
89
90   /**
91    * @brief Cast operator to const float reference
92    */
93   operator const float&() const;
94
95   /**
96    * @brief Cast operator to float reference.
97    */
98   operator float&();
99
100 private:
101   // member data
102   float mValue; ///< The value in degrees
103
104   /**
105    * @brief Disable the default constructor.
106    */
107   Degree();
108 };
109
110 } // namespace Dali
111
112 #endif // __DALI_DEGREE_H__