Make Dali::Vector movable & add use Modern C++ semantics on public & devel classes
[platform/core/uifw/dali-core.git] / dali / public-api / object / property-conditions.h
1 #ifndef DALI_PROPERTY_CONDITIONS_H
2 #define DALI_PROPERTY_CONDITIONS_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/dali-vector.h>
23 #include <dali/public-api/object/base-handle.h>
24 #include <dali/public-api/object/property.h>
25
26 namespace Dali
27 {
28 /**
29  * @addtogroup dali_core_object
30  * @{
31  */
32
33 namespace Internal DALI_INTERNAL
34 {
35 class PropertyCondition;
36 }
37
38 /**
39  * @brief This represents a condition that can be evaluated on a Property::Value.
40  * @SINCE_1_0.0
41  */
42 class DALI_CORE_API PropertyCondition : public BaseHandle
43 {
44 public:
45
46   /**
47    * @brief Constructor for condition clause.
48    * @SINCE_1_0.0
49    */
50   PropertyCondition();
51
52   /**
53    * @brief Destructor.
54    * @SINCE_1_0.0
55    */
56   ~PropertyCondition();
57
58   /**
59    * @brief This copy constructor is required for (smart) pointer semantics.
60    *
61    * @SINCE_1_0.0
62    * @param[in] handle A reference to the copied handle
63    */
64   PropertyCondition( const PropertyCondition& handle );
65
66   /**
67    * @brief This assignment operator is required for (smart) pointer semantics.
68    *
69    * @SINCE_1_0.0
70    * @param[in] rhs A reference to the copied handle
71    * @return A reference to this
72    */
73   PropertyCondition& operator=( const PropertyCondition& rhs );
74
75   /**
76    * @brief Move constructor.
77    *
78    * @SINCE_1_9.22
79    * @param[in] rhs A reference to the moved handle
80    */
81   PropertyCondition( PropertyCondition&& rhs );
82
83   /**
84    * @brief Move assignment operator.
85    *
86    * @SINCE_1_9.22
87    * @param[in] rhs A reference to the moved handle
88    * @return A reference to this handle
89    */
90   PropertyCondition& operator=( PropertyCondition&& rhs );
91
92 public:
93
94   /**
95    * @brief Retrieves the arguments that this condition uses.
96    *
97    * @SINCE_1_0.0
98    * @return The arguments used for this condition
99    */
100   std::size_t GetArgumentCount() const;
101
102   /**
103    * @brief Retrieves the arguments that this condition uses.
104    *
105    * @SINCE_1_0.0
106    * @param[in] index The condition index to get the argument
107    * @return The arguments used for this condition
108    * @note The container will only be valid as long PropertyCondition is valid.
109    */
110   float GetArgument( std::size_t index ) const;
111
112 };
113
114 /**
115  * @brief LessThanCondition compares whether property is less than arg.
116  *
117  * property type:
118  * bool (false = 0.0f, true = 1.0f)
119  * float (float)
120  * vector2 (the 2D length)
121  * vector3 (the 3D length)
122  * vector4 (the 4D length)
123  * @SINCE_1_0.0
124  * @param[in] arg The argument for the condition
125  * @return A property condition function object
126  */
127 DALI_CORE_API PropertyCondition LessThanCondition( float arg );
128
129 /**
130  * @brief GreaterThanCondition compares whether property is greater than arg.
131  *
132  * property type:
133  * bool (false = 0.0f, true = 1.0f)
134  * float (float)
135  * vector2 (the 2D length)
136  * vector3 (the 3D length)
137  * vector4 (the 4D length)
138  * @SINCE_1_0.0
139  * @param[in] arg The argument for the condition
140  * @return A property condition function object
141  */
142 DALI_CORE_API PropertyCondition GreaterThanCondition( float arg );
143
144 /**
145  * @brief InsideCondition compares whether property is greater than arg0 and less than arg1.
146  *
147  * property type:
148  * bool (false = 0.0f, true = 1.0f)
149  * float (float)
150  * vector2 (the 2D length)
151  * vector3 (the 3D length)
152  * vector4 (the 4D length)
153  * @SINCE_1_0.0
154  * @param[in] arg0 The first argument for the condition
155  * @param[in] arg1 The second argument for the condition
156  * @return A property condition function object
157  */
158 DALI_CORE_API PropertyCondition InsideCondition( float arg0, float arg1 );
159
160 /**
161  * @brief OutsideCondition compares whether property is less than arg0 or greater than arg1.
162  *
163  * property type:
164  * bool (false = 0.0f, true = 1.0f)
165  * float (float)
166  * vector2 (the 2D length)
167  * vector3 (the 3D length)
168  * vector4 (the 4D length)
169  * @SINCE_1_0.0
170  * @param[in] arg0 The first argument for the condition
171  * @param[in] arg1 The second argument for the condition
172  * @return A property condition function object
173  */
174 DALI_CORE_API PropertyCondition OutsideCondition( float arg0, float arg1 );
175
176 /**
177  * @brief Detects when a property changes by stepAmount from initialValue, in both positive and negative directions. This will continue checking for multiples of stepAmount.
178  *
179  * property type:
180  * float (float)
181  * vector2 (the 2D length)
182  * vector3 (the 3D length)
183  * vector4 (the 4D length)
184  * @SINCE_1_0.0
185  * @param[in] stepAmount The step size required to trigger condition
186  * @param[in] initialValue The initial value to step from
187  * @return A property condition function object
188  */
189 DALI_CORE_API PropertyCondition StepCondition( float stepAmount, float initialValue = 0.0f );
190
191 /**
192  * @brief Receives notifications as a property goes above/below the inputted values. Values must be ordered and can be either ascending or descending.
193  *
194  * property type:
195  * float (float)
196  * vector2 (the 2D length)
197  * vector3 (the 3D length)
198  * vector4 (the 4D length)
199  * @SINCE_1_0.0
200  * @param[in] steps List of values to receive notifications for as a property crosses them
201  * @return A property condition function object
202  */
203 DALI_CORE_API PropertyCondition VariableStepCondition( const Dali::Vector<float>& steps );
204
205 /**
206  * @}
207  */
208 } // namespace Dali
209
210 #endif // DALI_PROPERTY_CONDITIONS_H