Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 112b0974ad288f6cd55bf971ee6026a9 > files > 1184

libqt3-devel-3.0.2-2mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /tmp/qt-3.0-reggie-28534/qt-x11-free-3.0.2/doc/qdict.doc:409 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QDictIterator Class</title>
<style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
 <a href="index.html">
<font color="#004faf">Home</font></a>
 | <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QDictIterator Class Reference</h1>

<p>The QDictIterator class provides an iterator for QDict collections.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qdict-h.html">qdict.h</a>&gt;</tt>
<p><a href="qdictiterator-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class=fn><a href="#QDictIterator"><b>QDictIterator</b></a> ( const&nbsp;QDict&lt;type&gt;&nbsp;&amp;&nbsp;dict )</div></li>
<li><div class=fn><a href="#~QDictIterator"><b>~QDictIterator</b></a> ()</div></li>
<li><div class=fn>uint <a href="#count"><b>count</b></a> () const</div></li>
<li><div class=fn>bool <a href="#isEmpty"><b>isEmpty</b></a> () const</div></li>
<li><div class=fn>type * <a href="#toFirst"><b>toFirst</b></a> ()</div></li>
<li><div class=fn><a href="#operator-type-*"><b>operator type *</b></a> () const</div></li>
<li><div class=fn>type * <a href="#current"><b>current</b></a> () const</div></li>
<li><div class=fn>QString <a href="#currentKey"><b>currentKey</b></a> () const</div></li>
<li><div class=fn>type * <a href="#operator()"><b>operator()</b></a> ()</div></li>
<li><div class=fn>type * <a href="#operator++"><b>operator++</b></a> ()</div></li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


The QDictIterator class provides an iterator for <a href="qdict.html">QDict</a> collections.
<p> 

<p> QDictIterator is implemented as a template class.
Define a template instance QDictIterator&lt;X&gt; to create a
dictionary iterator that operates on QDict&lt;X&gt; (dictionary of X*).
<p> The traversal order is arbitrary; when we speak of the "first", "last"
and "next" item we are talking in terms of this arbitrary order.
<p> Multiple iterators may independently traverse the same dictionary. A
QDict knows about all iterators that are operating on the dictionary.
When an item is removed from the dictionary, QDict update all
iterators that are referring to the removed item to point to the next
item in the traversal order.
<p> Example:
<pre>
    <a href="qdict.html">QDict</a>&lt;QLineEdit&gt; fields;
    fields.<a href="qdict.html#insert">insert</a>( "forename", new <a href="qlineedit.html">QLineEdit</a>( this ) );
    fields.<a href="qdict.html#insert">insert</a>( "surname", new <a href="qlineedit.html">QLineEdit</a>( this ) );
    fields.<a href="qdict.html#insert">insert</a>( "age", new <a href="qlineedit.html">QLineEdit</a>( this ) );

    fields["forename"]-&gt;setText( "Homer" );
    fields["surname"]-&gt;setText( "Simpson" );
    fields["age"]-&gt;setText( "45" );

    QDictIterator&lt;QLineEdit&gt; it( fields );
    for( ; it.<a href="#current">current</a>(); ++it )
        cout &lt;&lt; it.<a href="#currentKey">currentKey</a>() &lt;&lt; ": " &lt;&lt; it.<a href="#current">current</a>()-&gt;text() &lt;&lt; endl;
    cout &lt;&lt; endl;

    // Output (random order):
    //  age: 45
    //  surname: Simpson
    //  forename: Homer
  </pre>
 
In the example we insert some pointers to line edits into a
dictionary, then iterate over the dictionary printing the strings
associated with the line edits.
<p> <p>See also <a href="qdict.html">QDict</a>, <a href="collection.html">Collection Classes</a> and <a href="tools.html">Non-GUI Classes</a>.

<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QDictIterator"></a>QDictIterator::QDictIterator ( const&nbsp;<a href="qdict.html">QDict</a>&lt;type&gt;&nbsp;&amp;&nbsp;dict )
</h3>

Constructs an iterator for <em>dict</em>.  The current iterator item is
set to point to the first item in the dictionary, <em>dict</em>. First in
this context means first in the arbitrary traversal order.

<h3 class=fn><a name="~QDictIterator"></a>QDictIterator::~QDictIterator ()
</h3>

Destroys the iterator.

<h3 class=fn>uint <a name="count"></a>QDictIterator::count () const
</h3>

Returns the number of items in the dictionary over which the iterator
is operating.
<p>See also <a href="#isEmpty">isEmpty</a>().

<h3 class=fn>type * <a name="current"></a>QDictIterator::current () const
</h3>

Returns a pointer to the current iterator item's value.

<h3 class=fn><a href="qstring.html">QString</a> <a name="currentKey"></a>QDictIterator::currentKey () const
</h3>

Returns the current iterator item's key.

<h3 class=fn>bool <a name="isEmpty"></a>QDictIterator::isEmpty () const
</h3>

Returns TRUE if the dictionary is empty, i.e. <a href="#count">count</a>() == 0; otherwise
returns FALSE.
<p>See also <a href="#count">count</a>().

<h3 class=fn><a name="operator-type-*"></a>QDictIterator::operator type * () const
</h3>

Cast operator. Returns a pointer to the current iterator item.
Same as <a href="#current">current</a>().

<h3 class=fn>type * <a name="operator()"></a>QDictIterator::operator() ()
</h3>

Makes the next item current and returns the original current item.
<p> If the current iterator item was the last item in the dictionary or if it
was 0, 0 is returned.

<h3 class=fn>type * <a name="operator++"></a>QDictIterator::operator++ ()
</h3>

Prefix ++ makes the next item current and returns the new current
item.
<p> If the current iterator item was the last item in the dictionary or if it
was 0, 0 is returned.

<h3 class=fn>type * <a name="toFirst"></a>QDictIterator::toFirst ()
</h3>

Resets the iterator, making the first item the first current item.
First in this context means first in the arbitrary traversal order.
Returns a pointer to this item.
<p> If the dictionary is empty it sets the current item to 0 and
returns 0.

<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 1995-2001
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2001 
<a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt version 3.0.2</div>
</table></div></address></body>
</html>