1 #ifndef DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_FUNCTIONS_H
2 #define DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_FUNCTIONS_H
5 * Copyright (c) 2019 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/public-api/object/property-value.h>
23 #include <dali/internal/update/common/scene-graph-property-notification.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>
36 class PropertyNotification;
41 // LessThan ///////////////////////////////////////////////////////////////////
44 * LessThan condition class,
45 * Checks if a Property is "Less Than" the argument:
47 * bool => false (0.0) or true (1.0) is less than arg0.
48 * float => value is less than arg0.
49 * Vector2 => 2 dimensional length of vector is less than arg0.
50 * Vector3 => 3 dimensional length of vector is less than arg0.
51 * Vector4 => 4 dimensional length of vector is less than arg0.
52 * Default => return false.
60 * @return function pointer to the correct condition function, based on
61 * the type of value being examined.
63 static ConditionFunction GetFunction(Property::Type valueType);
68 * Checks if bool is LessThan
69 * @param[in] value The value being examined.
70 * @param[in] arg The supplied arguments for the condition.
71 * @return Condition result (true if condition met, false if not)
73 static bool EvalBoolean( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
76 * Checks if integer is LessThan
77 * @param[in] value The value being examined.
78 * @param[in] arg The supplied arguments for the condition.
79 * @return Condition result (true if condition met, false if not)
81 static bool EvalInteger( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
84 * Checks if float is LessThan
85 * @param[in] value The value being examined.
86 * @param[in] arg The supplied arguments for the condition.
87 * @return Condition result (true if condition met, false if not)
89 static bool EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
92 * Checks if Vector2.Length() is LessThan
93 * @param[in] value The value being examined.
94 * @param[in] arg The supplied arguments for the condition.
95 * @return Condition result (true if condition met, false if not)
97 static bool EvalVector2( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
100 * Checks if Vector3.Length() is LessThan
101 * @param[in] value The value being examined.
102 * @param[in] arg The supplied arguments for the condition.
103 * @return Condition result (true if condition met, false if not)
105 static bool EvalVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
108 * Checks if Vector4.Length() is LessThan
109 * @param[in] value The value being examined.
110 * @param[in] arg The supplied arguments for the condition.
111 * @return Condition result (true if condition met, false if not)
113 static bool EvalVector4( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
116 * Default check for other types
117 * @param[in] value The value being examined.
118 * @param[in] arg The supplied arguments for the condition.
119 * @return Condition result (true if condition met, false if not)
121 static bool EvalDefault( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
125 // GreaterThan ////////////////////////////////////////////////////////////////
128 * GreaterThan condition class,
129 * Checks if a Property is "Greater Than" the argument:
131 * bool => false (0.0) or true (1.0) is greater than arg0.
132 * float => value is greater than arg0.
133 * Vector2 => 2 dimensional length of vector is greater than arg0.
134 * Vector3 => 3 dimensional length of vector is greater than arg0.
135 * Vector4 => 4 dimensional length of vector is greater than arg0.
136 * Default => return false.
144 * @returns function pointer to the correct condition function, based on
145 * the type of value being examined.
147 static ConditionFunction GetFunction(Property::Type valueType);
152 * Checks if bool is GreaterThan
153 * @param[in] value The value being examined.
154 * @param[in] arg The supplied arguments for the condition.
155 * @return Condition result (true if condition met, false if not)
157 static bool EvalBoolean( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
160 * Checks if integer is GreaterThan
161 * @param[in] value The value being examined.
162 * @param[in] arg The supplied arguments for the condition.
163 * @return Condition result (true if condition met, false if not)
165 static bool EvalInteger( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
168 * Checks if float is GreaterThan
169 * @param[in] value The value being examined.
170 * @param[in] arg The supplied arguments for the condition.
171 * @return Condition result (true if condition met, false if not)
173 static bool EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
176 * Checks if Vector2.Length() is GreaterThan
177 * @param[in] value The value being examined.
178 * @param[in] arg The supplied arguments for the condition.
179 * @return Condition result (true if condition met, false if not)
181 static bool EvalVector2( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
184 * Checks if Vector3.Length() is GreaterThan
185 * @param[in] value The value being examined.
186 * @param[in] arg The supplied arguments for the condition.
187 * @return Condition result (true if condition met, false if not)
189 static bool EvalVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
192 * Checks if Vector4.Length() is GreaterThan
193 * @param[in] value The value being examined.
194 * @param[in] arg The supplied arguments for the condition.
195 * @return Condition result (true if condition met, false if not)
197 static bool EvalVector4( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
200 * Default check for other types.
201 * @param[in] value The value being examined.
202 * @param[in] arg The supplied arguments for the condition.
203 * @return Condition result (true if condition met, false if not)
205 static bool EvalDefault( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
209 // Inside /////////////////////////////////////////////////////////////////////
212 * Inside condition class,
213 * Checks if a Property is "Inside" the two arguments:
215 * bool => false (0.0) or true (1.0) is inside arg0.
216 * float => value is between arg0 and arg1.
217 * Vector2 => 2 dimensional length of vector is between arg0 and arg1.
218 * Vector3 => 3 dimensional length of vector is between arg0 and arg1.
219 * Vector4 => 4 dimensional length of vector is between arg0 and arg1.
220 * Default => return false.
228 * @return function pointer to the correct condition function, based on
229 * the type of value being examined.
231 static ConditionFunction GetFunction(Property::Type valueType);
236 * Checks if bool is Inside
237 * @param[in] value The value being examined.
238 * @param[in] arg The supplied arguments for the condition.
239 * @return Condition result (true if condition met, false if not)
241 static bool EvalBoolean( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
244 * Checks if integer is Inside
245 * @param[in] value The value being examined.
246 * @param[in] arg The supplied arguments for the condition.
247 * @return Condition result (true if condition met, false if not)
249 static bool EvalInteger( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
252 * Checks if float is Inside
253 * @param[in] value The value being examined.
254 * @param[in] arg The supplied arguments for the condition.
255 * @return Condition result (true if condition met, false if not)
257 static bool EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
260 * Checks if Vector2.Length() is Inside
261 * @param[in] value The value being examined.
262 * @param[in] arg The supplied arguments for the condition.
263 * @return Condition result (true if condition met, false if not)
265 static bool EvalVector2( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
268 * Checks if Vector3.Length() is Inside
269 * @param[in] value The value being examined.
270 * @param[in] arg The supplied arguments for the condition.
271 * @return Condition result (true if condition met, false if not)
273 static bool EvalVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
276 * Checks if Vector4.Length() is Inside
277 * @param[in] value The value being examined.
278 * @param[in] arg The supplied arguments for the condition.
279 * @return Condition result (true if condition met, false if not)
281 static bool EvalVector4( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
284 * Default check for other types.
285 * @param[in] value The value being examined.
286 * @param[in] arg The supplied arguments for the condition.
287 * @return Condition result (true if condition met, false if not)
289 static bool EvalDefault( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
293 // Outside ////////////////////////////////////////////////////////////////////
296 * Outside condition class,
297 * Checks if a Property is "Outside" the two arguments:
299 * bool => false (0.0) or true (1.0) is outside arg0.
300 * float => value is outside arg0 and arg1.
301 * Vector2 => 2 dimensional length of vector is outside arg0 and arg1.
302 * Vector3 => 3 dimensional length of vector is outside arg0 and arg1.
303 * Vector4 => 4 dimensional length of vector is outside arg0 and arg1.
304 * Default => return false.
312 * @return function pointer to the correct condition function, based on
313 * the type of value being examined.
315 static ConditionFunction GetFunction(Property::Type valueType);
320 * Checks if bool is Outside
321 * @param[in] value The value being examined.
322 * @param[in] arg The supplied arguments for the condition.
323 * @return Condition result (true if condition met, false if not)
325 static bool EvalBoolean( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
328 * Checks if integer is Outside
329 * @param[in] value The value being examined.
330 * @param[in] arg The supplied arguments for the condition.
331 * @return Condition result (true if condition met, false if not)
333 static bool EvalInteger( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
336 * Checks if float is Outside
337 * @param[in] value The value being examined.
338 * @param[in] arg The supplied arguments for the condition.
339 * @return Condition result (true if condition met, false if not)
341 static bool EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
344 * Checks if Vector2.Length() is Outside
345 * @param[in] value The value being examined.
346 * @param[in] arg The supplied arguments for the condition.
347 * @return Condition result (true if condition met, false if not)
349 static bool EvalVector2( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
352 * Checks if Vector3.Length() is Outside
353 * @param[in] value The value being examined.
354 * @param[in] arg The supplied arguments for the condition.
355 * @return Condition result (true if condition met, false if not)
357 static bool EvalVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
360 * Checks if Vector4.Length() is Outside
361 * @param[in] value The value being examined.
362 * @param[in] arg The supplied arguments for the condition.
363 * @return Condition result (true if condition met, false if not)
365 static bool EvalVector4( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
368 * Default check for other types.
369 * @param[in] value The value being examined.
370 * @param[in] arg The supplied arguments for the condition.
371 * @return Condition result (true if condition met, false if not)
373 static bool EvalDefault( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
377 } // namespace SceneGraph
379 } // namespace Internal
383 #endif // DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_FUNCTIONS_H