2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @file FBaseColIEnumeratorT.h
20 * @brief This is the header file for the %IEnumeratorT interface.
22 * This header file contains the declarations of the %IEnumeratorT interface.
25 #ifndef _FBASE_COL_IENUMERATOR_T_H_
26 #define _FBASE_COL_IENUMERATOR_T_H_
28 #include <FBaseTypes.h>
31 namespace Tizen { namespace Base { namespace Collection
35 * @interface IEnumeratorT
36 * @brief This interface supports simple iteration over a template-based collection.
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.
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.
50 template< class Type >
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.
60 virtual ~IEnumeratorT(void) {}
63 * Gets the current object in the collection.
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.
74 virtual result GetCurrent(Type& obj) const = 0;
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.
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.
90 virtual result MoveNext(void) = 0;
93 * Positions the enumerator before the first element in the collection.
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.
102 virtual result Reset(void) = 0;
106 }}} // Tizen::Base::Collection
108 #endif // _FBASE_COL_IENUMERATOR_T_H_