92b9eeddafeb3437cf8f0c38ccfa0210bb266d85
[platform/framework/native/appfw.git] / inc / FBaseColIMapEnumerator.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                FBaseColIMapEnumerator.h
19  * @brief               This is the header file for the %IMapEnumerator interface.
20  *
21  * This header file contains the declarations of the %IMapEnumerator interface.
22  */
23 #ifndef _FBASE_COL_IMAP_ENUMERATOR_H_
24 #define _FBASE_COL_IMAP_ENUMERATOR_H_
25
26 #include <FBaseColIEnumerator.h>
27 #include <FBaseObject.h>
28
29
30 namespace Tizen { namespace Base { namespace Collection
31 {
32
33 class MapEntry;
34
35 /**
36  * @interface IMapEnumerator
37  * @brief       This interface supports simple iteration over a map.
38  *
39  * @since 2.0
40  *
41  * @remarks
42  * An enumerator remains valid as long as the map remains unchanged.
43  * If changes are made to the map, such as adding, modifying, or
44  * deleting elements, the enumerator is irrecoverably invalidated. The next call to any method returns an E_INVALID_OPERATION message.
45  *
46  * The %IMapEnumerator interface supports simple iteration over a map.
47  * One can only access the elements in a collection through %IMapEnumerator. The elements cannot be modified through this interface.
48  *
49  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/base/hashmap_multihashmap.htm">HashMap and MultiHashMap</a>.
50  *
51  */
52 class _OSP_EXPORT_ IMapEnumerator
53         : public virtual IEnumerator
54 {
55 public:
56         /**
57          * This polymorphic destructor should be overridden if required. @n
58          * This way, the destructors of the derived classes are called when the destructor of this interface is called.
59          *
60          * @since 2.0
61          */
62         virtual ~IMapEnumerator(void) {}
63
64         /**
65          * Gets the current object from the collection.
66          *
67          * @since 2.0
68          *
69          * @return              A pointer to the current object in the collection, @n
70          *                              else @c null if an exception occurs
71          * @exception   E_SUCCESS                       The method is successful.
72          * @exception   E_INVALID_OPERATION      Either of the following conditions has occurred: @n
73          *                                                                      - The current state of the instance prohibits the execution of the specified operation. @n
74          *                                                                      - The enumerator is currently positioned before the first element or after the last element. @n
75          *                                                                      - The collection is modified after the enumerator is created.
76          * @remarks             The specific error code can be accessed using the GetLastResult() method.
77          * @see                 GetLastResult()
78          */
79         virtual Object* GetCurrent(void) const = 0;
80
81         /**
82          * Gets the current key in the map.
83          *
84          * @since 2.0
85          *
86          * @return              A pointer to the current key in the map, @n
87          *                              else @c null if an exception occurs
88          * @exception   E_SUCCESS                       The method is successful.
89          * @exception   E_INVALID_OPERATION        Either of the following conditions has occurred: @n
90          *                                                                      - The current state of the instance prohibits the execution of the specified operation. @n
91          *                                                                      - The enumerator is currently positioned before the first element or after the last element. @n
92          *                                                                      - The collection is modified after the enumerator is created.
93          * @remarks             The specific error code can be accessed using the GetLastResult() method.
94          * @see                         GetLastResult()
95          */
96         virtual Object* GetKey(void) const = 0;
97
98         /**
99          * Gets the current value in the map.
100          *
101          * @since 2.0
102          *
103          * @return              A pointer to the current value in the map, @n
104          *                              else @c null if an exception occurs
105          * @exception   E_SUCCESS                       The method is successful.
106          * @exception   E_INVALID_OPERATION      Either of the following conditions has occurred: @n
107          *                                                                      - The current state of the instance prohibits the execution of the specified operation. @n
108          *                                                                      - The enumerator is currently positioned before the first element or after the last element. @n
109          *                                                                      - The collection is modified after the enumerator is created.
110          * @remarks             The specific error code can be accessed using the GetLastResult() method.
111          * @see                         GetLastResult()
112          */
113         virtual Object* GetValue(void) const = 0;
114
115 }; // IMapEnumerator
116
117 }}} // Tizen::Base::Collection
118
119 #endif // _FBASE_COL_IMAP_ENUMERATOR_H_