1
<?xml version="1.0" encoding="iso-8859-1"?>
3
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/doc/src/q3ptrdict.qdoc -->
7
<title>Qt 4.0: Q3PtrDictIterator Class Reference</title>
8
<style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
9
a:link { color: #004faf; text-decoration: none }
10
a:visited { color: #672967; text-decoration: none }
11
td.postheader { font-family: sans-serif }
12
tr.address { font-family: sans-serif }
13
body { background: #ffffff; color: black; }</style>
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
19
<td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="mainclasses.html"><font color="#004faf">Main Classes</font></a> · <a href="annotated.html"><font color="#004faf">Annotated</font></a> · <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td>
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">Q3PtrDictIterator Class Reference</h1>
21
<p>The Q3PtrDictIterator class provides an iterator for <a href="q3ptrdict.html">Q3PtrDict</a> collections. <a href="#details">More...</a></p>
22
<pre>#include <Q3PtrDictIterator></pre><p><b>This class is part of the Qt 3 support library.</b> It is provided to keep old source code working. We strongly advise against using it in new code. See the <a href="porting4.html">Porting Guide</a> for more information.</p>
23
<p>Part of the <a href="qt3support.html">Qt3Support</a> module.</p>
25
<li><a href="q3ptrdictiterator-members.html">List of all members, including inherited members</a></li>
27
<a name="public-functions"></a>
28
<h3>Public Functions</h3>
30
<li><div class="fn"/><b><a href="q3ptrdictiterator.html#Q3PtrDictIterator">Q3PtrDictIterator</a></b> ( const Q3PtrDict<type> & <i>dict</i> )</li>
31
<li><div class="fn"/><b><a href="q3ptrdictiterator.html#dtor.Q3PtrDictIterator">~Q3PtrDictIterator</a></b> ()</li>
32
<li><div class="fn"/>uint <b><a href="q3ptrdictiterator.html#count">count</a></b> () const</li>
33
<li><div class="fn"/>type * <b><a href="q3ptrdictiterator.html#current">current</a></b> () const</li>
34
<li><div class="fn"/>void * <b><a href="q3ptrdictiterator.html#currentKey">currentKey</a></b> () const</li>
35
<li><div class="fn"/>bool <b><a href="q3ptrdictiterator.html#isEmpty">isEmpty</a></b> () const</li>
36
<li><div class="fn"/>type * <b><a href="q3ptrdictiterator.html#toFirst">toFirst</a></b> ()</li>
37
<li><div class="fn"/><b><a href="q3ptrdictiterator.html#operator-type--2a">operator type *</a></b> () const</li>
38
<li><div class="fn"/>type * <b><a href="q3ptrdictiterator.html#operator-28-29">operator()</a></b> ()</li>
39
<li><div class="fn"/>type * <b><a href="q3ptrdictiterator.html#operator-2b-2b">operator++</a></b> ()</li>
40
<li><div class="fn"/>type * <b><a href="q3ptrdictiterator.html#operator-2b-eq">operator+=</a></b> ( uint <i>jump</i> )</li>
42
<a name="details"></a>
44
<h2>Detailed Description</h2>
45
<p>The Q3PtrDictIterator class provides an iterator for <a href="q3ptrdict.html">Q3PtrDict</a> collections.</p>
46
<p>Q3PtrDictIterator is implemented as a template class. Define a template instance Q3PtrDictIterator<X> to create a dictionary iterator that operates on <a href="q3ptrdict.html">Q3PtrDict</a><X> (dictionary of X*).</p>
48
<pre> Q3PtrDict<char> fields;
50
QLineEdit *le1 = new QLineEdit( this );
51
le1->setText( "Simpson" );
52
QLineEdit *le2 = new QLineEdit( this );
53
le2->setText( "Homer" );
54
QLineEdit *le3 = new QLineEdit( this );
55
le3->setText( "45" );
57
fields.insert( le1, "Surname" );
58
fields.insert( le2, "Forename" );
59
fields.insert( le3, "Age" );
61
Q3PtrDictIterator<char> it( fields );
62
for( ; it.current(); ++it ) {
63
QLineEdit *le = (QLineEdit)it.currentKey();
64
cout << it.current() << ": " << le->text() << endl;
68
// Output (random order):
71
// Surname: Simpson</pre>
72
<p>In the example we insert some line edits into a dictionary, associating a string with each. We then iterate over the dictionary printing the associated strings.</p>
73
<p>Multiple iterators may independently traverse the same dictionary. A <a href="q3ptrdict.html">Q3PtrDict</a> knows about all the iterators that are operating on the dictionary. When an item is removed from the dictionary, <a href="q3ptrdict.html">Q3PtrDict</a> updates all iterators that refer the removed item to point to the next item in the traversing order.</p>
74
<p>See also <a href="q3ptrdict.html">Q3PtrDict</a>.</p>
76
<h2>Member Function Documentation</h2>
77
<h3 class="fn"><a name="Q3PtrDictIterator"></a>Q3PtrDictIterator::Q3PtrDictIterator ( const <a href="q3ptrdict.html">Q3PtrDict</a><type> & <i>dict</i> )</h3>
78
<p>Constructs an iterator for <i>dict</i>. The current iterator item is set to point on the first item in the <i>dict</i>.</p>
79
<h3 class="fn"><a name="dtor.Q3PtrDictIterator"></a>Q3PtrDictIterator::~Q3PtrDictIterator ()</h3>
80
<p>Destroys the iterator.</p>
81
<h3 class="fn"><a name="count"></a><a href="qtglobal.html#uint-typedef">uint</a> Q3PtrDictIterator::count () const</h3>
82
<p>Returns the number of items in the dictionary this iterator operates on.</p>
83
<p>See also <a href="q3ptrdictiterator.html#isEmpty">isEmpty</a>().</p>
84
<h3 class="fn"><a name="current"></a>type * Q3PtrDictIterator::current () const</h3>
85
<p>Returns a pointer to the current iterator item's value.</p>
86
<h3 class="fn"><a name="currentKey"></a>void * Q3PtrDictIterator::currentKey () const</h3>
87
<p>Returns the current iterator item's key.</p>
88
<h3 class="fn"><a name="isEmpty"></a>bool Q3PtrDictIterator::isEmpty () const</h3>
89
<p>Returns TRUE if the dictionary is empty; otherwise returns FALSE.</p>
90
<p>See also <a href="q3ptrdictiterator.html#count">count</a>().</p>
91
<h3 class="fn"><a name="toFirst"></a>type * Q3PtrDictIterator::toFirst ()</h3>
92
<p>Sets the current iterator item to point to the first item in the dictionary and returns a pointer to the item. If the dictionary is empty, it sets the current item to 0 and returns 0.</p>
93
<h3 class="fn"><a name="operator-type--2a"></a>Q3PtrDictIterator::operator type * () const</h3>
94
<p>Cast operator. Returns a pointer to the current iterator item. Same as <a href="q3ptrdictiterator.html#current">current</a>().</p>
95
<h3 class="fn"><a name="operator-28-29"></a>type * Q3PtrDictIterator::operator() ()</h3>
96
<p>Makes the succeeding item current and returns the original current item.</p>
97
<p>If the current iterator item was the last item in the dictionary or if it was 0, 0 is returned.</p>
98
<h3 class="fn"><a name="operator-2b-2b"></a>type * Q3PtrDictIterator::operator++ ()</h3>
99
<p>Prefix ++ makes the succeeding item current and returns the new current item.</p>
100
<p>If the current iterator item was the last item in the dictionary or if it was 0, 0 is returned.</p>
101
<h3 class="fn"><a name="operator-2b-eq"></a>type * Q3PtrDictIterator::operator+= ( <a href="qtglobal.html#uint-typedef">uint</a> <i>jump</i> )</h3>
102
<p>Sets the current item to the item <i>jump</i> positions after the current item and returns a pointer to that item.</p>
103
<p>If that item is beyond the last item or if the dictionary is empty, it sets the current item to 0 and returns 0.</p>
104
<p /><address><hr /><div align="center">
105
<table width="100%" cellspacing="0" border="0"><tr class="address">
106
<td width="30%">Copyright © 2005 <a href="trolltech.html">Trolltech</a></td>
107
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
108
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
109
</tr></table></div></address></body>