source: trunk/doc/html/qasciidictiterator.html

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

reference documentation added

File size: 7.6 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/qasciidict.doc:337 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QAsciiDictIterator 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>QAsciiDictIterator Class Reference</h1>
33
34<p>The QAsciiDictIterator class provides an iterator for QAsciiDict collections.
35<a href="#details">More...</a>
36<p><tt>#include &lt;<a href="qasciidict-h.html">qasciidict.h</a>&gt;</tt>
37<p><a href="qasciidictiterator-members.html">List of all member functions.</a>
38<h2>Public Members</h2>
39<ul>
40<li class=fn><a href="#QAsciiDictIterator"><b>QAsciiDictIterator</b></a> ( const&nbsp;QAsciiDict&lt;type&gt;&nbsp;&amp;&nbsp;dict )</li>
41<li class=fn><a href="#~QAsciiDictIterator"><b>~QAsciiDictIterator</b></a> ()</li>
42<li class=fn>uint <a href="#count"><b>count</b></a> () const</li>
43<li class=fn>bool <a href="#isEmpty"><b>isEmpty</b></a> () const</li>
44<li class=fn>type * <a href="#toFirst"><b>toFirst</b></a> ()</li>
45<li class=fn><a href="#operator-type-*"><b>operator type *</b></a> () const</li>
46<li class=fn>type * <a href="#current"><b>current</b></a> () const</li>
47<li class=fn>const char * <a href="#currentKey"><b>currentKey</b></a> () const</li>
48<li class=fn>type * <a href="#operator()"><b>operator()</b></a> ()</li>
49<li class=fn>type * <a href="#operator++"><b>operator++</b></a> ()</li>
50<li class=fn>type * <a href="#operator+-eq"><b>operator+=</b></a> ( uint&nbsp;jump )</li>
51</ul>
52<hr><a name="details"></a><h2>Detailed Description</h2>
53
54
55The QAsciiDictIterator class provides an iterator for <a href="qasciidict.html">QAsciiDict</a> collections.
56<p>
57
58<p> QAsciiDictIterator is implemented as a template class. Define a
59template instance QAsciiDictIterator&lt;X&gt; to create a dictionary
60iterator that operates on QAsciiDict&lt;X&gt; (dictionary of X*).
61<p> Example:
62<pre>
63 <a href="qasciidict.html">QAsciiDict</a>&lt;QLineEdit&gt; fields;
64 fields.<a href="qasciidict.html#insert">insert</a>( "forename", new <a href="qlineedit.html">QLineEdit</a>( this ) );
65 fields.<a href="qasciidict.html#insert">insert</a>( "surname", new <a href="qlineedit.html">QLineEdit</a>( this ) );
66 fields.<a href="qasciidict.html#insert">insert</a>( "age", new <a href="qlineedit.html">QLineEdit</a>( this ) );
67
68 fields["forename"]-&gt;setText( "Homer" );
69 fields["surname"]-&gt;setText( "Simpson" );
70 fields["age"]-&gt;setText( "45" );
71
72 QAsciiDictIterator&lt;QLineEdit&gt; it( fields );
73 for( ; it.<a href="#current">current</a>(); ++it )
74 cout &lt;&lt; it.<a href="#currentKey">currentKey</a>() &lt;&lt; ": " &lt;&lt; it.<a href="#current">current</a>()-&gt;text() &lt;&lt; endl;
75 cout &lt;&lt; endl;
76
77 // Output (random order):
78 // age: 45
79 // surname: Simpson
80 // forename: Homer
81 </pre>
82
83In the example we insert some line edits into a dictionary, then
84iterate over the dictionary printing the strings associated with
85those line edits.
86<p> Note that the traversal order is arbitrary; you are not guaranteed
87any particular order.
88<p> Multiple iterators may independently traverse the same dictionary.
89A <a href="qasciidict.html">QAsciiDict</a> knows about all the iterators that are operating on
90the dictionary. When an item is removed from the dictionary,
91QAsciiDict updates all the iterators that are referring to the
92removed item to point to the next item in the (arbitrary)
93traversal order.
94<p> <p>See also <a href="qasciidict.html">QAsciiDict</a>, <a href="collection.html">Collection Classes</a>, and <a href="tools.html">Non-GUI Classes</a>.
95
96<hr><h2>Member Function Documentation</h2>
97<h3 class=fn><a name="QAsciiDictIterator"></a>QAsciiDictIterator::QAsciiDictIterator ( const&nbsp;<a href="qasciidict.html">QAsciiDict</a>&lt;type&gt;&nbsp;&amp;&nbsp;dict )
98</h3>
99
100<p> Constructs an iterator for <em>dict</em>. The current iterator item is
101set to point on the first item in the <em>dict</em>.
102
103<h3 class=fn><a name="~QAsciiDictIterator"></a>QAsciiDictIterator::~QAsciiDictIterator ()
104</h3>
105
106<p> Destroys the iterator.
107
108<h3 class=fn>uint <a name="count"></a>QAsciiDictIterator::count () const
109</h3>
110
111<p> Returns the number of items in the dictionary this iterator
112operates over.
113<p> <p>See also <a href="#isEmpty">isEmpty</a>().
114
115<h3 class=fn>type * <a name="current"></a>QAsciiDictIterator::current () const
116</h3>
117
118<p> Returns a pointer to the current iterator item.
119
120<h3 class=fn>const char * <a name="currentKey"></a>QAsciiDictIterator::currentKey () const
121</h3>
122
123<p> Returns a pointer to the key for the current iterator item.
124
125<h3 class=fn>bool <a name="isEmpty"></a>QAsciiDictIterator::isEmpty () const
126</h3>
127
128<p> Returns TRUE if the dictionary is empty, i.e. <a href="#count">count</a>() == 0,
129otherwise returns FALSE.
130<p> <p>See also <a href="#count">count</a>().
131
132<h3 class=fn><a name="operator-type-*"></a>QAsciiDictIterator::operator type * () const
133</h3>
134
135<p> Cast operator. Returns a pointer to the current iterator item.
136Same as <a href="#current">current</a>().
137
138<h3 class=fn>type * <a name="operator()"></a>QAsciiDictIterator::operator() ()
139</h3>
140
141<p> Makes the succeeding item current and returns the original current
142item.
143<p> If the current iterator item was the last item in the dictionary
144or if it was 0, 0 is returned.
145
146<h3 class=fn>type * <a name="operator++"></a>QAsciiDictIterator::operator++ ()
147</h3>
148
149<p> Prefix ++ makes the succeeding item current and returns the new
150current item.
151<p> If the current iterator item was the last item in the dictionary
152or if it was 0, 0 is returned.
153
154<h3 class=fn>type * <a name="operator+-eq"></a>QAsciiDictIterator::operator+= ( uint&nbsp;jump )
155</h3>
156
157<p> Sets the current item to the item <em>jump</em> positions after the
158current item, and returns a pointer to that item.
159<p> If that item is beyond the last item or if the dictionary is
160empty, it sets the current item to 0 and returns 0.
161
162<h3 class=fn>type * <a name="toFirst"></a>QAsciiDictIterator::toFirst ()
163</h3>
164
165<p> Sets the current iterator item to point to the first item in the
166dictionary and returns a pointer to the item. If the dictionary is
167empty it sets the current item to 0 and returns 0.
168
169<!-- eof -->
170<hr><p>
171This file is part of the <a href="index.html">Qt toolkit</a>.
172Copyright &copy; 1995-2007
173<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
174<table width=100% cellspacing=0 border=0><tr>
175<td>Copyright &copy; 2007
176<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
177<td align=right><div align=right>Qt 3.3.8</div>
178</table></div></address></body>
179</html>
Note: See TracBrowser for help on using the repository browser.