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