Sophie

Sophie

distrib > Mandriva > current > i586 > media > main-updates > by-pkgid > 8e6051afcdb111a0317a58fb64c2abf5 > files > 4105

qt4-doc-4.6.3-0.2mdv2010.2.i586.rpm

<?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">
<!-- qfuture.cpp -->
<head>
  <title>Qt 4.6: QFutureIterator Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<a name="//apple_ref/cpp/cl//QFutureIterator"></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">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">All&nbsp;Functions</font></a>&nbsp;&middot; <a href="overviews.html"><font color="#004faf">Overviews</font></a></td></tr></table><h1 class="title">QFutureIterator Class Reference<br /><span class="small-subtitle">[<a href="qtcore.html">QtCore</a> module]</span>
</h1>
<p>The QFutureIterator class provides a Java-style const iterator for <a href="qfuture.html">QFuture</a>. <a href="#details">More...</a></p>
<pre> #include &lt;QFutureIterator&gt;</pre><p><b>Note:</b> All functions in this class are <a href="threads-reentrancy.html#reentrant">reentrant</a>.</p>
<p>This class was introduced in Qt 4.4.</p>
<ul>
<li><a href="qfutureiterator-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="qfutureiterator.html#QFutureIterator">QFutureIterator</a></b> ( const QFuture&lt;T&gt; &amp; <i>future</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qfutureiterator.html#findNext">findNext</a></b> ( const T &amp; <i>value</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qfutureiterator.html#findPrevious">findPrevious</a></b> ( const T &amp; <i>value</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qfutureiterator.html#hasNext">hasNext</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qfutureiterator.html#hasPrevious">hasPrevious</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const T &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qfutureiterator.html#next">next</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const T &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qfutureiterator.html#peekNext">peekNext</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const T &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qfutureiterator.html#peekPrevious">peekPrevious</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const T &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qfutureiterator.html#previous">previous</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qfutureiterator.html#toBack">toBack</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qfutureiterator.html#toFront">toFront</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QFutureIterator &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qfutureiterator.html#operator-eq">operator=</a></b> ( const QFuture&lt;T&gt; &amp; <i>future</i> )</td></tr>
</table>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QFutureIterator class provides a Java-style const iterator for <a href="qfuture.html">QFuture</a>.</p>
<p><a href="qfuture.html">QFuture</a> has both <a href="containers.html#java-style-iterators">Java-style iterators</a> and <a href="containers.html#stl-style-iterators">STL-style iterators</a>. The Java-style iterators are more high-level and easier to use than the STL-style iterators; on the other hand, they are slightly less efficient.</p>
<p>An alternative to using iterators is to use index positions. Some <a href="qfuture.html">QFuture</a> member functions take an index as their first parameter, making it possible to access results without using iterators.</p>
<p>QFutureIterator&lt;T&gt; allows you to iterate over a <a href="qfuture.html">QFuture</a>&lt;T&gt;. Note that there is no mutable iterator for <a href="qfuture.html">QFuture</a> (unlike the other Java-style iterators).</p>
<p>The QFutureIterator constructor takes a <a href="qfuture.html">QFuture</a> as its argument. After construction, the iterator is located at the very beginning of the result list (i.e&#x2e; before the first result). Here's how to iterate over all the results sequentially:</p>
<pre> QFuture&lt;QString&gt; future;
 ...
 QFutureIterator&lt;QString&gt; i(future);
 while (i.hasNext())
     qDebug() &lt;&lt; i.next();</pre>
<p>The <a href="qfutureiterator.html#next">next</a>() function returns the next result (waiting for it to become available, if necessary) from the future and advances the iterator. Unlike STL-style iterators, Java-style iterators point <i>between</i> results rather than directly <i>at</i> results. The first call to <a href="qfutureiterator.html#next">next</a>() advances the iterator to the position between the first and second result, and returns the first result; the second call to <a href="qfutureiterator.html#next">next</a>() advances the iterator to the position between the second and third result, and returns the second result; and so on.</p>
<p align="center"><img src="images/javaiterators1.png" /></p><p>Here's how to iterate over the elements in reverse order:</p>
<pre> QFutureIterator&lt;QString&gt; i(future);
 i.toBack();
 while (i.hasPrevious())
     qDebug() &lt;&lt; i.previous();</pre>
<p>If you want to find all occurrences of a particular value, use <a href="qfutureiterator.html#findNext">findNext</a>() or <a href="qfutureiterator.html#findPrevious">findPrevious</a>() in a loop.</p>
<p>Multiple iterators can be used on the same future. If the future is modified while a QFutureIterator is active, the QFutureIterator will continue iterating over the original future, ignoring the modified copy.</p>
<p>See also <a href="qfuture-const-iterator.html">QFuture::const_iterator</a> and <a href="qfuture.html">QFuture</a>.</p>
<hr />
<h2>Member Function Documentation</h2>
<a name="//apple_ref/cpp/instm/QFutureIterator/QFutureIterator"></a>
<h3 class="fn"><a name="QFutureIterator"></a>QFutureIterator::QFutureIterator ( const <a href="qfuture.html">QFuture</a>&lt;T&gt; &amp; <i>future</i> )</h3>
<p>Constructs an iterator for traversing <i>future</i>. The iterator is set to be at the front of the result list (before the first result).</p>
<p>See also <a href="qfutureiterator.html#operator-eq">operator=</a>().</p>
<a name="//apple_ref/cpp/instm/QFutureIterator/findNext"></a>
<h3 class="fn"><a name="findNext"></a>bool QFutureIterator::findNext ( const T &amp; <i>value</i> )</h3>
<p>Searches for <i>value</i> starting from the current iterator position forward. Returns true if <i>value</i> is found; otherwise returns false.</p>
<p>After the call, if <i>value</i> was found, the iterator is positioned just after the matching result; otherwise, the iterator is positioned at the back of the result list.</p>
<p>See also <a href="qfutureiterator.html#findPrevious">findPrevious</a>().</p>
<a name="//apple_ref/cpp/instm/QFutureIterator/findPrevious"></a>
<h3 class="fn"><a name="findPrevious"></a>bool QFutureIterator::findPrevious ( const T &amp; <i>value</i> )</h3>
<p>Searches for <i>value</i> starting from the current iterator position backward. Returns true if <i>value</i> is found; otherwise returns false.</p>
<p>After the call, if <i>value</i> was found, the iterator is positioned just before the matching result; otherwise, the iterator is positioned at the front of the result list.</p>
<p>See also <a href="qfutureiterator.html#findNext">findNext</a>().</p>
<a name="//apple_ref/cpp/instm/QFutureIterator/hasNext"></a>
<h3 class="fn"><a name="hasNext"></a>bool QFutureIterator::hasNext () const</h3>
<p>Returns true if there is at least one result ahead of the iterator, e.g&#x2e;, the iterator is <i>not</i> at the back of the result list; otherwise returns false.</p>
<p>See also <a href="qfutureiterator.html#hasPrevious">hasPrevious</a>() and <a href="qfutureiterator.html#next">next</a>().</p>
<a name="//apple_ref/cpp/instm/QFutureIterator/hasPrevious"></a>
<h3 class="fn"><a name="hasPrevious"></a>bool QFutureIterator::hasPrevious () const</h3>
<p>Returns true if there is at least one result ahead of the iterator, e.g&#x2e;, the iterator is <i>not</i> at the front of the result list; otherwise returns false.</p>
<p>See also <a href="qfutureiterator.html#hasNext">hasNext</a>() and <a href="qfutureiterator.html#previous">previous</a>().</p>
<a name="//apple_ref/cpp/instm/QFutureIterator/next"></a>
<h3 class="fn"><a name="next"></a>const T &amp; QFutureIterator::next ()</h3>
<p>Returns the next result and advances the iterator by one position.</p>
<p>Calling this function on an iterator located at the back of the result list leads to undefined results.</p>
<p>See also <a href="qfutureiterator.html#hasNext">hasNext</a>(), <a href="qfutureiterator.html#peekNext">peekNext</a>(), and <a href="qfutureiterator.html#previous">previous</a>().</p>
<a name="//apple_ref/cpp/instm/QFutureIterator/peekNext"></a>
<h3 class="fn"><a name="peekNext"></a>const T &amp; QFutureIterator::peekNext () const</h3>
<p>Returns the next result without moving the iterator.</p>
<p>Calling this function on an iterator located at the back of the result list leads to undefined results.</p>
<p>See also <a href="qfutureiterator.html#hasNext">hasNext</a>(), <a href="qfutureiterator.html#next">next</a>(), and <a href="qfutureiterator.html#peekPrevious">peekPrevious</a>().</p>
<a name="//apple_ref/cpp/instm/QFutureIterator/peekPrevious"></a>
<h3 class="fn"><a name="peekPrevious"></a>const T &amp; QFutureIterator::peekPrevious () const</h3>
<p>Returns the previous result without moving the iterator.</p>
<p>Calling this function on an iterator located at the front of the result list leads to undefined results.</p>
<p>See also <a href="qfutureiterator.html#hasPrevious">hasPrevious</a>(), <a href="qfutureiterator.html#previous">previous</a>(), and <a href="qfutureiterator.html#peekNext">peekNext</a>().</p>
<a name="//apple_ref/cpp/instm/QFutureIterator/previous"></a>
<h3 class="fn"><a name="previous"></a>const T &amp; QFutureIterator::previous ()</h3>
<p>Returns the previous result and moves the iterator back by one position.</p>
<p>Calling this function on an iterator located at the front of the result list leads to undefined results.</p>
<p>See also <a href="qfutureiterator.html#hasPrevious">hasPrevious</a>(), <a href="qfutureiterator.html#peekPrevious">peekPrevious</a>(), and <a href="qfutureiterator.html#next">next</a>().</p>
<a name="//apple_ref/cpp/instm/QFutureIterator/toBack"></a>
<h3 class="fn"><a name="toBack"></a>void QFutureIterator::toBack ()</h3>
<p>Moves the iterator to the back of the result list (after the last result).</p>
<p>See also <a href="qfutureiterator.html#toFront">toFront</a>() and <a href="qfutureiterator.html#previous">previous</a>().</p>
<a name="//apple_ref/cpp/instm/QFutureIterator/toFront"></a>
<h3 class="fn"><a name="toFront"></a>void QFutureIterator::toFront ()</h3>
<p>Moves the iterator to the front of the result list (before the first result).</p>
<p>See also <a href="qfutureiterator.html#toBack">toBack</a>() and <a href="qfutureiterator.html#next">next</a>().</p>
<a name="//apple_ref/cpp/instm/QFutureIterator/operator="></a>
<h3 class="fn"><a name="operator-eq"></a>QFutureIterator &amp; QFutureIterator::operator= ( const <a href="qfuture.html">QFuture</a>&lt;T&gt; &amp; <i>future</i> )</h3>
<p>Makes the iterator operate on <i>future</i>. The iterator is set to be at the front of the result list (before the first result).</p>
<p>See also <a href="qfutureiterator.html#toFront">toFront</a>() and <a href="qfutureiterator.html#toBack">toBack</a>().</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="40%" align="left">Copyright &copy; 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>