source: trunk/doc/html/qvaluelistiterator.html

Last change on this file was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 10.5 KB
Line 
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"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { 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&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;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&nbsp;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 &lt;<a href="qvaluelist-h.html">qvaluelist.h</a>&gt;</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&nbsp;<a href="#value_type"><b>value_type</b></a></li>
42<li class=fn>typedef T&nbsp;*&nbsp;<a href="#pointer"><b>pointer</b></a></li>
43<li class=fn>typedef T&nbsp;&amp;&nbsp;<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&nbsp;QValueListIterator&lt;T&gt;&nbsp;&amp;&nbsp;it )</li>
46<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const&nbsp;QValueListIterator&lt;T&gt;&nbsp;&amp;&nbsp;it ) const</li>
47<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const&nbsp;QValueListIterator&lt;T&gt;&nbsp;&amp;&nbsp;it ) const</li>
48<li class=fn>const T &amp; <a href="#operator*-2"><b>operator*</b></a> () const</li>
49<li class=fn>T &amp; <a href="#operator*"><b>operator*</b></a> ()</li>
50<li class=fn>QValueListIterator&lt;T&gt; &amp; <a href="#operator++"><b>operator++</b></a> ()</li>
51<li class=fn>QValueListIterator&lt;T&gt; <a href="#operator++-2"><b>operator++</b></a> ( int )</li>
52<li class=fn>QValueListIterator&lt;T&gt; &amp; <a href="#operator--"><b>operator--</b></a> ()</li>
53<li class=fn>QValueListIterator&lt;T&gt; <a href="#operator---2"><b>operator--</b></a> ( int )</li>
54<li class=fn>QValueListIterator&lt;T&gt; &amp; <a href="#operator+-eq"><b>operator+=</b></a> ( int&nbsp;j )</li>
55<li class=fn>QValueListIterator&lt;T&gt; &amp; <a href="#operator--eq"><b>operator-=</b></a> ( int&nbsp;j )</li>
56</ul>
57<hr><a name="details"></a><h2>Detailed Description</h2>
58
59
60The 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
65class: a generalization of the index in an array. A pointer
66into a "const char *" and an index into an "int[]" are both
67iterators, and the general idea is to provide that functionality
68for any data structure.
69<p> The QValueListIterator class is an iterator for QValueList
70instantiations. You can create the appropriate iterator type by
71using the <tt>iterator</tt> typedef provided by QValueList.
72<p> The only way to access the items in a QValueList is to use an
73iterator.
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 &lt;&lt; (*it).surname().latin1() &lt;&lt; ", " &lt;&lt;
79 (*it).forename().latin1() &lt;&lt; " earns " &lt;&lt;
80 (*it).salary() &lt;&lt; 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.
90This means that you must be careful: QValueList does not know
91about all its iterators and the iterators don't know to which list
92they belong. This makes things very fast, but if you're not
93careful, you can get spectacular bugs. Always make sure iterators
94are valid before dereferencing them or using them as parameters to
95generic algorithms in the STL or the <a href="qtl.html">QTL</a>.
96<p> Using an invalid iterator is undefined (your application will
97probably crash). Many Qt functions return const value lists; to
98iterate over these you should make a copy and iterate over the
99copy.
100<p> For every Iterator there is a ConstIterator. When accessing a
101QValueList in a const environment or if the reference or pointer
102to the list is itself const, then you must use the ConstIterator.
103Its semantics are the same as the Iterator, but it only returns
104const 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>
109Pointer to value_type.
110<h3 class=fn><a name="reference"></a>QValueListIterator::reference</h3>
111Reference to value_type.
112<h3 class=fn><a name="value_type"></a>QValueListIterator::value_type</h3>
113The 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&nbsp;<a href="qvaluelistiterator.html">QValueListIterator</a>&lt;T&gt;&nbsp;&amp;&nbsp;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&nbsp;<a href="qvaluelistiterator.html">QValueListIterator</a>&lt;T&gt;&nbsp;&amp;&nbsp;it ) const
127</h3>
128
129<p> Compares this iterator and <em>it</em> and returns TRUE if they point to
130different items; otherwise returns FALSE.
131
132<h3 class=fn>T &amp; <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 &amp; <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>&lt;T&gt;&nbsp;&amp; <a name="operator++"></a>QValueListIterator::operator++ ()
144</h3>
145
146<p> Prefix ++ makes the succeeding item current and returns an
147iterator pointing to the new current item. The iterator cannot
148check whether it reached the end of the list. Incrementing the
149iterator returned by end() causes undefined results.
150
151<h3 class=fn><a href="qvaluelistiterator.html">QValueListIterator</a>&lt;T&gt; <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
156iterator pointing to the new current item. The iterator cannot
157check whether it reached the end of the list. Incrementing the
158iterator returned by end() causes undefined results.
159
160<h3 class=fn><a href="qvaluelistiterator.html">QValueListIterator</a>&lt;T&gt;&nbsp;&amp; <a name="operator+-eq"></a>QValueListIterator::operator+= ( int&nbsp;j )
161</h3>
162
163<p> Postfix -- jumps <em>j</em> steps forward in the list. The iterator
164cannot check whether it reached the end of the list. Jumping past
165the end() causes undefined results.
166
167<h3 class=fn><a href="qvaluelistiterator.html">QValueListIterator</a>&lt;T&gt;&nbsp;&amp; <a name="operator--"></a>QValueListIterator::operator-- ()
168</h3>
169
170<p> Prefix -- makes the previous item current and returns an iterator
171pointing to the new current item. The iterator cannot check
172whether it reached the beginning of the list. Decrementing the
173iterator returned by begin() causes undefined results.
174
175<h3 class=fn><a href="qvaluelistiterator.html">QValueListIterator</a>&lt;T&gt; <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
180pointing to the new current item. The iterator cannot check
181whether it reached the beginning of the list. Decrementing the
182iterator returned by begin() causes undefined results.
183
184<h3 class=fn><a href="qvaluelistiterator.html">QValueListIterator</a>&lt;T&gt;&nbsp;&amp; <a name="operator--eq"></a>QValueListIterator::operator-= ( int&nbsp;j )
185</h3>
186
187<p> Postfix -- jumps <em>j</em> steps backward in the list. The iterator
188cannot check whether it reached the beginning of the list. Jumping
189past begin() causes undefined results.
190
191<h3 class=fn>bool <a name="operator-eq-eq"></a>QValueListIterator::operator== ( const&nbsp;<a href="qvaluelistiterator.html">QValueListIterator</a>&lt;T&gt;&nbsp;&amp;&nbsp;it ) const
192</h3>
193
194<p> Compares this iterator and <em>it</em> and returns TRUE if they point to
195the same item; otherwise returns FALSE.
196
197<!-- eof -->
198<hr><p>
199This file is part of the <a href="index.html">Qt toolkit</a>.
200Copyright &copy; 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 &copy; 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>
Note: See TracBrowser for help on using the repository browser.