sync with tizen_2.0
[platform/framework/native/appfw.git] / inc / FBaseColIEnumeratorT.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                FBaseColIEnumeratorT.h
20  * @brief               This is the header file for the %IEnumeratorT interface.
21  *
22  * This header file contains the declarations of the %IEnumeratorT interface.
23  *
24  */
25 #ifndef _FBASE_COL_IENUMERATOR_T_H_
26 #define _FBASE_COL_IENUMERATOR_T_H_
27
28 #include <FBaseTypes.h>
29
30
31 namespace Tizen { namespace Base { namespace Collection
32 {
33
34 /**
35  * @interface IEnumeratorT
36  * @brief       This interface supports simple iteration over a template-based collection.
37  *
38  * @since 2.0
39  *
40  * @remarks
41  * An enumerator remains valid as long as the collection remains unchanged.
42  * If changes are made to the collection, such as adding, modifying, or
43  * deleting elements, the enumerator is irrecoverably invalidated. The next call to GetCurrent(), MoveNext(), or Reset() fails and returns
44  * E_INVALID_OPERATION.
45  *
46  * The %IEnumeratorT interface supports simple iteration over a template-based collection.
47  * One can only access the elements in a collection through %IEnumeratorT. The elements cannot be modified through this interface.
48  *
49  */
50 template< class Type >
51 class IEnumeratorT
52 {
53 public:
54         /**
55          * This polymorphic destructor should be overridden if required. @n
56          * This way, the destructors of the derived classes are called when the destructor of this interface is called.
57          *
58          * @since 2.0
59          */
60         virtual ~IEnumeratorT(void) {}
61
62         /**
63          * Gets the current object in the collection.
64          *
65          * @since 2.0
66          *
67          * @return              An error code
68          * @param[out]  obj A pointer to the current object
69          * @exception   E_SUCCESS                       The method is successful.
70          * @exception   E_INVALID_OPERATION     The current state of the instance prohibits the execution of the specified operation. @n
71          *                                                                      The enumerator is currently positioned before the first element or
72          *                                                                      after the last element or the collection is modified after the enumerator is created.
73          */
74         virtual result GetCurrent(Type& obj) const = 0;
75
76         /**
77          * Moves %IEnumeratorT to the next element of the collection. @n
78          * After the enumerator is first created or reset using the Reset() method,
79          * the first call to this method positions the enumerator to the first element in the collection.
80          *
81          * @since 2.0
82          *
83          * @return              An error code
84          * @exception   E_SUCCESS                       The method is successful.
85          * @exception   E_OUT_OF_RANGE          The enumerator has passed the end of the collection.
86          * @exception   E_INVALID_OPERATION     The current state of the instance prohibits the execution of the specified operation, or
87          *                                                                      the collection is modified after the enumerator is created.
88          * @see                 Reset()
89          */
90         virtual result MoveNext(void) = 0;
91
92         /**
93          * Positions the enumerator before the first element in the collection.
94          *
95          * @since 2.0
96          *
97          * @return              An error code
98          * @exception   E_SUCCESS                       The method is successful.
99          * @exception   E_INVALID_OPERATION     The current state of the instance prohibits the execution of the specified operation, or
100          *                                                                      the collection is modified after the enumerator is created.
101          */
102         virtual result Reset(void) = 0;
103
104 }; // IEnumeratorT
105
106 }}} // Tizen::Base::Collection
107
108 #endif // _FBASE_COL_IENUMERATOR_T_H_