Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > 1dd17e0d683ef79b4bb6872bbf359d7f > files > 4774

qt4-doc-4.8.7-26.2.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qabstractfileengine.cpp -->
  <title>Qt 4.8: QAbstractFileEngineIterator Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  <script src="scripts/jquery.js" type="text/javascript"></script>
  <script src="scripts/functions.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />
  <!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->

<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>

</head>
<body class="" onload="CheckEmptyAndLoadList();">
 <div class="header" id="qtdocheader">
    <div class="content"> 
    <div id="nav-logo">
      <a href="index.html">Home</a></div>
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
    <div id="narrowsearch"></div>
    <div id="nav-topright">
      <ul>
        <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
        <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
        <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
          DOC</a></li>
        <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
      </ul>
    </div>
    <div id="shortCut">
      <ul>
        <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
        <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS        </a></li>
      </ul>
     </div>
 <ul class="sf-menu" id="narrowmenu"> 
             <li><a href="#">API Lookup</a> 
                 <ul> 
                     <li><a href="classes.html">Class index</a></li> 
           <li><a href="functions.html">Function index</a></li> 
           <li><a href="modules.html">Modules</a></li> 
           <li><a href="namespaces.html">Namespaces</a></li> 
           <li><a href="qtglobal.html">Global Declarations</a></li> 
           <li><a href="qdeclarativeelements.html">QML elements</a></li> 
             </ul> 
             </li> 
             <li><a href="#">Qt Topics</a> 
                 <ul> 
                        <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>  
                        <li><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li>  
                        <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>  
                        <li><a href="supported-platforms.html">Supported Platforms</a></li>  
                        <li><a href="technology-apis.html">Qt and Key Technologies</a></li>  
                        <li><a href="best-practices.html">How-To's and Best Practices</a></li>  
              </ul> 
                 </li> 
                 <li><a href="#">Examples</a> 
                     <ul> 
                       <li><a href="all-examples.html">Examples</a></li> 
                       <li><a href="tutorials.html">Tutorials</a></li> 
                       <li><a href="demos.html">Demos</a></li> 
                       <li><a href="qdeclarativeexamples.html">QML Examples</a></li> 
                </ul> 
                     </li> 
                 </ul> 
    </div>
  </div>
  <div class="wrapper">
    <div class="hd">
      <span></span>
    </div>
    <div class="bd group">
      <div class="sidebar">
        <div class="searchlabel">
          Search index:</div>
        <div class="search" id="sidebarsearch">
          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />
 <div id="resultdialog"> 
 <a href="#" id="resultclose">Close</a> 
 <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> 
 <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span>&nbsp;results:</p> 
 <ul id="resultlist" class="all"> 
 </ul> 
 </div> 
            </fieldset>
          </form>
        </div>
        <div class="box first bottombar" id="lookup">
          <h2 title="API Lookup"><span></span>
            API Lookup</h2>
          <div  id="list001" class="list">
          <ul id="ul001" >
              <li class="defaultLink"><a href="classes.html">Class index</a></li>
              <li class="defaultLink"><a href="functions.html">Function index</a></li>
              <li class="defaultLink"><a href="modules.html">Modules</a></li>
              <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
              <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
              <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
            </ul> 
          </div>
        </div>
        <div class="box bottombar" id="topics">
          <h2 title="Qt Topics"><span></span>
            Qt Topics</h2>
          <div id="list002" class="list">
            <ul id="ul002" >
               <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> 
               <li class="defaultLink"><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li> 
               <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> 
               <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>  
               <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> 
               <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> 
            </ul>  
          </div>
        </div>
        <div class="box" id="examples">
          <h2 title="Examples"><span></span>
            Examples</h2>
          <div id="list003" class="list">
        <ul id="ul003">
              <li class="defaultLink"><a href="all-examples.html">Examples</a></li>
              <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
              <li class="defaultLink"><a href="demos.html">Demos</a></li>
              <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
            </ul> 
          </div>
        </div>
      </div>
      <div class="wrap">
        <div class="toolbar">
          <div class="breadcrumb toolblock">
            <ul>
              <li class="first"><a href="index.html">Home</a></li>
              <!--  Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtcore.html">QtCore</a></li>
<li>QAbstractFileEngineIterator</li>
            </ul>
          </div>
          <div class="toolbuttons toolblock">
            <ul>
              <li id="smallA" class="t_button">A</li>
              <li id="medA" class="t_button active">A</li>
              <li id="bigA" class="t_button">A</li>
              <li id="print" class="t_button"><a href="javascript:this.print();">
                <span>Print</span></a></li>
            </ul>
        </div>
        </div>
        <div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QAbstractFileEngineIterator Class Reference</h1>
<!-- $$$QAbstractFileEngineIterator-brief -->
<p>The QAbstractFileEngineIterator class provides an iterator interface for custom file engines. <a href="#details">More...</a></p>
<!-- @@@QAbstractFileEngineIterator -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QAbstractFileEngineIterator&gt;</span></pre><p>This class was introduced in Qt 4.3.</p>
<ul>
<li><a href="qabstractfileengineiterator-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qabstractfileengineiterator.html#QAbstractFileEngineIterator">QAbstractFileEngineIterator</a></b> ( QDir::Filters <i>filters</i>, const QStringList &amp; <i>nameFilters</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qabstractfileengineiterator.html#dtor.QAbstractFileEngineIterator">~QAbstractFileEngineIterator</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QFileInfo </td><td class="memItemRight bottomAlign"><b><a href="qabstractfileengineiterator.html#currentFileInfo">currentFileInfo</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QString </td><td class="memItemRight bottomAlign"><b><a href="qabstractfileengineiterator.html#currentFileName">currentFileName</a></b> () const = 0</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qabstractfileengineiterator.html#currentFilePath">currentFilePath</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDir::Filters </td><td class="memItemRight bottomAlign"><b><a href="qabstractfileengineiterator.html#filters">filters</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qabstractfileengineiterator.html#hasNext">hasNext</a></b> () const = 0</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringList </td><td class="memItemRight bottomAlign"><b><a href="qabstractfileengineiterator.html#nameFilters">nameFilters</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QString </td><td class="memItemRight bottomAlign"><b><a href="qabstractfileengineiterator.html#next">next</a></b> () = 0</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qabstractfileengineiterator.html#path">path</a></b> () const</td></tr>
</table>
<a name="details"></a>
<!-- $$$QAbstractFileEngineIterator-description -->
<div class="descr">
<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&#x2e;, 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&#x2e;, 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">&quot;entry1&quot;</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;entry2&quot;</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;entry3&quot;</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>
</div>
<p><b>See also </b><a href="qdiriterator.html">QDirIterator</a>.</p>
<!-- @@@QAbstractFileEngineIterator -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QAbstractFileEngineIterator[overload1]$$$QAbstractFileEngineIteratorQDir::FiltersconstQStringList& -->
<h3 class="fn"><a name="QAbstractFileEngineIterator"></a>QAbstractFileEngineIterator::<span class="name">QAbstractFileEngineIterator</span> ( <span class="type"><a href="qdir.html#Filter-enum">QDir::Filters</a></span> <i>filters</i>, const <span class="type"><a href="qstringlist.html">QStringList</a></span> &amp; <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>
<!-- @@@QAbstractFileEngineIterator -->
<!-- $$$~QAbstractFileEngineIterator[overload1]$$$~QAbstractFileEngineIterator -->
<h3 class="fn"><a name="dtor.QAbstractFileEngineIterator"></a>QAbstractFileEngineIterator::<span class="name">~QAbstractFileEngineIterator</span> ()<tt> [virtual]</tt></h3>
<p>Destroys the <a href="qabstractfileengineiterator.html">QAbstractFileEngineIterator</a>.</p>
<p><b>See also </b><a href="qdiriterator.html">QDirIterator</a>.</p>
<!-- @@@~QAbstractFileEngineIterator -->
<!-- $$$currentFileInfo[overload1]$$$currentFileInfo -->
<h3 class="fn"><a name="currentFileInfo"></a><span class="type"><a href="qfileinfo.html">QFileInfo</a></span> QAbstractFileEngineIterator::<span class="name">currentFileInfo</span> () const<tt> [virtual]</tt></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>
<!-- @@@currentFileInfo -->
<!-- $$$currentFileName[overload1]$$$currentFileName -->
<h3 class="fn"><a name="currentFileName"></a><span class="type"><a href="qstring.html">QString</a></span> QAbstractFileEngineIterator::<span class="name">currentFileName</span> () const<tt> [pure virtual]</tt></h3>
<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>
<!-- @@@currentFileName -->
<!-- $$$currentFilePath[overload1]$$$currentFilePath -->
<h3 class="fn"><a name="currentFilePath"></a><span class="type"><a href="qstring.html">QString</a></span> QAbstractFileEngineIterator::<span class="name">currentFilePath</span> () const</h3>
<p>Returns the path to the current directory entry. It's the same as prepending <a href="qabstractfileengineiterator.html#path">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>
<!-- @@@currentFilePath -->
<!-- $$$filters[overload1]$$$filters -->
<h3 class="fn"><a name="filters"></a><span class="type"><a href="qdir.html#Filter-enum">QDir::Filters</a></span> QAbstractFileEngineIterator::<span class="name">filters</span> () const</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#path">path</a>().</p>
<!-- @@@filters -->
<!-- $$$hasNext[overload1]$$$hasNext -->
<h3 class="fn"><a name="hasNext"></a><span class="type">bool</span> QAbstractFileEngineIterator::<span class="name">hasNext</span> () const<tt> [pure virtual]</tt></h3>
<p>This pure virtual function returns true if there is at least one more entry in the current directory (i.e&#x2e;, 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>
<!-- @@@hasNext -->
<!-- $$$nameFilters[overload1]$$$nameFilters -->
<h3 class="fn"><a name="nameFilters"></a><span class="type"><a href="qstringlist.html">QStringList</a></span> QAbstractFileEngineIterator::<span class="name">nameFilters</span> () const</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#path">path</a>().</p>
<!-- @@@nameFilters -->
<!-- $$$next[overload1]$$$next -->
<h3 class="fn"><a name="next"></a><span class="type"><a href="qstring.html">QString</a></span> QAbstractFileEngineIterator::<span class="name">next</span> ()<tt> [pure virtual]</tt></h3>
<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>
<!-- @@@next -->
<!-- $$$path[overload1]$$$path -->
<h3 class="fn"><a name="path"></a><span class="type"><a href="qstring.html">QString</a></span> QAbstractFileEngineIterator::<span class="name">path</span> () const</h3>
<p>Returns the path for this iterator. <a href="qdiriterator.html">QDirIterator</a> is responsible for assigning this path; it cannot change during the iterator's lifetime.</p>
<p><b>See also </b><a href="qabstractfileengineiterator.html#nameFilters">nameFilters</a>() and <a href="qabstractfileengineiterator.html#filters">filters</a>().</p>
<!-- @@@path -->
</div>
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2015 The Qt Company Ltd.
      Documentation contributions included herein are the copyrights of
      their respective owners.</p>
    <br />
    <p>
      The documentation provided herein is licensed under the terms of the
      <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
      License version 1.3</a> as published by the Free Software Foundation.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      Qt and respective logos are trademarks of The Qt Company Ltd 
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
  </div>

  <script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>