Apply the new doxygen tagging rule for @SINCE
[platform/core/uifw/dali-core.git] / dali / public-api / object / property.h
1 #ifndef __DALI_PROPERTY_H__
2 #define __DALI_PROPERTY_H__
3
4 /*
5  * Copyright (c) 2015 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 // EXTERNAL INCLUDES
22 #include <string>
23 #include <utility>
24
25 // INTERNAL INCLUDES
26 #include <dali/public-api/common/vector-wrapper.h>
27 #include <dali/public-api/common/dali-common.h>
28 #include <dali/public-api/common/dali-vector.h>
29
30 namespace Dali
31 {
32 /**
33  * @addtogroup dali_core_object
34  * @{
35  */
36
37 class Handle;
38
39 /**
40  * @brief An object + property pair.
41  * @SINCE_1_0.0
42  */
43 struct DALI_IMPORT_API Property
44 {
45   /**
46    * @brief A valid property index is zero or greater.
47    * @SINCE_1_0.0
48    */
49   typedef int Index;
50
51   static const int INVALID_INDEX; ///< -1 is not a valid property index
52   static const int INVALID_COMPONENT_INDEX; ///< -1 is not a valid property index
53
54   typedef Dali::Vector< Index > IndexContainer; ///< A vector of property indices @SINCE_1_0.0
55
56   /**
57    * @brief A value-type representing a property value.
58    */
59   class Value;
60
61   /**
62    * @brief A Map of property values.
63    */
64   class Map;
65
66   /**
67    * @brief An Array of property values.
68    */
69   class Array;
70
71   /**
72    * @brief The property types supported.
73    * @SINCE_1_0.0
74    */
75   enum Type
76   {
77     NONE,            ///< No type @SINCE_1_0.0
78
79     BOOLEAN,         ///< A boolean type @SINCE_1_0.0
80     FLOAT,           ///< A float type @SINCE_1_0.0
81     INTEGER,         ///< An integer type @SINCE_1_0.0
82     VECTOR2,         ///< a vector array of size=2 with float precision @SINCE_1_0.0
83     VECTOR3,         ///< a vector array of size=3 with float precision @SINCE_1_0.0
84     VECTOR4,         ///< a vector array of size=4 with float precision @SINCE_1_0.0
85     MATRIX3,         ///< a 3x3 matrix @SINCE_1_0.0
86     MATRIX,          ///< a 4x4 matrix @SINCE_1_0.0
87     RECTANGLE,       ///< an integer array of size=4 @SINCE_1_0.0
88     ROTATION,        ///< either a quaternion or an axis angle rotation @SINCE_1_0.0
89     STRING,          ///< A string type @SINCE_1_0.0
90     ARRAY,           ///< an array of Property::Value @SINCE_1_0.0
91     MAP              ///< a string key to Property:value mapping @SINCE_1_0.0
92   };
93
94   /**
95    * @brief The access mode for custom properties
96    * @SINCE_1_0.0
97    */
98   enum AccessMode
99   {
100     READ_ONLY,          ///< if the property is read-only @SINCE_1_0.0
101     READ_WRITE,         ///< If the property is read/writeable @SINCE_1_0.0
102     ANIMATABLE,         ///< If the property can be animated or constrained @SINCE_1_0.0
103     ACCESS_MODE_COUNT   ///< The number of access modes @SINCE_1_0.0
104   };
105
106
107   /**
108    * @brief Create a Property instance.
109    *
110    * @SINCE_1_0.0
111    * @param [in] object A valid handle to the target object.
112    * @param [in] propertyIndex The index of a property.
113    */
114   Property( Handle& object, Property::Index propertyIndex );
115
116
117   /**
118    * @brief Create a Property instance.
119    *
120    * @SINCE_1_0.0
121    * @param [in] object A valid handle to the target object.
122    * @param [in] propertyIndex The index of a property.
123    * @param [in] componentIndex Index to a sub component of a property, for use with Vector2, Vector3 and Vector4. -1 for main property (default is -1)
124    */
125   Property( Handle& object, Property::Index propertyIndex, int componentIndex );
126
127   /**
128    * @brief Create a Property instance.
129    *
130    * @SINCE_1_0.0
131    * @param [in] object A valid handle to the target object.
132    * @param [in] propertyName The property name.
133    * @note This performs a property index query and is therefore slower than
134    * constructing a Property directly with the index.
135    */
136   Property( Handle& object, const std::string& propertyName );
137
138   /**
139    * @brief Create a Property instance.
140    *
141    * @SINCE_1_0.0
142    * @param [in] object A valid handle to the target object.
143    * @param [in] propertyName The property name.
144    * @param [in] componentIndex Index to a sub component of a property, for use with Vector2, Vector3 and Vector4. -1 for main property (default is -1)
145    * @note This performs a property index query and is therefore slower than
146    * constructing a Property directly with the index.
147    */
148   Property( Handle& object, const std::string& propertyName, int componentIndex );
149
150   /**
151    * @brief Non-virtual destructor; Property is not intended as a base class.
152    * @SINCE_1_0.0
153    */
154   ~Property();
155
156   Handle& object; ///< A valid handle to the target object.
157
158   Index propertyIndex; ///< The index of a property provided by object.
159
160   int componentIndex; ///< Index of a property sub component, for use with Vector2, Vector3 and Vector4, -1 if using main property
161 };
162
163 /**
164  * @}
165  */
166 } // namespace Dali
167
168 #endif // __DALI_PROPERTY_H__