Merge "Klockwork fixes: Distance field iteration Checking for null...
[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) 2014 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/vector-wrapper.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 namespace Internal DALI_INTERNAL
30 {
31 class PropertyCondition;
32 }
33
34 /**
35  * @brief This represents a condition that can be evaluated on a Property::Value.
36  */
37 class DALI_IMPORT_API PropertyCondition : public BaseHandle
38 {
39 public:
40
41   /**
42    * @brief Argument container, represents the arguments to be supplied to the condition function.
43    */
44   typedef std::vector<Property::Value>      ArgumentContainer;
45   typedef ArgumentContainer::iterator       ArgumentIter;     ///< Iterator for Dali::PropertyCondition::ArgumentContainer
46   typedef ArgumentContainer::const_iterator ArgumentConstIter;///< Const Iterator for Dali::PropertyCondition::ArgumentContainer
47
48 public:
49
50   /**
51    * @brief Constructor for condition clause.
52    */
53   PropertyCondition();
54
55   /**
56    * @brief Destructor.
57    */
58   ~PropertyCondition();
59
60   /**
61    * @brief This copy constructor is required for (smart) pointer semantics.
62    *
63    * @param [in] handle A reference to the copied handle
64    */
65   PropertyCondition(const PropertyCondition& handle);
66
67   /**
68    * @brief This assignment operator is required for (smart) pointer semantics.
69    *
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 public:
76
77   /**
78    * @brief Retrieve the arguments that this condition uses.
79    *
80    * @return The arguments used for this condition
81    */
82   ArgumentContainer GetArguments();
83
84   /**
85    * @brief Retrieve the arguments that this condition uses.
86    *
87    * @return The arguments used for this condition
88    * @note The container will only be valid as long PropertyCondition is valid.
89    */
90   const ArgumentContainer& GetArguments() const;
91
92 };
93
94 /**
95  * @brief LessThanCondition compares whether property is less than arg.
96  *
97  * property type:
98  * bool (false = 0.0f, true = 1.0f)
99  * float (float)
100  * vector2 (the 2D length)
101  * vector3 (the 3D length)
102  * vector4 (the 4D length)
103  * @param[in] arg The argument for the condition
104  * @return A property condition function object
105  */
106 DALI_IMPORT_API PropertyCondition LessThanCondition(float arg);
107
108 /**
109  * @brief GreaterThanCondition compares whether property is greater than arg.
110  *
111  * property type:
112  * bool (false = 0.0f, true = 1.0f)
113  * float (float)
114  * vector2 (the 2D length)
115  * vector3 (the 3D length)
116  * vector4 (the 4D length)
117  * @param[in] arg The argument for the condition
118  * @return A property condition function object
119  */
120 DALI_IMPORT_API PropertyCondition GreaterThanCondition(float arg);
121
122 /**
123  * @brief InsideCondition compares whether property is greater than arg0 and less than arg1.
124  *
125  * property type:
126  * bool (false = 0.0f, true = 1.0f)
127  * float (float)
128  * vector2 (the 2D length)
129  * vector3 (the 3D length)
130  * vector4 (the 4D length)
131  * @param[in] arg0 The first argument for the condition
132  * @param[in] arg1 The second argument for the condition
133  * @return A property condition function object
134  */
135 DALI_IMPORT_API PropertyCondition InsideCondition(float arg0, float arg1);
136
137 /**
138  * @brief OutsideCondition compares whether property is less than arg0 or greater than arg1.
139  *
140  * property type:
141  * bool (false = 0.0f, true = 1.0f)
142  * float (float)
143  * vector2 (the 2D length)
144  * vector3 (the 3D length)
145  * vector4 (the 4D length)
146  * @param[in] arg0 The first argument for the condition
147  * @param[in] arg1 The second argument for the condition
148  * @return A property condition function object
149  */
150 DALI_IMPORT_API PropertyCondition OutsideCondition(float arg0, float arg1);
151
152 /**
153  * @brief Detects when a property changes by stepAmount from initialValue, in both positive and negative directions. This will continue checking for multiples of stepAmount
154  *
155  * property type:
156  * float (float)
157  * vector2 (the 2D length)
158  * vector3 (the 3D length)
159  * vector4 (the 4D length)
160  * @param[in] stepAmount The step size required to trigger condition
161  * @param[in] initialValue The initial value to step from
162  * @return A property condition function object
163  */
164 DALI_IMPORT_API PropertyCondition StepCondition(float stepAmount, float initialValue = 0.0f);
165
166 /**
167  * @brief Receive notifications as a property goes above/below the inputted values. Values must be ordered and can be either ascending or descending
168  *
169  * property type:
170  * float (float)
171  * vector2 (the 2D length)
172  * vector3 (the 3D length)
173  * vector4 (the 4D length)
174  * @param[in] steps List of values to receive notifications for as a property crosses them
175  * @return A property condition function object
176  */
177 DALI_IMPORT_API PropertyCondition VariableStepCondition(const std::vector<float>& steps);
178
179 } // namespace Dali
180
181 #endif // __DALI_PROPERTY_CONDITIONS_H__