[190] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/doc/qmap.doc:604 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>QMapIterator Class</title>
|
---|
| 7 | <style type="text/css"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { background: #ffffff; color: black; }
|
---|
| 12 | --></style>
|
---|
| 13 | </head>
|
---|
| 14 | <body>
|
---|
| 15 |
|
---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
| 17 | <tr bgcolor="#E5E5E5">
|
---|
| 18 | <td valign=center>
|
---|
| 19 | <a href="index.html">
|
---|
| 20 | <font color="#004faf">Home</font></a>
|
---|
| 21 | | <a href="classes.html">
|
---|
| 22 | <font color="#004faf">All Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
---|
| 25 | | <a href="annotated.html">
|
---|
| 26 | <font color="#004faf">Annotated</font></a>
|
---|
| 27 | | <a href="groups.html">
|
---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
| 29 | | <a href="functions.html">
|
---|
| 30 | <font color="#004faf">Functions</font></a>
|
---|
| 31 | </td>
|
---|
| 32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QMapIterator Class Reference</h1>
|
---|
| 33 |
|
---|
| 34 | <p>The QMapIterator class provides an iterator for QMap.
|
---|
| 35 | <a href="#details">More...</a>
|
---|
| 36 | <p><tt>#include <<a href="qmap-h.html">qmap.h</a>></tt>
|
---|
| 37 | <p><a href="qmapiterator-members.html">List of all member functions.</a>
|
---|
| 38 | <h2>Public Members</h2>
|
---|
| 39 | <ul>
|
---|
| 40 | <li class=fn>typedef std::bidirectional_iterator_tag <a href="#iterator_category"><b>iterator_category</b></a></li>
|
---|
| 41 | <li class=fn>typedef T <a href="#value_type"><b>value_type</b></a></li>
|
---|
| 42 | <li class=fn>typedef T * <a href="#pointer"><b>pointer</b></a></li>
|
---|
| 43 | <li class=fn>typedef T & <a href="#reference"><b>reference</b></a></li>
|
---|
| 44 | <li class=fn><a href="#QMapIterator"><b>QMapIterator</b></a> ()</li>
|
---|
| 45 | <li class=fn><a href="#QMapIterator-2"><b>QMapIterator</b></a> ( QMapNode<K, T> * p )</li>
|
---|
| 46 | <li class=fn><a href="#QMapIterator-3"><b>QMapIterator</b></a> ( const QMapIterator<K, T> & it )</li>
|
---|
| 47 | <li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const QMapIterator<K, T> & it ) const</li>
|
---|
| 48 | <li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const QMapIterator<K, T> & it ) const</li>
|
---|
| 49 | <li class=fn>T & <a href="#operator*"><b>operator*</b></a> ()</li>
|
---|
| 50 | <li class=fn>const T & <a href="#operator*-2"><b>operator*</b></a> () const</li>
|
---|
| 51 | <li class=fn>const K & <a href="#key"><b>key</b></a> () const</li>
|
---|
| 52 | <li class=fn>T & <a href="#data"><b>data</b></a> ()</li>
|
---|
| 53 | <li class=fn>const T & <a href="#data-2"><b>data</b></a> () const</li>
|
---|
| 54 | <li class=fn>QMapIterator<K, T> & <a href="#operator++"><b>operator++</b></a> ()</li>
|
---|
| 55 | <li class=fn>QMapIterator<K, T> <a href="#operator++-2"><b>operator++</b></a> ( int )</li>
|
---|
| 56 | <li class=fn>QMapIterator<K, T> & <a href="#operator--"><b>operator--</b></a> ()</li>
|
---|
| 57 | <li class=fn>QMapIterator<K, T> <a href="#operator---2"><b>operator--</b></a> ( int )</li>
|
---|
| 58 | </ul>
|
---|
| 59 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
| 60 |
|
---|
| 61 |
|
---|
| 62 | The QMapIterator class provides an iterator for <a href="qmap.html">QMap</a>.
|
---|
| 63 | <p>
|
---|
| 64 |
|
---|
| 65 | <p> You cannot create an iterator by yourself. Instead, you must ask a
|
---|
| 66 | map to give you one. An iterator is as big as a pointer; on 32-bit
|
---|
| 67 | machines that means 4 bytes, on 64-bit machines, 8 bytes. That
|
---|
| 68 | makes copying iterators very fast. Iterators behave in a similar
|
---|
| 69 | way to pointers, and they are almost as fast as pointers. See the
|
---|
| 70 | <a href="qmap.html#qmap-eg">QMap example</a>.
|
---|
| 71 | <p> QMap is highly optimized for performance and memory usage, but the
|
---|
| 72 | trade-off is that you must be more careful. The only way to
|
---|
| 73 | traverse a map is to use iterators. QMap does not know about its
|
---|
| 74 | iterators, and the iterators don't even know to which map they
|
---|
| 75 | belong. That makes things fast but a bit dangerous because it is
|
---|
| 76 | up to you to make sure that the iterators you are using are still
|
---|
| 77 | valid. <a href="qdictiterator.html">QDictIterator</a> will be able to give warnings, whereas
|
---|
| 78 | QMapIterator may end up in an undefined state.
|
---|
| 79 | <p> For every Iterator there is also a ConstIterator. You must use the
|
---|
| 80 | ConstIterator to access a <a href="qmap.html">QMap</a> in a const environment or if the
|
---|
| 81 | reference or pointer to the map is itself const. Its semantics are
|
---|
| 82 | the same, but it only returns const references to the item it
|
---|
| 83 | points to.
|
---|
| 84 | <p> <p>See also <a href="qmap.html">QMap</a>, <a href="qmapconstiterator.html">QMapConstIterator</a>, <a href="qtl.html">Qt Template Library Classes</a>, and <a href="tools.html">Non-GUI Classes</a>.
|
---|
| 85 |
|
---|
| 86 | <hr><h2>Member Type Documentation</h2>
|
---|
| 87 | <h3 class=fn><a name="iterator_category"></a>QMapIterator::iterator_category</h3>
|
---|
| 88 | The type of iterator category, <tt>std::bidirectional_iterator_tag</tt>.
|
---|
| 89 | <h3 class=fn><a name="pointer"></a>QMapIterator::pointer</h3>
|
---|
| 90 | Pointer to value_type.
|
---|
| 91 | <h3 class=fn><a name="reference"></a>QMapIterator::reference</h3>
|
---|
| 92 | Reference to value_type.
|
---|
| 93 | <h3 class=fn><a name="value_type"></a>QMapIterator::value_type</h3>
|
---|
| 94 | The type of value.
|
---|
| 95 | <hr><h2>Member Function Documentation</h2>
|
---|
| 96 | <h3 class=fn><a name="QMapIterator"></a>QMapIterator::QMapIterator ()
|
---|
| 97 | </h3>
|
---|
| 98 |
|
---|
| 99 | <p> Creates an uninitialized iterator.
|
---|
| 100 |
|
---|
| 101 | <h3 class=fn><a name="QMapIterator-2"></a>QMapIterator::QMapIterator ( QMapNode<K, T> * p )
|
---|
| 102 | </h3>
|
---|
| 103 |
|
---|
| 104 | <p> Constructs an iterator starting at node <em>p</em>.
|
---|
| 105 |
|
---|
| 106 | <h3 class=fn><a name="QMapIterator-3"></a>QMapIterator::QMapIterator ( const <a href="qmapiterator.html">QMapIterator</a><K, T> & it )
|
---|
| 107 | </h3>
|
---|
| 108 |
|
---|
| 109 | <p> Constructs a copy of the iterator, <em>it</em>.
|
---|
| 110 |
|
---|
| 111 | <h3 class=fn>T & <a name="data"></a>QMapIterator::data ()
|
---|
| 112 | </h3>
|
---|
| 113 |
|
---|
| 114 | <p> Returns a reference to the current item's data.
|
---|
| 115 |
|
---|
| 116 | <h3 class=fn>const T & <a name="data-2"></a>QMapIterator::data () const
|
---|
| 117 | </h3>
|
---|
| 118 |
|
---|
| 119 | <p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
| 120 | <p> Returns a const reference to the current item's data.
|
---|
| 121 |
|
---|
| 122 | <h3 class=fn>const K & <a name="key"></a>QMapIterator::key () const
|
---|
| 123 | </h3>
|
---|
| 124 |
|
---|
| 125 | <p> Returns a const reference to the current item's key.
|
---|
| 126 |
|
---|
| 127 | <h3 class=fn>bool <a name="operator!-eq"></a>QMapIterator::operator!= ( const <a href="qmapiterator.html">QMapIterator</a><K, T> & it ) const
|
---|
| 128 | </h3>
|
---|
| 129 |
|
---|
| 130 | <p> Compares the iterator to the <em>it</em> iterator and returns FALSE if
|
---|
| 131 | they point to the same item; otherwise returns TRUE.
|
---|
| 132 |
|
---|
| 133 | <h3 class=fn>T & <a name="operator*"></a>QMapIterator::operator* ()
|
---|
| 134 | </h3>
|
---|
| 135 |
|
---|
| 136 | <p> Dereference operator. Returns a reference to the current item's
|
---|
| 137 | data. The same as <a href="#data">data</a>().
|
---|
| 138 |
|
---|
| 139 | <h3 class=fn>const T & <a name="operator*-2"></a>QMapIterator::operator* () const
|
---|
| 140 | </h3>
|
---|
| 141 |
|
---|
| 142 | <p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
| 143 | <p> Dereference operator. Returns a const reference to the current
|
---|
| 144 | item's data. The same as <a href="#data">data</a>().
|
---|
| 145 |
|
---|
| 146 | <h3 class=fn><a href="qmapiterator.html">QMapIterator</a><K, T> & <a name="operator++"></a>QMapIterator::operator++ ()
|
---|
| 147 | </h3>
|
---|
| 148 |
|
---|
| 149 | <p> Prefix ++ makes the succeeding item current and returns an
|
---|
| 150 | iterator pointing to the new current item. The iterator cannot
|
---|
| 151 | check whether it reached the end of the map. Incrementing the
|
---|
| 152 | iterator returned by end() causes undefined results.
|
---|
| 153 |
|
---|
| 154 | <h3 class=fn><a href="qmapiterator.html">QMapIterator</a><K, T> <a name="operator++-2"></a>QMapIterator::operator++ ( int )
|
---|
| 155 | </h3>
|
---|
| 156 |
|
---|
| 157 | <p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
| 158 | <p> Postfix ++ makes the succeeding item current and returns an
|
---|
| 159 | iterator pointing to the new current item. The iterator cannot
|
---|
| 160 | check whether it reached the end of the map. Incrementing the
|
---|
| 161 | iterator returned by end() causes undefined results.
|
---|
| 162 |
|
---|
| 163 | <h3 class=fn><a href="qmapiterator.html">QMapIterator</a><K, T> & <a name="operator--"></a>QMapIterator::operator-- ()
|
---|
| 164 | </h3>
|
---|
| 165 |
|
---|
| 166 | <p> Prefix -- makes the previous item current and returns an iterator
|
---|
| 167 | pointing to the new current item. The iterator cannot check
|
---|
| 168 | whether it reached the beginning of the map. Decrementing the
|
---|
| 169 | iterator returned by begin() causes undefined results.
|
---|
| 170 |
|
---|
| 171 | <h3 class=fn><a href="qmapiterator.html">QMapIterator</a><K, T> <a name="operator---2"></a>QMapIterator::operator-- ( int )
|
---|
| 172 | </h3>
|
---|
| 173 |
|
---|
| 174 | <p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
| 175 | <p> Postfix -- makes the previous item current and returns an iterator
|
---|
| 176 | pointing to the new current item. The iterator cannot check
|
---|
| 177 | whether it reached the beginning of the map. Decrementing the
|
---|
| 178 | iterator returned by begin() causes undefined results.
|
---|
| 179 |
|
---|
| 180 | <h3 class=fn>bool <a name="operator-eq-eq"></a>QMapIterator::operator== ( const <a href="qmapiterator.html">QMapIterator</a><K, T> & it ) const
|
---|
| 181 | </h3>
|
---|
| 182 |
|
---|
| 183 | <p> Compares the iterator to the <em>it</em> iterator and returns TRUE if
|
---|
| 184 | they point to the same item; otherwise returns FALSE.
|
---|
| 185 |
|
---|
| 186 | <!-- eof -->
|
---|
| 187 | <hr><p>
|
---|
| 188 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
| 189 | Copyright © 1995-2007
|
---|
| 190 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
| 191 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 192 | <td>Copyright © 2007
|
---|
| 193 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 194 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 195 | </table></div></address></body>
|
---|
| 196 | </html>
|
---|