Merge branch 'devel/master' into tizen
[platform/core/uifw/dali-core.git] / dali / public-api / object / property-types.h
1 #ifndef DALI_PROPERTY_TYPES_H
2 #define DALI_PROPERTY_TYPES_H
3
4 /*
5  * Copyright (c) 2020 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/constants.h>
23 #include <dali/public-api/common/extents.h>
24 #include <dali/public-api/math/angle-axis.h>
25 #include <dali/public-api/math/degree.h>
26 #include <dali/public-api/math/matrix.h>
27 #include <dali/public-api/math/matrix3.h>
28 #include <dali/public-api/math/quaternion.h>
29 #include <dali/public-api/math/rect.h>
30 #include <dali/public-api/math/vector2.h>
31 #include <dali/public-api/math/vector3.h>
32 #include <dali/public-api/math/vector4.h>
33 #include <dali/public-api/object/property.h>
34
35 namespace Dali
36 {
37 /**
38  * @addtogroup dali_core_object
39  * @{
40  */
41
42 /**
43  * @brief Template function instances for property getters.
44  * @SINCE_1_0.0
45  */
46 namespace PropertyTypes
47 {
48 /**
49  * @brief Retrieves the name of a property type.
50  *
51  * @SINCE_1_0.0
52  * @param[in] type The property type
53  * @return The name of this type
54  */
55 DALI_CORE_API const char* GetName(Property::Type type);
56
57 /**
58  * @brief Retrieves an enumerated property type.
59  *
60  * New versions of this templated function must be defined for future types.
61  * @SINCE_1_0.0
62  * @return The property type
63  */
64 template<typename T>
65 inline Property::Type Get()
66 {
67   return Property::NONE;
68 }
69 template<>
70 inline Property::Type Get<bool>()
71 {
72   return Property::BOOLEAN;
73 }
74 template<>
75 inline Property::Type Get<float>()
76 {
77   return Property::FLOAT;
78 }
79 template<>
80 inline Property::Type Get<int>()
81 {
82   return Property::INTEGER;
83 }
84 template<>
85 inline Property::Type Get<Vector2>()
86 {
87   return Property::VECTOR2;
88 }
89 template<>
90 inline Property::Type Get<Vector3>()
91 {
92   return Property::VECTOR3;
93 }
94 template<>
95 inline Property::Type Get<Vector4>()
96 {
97   return Property::VECTOR4;
98 }
99 template<>
100 inline Property::Type Get<Matrix3>()
101 {
102   return Property::MATRIX3;
103 }
104 template<>
105 inline Property::Type Get<Matrix>()
106 {
107   return Property::MATRIX;
108 }
109 template<>
110 inline Property::Type Get<AngleAxis>()
111 {
112   return Property::ROTATION;
113 } // Rotation has two representations
114 template<>
115 inline Property::Type Get<Quaternion>()
116 {
117   return Property::ROTATION;
118 } // Rotation has two representations
119 template<>
120 inline Property::Type Get<std::string>()
121 {
122   return Property::STRING;
123 }
124 template<>
125 inline Property::Type Get<Dali::Rect<int> >()
126 {
127   return Property::RECTANGLE;
128 }
129 template<>
130 inline Property::Type Get<Property::Map>()
131 {
132   return Property::MAP;
133 }
134 template<>
135 inline Property::Type Get<Property::Array>()
136 {
137   return Property::ARRAY;
138 }
139 template<>
140 inline Property::Type Get<Extents>()
141 {
142   return Property::EXTENTS;
143 }
144
145 }; // namespace PropertyTypes
146
147 /**
148  * @}
149  */
150 } // namespace Dali
151
152 #endif // DALI_PROPERTY_TYPES_H