1QMapIterator(3qt) QMapIterator(3qt)
2
3
4
6 QMapIterator - Iterator for QMap
7
9 #include <qmap.h>
10
11 Public Members
12 typedef std::bidirectional_iterator_tag iterator_category
13 typedef T value_type
14 typedef T * pointer
15 typedef T & reference
16 QMapIterator ()
17 QMapIterator ( QMapNode<K, T> * p )
18 QMapIterator ( const QMapIterator<K, T> & it )
19 bool operator== ( const QMapIterator<K, T> & it ) const
20 bool operator!= ( const QMapIterator<K, T> & it ) const
21 T & operator* ()
22 const T & operator* () const
23 const K & key () const
24 T & data ()
25 const T & data () const
26 QMapIterator<K, T> & operator++ ()
27 QMapIterator<K, T> operator++ ( int )
28 QMapIterator<K, T> & operator-- ()
29 QMapIterator<K, T> operator-- ( int )
30
32 The QMapIterator class provides an iterator for QMap.
33
34 You cannot create an iterator by yourself. Instead, you must ask a map
35 to give you one. An iterator is as big as a pointer; on 32-bit machines
36 that means 4 bytes, on 64-bit machines, 8 bytes. That makes copying
37 iterators very fast. Iterators behave in a similar way to pointers, and
38 they are almost as fast as pointers. See the QMap example.
39
40 QMap is highly optimized for performance and memory usage, but the
41 trade-off is that you must be more careful. The only way to traverse a
42 map is to use iterators. QMap does not know about its iterators, and
43 the iterators don't even know to which map they belong. That makes
44 things fast but a bit dangerous because it is up to you to make sure
45 that the iterators you are using are still valid. QDictIterator will be
46 able to give warnings, whereas QMapIterator may end up in an undefined
47 state.
48
49 For every Iterator there is also a ConstIterator. You must use the
50 ConstIterator to access a QMap in a const environment or if the
51 reference or pointer to the map is itself const. Its semantics are the
52 same, but it only returns const references to the item it points to.
53
54 See also QMap, QMapConstIterator, Qt Template Library Classes, and Non-
55 GUI Classes.
56
57 Member Type Documentation
59 The type of iterator category, std::bidirectional_iterator_tag.
60
62 Pointer to value_type.
63
65 Reference to value_type.
66
68 The type of value.
69
72 Creates an uninitialized iterator.
73
75 Constructs an iterator starting at node p.
76
78 Constructs a copy of the iterator, it.
79
81 Returns a reference to the current item's data.
82
84 This is an overloaded member function, provided for convenience. It
85 behaves essentially like the above function.
86
87 Returns a const reference to the current item's data.
88
90 Returns a const reference to the current item's key.
91
93 Compares the iterator to the it iterator and returns FALSE if they
94 point to the same item; otherwise returns TRUE.
95
97 Dereference operator. Returns a reference to the current item's data.
98 The same as data().
99
101 This is an overloaded member function, provided for convenience. It
102 behaves essentially like the above function.
103
104 Dereference operator. Returns a const reference to the current item's
105 data. The same as data().
106
108 Prefix ++ makes the succeeding item current and returns an iterator
109 pointing to the new current item. The iterator cannot check whether it
110 reached the end of the map. Incrementing the iterator returned by end()
111 causes undefined results.
112
114 This is an overloaded member function, provided for convenience. It
115 behaves essentially like the above function.
116
117 Postfix ++ makes the succeeding item current and returns an iterator
118 pointing to the new current item. The iterator cannot check whether it
119 reached the end of the map. Incrementing the iterator returned by end()
120 causes undefined results.
121
123 Prefix -- makes the previous item current and returns an iterator
124 pointing to the new current item. The iterator cannot check whether it
125 reached the beginning of the map. Decrementing the iterator returned by
126 begin() causes undefined results.
127
129 This is an overloaded member function, provided for convenience. It
130 behaves essentially like the above function.
131
132 Postfix -- makes the previous item current and returns an iterator
133 pointing to the new current item. The iterator cannot check whether it
134 reached the beginning of the map. Decrementing the iterator returned by
135 begin() causes undefined results.
136
138 Compares the iterator to the it iterator and returns TRUE if they point
139 to the same item; otherwise returns FALSE.
140
141
143 http://doc.trolltech.com/qmapiterator.html
144 http://www.trolltech.com/faq/tech.html
145
147 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
148 license file included in the distribution for a complete license
149 statement.
150
152 Generated automatically from the source code.
153
155 If you find a bug in Qt, please report it as described in
156 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
157 help you. Thank you.
158
159 The definitive Qt documentation is provided in HTML format; it is
160 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
161 web browser. This man page is provided as a convenience for those users
162 who prefer man pages, although this format is not officially supported
163 by Trolltech.
164
165 If you find errors in this manual page, please report them to qt-
166 bugs@trolltech.com. Please include the name of the manual page
167 (qmapiterator.3qt) and the Qt version (3.3.8).
168
169
170
171Trolltech AS 2 February 2007 QMapIterator(3qt)