f10f34efef8f1001b2c2967d2c10c9961741674d
[platform/framework/native/appfw.git] / inc / FBaseColIMapEnumeratorT.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                FBaseColIMapEnumeratorT.h
19  * @brief               This is the header file for the %IMapEnumeratorT interface.
20  *
21  * This header file contains the declarations of the %IMapEnumeratorT interface.
22  */
23 #ifndef _FBASE_COL_IMAP_ENUMERATOR_T_H_
24 #define _FBASE_COL_IMAP_ENUMERATOR_T_H_
25
26 #include <FBaseColIEnumeratorT.h>
27 #include <FBaseColMapEntryT.h>
28
29
30 namespace Tizen { namespace Base { namespace Collection
31 {
32
33 /**
34  * @interface IMapEnumeratorT
35  * @brief       This interface supports simple iteration over a template-based map. @n
36  *                      Using this method, you can only access the elements in the map. You cannot modify the elements.
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 @c E_INVALID_OPERATION message.
44  *
45  * The %IMapEnumeratorT interface supports simple iteration over a template-based map.
46  *                      Using this method, you can only access the elements in the map. You cannot modify the elements.
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 template< class KeyType, class ValueType >
52 class IMapEnumeratorT
53         : public virtual IEnumeratorT< MapEntryT< KeyType, ValueType > >
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 ~IMapEnumeratorT(void) {}
63
64         /**
65          * Gets the current key in the map.
66          *
67          * @since 2.0
68          *
69          * @return              An error code
70          * @param[out]  key The current key
71          * @exception   E_INVALID_OPERATION     The current state of the instance prohibits the execution of the specified operation. @n
72          *                                                                      The enumerator is currently positioned before the first element or after the last element or the collection is modified after the enumerator is created.
73          * @exception   E_SUCCESS                       The method is successful.
74          */
75         virtual result GetKey(KeyType& key) const = 0;
76
77         /**
78          * Gets the current value in the map.
79          *
80          * @since 2.0
81          *
82          * @return              An error code
83          * @param[out]  value The current value
84          * @exception   E_INVALID_OPERATION     The current state of the instance prohibits the execution of the specified operation. @n
85          *                                                                      The enumerator is currently positioned before the first element or after the last element or the collection is modified after the enumerator is created.
86          * @exception   E_SUCCESS                       The method is successful.
87          */
88         virtual result GetValue(ValueType& value) const = 0;
89
90 }; // IMapEnumeratorT
91
92 }}} // Tizen::Base::Collection
93
94 #endif // _FBASE_COL_IMAP_ENUMERATOR_H_