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