Merge "use modern construct 'nullptr' instead of 'NULL' or '0'" into devel/master
[platform/core/uifw/dali-core.git] / dali / internal / update / common / property-condition-step-functions.h
1 #ifndef DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_STEP_FUNCTIONS_H
2 #define DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_STEP_FUNCTIONS_H
3
4 /*
5  * Copyright (c) 2019 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/object/property-value.h>
23 #include <dali/internal/update/common/scene-graph-property-notification.h>
24
25 namespace Dali
26 {
27
28 namespace Internal
29 {
30
31 class Object;
32 class PropertyNotification;
33
34 namespace SceneGraph
35 {
36
37 /**
38  * Step condition class,
39  * Checks if a Property has stepped a certain amount from the reference point
40  *
41  * float      => value has stepped arg1 amount from arg0.
42  * Vector2    => 2 dimensional length of vector has stepped arg1 amount from arg0.
43  * Vector3    => 3 dimensional length of vector has stepped arg1 amount from arg0.
44  * Vector4    => 4 dimensional length of vector has stepped arg1 amount from arg0.
45  * Default    => return false.
46  */
47 class Step
48 {
49
50 public:
51
52   /**
53    * @return function pointer to the correct condition function, based on
54    * the type of value being examined.
55    */
56   static ConditionFunction GetFunction( Property::Type valueType );
57
58   /**
59    * @return function pointer to the correct condition function, based on
60    * the type of value being examined.
61    *
62    * This function pointer is to compare previous and current components for the swapping case.
63    */
64   static ConditionFunction GetCompareFunction( Property::Type valueType );
65
66 private:
67
68   static bool Evaluate( const float propertyValue, PropertyNotification::RawArgumentContainer& arg );
69
70   /**
71    * Checks if integer is Outside
72    * @param[in] value The value being examined.
73    * @param[in] arg The supplied arguments for the condition.
74    * @return Condition result (true if condition met, false if not)
75    */
76   static bool EvalInteger( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
77
78   /**
79    * Checks if float is Outside
80    * @param[in] value The value being examined.
81    * @param[in] arg The supplied arguments for the condition.
82    * @return Condition result (true if condition met, false if not)
83    */
84   static bool EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
85
86   /**
87    * Checks if Vector2.Length() is Outside
88    * @param[in] value The value being examined.
89    * @param[in] arg The supplied arguments for the condition.
90    * @return Condition result (true if condition met, false if not)
91    */
92   static bool EvalVector2( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
93
94   /**
95    * Checks if Vector3.Length() is Outside
96    * @param[in] value The value being examined.
97    * @param[in] arg The supplied arguments for the condition.
98    * @return Condition result (true if condition met, false if not)
99    */
100   static bool EvalVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
101
102   /**
103    * Checks if Vector3.Length() is Outside
104    *
105    * If previous Vector3.Lenght() and current are same, the raw datas are checked with comparing these values.
106    *
107    * @param[in] value The value being examined.
108    * @param[in] arg The supplied arguments for the condition.
109    * @return Condition result (true if condition met, false if not)
110    */
111   static bool EvalAndCompareVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
112
113   /**
114    * Checks if Vector4.Length() is Outside
115    * @param[in] value The value being examined.
116    * @param[in] arg The supplied arguments for the condition.
117    * @return Condition result (true if condition met, false if not)
118    */
119   static bool EvalVector4( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
120
121   /**
122    * Default check for other types.
123    * @param[in] value The value being examined.
124    * @param[in] arg The supplied arguments for the condition.
125    * @return Condition result (true if condition met, false if not)
126    */
127   static bool EvalDefault( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
128 };
129
130 } // namespace SceneGraph
131
132 } // namespace Internal
133
134 } // namespace Dali
135
136 #endif // DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_STEP_FUNCTIONS_H