Merge "Update deprecated libprivilege-control API functions." into tizen
[platform/framework/native/appfw.git] / inc / FBaseColIEnumerator.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
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.
15 //
16
17 /**
18  * @file                FBaseColIEnumerator.h
19  * @brief               This is the header file for the %IEnumerator interface.
20  *
21  * This header file contains the declarations of the %IEnumerator interface.
22  *
23  */
24 #ifndef _FBASE_COL_IENUMERATOR_H_
25 #define _FBASE_COL_IENUMERATOR_H_
26
27 #include <FBaseTypes.h>
28 #include <FBaseObject.h>
29
30 namespace Tizen { namespace Base { namespace Collection
31 {
32
33 /**
34  * @interface IEnumerator
35  * @brief       This interface supports simple iteration over a collection.
36  *
37  * @since 2.0
38  *
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.
44  *
45  * The %IEnumerator interface supports simple iteration over a collection.
46  * One can only access the elements in a collection through %IEnumerator. The elements cannot be modified through this interface.
47  *
48  */
49 class _OSP_EXPORT_ IEnumerator
50 {
51 public:
52         /**
53          * This polymorphic destructor should be overridden if required. @n
54          * This way, the destructors of the derived classes are called when the destructor of this interface is called.
55          *
56          * @since 2.0
57          */
58         virtual ~IEnumerator(void) {}
59
60         /**
61          * Gets the current object in the collection.
62          *
63          * @since 2.0
64          *
65          * @return              The current object in the collection, @n
66          *                              else @c null if an exception occurs
67          * @exception   E_SUCCESS                       The method is successful.
68          * @exception   E_INVALID_OPERATION     Either of the following conditions has occurred:
69          *                                                                      - The current state of the instance prohibits the execution of the specified operation.
70          *                                                                      - The enumerator is currently positioned before the first element
71          *                                                                        or after the last element.
72          *                                                                      - The collection is modified after the enumerator is created.
73          * @remarks             The specific error code can be accessed using the GetLastResult() method.
74          */
75         virtual Tizen::Base::Object* GetCurrent(void) const = 0;
76
77         /**
78          * Moves %IEnumerator 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.
81          *
82          * @since 2.0
83          *
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.
90          */
91         virtual result MoveNext(void) = 0;
92
93         /**
94          * Positions the enumerator before the first element in the collection.
95          *
96          * @since 2.0
97          *
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.
103          */
104         virtual result Reset(void) = 0;
105
106         /**
107          * Gets the reference of the current object in the collection
108          *
109          * @since               3.0
110          *
111          * @return              The reference of the pointer to the current object in the collection
112          * @exception   E_SUCCESS                       The method is successful.
113          * @exception   E_INVALID_OPERATION     Either of the following conditions has occurred: @n
114          *                                                                      - The current state of the instance prohibits the execution of the specified operation. @n
115          *                                                                      - The enumerator is currently positioned before the first element
116          *                                                                      or after the last element. @n
117          *                                                                      - The collection is modified after the enumerator is created.
118          * @remarks             The specific error code can be accessed using the GetLastResult() method.
119          * @see                 GetLastResult()
120          */
121         virtual Tizen::Base::Object*& GetCurrentRef(void) const
122         {
123                 return Tizen::Base::Object::pNullObj;
124         }
125
126 protected:
127         //
128         // This method is for internal use only. Using this method can cause behavioral, security-related,
129         // and consistency-related issues in the application.
130         // This method is reserved and may change its name at any time without prior notice.
131         //
132         // @since 2.0
133         //
134         virtual void IEnumerator_Reserved1(void) { }
135
136 }; // IEnumerator
137
138 }}} // Tizen::Base::Collection
139
140 #endif // _FBASE_COL_IENUMERATOR_H_