Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 28b9e36e96ce34b2567ae5b47a27b2c5 > files > 491

python-qt4-doc-4.10.3-3.mga4.noarch.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QAbstractFileEngineIterator Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QAbstractFileEngineIterator Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QAbstractFileEngineIterator class provides an iterator
interface for custom file engines. <a href="#details">More...</a></p>

<h3>Methods</h3><ul><li><div class="fn" /><b><a href="qabstractfileengineiterator.html#QAbstractFileEngineIterator">__init__</a></b> (<i>self</i>, QDir.Filters&#160;<i>filters</i>, QStringList&#160;<i>nameFilters</i>)</li><li><div class="fn" />QFileInfo <b><a href="qabstractfileengineiterator.html#currentFileInfo">currentFileInfo</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qabstractfileengineiterator.html#currentFileName">currentFileName</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qabstractfileengineiterator.html#currentFilePath">currentFilePath</a></b> (<i>self</i>)</li><li><div class="fn" />QDir.Filters <b><a href="qabstractfileengineiterator.html#filters">filters</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qabstractfileengineiterator.html#hasNext">hasNext</a></b> (<i>self</i>)</li><li><div class="fn" />QStringList <b><a href="qabstractfileengineiterator.html#nameFilters">nameFilters</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qabstractfileengineiterator.html#next">next</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qabstractfileengineiterator.html#path">path</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QAbstractFileEngineIterator class provides an iterator
interface for custom file engines.</p>
<p>If all you want is to iterate over entries in a directory, see
<a href="qdiriterator.html">QDirIterator</a> instead. This class is
only for custom file engine authors.</p>
<p>QAbstractFileEngineIterator is a unidirectional single-use
virtual iterator that plugs into <a href="qdiriterator.html">QDirIterator</a>, providing transparent proxy
iteration for custom file engines.</p>
<p>You can subclass QAbstractFileEngineIterator to provide an
iterator when writing your own file engine. To plug the iterator
into your file system, you simply return an instance of this
subclass from a reimplementation of <a href="qabstractfileengine.html#beginEntryList">QAbstractFileEngine.beginEntryList</a>().</p>
<p>Example:</p>
<pre class="cpp">
 <span class="type">QAbstractFileEngineIterator</span> <span class="operator">*</span>
 CustomFileEngine<span class="operator">.</span>beginEntryList(<span class="type"><a href="qdir.html">QDir</a></span><span class="operator">.</span>Filters filters<span class="operator">,</span> <span class="keyword">const</span> <span class="type"><a href="qstringlist.html">QStringList</a></span> <span class="operator">&amp;</span>filterNames)
 {
     <span class="keyword">return</span> <span class="keyword">new</span> CustomFileEngineIterator(filters<span class="operator">,</span> filterNames);
 }
</pre>
<p>QAbstractFileEngineIterator is associated with a path, name
filters, and entry filters. The path is the directory that the
iterator lists entries in. The name filters and entry filters are
provided for file engines that can optimize directory listing at
the iterator level (e.g., network file systems that need to
minimize network traffic), but they can also be ignored by the
iterator subclass; QAbstractFileEngineIterator already provides the
required filtering logics in the matchesFilters() function. You can
call dirName() to get the directory name, <a href="qabstractfileengineiterator.html#nameFilters">nameFilters</a>() to
get a stringlist of name filters, and <a href="qabstractfileengineiterator.html#filters">filters</a>() to get the
entry filters.</p>
<p>The pure virtual function <a href="qabstractfileengineiterator.html#hasNext">hasNext</a>() returns
true if the current directory has at least one more entry (i.e.,
the directory name is valid and accessible, and we have not reached
the end of the entry list), and false otherwise. Reimplement
<a href="qabstractfileengineiterator.html#next">next</a>() to seek
to the next entry.</p>
<p>The pure virtual function <a href="qabstractfileengineiterator.html#currentFileName">currentFileName</a>()
returns the name of the current entry without advancing the
iterator. The <a href="qabstractfileengineiterator.html#currentFilePath">currentFilePath</a>()
function is provided for convenience; it returns the full path of
the current entry.</p>
<p>Here is an example of how to implement an iterator that returns
each of three fixed entries in sequence.</p>
<pre class="cpp">
 <span class="keyword">class</span> CustomIterator : <span class="keyword">public</span> <span class="type">QAbstractFileEngineIterator</span>
 {
 <span class="keyword">public</span>:
     CustomIterator(<span class="keyword">const</span> <span class="type"><a href="qstringlist.html">QStringList</a></span> <span class="operator">&amp;</span>nameFilters<span class="operator">,</span> <span class="type"><a href="qdir.html">QDir</a></span><span class="operator">.</span>Filters filters)
         : <span class="type">QAbstractFileEngineIterator</span>(nameFilters<span class="operator">,</span> filters)<span class="operator">,</span> index(<span class="number">0</span>)
     {
         <span class="comment">// In a real iterator, these entries are fetched from the</span>
         <span class="comment">// file system based on the value of path().</span>
         entries <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">"entry1"</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">"entry2"</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">"entry3"</span>;
     }

     <span class="type">bool</span> hasNext() <span class="keyword">const</span>
     {
         <span class="keyword">return</span> index <span class="operator">&lt;</span> entries<span class="operator">.</span>size() <span class="operator">-</span> <span class="number">1</span>;
     }

     <span class="type"><a href="qstring.html">QString</a></span> next()
     {
        <span class="keyword">if</span> (<span class="operator">!</span>hasNext())
            <span class="keyword">return</span> <span class="type"><a href="qstring.html">QString</a></span>();
        <span class="operator">+</span><span class="operator">+</span>index;
        <span class="keyword">return</span> currentFilePath();
     }

     <span class="type"><a href="qstring.html">QString</a></span> currentFileName()
     {
         <span class="keyword">return</span> entries<span class="operator">.</span>at(index);
     }

 <span class="keyword">private</span>:
     <span class="type"><a href="qstringlist.html">QStringList</a></span> entries;
     <span class="type">int</span> index;
 };
</pre>
<p>Note: QAbstractFileEngineIterator does not deal with
QDir.IteratorFlags; it simply returns entries for a single
directory.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QAbstractFileEngineIterator" />QAbstractFileEngineIterator.__init__ (<i>self</i>, <a href="qdir-filters.html">QDir.Filters</a>&#160;<i>filters</i>, QStringList&#160;<i>nameFilters</i>)</h3><p>Constructs a <a href="qabstractfileengineiterator.html">QAbstractFileEngineIterator</a>,
using the entry filters <i>filters</i>, and wildcard name filters
<i>nameFilters</i>.</p>


<h3 class="fn"><a name="currentFileInfo" /><a href="qfileinfo.html">QFileInfo</a> QAbstractFileEngineIterator.currentFileInfo (<i>self</i>)</h3><p>The virtual function returns a <a href="qfileinfo.html">QFileInfo</a> for the current directory entry.
This function is provided for convenience. It can also be slightly
faster than creating a <a href="qfileinfo.html">QFileInfo</a>
object yourself, as the object returned by this function might
contain cached information that <a href="qfileinfo.html">QFileInfo</a> otherwise would have to access
through the file engine.</p>
<p><b>See also</b> <a href="qabstractfileengineiterator.html#currentFileName">currentFileName</a>().</p>


<h3 class="fn"><a name="currentFileName" />QString QAbstractFileEngineIterator.currentFileName (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>This pure virtual function returns the name of the current
directory entry, excluding the path.</p>
<p><b>See also</b> <a href="qabstractfileengineiterator.html#currentFilePath">currentFilePath</a>().</p>


<h3 class="fn"><a name="currentFilePath" />QString QAbstractFileEngineIterator.currentFilePath (<i>self</i>)</h3><p>Returns the path to the current directory entry. It's the same
as prepending <a href="qabstractfileengineiterator.html#pathx">path</a>() to the return
value of <a href="qabstractfileengineiterator.html#currentFileName">currentFileName</a>().</p>
<p><b>See also</b> <a href="qabstractfileengineiterator.html#currentFileName">currentFileName</a>().</p>


<h3 class="fn"><a name="filters" /><a href="qdir-filters.html">QDir.Filters</a> QAbstractFileEngineIterator.filters (<i>self</i>)</h3><p>Returns the entry filters for this iterator.</p>
<p><b>See also</b> <a href="qdir.html#filter">QDir.filter</a>(),
<a href="qabstractfileengineiterator.html#nameFilters">nameFilters</a>(),
and <a href="qabstractfileengineiterator.html#pathx">path</a>().</p>


<h3 class="fn"><a name="hasNext" />bool QAbstractFileEngineIterator.hasNext (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>This pure virtual function returns true if there is at least one
more entry in the current directory (i.e., the iterator path is
valid and accessible, and the iterator has not reached the end of
the entry list).</p>
<p><b>See also</b> <a href="qdiriterator.html#hasNext">QDirIterator.hasNext</a>().</p>


<h3 class="fn"><a name="nameFilters" />QStringList QAbstractFileEngineIterator.nameFilters (<i>self</i>)</h3><p>Returns the name filters for this iterator.</p>
<p><b>See also</b> <a href="qdir.html#nameFilters">QDir.nameFilters</a>(), <a href="qabstractfileengineiterator.html#filters">filters</a>(), and
<a href="qabstractfileengineiterator.html#pathx">path</a>().</p>


<h3 class="fn"><a name="next" />QString QAbstractFileEngineIterator.next (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>This pure virtual function advances the iterator to the next
directory entry, and returns the file path to the current
entry.</p>
<p>This function can optionally make use of <a href="qabstractfileengineiterator.html#nameFilters">nameFilters</a>()
and <a href="qabstractfileengineiterator.html#filters">filters</a>() to
optimize its performance.</p>
<p>Reimplement this function in a subclass to advance the
iterator.</p>
<p><b>See also</b> <a href="qdiriterator.html#next">QDirIterator.next</a>().</p>


<h3 class="fn"><a name="path" />QString QAbstractFileEngineIterator.path (<i>self</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.10.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.5</td></tr></table></div></address></body></html>