<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <!-- q3ptrdict.qdoc --> <head> <title>Qt 4.6: Q3PtrDictIterator Class Reference</title> <link href="classic.css" rel="stylesheet" type="text/css" /> </head> <body> <a name="//apple_ref/cpp/cl//Q3PtrDictIterator"></a> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td> <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="functions.html"><font color="#004faf">All Functions</font></a> · <a href="overviews.html"><font color="#004faf">Overviews</font></a></td></tr></table><h1 class="title">Q3PtrDictIterator Class Reference<br /><span class="small-subtitle">[<a href="qt3support.html">Qt3Support</a> module]</span> </h1> <p>The Q3PtrDictIterator class provides an iterator for <a href="q3ptrdict.html">Q3PtrDict</a> collections. <a href="#details">More...</a></p> <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 <a href="porting4.html">Porting to Qt 4</a> for more information.</p> <ul> <li><a href="q3ptrdictiterator-members.html">List of all members, including inherited members</a></li> </ul> <hr /> <a name="public-functions"></a> <h2>Public Functions</h2> <table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%"> <tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="q3ptrdictiterator.html#Q3PtrDictIterator">Q3PtrDictIterator</a></b> ( const Q3PtrDict<type> & <i>dict</i> )</td></tr> <tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="q3ptrdictiterator.html#dtor.Q3PtrDictIterator">~Q3PtrDictIterator</a></b> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">uint </td><td class="memItemRight" valign="bottom"><b><a href="q3ptrdictiterator.html#count">count</a></b> () const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">type * </td><td class="memItemRight" valign="bottom"><b><a href="q3ptrdictiterator.html#current">current</a></b> () const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><b><a href="q3ptrdictiterator.html#currentKey">currentKey</a></b> () const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="q3ptrdictiterator.html#isEmpty">isEmpty</a></b> () const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">type * </td><td class="memItemRight" valign="bottom"><b><a href="q3ptrdictiterator.html#toFirst">toFirst</a></b> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="q3ptrdictiterator.html#operator-type--2a">operator type *</a></b> () const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">type * </td><td class="memItemRight" valign="bottom"><b><a href="q3ptrdictiterator.html#operator-28-29">operator()</a></b> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">type * </td><td class="memItemRight" valign="bottom"><b><a href="q3ptrdictiterator.html#operator-2b-2b">operator++</a></b> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">type * </td><td class="memItemRight" valign="bottom"><b><a href="q3ptrdictiterator.html#operator-2b-eq">operator+=</a></b> ( uint <i>jump</i> )</td></tr> </table> <a name="details"></a> <hr /> <h2>Detailed Description</h2> <p>The Q3PtrDictIterator class provides an iterator for <a href="q3ptrdict.html">Q3PtrDict</a> collections.</p> <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> <p>Example:</p> <pre> Q3PtrDict<char> fields; QLineEdit *le1 = new QLineEdit( this ); le1->setText( "Simpson" ); QLineEdit *le2 = new QLineEdit( this ); le2->setText( "Homer" ); QLineEdit *le3 = new QLineEdit( this ); le3->setText( "45" ); fields.insert( le1, "Surname" ); fields.insert( le2, "Forename" ); fields.insert( le3, "Age" ); Q3PtrDictIterator<char> it( fields ); for( ; it.current(); ++it ) { QLineEdit *le = (QLineEdit)it.currentKey(); cout << it.current() << ": " << le->text() << endl; } cout << endl; // Output (random order): // Forename: Homer // Age: 45 // Surname: Simpson</pre> <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> <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> <p>See also <a href="q3ptrdict.html">Q3PtrDict</a>.</p> <hr /> <h2>Member Function Documentation</h2> <a name="//apple_ref/cpp/instm/Q3PtrDictIterator/Q3PtrDictIterator"></a> <h3 class="fn"><a name="Q3PtrDictIterator"></a>Q3PtrDictIterator::Q3PtrDictIterator ( const <a href="q3ptrdict.html">Q3PtrDict</a><type> & <i>dict</i> )</h3> <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> <a name="//apple_ref/cpp/instm/Q3PtrDictIterator/~Q3PtrDictIterator"></a> <h3 class="fn"><a name="dtor.Q3PtrDictIterator"></a>Q3PtrDictIterator::~Q3PtrDictIterator ()</h3> <p>Destroys the iterator.</p> <a name="//apple_ref/cpp/instm/Q3PtrDictIterator/count"></a> <h3 class="fn"><a name="count"></a><a href="qtglobal.html#uint-typedef">uint</a> Q3PtrDictIterator::count () const</h3> <p>Returns the number of items in the dictionary this iterator operates on.</p> <p>See also <a href="q3ptrdictiterator.html#isEmpty">isEmpty</a>().</p> <a name="//apple_ref/cpp/instm/Q3PtrDictIterator/current"></a> <h3 class="fn"><a name="current"></a>type * Q3PtrDictIterator::current () const</h3> <p>Returns a pointer to the current iterator item's value.</p> <a name="//apple_ref/cpp/instm/Q3PtrDictIterator/currentKey"></a> <h3 class="fn"><a name="currentKey"></a>void * Q3PtrDictIterator::currentKey () const</h3> <p>Returns the current iterator item's key.</p> <a name="//apple_ref/cpp/instm/Q3PtrDictIterator/isEmpty"></a> <h3 class="fn"><a name="isEmpty"></a>bool Q3PtrDictIterator::isEmpty () const</h3> <p>Returns TRUE if the dictionary is empty; otherwise returns FALSE.</p> <p>See also <a href="q3ptrdictiterator.html#count">count</a>().</p> <a name="//apple_ref/cpp/instm/Q3PtrDictIterator/toFirst"></a> <h3 class="fn"><a name="toFirst"></a>type * Q3PtrDictIterator::toFirst ()</h3> <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> <a name="//apple_ref/cpp/instm/Q3PtrDictIterator/operator type *"></a> <h3 class="fn"><a name="operator-type--2a"></a>Q3PtrDictIterator::operator type * () const</h3> <p>Cast operator. Returns a pointer to the current iterator item. Same as <a href="q3ptrdictiterator.html#current">current</a>().</p> <a name="//apple_ref/cpp/instm/Q3PtrDictIterator/operator"></a> <h3 class="fn"><a name="operator-28-29"></a>type * Q3PtrDictIterator::operator() ()</h3> <p>Makes the succeeding item current and returns the original current item.</p> <p>If the current iterator item was the last item in the dictionary or if it was 0, 0 is returned.</p> <a name="//apple_ref/cpp/instm/Q3PtrDictIterator/operator++"></a> <h3 class="fn"><a name="operator-2b-2b"></a>type * Q3PtrDictIterator::operator++ ()</h3> <p>Prefix ++ makes the succeeding item current and returns the new current item.</p> <p>If the current iterator item was the last item in the dictionary or if it was 0, 0 is returned.</p> <a name="//apple_ref/cpp/instm/Q3PtrDictIterator/operator+="></a> <h3 class="fn"><a name="operator-2b-eq"></a>type * Q3PtrDictIterator::operator+= ( <a href="qtglobal.html#uint-typedef">uint</a> <i>jump</i> )</h3> <p>Sets the current item to the item <i>jump</i> positions after the current item and returns a pointer to that item.</p> <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> <p /><address><hr /><div align="center"> <table width="100%" cellspacing="0" border="0"><tr class="address"> <td width="40%" align="left">Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies)</td> <td width="20%" align="center"><a href="trademarks.html">Trademarks</a></td> <td width="40%" align="right"><div align="right">Qt 4.6.3</div></td> </tr></table></div></address></body> </html>