1 #ifndef DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_FUNCTIONS_H
2 #define DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_FUNCTIONS_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/internal/update/common/scene-graph-property-notification.h>
23 #include <dali/public-api/object/property-value.h>
25 // OTHER CONDITITION INCLUDES
26 #include <dali/internal/update/common/property-condition-step-functions.h>
27 #include <dali/internal/update/common/property-condition-variable-step-functions.h>
34 class PropertyNotification;
38 // LessThan ///////////////////////////////////////////////////////////////////
41 * LessThan condition class,
42 * Checks if a Property is "Less Than" the argument:
44 * bool => false (0.0) or true (1.0) is less than arg0.
45 * float => value is less than arg0.
46 * Vector2 => 2 dimensional length of vector is less than arg0.
47 * Vector3 => 3 dimensional length of vector is less than arg0.
48 * Vector4 => 4 dimensional length of vector is less than arg0.
49 * Default => return false.
55 * @return function pointer to the correct condition function, based on
56 * the type of value being examined.
58 static ConditionFunction GetFunction(Property::Type valueType);
62 * Checks if bool is LessThan
63 * @param[in] value The value being examined.
64 * @param[in] arg The supplied arguments for the condition.
65 * @return Condition result (true if condition met, false if not)
67 static bool EvalBoolean(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
70 * Checks if integer is LessThan
71 * @param[in] value The value being examined.
72 * @param[in] arg The supplied arguments for the condition.
73 * @return Condition result (true if condition met, false if not)
75 static bool EvalInteger(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
78 * Checks if float is LessThan
79 * @param[in] value The value being examined.
80 * @param[in] arg The supplied arguments for the condition.
81 * @return Condition result (true if condition met, false if not)
83 static bool EvalFloat(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
86 * Checks if Vector2.Length() is LessThan
87 * @param[in] value The value being examined.
88 * @param[in] arg The supplied arguments for the condition.
89 * @return Condition result (true if condition met, false if not)
91 static bool EvalVector2(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
94 * Checks if Vector3.Length() is LessThan
95 * @param[in] value The value being examined.
96 * @param[in] arg The supplied arguments for the condition.
97 * @return Condition result (true if condition met, false if not)
99 static bool EvalVector3(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
102 * Checks if Vector4.Length() is LessThan
103 * @param[in] value The value being examined.
104 * @param[in] arg The supplied arguments for the condition.
105 * @return Condition result (true if condition met, false if not)
107 static bool EvalVector4(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
110 * Default check for other types
111 * @param[in] value The value being examined.
112 * @param[in] arg The supplied arguments for the condition.
113 * @return Condition result (true if condition met, false if not)
115 static bool EvalDefault(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
118 // GreaterThan ////////////////////////////////////////////////////////////////
121 * GreaterThan condition class,
122 * Checks if a Property is "Greater Than" the argument:
124 * bool => false (0.0) or true (1.0) is greater than arg0.
125 * float => value is greater than arg0.
126 * Vector2 => 2 dimensional length of vector is greater than arg0.
127 * Vector3 => 3 dimensional length of vector is greater than arg0.
128 * Vector4 => 4 dimensional length of vector is greater than arg0.
129 * Default => return false.
135 * @returns function pointer to the correct condition function, based on
136 * the type of value being examined.
138 static ConditionFunction GetFunction(Property::Type valueType);
142 * Checks if bool is GreaterThan
143 * @param[in] value The value being examined.
144 * @param[in] arg The supplied arguments for the condition.
145 * @return Condition result (true if condition met, false if not)
147 static bool EvalBoolean(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
150 * Checks if integer is GreaterThan
151 * @param[in] value The value being examined.
152 * @param[in] arg The supplied arguments for the condition.
153 * @return Condition result (true if condition met, false if not)
155 static bool EvalInteger(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
158 * Checks if float is GreaterThan
159 * @param[in] value The value being examined.
160 * @param[in] arg The supplied arguments for the condition.
161 * @return Condition result (true if condition met, false if not)
163 static bool EvalFloat(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
166 * Checks if Vector2.Length() is GreaterThan
167 * @param[in] value The value being examined.
168 * @param[in] arg The supplied arguments for the condition.
169 * @return Condition result (true if condition met, false if not)
171 static bool EvalVector2(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
174 * Checks if Vector3.Length() is GreaterThan
175 * @param[in] value The value being examined.
176 * @param[in] arg The supplied arguments for the condition.
177 * @return Condition result (true if condition met, false if not)
179 static bool EvalVector3(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
182 * Checks if Vector4.Length() is GreaterThan
183 * @param[in] value The value being examined.
184 * @param[in] arg The supplied arguments for the condition.
185 * @return Condition result (true if condition met, false if not)
187 static bool EvalVector4(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
190 * Default check for other types.
191 * @param[in] value The value being examined.
192 * @param[in] arg The supplied arguments for the condition.
193 * @return Condition result (true if condition met, false if not)
195 static bool EvalDefault(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
198 // Inside /////////////////////////////////////////////////////////////////////
201 * Inside condition class,
202 * Checks if a Property is "Inside" the two arguments:
204 * bool => false (0.0) or true (1.0) is inside arg0.
205 * float => value is between arg0 and arg1.
206 * Vector2 => 2 dimensional length of vector is between arg0 and arg1.
207 * Vector3 => 3 dimensional length of vector is between arg0 and arg1.
208 * Vector4 => 4 dimensional length of vector is between arg0 and arg1.
209 * Default => return false.
215 * @return function pointer to the correct condition function, based on
216 * the type of value being examined.
218 static ConditionFunction GetFunction(Property::Type valueType);
222 * Checks if bool is Inside
223 * @param[in] value The value being examined.
224 * @param[in] arg The supplied arguments for the condition.
225 * @return Condition result (true if condition met, false if not)
227 static bool EvalBoolean(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
230 * Checks if integer is Inside
231 * @param[in] value The value being examined.
232 * @param[in] arg The supplied arguments for the condition.
233 * @return Condition result (true if condition met, false if not)
235 static bool EvalInteger(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
238 * Checks if float is Inside
239 * @param[in] value The value being examined.
240 * @param[in] arg The supplied arguments for the condition.
241 * @return Condition result (true if condition met, false if not)
243 static bool EvalFloat(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
246 * Checks if Vector2.Length() is Inside
247 * @param[in] value The value being examined.
248 * @param[in] arg The supplied arguments for the condition.
249 * @return Condition result (true if condition met, false if not)
251 static bool EvalVector2(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
254 * Checks if Vector3.Length() is Inside
255 * @param[in] value The value being examined.
256 * @param[in] arg The supplied arguments for the condition.
257 * @return Condition result (true if condition met, false if not)
259 static bool EvalVector3(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
262 * Checks if Vector4.Length() is Inside
263 * @param[in] value The value being examined.
264 * @param[in] arg The supplied arguments for the condition.
265 * @return Condition result (true if condition met, false if not)
267 static bool EvalVector4(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
270 * Default check for other types.
271 * @param[in] value The value being examined.
272 * @param[in] arg The supplied arguments for the condition.
273 * @return Condition result (true if condition met, false if not)
275 static bool EvalDefault(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
278 // Outside ////////////////////////////////////////////////////////////////////
281 * Outside condition class,
282 * Checks if a Property is "Outside" the two arguments:
284 * bool => false (0.0) or true (1.0) is outside arg0.
285 * float => value is outside arg0 and arg1.
286 * Vector2 => 2 dimensional length of vector is outside arg0 and arg1.
287 * Vector3 => 3 dimensional length of vector is outside arg0 and arg1.
288 * Vector4 => 4 dimensional length of vector is outside arg0 and arg1.
289 * Default => return false.
295 * @return function pointer to the correct condition function, based on
296 * the type of value being examined.
298 static ConditionFunction GetFunction(Property::Type valueType);
302 * Checks if bool is Outside
303 * @param[in] value The value being examined.
304 * @param[in] arg The supplied arguments for the condition.
305 * @return Condition result (true if condition met, false if not)
307 static bool EvalBoolean(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
310 * Checks if integer is Outside
311 * @param[in] value The value being examined.
312 * @param[in] arg The supplied arguments for the condition.
313 * @return Condition result (true if condition met, false if not)
315 static bool EvalInteger(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
318 * Checks if float is Outside
319 * @param[in] value The value being examined.
320 * @param[in] arg The supplied arguments for the condition.
321 * @return Condition result (true if condition met, false if not)
323 static bool EvalFloat(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
326 * Checks if Vector2.Length() is Outside
327 * @param[in] value The value being examined.
328 * @param[in] arg The supplied arguments for the condition.
329 * @return Condition result (true if condition met, false if not)
331 static bool EvalVector2(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
334 * Checks if Vector3.Length() is Outside
335 * @param[in] value The value being examined.
336 * @param[in] arg The supplied arguments for the condition.
337 * @return Condition result (true if condition met, false if not)
339 static bool EvalVector3(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
342 * Checks if Vector4.Length() is Outside
343 * @param[in] value The value being examined.
344 * @param[in] arg The supplied arguments for the condition.
345 * @return Condition result (true if condition met, false if not)
347 static bool EvalVector4(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
350 * Default check for other types.
351 * @param[in] value The value being examined.
352 * @param[in] arg The supplied arguments for the condition.
353 * @return Condition result (true if condition met, false if not)
355 static bool EvalDefault(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg);
358 } // namespace SceneGraph
360 } // namespace Internal
364 #endif // DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_FUNCTIONS_H