sync with tizen_2.0
[platform/framework/native/appfw.git] / inc / FBaseColIEnumerator.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 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                FBaseColIEnumerator.h
20  * @brief               This is the header file for the %IEnumerator interface.
21  *
22  * This header file contains the declarations of the %IEnumerator interface.
23  *
24  */
25 #ifndef _FBASE_COL_IENUMERATOR_H_
26 #define _FBASE_COL_IENUMERATOR_H_
27
28 #include <FBaseTypes.h>
29
30 namespace Tizen {namespace Base
31 {
32 class Object;
33 }}
34
35 namespace Tizen { namespace Base { namespace Collection
36 {
37
38 /**
39  * @interface IEnumerator
40  * @brief       This interface supports simple iteration over a collection.
41  *
42  * @since 2.0
43  *
44  * @remarks
45  * An enumerator remains valid as long as the collection remains unchanged.
46  * If changes are made to the collection, such as adding, modifying, or
47  * deleting elements, the enumerator is irrecoverably invalidated. The next call to GetCurrent(), MoveNext(), or Reset() fails and returns
48  * E_INVALID_OPERATION.
49  *
50  * The %IEnumerator interface supports simple iteration over a collection.
51  * One can only access the elements in a collection through %IEnumerator. The elements cannot be modified through this interface.
52  *
53  */
54 class _OSP_EXPORT_ IEnumerator
55 {
56 public:
57         /**
58          * This polymorphic destructor should be overridden if required. @n
59          * This way, the destructors of the derived classes are called when the destructor of this interface is called.
60          *
61          * @since 2.0
62          */
63         virtual ~IEnumerator(void) {}
64
65         /**
66          * Gets the current object in the collection.
67          *
68          * @since 2.0
69          *
70          * @return              The current object in the collection, @n
71          *                              else @c null if an exception occurs
72          * @exception   E_SUCCESS                       The method is successful.
73          * @exception   E_INVALID_OPERATION     Either of the following conditions has occurred: @n
74          *                                                                      - The current state of the instance prohibits the execution of the specified operation. @n
75          *                                                                      - The enumerator is currently positioned before the first element
76          *                                                                      or after the last element. @n
77          *                                                                      - The collection is modified after the enumerator is created.
78          * @remarks             The specific error code can be accessed using the GetLastResult() method.
79          * @see                 GetLastResult()
80          */
81         virtual Tizen::Base::Object* GetCurrent(void) const = 0;
82
83         /**
84          * Moves %IEnumerator to the next element of the collection. @n
85          * After the enumerator is first created or reset using the Reset() method,
86          * the first call to this method positions the enumerator to the first element in the collection.
87          *
88          * @since 2.0
89          *
90          * @return              An error code
91          * @exception   E_SUCCESS                       The method is successful.
92          * @exception   E_OUT_OF_RANGE          The enumerator has passed the end of the collection.
93          * @exception   E_INVALID_OPERATION     The current state of the instance prohibits the execution of the specified operation, or
94          *                                                                      the collection is modified after the enumerator is created.
95          * @see                 Reset()
96          */
97         virtual result MoveNext(void) = 0;
98
99         /**
100          * Positions the enumerator before the first element in the collection.
101          *
102          * @since 2.0
103          *
104          * @return              An error code
105          * @exception   E_SUCCESS                       The method is successful.
106          * @exception   E_INVALID_OPERATION     The current state of the instance prohibits the execution of the specified operation, or
107          *                                                                      the collection is modified after the enumerator is created.
108          */
109         virtual result Reset(void) = 0;
110
111 protected:
112         //
113         // This method is for internal use only. Using this method can cause behavioral, security-related,
114         // and consistency-related issues in the application.
115         // This method is reserved and may change its name at any time without prior notice.
116         //
117         // @since 2.0
118         //
119         virtual void IEnumerator_Reserved1(void) { }
120
121
122         //
123         // This method is for internal use only. Using this method can cause behavioral, security-related,
124         // and consistency-related issues in the application.
125         // This method is reserved and may change its name at any time without prior notice.
126         //
127         // @since 2.0
128         //
129         virtual void IEnumerator_Reserved2(void) { }
130
131 }; // IEnumerator
132
133 }}} // Tizen::Base::Collection
134
135 #endif // _FBASE_COL_IENUMERATOR_H_