2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file FBaseColIEnumeratorT.h
19 * @brief This is the header file for the %IEnumeratorT interface.
21 * This header file contains the declarations of the %IEnumeratorT interface.
24 #ifndef _FBASE_COL_IENUMERATOR_T_H_
25 #define _FBASE_COL_IENUMERATOR_T_H_
27 #include <FBaseTypes.h>
30 namespace Tizen { namespace Base { namespace Collection
34 * @interface IEnumeratorT
35 * @brief This interface supports simple iteration over a template-based collection.
39 * @remarks An enumerator remains valid as long as the collection remains unchanged. @n
40 * If changes are made to the collection, such as adding, modifying, or
41 * deleting elements, the enumerator is irrecoverably invalidated. @n
42 * The next call to GetCurrent(), MoveNext(), or Reset() fails and returns
43 * @c E_INVALID_OPERATION.
45 * The %IEnumeratorT interface supports simple iteration over a template-based collection.
46 * One can only access the elements in a collection through %IEnumeratorT. The elements cannot be modified through this interface.
49 template< class Type >
54 * This polymorphic destructor should be overridden if required. @n
55 * This way, the destructors of the derived classes are called when the destructor of this interface is called.
59 virtual ~IEnumeratorT(void) {}
62 * Gets the current object in the collection.
66 * @return An error code
67 * @param[out] obj A pointer to the current object
68 * @exception E_SUCCESS The method is successful.
69 * @exception E_INVALID_OPERATION Either of the following conditions has occurred:
70 * - The current state of the instance prohibits the execution of the specified operation.
71 * - The enumerator is currently positioned before the first element or
72 * after the last element.
73 * - The collection is modified after the enumerator is created.
75 virtual result GetCurrent(Type& obj) const = 0;
78 * Moves %IEnumeratorT to the next element of the collection. @n
79 * After the enumerator is first created or reset using the Reset() method,
80 * the first call to this method positions the enumerator to the first element in the collection.
84 * @return An error code
85 * @exception E_SUCCESS The method is successful.
86 * @exception E_OUT_OF_RANGE The enumerator has passed the end of the collection.
87 * @exception E_INVALID_OPERATION Either of the following conditions has occurred:
88 * - The current state of the instance prohibits the execution of the specified operation.
89 * - The collection is modified after the enumerator is created.
91 virtual result MoveNext(void) = 0;
94 * Positions the enumerator before the first element in the collection.
98 * @return An error code
99 * @exception E_SUCCESS The method is successful.
100 * @exception E_INVALID_OPERATION Either of the following conditions has occurred:
101 * - The current state of the instance prohibits the execution of the specified operation.
102 * - The collection is modified after the enumerator is created.
104 virtual result Reset(void) = 0;
108 }}} // Tizen::Base::Collection
110 #endif // _FBASE_COL_IENUMERATOR_T_H_