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/qvaluelist.doc:834 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>QValueListIterator 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>QValueListIterator Class Reference</h1>
|
---|
33 |
|
---|
34 | <p>The QValueListIterator class provides an iterator for QValueList.
|
---|
35 | <a href="#details">More...</a>
|
---|
36 | <p>All the functions in this class are <a href="threads.html#reentrant">reentrant</a> when Qt is built with thread support.</p>
|
---|
37 | <p><tt>#include <<a href="qvaluelist-h.html">qvaluelist.h</a>></tt>
|
---|
38 | <p><a href="qvaluelistiterator-members.html">List of all member functions.</a>
|
---|
39 | <h2>Public Members</h2>
|
---|
40 | <ul>
|
---|
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="#QValueListIterator"><b>QValueListIterator</b></a> ()</li>
|
---|
45 | <li class=fn><a href="#QValueListIterator-3"><b>QValueListIterator</b></a> ( const QValueListIterator<T> & it )</li>
|
---|
46 | <li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const QValueListIterator<T> & it ) const</li>
|
---|
47 | <li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const QValueListIterator<T> & it ) const</li>
|
---|
48 | <li class=fn>const T & <a href="#operator*-2"><b>operator*</b></a> () const</li>
|
---|
49 | <li class=fn>T & <a href="#operator*"><b>operator*</b></a> ()</li>
|
---|
50 | <li class=fn>QValueListIterator<T> & <a href="#operator++"><b>operator++</b></a> ()</li>
|
---|
51 | <li class=fn>QValueListIterator<T> <a href="#operator++-2"><b>operator++</b></a> ( int )</li>
|
---|
52 | <li class=fn>QValueListIterator<T> & <a href="#operator--"><b>operator--</b></a> ()</li>
|
---|
53 | <li class=fn>QValueListIterator<T> <a href="#operator---2"><b>operator--</b></a> ( int )</li>
|
---|
54 | <li class=fn>QValueListIterator<T> & <a href="#operator+-eq"><b>operator+=</b></a> ( int j )</li>
|
---|
55 | <li class=fn>QValueListIterator<T> & <a href="#operator--eq"><b>operator-=</b></a> ( int j )</li>
|
---|
56 | </ul>
|
---|
57 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
58 |
|
---|
59 |
|
---|
60 | The QValueListIterator class provides an iterator for <a href="qvaluelist.html">QValueList</a>.
|
---|
61 | <p>
|
---|
62 |
|
---|
63 |
|
---|
64 | <p> An iterator is a class for accessing the items of a container
|
---|
65 | class: a generalization of the index in an array. A pointer
|
---|
66 | into a "const char *" and an index into an "int[]" are both
|
---|
67 | iterators, and the general idea is to provide that functionality
|
---|
68 | for any data structure.
|
---|
69 | <p> The QValueListIterator class is an iterator for QValueList
|
---|
70 | instantiations. You can create the appropriate iterator type by
|
---|
71 | using the <tt>iterator</tt> typedef provided by QValueList.
|
---|
72 | <p> The only way to access the items in a QValueList is to use an
|
---|
73 | iterator.
|
---|
74 | <p> Example (see QValueList for the complete code):
|
---|
75 | <pre>
|
---|
76 | EmployeeList::iterator it;
|
---|
77 | for ( it = list.begin(); it != list.end(); ++it )
|
---|
78 | cout << (*it).surname().latin1() << ", " <<
|
---|
79 | (*it).forename().latin1() << " earns " <<
|
---|
80 | (*it).salary() << endl;
|
---|
81 |
|
---|
82 | // Output:
|
---|
83 | // Doe, John earns 50000
|
---|
84 | // Williams, Jane earns 80000
|
---|
85 | // Hawthorne, Mary earns 90000
|
---|
86 | // Jones, Tom earns 60000
|
---|
87 | </pre>
|
---|
88 |
|
---|
89 | <p> <a href="qvaluelist.html">QValueList</a> is highly optimized for performance and memory usage.
|
---|
90 | This means that you must be careful: QValueList does not know
|
---|
91 | about all its iterators and the iterators don't know to which list
|
---|
92 | they belong. This makes things very fast, but if you're not
|
---|
93 | careful, you can get spectacular bugs. Always make sure iterators
|
---|
94 | are valid before dereferencing them or using them as parameters to
|
---|
95 | generic algorithms in the STL or the <a href="qtl.html">QTL</a>.
|
---|
96 | <p> Using an invalid iterator is undefined (your application will
|
---|
97 | probably crash). Many Qt functions return const value lists; to
|
---|
98 | iterate over these you should make a copy and iterate over the
|
---|
99 | copy.
|
---|
100 | <p> For every Iterator there is a ConstIterator. When accessing a
|
---|
101 | QValueList in a const environment or if the reference or pointer
|
---|
102 | to the list is itself const, then you must use the ConstIterator.
|
---|
103 | Its semantics are the same as the Iterator, but it only returns
|
---|
104 | const references.
|
---|
105 | <p> <p>See also <a href="qvaluelist.html">QValueList</a>, <a href="qvaluelistconstiterator.html">QValueListConstIterator</a>, <a href="qtl.html">Qt Template Library Classes</a>, and <a href="tools.html">Non-GUI Classes</a>.
|
---|
106 |
|
---|
107 | <hr><h2>Member Type Documentation</h2>
|
---|
108 | <h3 class=fn><a name="pointer"></a>QValueListIterator::pointer</h3>
|
---|
109 | Pointer to value_type.
|
---|
110 | <h3 class=fn><a name="reference"></a>QValueListIterator::reference</h3>
|
---|
111 | Reference to value_type.
|
---|
112 | <h3 class=fn><a name="value_type"></a>QValueListIterator::value_type</h3>
|
---|
113 | The type of value, T.
|
---|
114 | <hr><h2>Member Function Documentation</h2>
|
---|
115 | <h3 class=fn><a name="QValueListIterator"></a>QValueListIterator::QValueListIterator ()
|
---|
116 | </h3>
|
---|
117 |
|
---|
118 | <p> Creates un uninitialized iterator.
|
---|
119 |
|
---|
120 | <h3 class=fn><a name="QValueListIterator-3"></a>QValueListIterator::QValueListIterator ( const <a href="qvaluelistiterator.html">QValueListIterator</a><T> & it )
|
---|
121 | </h3>
|
---|
122 |
|
---|
123 | <p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
124 | <p> Constructs a copy of the iterator <em>it</em>.
|
---|
125 |
|
---|
126 | <h3 class=fn>bool <a name="operator!-eq"></a>QValueListIterator::operator!= ( const <a href="qvaluelistiterator.html">QValueListIterator</a><T> & it ) const
|
---|
127 | </h3>
|
---|
128 |
|
---|
129 | <p> Compares this iterator and <em>it</em> and returns TRUE if they point to
|
---|
130 | different items; otherwise returns FALSE.
|
---|
131 |
|
---|
132 | <h3 class=fn>T & <a name="operator*"></a>QValueListIterator::operator* ()
|
---|
133 | </h3>
|
---|
134 |
|
---|
135 | <p> Asterisk operator. Returns a reference to the current iterator item.
|
---|
136 |
|
---|
137 | <h3 class=fn>const T & <a name="operator*-2"></a>QValueListIterator::operator* () const
|
---|
138 | </h3>
|
---|
139 |
|
---|
140 | <p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
141 | <p> Asterisk operator. Returns a reference to the current iterator item.
|
---|
142 |
|
---|
143 | <h3 class=fn><a href="qvaluelistiterator.html">QValueListIterator</a><T> & <a name="operator++"></a>QValueListIterator::operator++ ()
|
---|
144 | </h3>
|
---|
145 |
|
---|
146 | <p> Prefix ++ makes the succeeding item current and returns an
|
---|
147 | iterator pointing to the new current item. The iterator cannot
|
---|
148 | check whether it reached the end of the list. Incrementing the
|
---|
149 | iterator returned by end() causes undefined results.
|
---|
150 |
|
---|
151 | <h3 class=fn><a href="qvaluelistiterator.html">QValueListIterator</a><T> <a name="operator++-2"></a>QValueListIterator::operator++ ( int )
|
---|
152 | </h3>
|
---|
153 |
|
---|
154 | <p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
155 | <p> Postfix ++ makes the succeeding item current and returns an
|
---|
156 | iterator pointing to the new current item. The iterator cannot
|
---|
157 | check whether it reached the end of the list. Incrementing the
|
---|
158 | iterator returned by end() causes undefined results.
|
---|
159 |
|
---|
160 | <h3 class=fn><a href="qvaluelistiterator.html">QValueListIterator</a><T> & <a name="operator+-eq"></a>QValueListIterator::operator+= ( int j )
|
---|
161 | </h3>
|
---|
162 |
|
---|
163 | <p> Postfix -- jumps <em>j</em> steps forward in the list. The iterator
|
---|
164 | cannot check whether it reached the end of the list. Jumping past
|
---|
165 | the end() causes undefined results.
|
---|
166 |
|
---|
167 | <h3 class=fn><a href="qvaluelistiterator.html">QValueListIterator</a><T> & <a name="operator--"></a>QValueListIterator::operator-- ()
|
---|
168 | </h3>
|
---|
169 |
|
---|
170 | <p> Prefix -- makes the previous item current and returns an iterator
|
---|
171 | pointing to the new current item. The iterator cannot check
|
---|
172 | whether it reached the beginning of the list. Decrementing the
|
---|
173 | iterator returned by begin() causes undefined results.
|
---|
174 |
|
---|
175 | <h3 class=fn><a href="qvaluelistiterator.html">QValueListIterator</a><T> <a name="operator---2"></a>QValueListIterator::operator-- ( int )
|
---|
176 | </h3>
|
---|
177 |
|
---|
178 | <p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
179 | <p> Postfix -- makes the previous item current and returns an iterator
|
---|
180 | pointing to the new current item. The iterator cannot check
|
---|
181 | whether it reached the beginning of the list. Decrementing the
|
---|
182 | iterator returned by begin() causes undefined results.
|
---|
183 |
|
---|
184 | <h3 class=fn><a href="qvaluelistiterator.html">QValueListIterator</a><T> & <a name="operator--eq"></a>QValueListIterator::operator-= ( int j )
|
---|
185 | </h3>
|
---|
186 |
|
---|
187 | <p> Postfix -- jumps <em>j</em> steps backward in the list. The iterator
|
---|
188 | cannot check whether it reached the beginning of the list. Jumping
|
---|
189 | past begin() causes undefined results.
|
---|
190 |
|
---|
191 | <h3 class=fn>bool <a name="operator-eq-eq"></a>QValueListIterator::operator== ( const <a href="qvaluelistiterator.html">QValueListIterator</a><T> & it ) const
|
---|
192 | </h3>
|
---|
193 |
|
---|
194 | <p> Compares this iterator and <em>it</em> and returns TRUE if they point to
|
---|
195 | the same item; otherwise returns FALSE.
|
---|
196 |
|
---|
197 | <!-- eof -->
|
---|
198 | <hr><p>
|
---|
199 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
200 | Copyright © 1995-2007
|
---|
201 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
202 | <table width=100% cellspacing=0 border=0><tr>
|
---|
203 | <td>Copyright © 2007
|
---|
204 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
205 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
206 | </table></div></address></body>
|
---|
207 | </html>
|
---|