Fix for klockwork minor issues.
[platform/framework/native/uifw.git] / inc / FUiAnimIntegerAnimation.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file        FUiAnimIntegerAnimation.h
20  * @brief       This is the header file for the %IntegerAnimation class.
21  *
22  * This header file contains the declarations of the %IntegerAnimation class.
23  */
24
25 #ifndef _FUI_ANIM_INTEGER_ANIMATION_H_
26 #define _FUI_ANIM_INTEGER_ANIMATION_H_
27
28 #include <FBaseInteger.h>
29 #include <FUiAnimAnimationBase.h>
30
31 namespace Tizen { namespace Ui { namespace Animations
32 {
33
34 /**
35  * @class       IntegerAnimation
36  * @brief       This class animates an object from an integer value to another integer value.
37  *
38  * @since       2.0
39  *
40  * @final   This class is not intended for extension.
41  *
42  * The %IntegerAnimation class animates an object from an integer value to another integer value based on the specified interpolator type.
43  *
44  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/ui/animating_uicontrols.htm">Animating UI Controls</a>.
45  */
46 class _OSP_EXPORT_ IntegerAnimation
47         : public AnimationBase
48 {
49 public:
50         /**
51          * Initializes this instance of %IntegerAnimation with the specified parameters.
52          *
53          * @since       2.0
54          *
55          * @param[in]   startValue                      The start value for Integer animation
56          * @param[in]   endValue                        The end value for Integer animation
57          * @param[in]   duration                        The duration of animation in milliseconds
58          * @param[in]   interpolator            The type of Interpolation @n
59          *                                                                      This is used for the intermediate value calculation of the animation.
60          * @exception   E_SUCCESS                       The method is successful.
61          * @exception   E_INVALID_ARG           The value of the specified parameter is negative or the interpolator is of an invalid type.
62          * @remarks             The specific error code can be accessed using the GetLastResult() method.
63          */
64         IntegerAnimation(int startValue, int endValue, long duration, AnimationInterpolatorType interpolator);
65
66
67         /**
68          * This is the destructor for this class.
69          *
70          * @since       2.0
71          */
72         virtual ~IntegerAnimation(void);
73
74
75         /**
76          * This is the copy constructor for the %IntegerAnimation class.
77          *
78          * @since       2.0
79          *
80          * @param[in]   integerAnimation        An instance of %IntegerAnimation
81          * @exception   E_SUCCESS               The method is successful.
82          * @exception   E_OUT_OF_MEMORY The memory is insufficient.
83          * @remarks             The specific error code can be accessed using the GetLastResult() method.
84          */
85         IntegerAnimation(const IntegerAnimation& integerAnimation);
86
87
88         /**
89          * Assigns the value of the specified instance to the current instance of %IntegerAnimation.
90          *
91          * @since       2.0
92          *
93          * @param[in]   rhs             An instance of %IntegerAnimation
94          * @exception   E_SUCCESS               The method is successful.
95          * @exception   E_OUT_OF_MEMORY The memory is insufficient.
96          * @remarks             The specific error code can be accessed using the GetLastResult() method.
97          */
98         IntegerAnimation& operator =(const IntegerAnimation& rhs);
99
100
101         /**
102          * Checks whether the specified and current instance of %IntegerAnimation have equal animation values.
103          *
104          * @since       2.0
105          *
106          * @return              @c true if the animation of the two instances of %IntegerAnimation are equal, @n
107          *                              else @c false
108          * @param[in]   rhs             An instance of %IntegerAnimation
109          */
110         bool operator ==(const IntegerAnimation& rhs) const;
111
112
113         /**
114          * Checks whether the specified instance and the current instance of %IntegerAnimation have different animation values.
115          *
116          * @since       2.0
117          *
118          * @return              @c true if the values of the animations of the two instances of %IntegerAnimation are not equal, @n
119          *                              else @c false
120          * @param[in]   rhs             An instance of %IntegerAnimation
121          */
122         bool operator !=(const IntegerAnimation& rhs) const;
123
124
125         /**
126          * Checks whether the value of the current instance of %IntegerAnimation equals the value of the specified instance.
127          *
128          * @since       2.0
129          *
130          * @return              @c true if the value of the current instance equals the value of the specified instance, @n
131          *              else @c false
132          * @param[in]   obj             An instance of %IntegerAnimation
133          * @remarks     The %IntegerAnimation class has a semantic value. @n
134          *                              This means that this method checks whether the two instances have the same animation.
135          */
136         virtual bool Equals(const Tizen::Base::Object& obj) const;
137
138
139         /**
140          * Gets the hash value of the current instance.
141          *
142          * @since       2.0
143          *
144          * @return              The hash value of the current instance
145          * @remarks     The two equal instances must return the same hash value. For better performance, the used hash function must generate a random distribution for all inputs.
146          */
147         virtual int GetHashCode(void) const;
148
149
150         /**
151          * Gets the animated value for the current time.
152          *
153          * @since       2.0
154          *
155          * @return      An error code
156          * @param[in]   currentTime             The current time value of the animation play @n
157          *                                                              The value must be between @c 0 and the duration of the animation.
158          * @param[out]  animatedValue   The animated value for the current time @n
159          *                              The value is passed as the input parameter.
160          * @exception   E_SUCCESS               The method is successful.
161          * @exception   E_INVALID_ARG   A specified input parameter is invalid.
162          * @exception   E_SYSTEM                A system error has occurred.
163          *
164          */
165         result GetAnimatedValue(long currentTime, int& animatedValue) const;
166
167
168         /**
169          * Adds a key frame to the animation.
170          *
171          * @since       2.0
172          *
173          * @return              An error code
174          * @param[in]   time                            The time stamp
175          * @param[in]   value                           The value at the specified @c time
176          * @exception   E_SUCCESS                       The method is successful.
177          * @exception   E_INVALID_ARG       A specified input parameter is invalid.
178          * @exception   E_SYSTEM                        A system error has occurred.
179          * @remarks             If @c time is greater than the duration, it becomes the new duration and @c value becomes the new @c endValue.
180          *              Also the old duration and @c endValue are added as a new keyframe entry in the list.
181          * @remarks             If a key-value pair with the current key already exists, the old value is overwritten with the new one.
182          * @remarks             An exception is returned if @c time is equal to @c 0 or the duration of the animation.
183          */
184         result AddKeyFrame(long time, int value);
185
186
187         /**
188          * Gets the keyframe at a particular index in this animation.
189          *
190          * @since       2.0
191          *
192          * @return      An error code
193          * @param[in]   index                           The index value in the Keyframe list @n
194          *                                  The value is sorted in an increasing order of time.
195          * @param[out]  time                            The time stamp at the specified @c index
196          * @param[out]  value                           The value at the specified @c index
197          * @exception   E_SUCCESS                       The method is successful.
198          * @exception   E_OUT_OF_RANGE          The specified @c index is out of range.
199          * @exception   E_SYSTEM                        A system error has occurred.
200          * @remarks             The @c time and @c value returned are present at the index of the sorted map list (sorted with respect to key).
201          *              For example, if the user adds keyframe in the order (10,value1), (20,value2), (5,value3), and then
202          *              GetKeyFrameAt(0,time,value) is called, the pair returned is (5,value3).
203          */
204         result GetKeyFrameAt(int index, long& time, int& value) const;
205
206
207         /**
208          * Removes the specified keyframe object from the keyframe list.
209          *
210          * @since       2.0
211          *
212          * @return              An error code
213          * @param[in]   time                            The key frame time
214          * @exception   E_SUCCESS                       The method is successful.
215          * @exception   E_INVALID_ARG           The specified @c time value is invalid.
216          * @exception   E_OBJ_NOT_FOUND         The specified @c time is not found in the KeyFrame List.
217          * @exception   E_SYSTEM                        A system error has occurred.
218          */
219         result RemoveKeyFrame(long time);
220
221
222         /**
223          * Removes the keyframe present at the specified @c index from the keyframe list.
224          *
225          * @since       2.0
226          *
227          * @return              An error code
228          * @param[in]   index                           The index value in the Keyframe list @n
229          *                                  The value is sorted in an increasing order of time.
230          * @exception   E_SUCCESS                       The method is successful.
231          * @exception   E_OUT_OF_RANGE          The specified @c index is out of range.
232          * @exception   E_SYSTEM                        A system error has occurred.
233          */
234         result RemoveKeyFrameAt(int index);
235
236
237         /**
238          * Removes all the keyframes from an animation.
239          *
240          * @since       2.0
241          *
242          * @return              An error code
243          * @exception   E_SUCCESS                       The method is successful.
244          * @exception   E_SYSTEM                        A system error has occurred.
245          */
246         result RemoveAllKeyFrames(void);
247
248
249         /**
250          * Sets the start value of the animation.
251          *
252          * @since       2.0
253          *
254          * @return              An error code
255          * @param[in]   startValue                      The start value of the animation to set
256          * @exception   E_SUCCESS                       The method is successful.
257          * @exception   E_SYSTEM                        A system error has occurred.
258          */
259         result SetStartValue(int startValue);
260
261
262         /**
263          * Sets the end value of the animation.
264          *
265          * @since       2.0
266          *
267          * @return      An error code
268          * @param[in]   endValue                        The end value of the animation to set
269          * @exception   E_SUCCESS                       The method is successful.
270          * @exception   E_SYSTEM                        A system error has occurred.
271          */
272         result SetEndValue(int endValue);
273
274
275         /**
276          * Gets the start value of the animation.
277          *
278          * @since       2.0
279          *
280          * @return      The start value
281          */
282         int GetStartValue(void) const;
283
284
285         /**
286          * Gets the end value of the animation.
287          *
288          * @since       2.0
289          *
290          * @return              The end value
291          */
292         int GetEndValue(void) const;
293
294
295         /**
296          * Gets the type information of this instance.
297          *
298          * @since       2.0
299          *
300          * @return  The type information of this instance
301          */
302         virtual AnimationType GetType(void) const;
303
304
305 protected:
306         friend class _IntegerAnimationImpl;
307
308
309         //
310         // This method is for internal use only. Using this method can cause behavioral, security-related,
311         // and consistency-related issues in the application.
312         //
313         // This variable is for internal usage.
314         //
315         // @since  2.0
316         //
317         class _IntegerAnimationImpl* _pIntegerAnimationImpl;
318
319 private:
320         //
321         // This method is for internal use only. Using this method can cause behavioral, security-related,
322         // and consistency-related issues in the application.
323         //
324         // This is the default constructor for this class.
325         //
326         // @since  2.0
327         //
328         IntegerAnimation(void);
329 };      // IntegerAnimation
330
331
332 }}}     // Tizen::Ui::Animations
333
334 #endif  // _FUI_ANIM_INTEGER_ANIMATION_H_