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 FBaseColIEnumerator.h
20 * @brief This is the header file for the %IEnumerator interface.
22 * This header file contains the declarations of the %IEnumerator interface.
25 #ifndef _FBASE_COL_IENUMERATOR_H_
26 #define _FBASE_COL_IENUMERATOR_H_
28 #include <FBaseTypes.h>
30 namespace Tizen {namespace Base
35 namespace Tizen { namespace Base { namespace Collection
39 * @interface IEnumerator
40 * @brief This interface supports simple iteration over a collection.
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.
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.
54 class _OSP_EXPORT_ IEnumerator
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.
63 virtual ~IEnumerator(void) {}
66 * Gets the current object in the collection.
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()
81 virtual Tizen::Base::Object* GetCurrent(void) const = 0;
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.
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.
97 virtual result MoveNext(void) = 0;
100 * Positions the enumerator before the first element in the collection.
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.
109 virtual result Reset(void) = 0;
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.
119 virtual void IEnumerator_Reserved1(void) { }
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.
129 virtual void IEnumerator_Reserved2(void) { }
133 }}} // Tizen::Base::Collection
135 #endif // _FBASE_COL_IENUMERATOR_H_