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"><!--
|
---|
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>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 <<a href="qasciidict-h.html">qasciidict.h</a>></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 QAsciiDict<type> & 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 jump )</li>
|
---|
51 | </ul>
|
---|
52 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
53 |
|
---|
54 |
|
---|
55 | The 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
|
---|
59 | template instance QAsciiDictIterator<X> to create a dictionary
|
---|
60 | iterator that operates on QAsciiDict<X> (dictionary of X*).
|
---|
61 | <p> Example:
|
---|
62 | <pre>
|
---|
63 | <a href="qasciidict.html">QAsciiDict</a><QLineEdit> 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"]->setText( "Homer" );
|
---|
69 | fields["surname"]->setText( "Simpson" );
|
---|
70 | fields["age"]->setText( "45" );
|
---|
71 |
|
---|
72 | QAsciiDictIterator<QLineEdit> it( fields );
|
---|
73 | for( ; it.<a href="#current">current</a>(); ++it )
|
---|
74 | cout << it.<a href="#currentKey">currentKey</a>() << ": " << it.<a href="#current">current</a>()->text() << endl;
|
---|
75 | cout << endl;
|
---|
76 |
|
---|
77 | // Output (random order):
|
---|
78 | // age: 45
|
---|
79 | // surname: Simpson
|
---|
80 | // forename: Homer
|
---|
81 | </pre>
|
---|
82 |
|
---|
83 | In the example we insert some line edits into a dictionary, then
|
---|
84 | iterate over the dictionary printing the strings associated with
|
---|
85 | those line edits.
|
---|
86 | <p> Note that the traversal order is arbitrary; you are not guaranteed
|
---|
87 | any particular order.
|
---|
88 | <p> Multiple iterators may independently traverse the same dictionary.
|
---|
89 | A <a href="qasciidict.html">QAsciiDict</a> knows about all the iterators that are operating on
|
---|
90 | the dictionary. When an item is removed from the dictionary,
|
---|
91 | QAsciiDict updates all the iterators that are referring to the
|
---|
92 | removed item to point to the next item in the (arbitrary)
|
---|
93 | traversal 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 <a href="qasciidict.html">QAsciiDict</a><type> & dict )
|
---|
98 | </h3>
|
---|
99 |
|
---|
100 | <p> Constructs an iterator for <em>dict</em>. The current iterator item is
|
---|
101 | set 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
|
---|
112 | operates 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,
|
---|
129 | otherwise 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.
|
---|
136 | Same 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
|
---|
142 | item.
|
---|
143 | <p> If the current iterator item was the last item in the dictionary
|
---|
144 | or 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
|
---|
150 | current item.
|
---|
151 | <p> If the current iterator item was the last item in the dictionary
|
---|
152 | or if it was 0, 0 is returned.
|
---|
153 |
|
---|
154 | <h3 class=fn>type * <a name="operator+-eq"></a>QAsciiDictIterator::operator+= ( uint jump )
|
---|
155 | </h3>
|
---|
156 |
|
---|
157 | <p> Sets the current item to the item <em>jump</em> positions after the
|
---|
158 | current item, and returns a pointer to that item.
|
---|
159 | <p> If that item is beyond the last item or if the dictionary is
|
---|
160 | empty, 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
|
---|
166 | dictionary and returns a pointer to the item. If the dictionary is
|
---|
167 | empty it sets the current item to 0 and returns 0.
|
---|
168 |
|
---|
169 | <!-- eof -->
|
---|
170 | <hr><p>
|
---|
171 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
172 | Copyright © 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 © 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>
|
---|