[2.2.1] Apply reviewed header file (Base to Collection)
[platform/framework/native/appfw.git] / inc / FBaseColIEnumerator.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 /**
18  * @file                FBaseColIEnumerator.h
19  * @brief               This is the header file for the %IEnumerator interface.
20  *
21  * This header file contains the declarations of the %IEnumerator interface.
22  *
23  */
24 #ifndef _FBASE_COL_IENUMERATOR_H_
25 #define _FBASE_COL_IENUMERATOR_H_
26
27 #include <FBaseTypes.h>
28
29 namespace Tizen {namespace Base
30 {
31 class Object;
32 }}
33
34 namespace Tizen { namespace Base { namespace Collection
35 {
36
37 /**
38  * @interface IEnumerator
39  * @brief       This interface supports simple iteration over a collection.
40  *
41  * @since 2.0
42  *
43  * @remarks     An enumerator remains valid as long as the collection remains unchanged. @n
44  *                              If changes are made to the collection, such as adding, modifying, or
45  *                              deleting elements, the enumerator is irrecoverably invalidated. @n
46  *                         The next call to GetCurrent(), MoveNext(), or Reset() fails and returns
47  *                              @c E_INVALID_OPERATION.
48  *
49  * The %IEnumerator interface supports simple iteration over a collection.
50  * One can only access the elements in a collection through %IEnumerator. The elements cannot be modified through this interface.
51  *
52  */
53 class _OSP_EXPORT_ IEnumerator
54 {
55 public:
56         /**
57          * This polymorphic destructor should be overridden if required. @n
58          * This way, the destructors of the derived classes are called when the destructor of this interface is called.
59          *
60          * @since 2.0
61          */
62         virtual ~IEnumerator(void) {}
63
64         /**
65          * Gets the current object in the collection.
66          *
67          * @since 2.0
68          *
69          * @return              The current object in the collection, @n
70          *                              else @c null if an exception occurs
71          * @exception   E_SUCCESS                       The method is successful.
72          * @exception   E_INVALID_OPERATION     Either of the following conditions has occurred:
73          *                                                                      - The current state of the instance prohibits the execution of the specified operation.
74          *                                                                      - The enumerator is currently positioned before the first element
75          *                                                                        or after the last element.
76          *                                                                      - The collection is modified after the enumerator is created.
77          * @remarks             The specific error code can be accessed using the GetLastResult() method.
78          */
79         virtual Tizen::Base::Object* GetCurrent(void) const = 0;
80
81         /**
82          * Moves %IEnumerator to the next element of the collection. @n
83          * After the enumerator is first created or reset using the Reset() method,
84          * the first call to this method positions the enumerator to the first element in the collection.
85          *
86          * @since 2.0
87          *
88          * @return              An error code
89          * @exception   E_SUCCESS                       The method is successful.
90          * @exception   E_OUT_OF_RANGE          The enumerator has passed the end of the collection.
91          * @exception   E_INVALID_OPERATION     Either of the following conditions has occurred:
92          *                                                                      - The current state of the instance prohibits the execution of the specified operation.
93          *                                                                      - The collection is modified after the enumerator is created.
94          */
95         virtual result MoveNext(void) = 0;
96
97         /**
98          * Positions the enumerator before the first element in the collection.
99          *
100          * @since 2.0
101          *
102          * @return              An error code
103          * @exception   E_SUCCESS                       The method is successful.
104          * @exception   E_INVALID_OPERATION     Either of the following conditions has occurred:
105          *                                                                      - The current state of the instance prohibits the execution of the specified operation.
106          *                                                                      - The collection is modified after the enumerator is created.
107          */
108         virtual result Reset(void) = 0;
109
110 protected:
111         //
112         // This method is for internal use only. Using this method can cause behavioral, security-related,
113         // and consistency-related issues in the application.
114         // This method is reserved and may change its name at any time without prior notice.
115         //
116         // @since 2.0
117         //
118         virtual void IEnumerator_Reserved1(void) { }
119
120
121         //
122         // This method is for internal use only. Using this method can cause behavioral, security-related,
123         // and consistency-related issues in the application.
124         // This method is reserved and may change its name at any time without prior notice.
125         //
126         // @since 2.0
127         //
128         virtual void IEnumerator_Reserved2(void) { }
129
130 }; // IEnumerator
131
132 }}} // Tizen::Base::Collection
133
134 #endif // _FBASE_COL_IENUMERATOR_H_