Sophie

Sophie

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

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" />
<!-- q3ptrlist.qdoc -->
  <title>Qt 4.8: Q3PtrList 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>Qt3SupportLight</li>
<li>Q3PtrList</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="#protected-functions">Protected Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">Q3PtrList Class Reference</h1>
<!-- $$$Q3PtrList-brief -->
<p>The Q3PtrList class is a template class that provides a list. <a href="#details">More...</a></p>
<!-- @@@Q3PtrList -->
<pre class="cpp"> <span class="preprocessor">#include &lt;Q3PtrList&gt;</span></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>
<p><b>Inherits: </b><a href="q3ptrcollection.html">Q3PtrCollection</a>.</p>
<p><b>Inherited by: </b><a href="q3strlist.html">Q3StrList</a>.</p>
<ul>
<li><a href="q3ptrlist-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="q3ptrlist.html#Q3PtrList">Q3PtrList</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#Q3PtrList-2">Q3PtrList</a></b> ( const Q3PtrList&lt;type&gt; &amp; <i>list</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#dtor.Q3PtrList">~Q3PtrList</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#append">append</a></b> ( const type * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> type * </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#at">at</a></b> ( uint <i>index</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#at-2">at</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> uint </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#contains">contains</a></b> ( const type * <i>item</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> uint </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#containsRef">containsRef</a></b> ( const type * <i>item</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> type * </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#current">current</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Q3LNode * </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#currentNode">currentNode</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#find">find</a></b> ( const type * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#findNext">findNext</a></b> ( const type * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#findNextRef">findNextRef</a></b> ( const type * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#findRef">findRef</a></b> ( const type * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> type * </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#first">first</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> type * </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#getFirst">getFirst</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> type * </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#getLast">getLast</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#inSort">inSort</a></b> ( const type * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#insert">insert</a></b> ( uint <i>index</i>, const type * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#isEmpty">isEmpty</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> type * </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#last">last</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> type * </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#next">next</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#prepend">prepend</a></b> ( const type * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> type * </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#prev">prev</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#remove">remove</a></b> ( uint <i>index</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#remove-2">remove</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#remove-3">remove</a></b> ( const type * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#removeFirst">removeFirst</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#removeLast">removeLast</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#removeNode">removeNode</a></b> ( Q3LNode * <i>node</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#removeRef">removeRef</a></b> ( const type * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#replace">replace</a></b> ( uint <i>index</i>, const type * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#sort">sort</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> type * </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#take">take</a></b> ( uint <i>index</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> type * </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#take-2">take</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> type * </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#takeNode">takeNode</a></b> ( Q3LNode * <i>node</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#toVector">toVector</a></b> ( Q3GVector * <i>vec</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#operator-not-eq">operator!=</a></b> ( const Q3PtrList&lt;type&gt; &amp; <i>list</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Q3PtrList&lt;type&gt; &amp; </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#operator-eq">operator=</a></b> ( const Q3PtrList&lt;type&gt; &amp; <i>list</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#operator-eq-eq">operator==</a></b> ( const Q3PtrList&lt;type&gt; &amp; <i>list</i> ) const</td></tr>
</table>
<a name="reimplemented-public-functions"></a>
<h2>Reimplemented Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#clear">clear</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual uint </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#count">count</a></b> () const</td></tr>
</table>
<ul>
<li class="fn">4 public functions inherited from <a href="q3ptrcollection.html#public-functions">Q3PtrCollection</a></li>
</ul>
<a name="protected-functions"></a>
<h2>Protected Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#compareItems">compareItems</a></b> ( Q3PtrCollection::Item <i>item1</i>, Q3PtrCollection::Item <i>item2</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QDataStream &amp; </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#read">read</a></b> ( QDataStream &amp; <i>s</i>, Q3PtrCollection::Item &amp; <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QDataStream &amp; </td><td class="memItemRight bottomAlign"><b><a href="q3ptrlist.html#write">write</a></b> ( QDataStream &amp; <i>s</i>, Q3PtrCollection::Item <i>item</i> ) const</td></tr>
</table>
<ul>
<li class="fn">2 protected functions inherited from <a href="q3ptrcollection.html#protected-functions">Q3PtrCollection</a></li>
</ul>
<a name="details"></a>
<!-- $$$Q3PtrList-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The Q3PtrList class is a template class that provides a list.</p>
<p><a href="q3valuelist.html">Q3ValueList</a> is an STL-compatible alternative to this class.</p>
<p>Define a template instance Q3PtrList&lt;X&gt; to create a list that operates on pointers to X (X*).</p>
<p>The list class is indexable and has a <a href="q3ptrlist.html#at">current index</a> and a <a href="q3ptrlist.html#current">current item</a>. The first item corresponds to index position 0. The current index is -1 if the current item is 0.</p>
<p>Items are inserted with <a href="q3ptrlist.html#prepend">prepend</a>(), <a href="q3ptrlist.html#insert">insert</a>() or <a href="q3ptrlist.html#append">append</a>(). Items are removed with <a href="q3ptrlist.html#remove">remove</a>(), <a href="q3ptrlist.html#removeRef">removeRef</a>(), <a href="q3ptrlist.html#removeFirst">removeFirst</a>() and <a href="q3ptrlist.html#removeLast">removeLast</a>(). You can search for an item using <a href="q3ptrlist.html#find">find</a>(), <a href="q3ptrlist.html#findNext">findNext</a>(), <a href="q3ptrlist.html#findRef">findRef</a>() or <a href="q3ptrlist.html#findNextRef">findNextRef</a>(). The list can be sorted with <a href="q3ptrlist.html#sort">sort</a>(). You can count the number of occurrences of an item with <a href="q3ptrlist.html#contains">contains</a>() or <a href="q3ptrlist.html#containsRef">containsRef</a>(). You can get a pointer to the current item with <a href="q3ptrlist.html#current">current</a>(), to an item at a particular index position in the list with <a href="q3ptrlist.html#at">at</a>() or to the first or last item with <a href="q3ptrlist.html#getFirst">getFirst</a>() and <a href="q3ptrlist.html#getLast">getLast</a>(). You can also iterate over the list with <a href="q3ptrlist.html#first">first</a>(), <a href="q3ptrlist.html#last">last</a>(), <a href="q3ptrlist.html#next">next</a>() and <a href="q3ptrlist.html#prev">prev</a>() (which all update <a href="q3ptrlist.html#current">current</a>()). The list's deletion property is set with <a href="q3ptrcollection.html#setAutoDelete">setAutoDelete</a>().</p>
<a name="example"></a><p>Example:</p>
<pre class="cpp"> <span class="keyword">class</span> Employee
 {
 <span class="keyword">public</span>:
     Employee() : sn( <span class="number">0</span> ) { }
     Employee( <span class="keyword">const</span> <span class="type"><a href="qstring.html">QString</a></span><span class="operator">&amp;</span> forename<span class="operator">,</span> <span class="keyword">const</span> <span class="type"><a href="qstring.html">QString</a></span><span class="operator">&amp;</span> surname<span class="operator">,</span> <span class="type">int</span> salary )
         : fn( forename )<span class="operator">,</span> sn( surname )<span class="operator">,</span> sal( salary )
     { }

     <span class="type">void</span> setSalary( <span class="type">int</span> salary ) { sal <span class="operator">=</span> salary; }

     <span class="type"><a href="qstring.html">QString</a></span> forename() <span class="keyword">const</span> { <span class="keyword">return</span> fn; }
     <span class="type"><a href="qstring.html">QString</a></span> surname() <span class="keyword">const</span> { <span class="keyword">return</span> sn; }
     <span class="type">int</span> salary() <span class="keyword">const</span> { <span class="keyword">return</span> sal; }

 <span class="keyword">private</span>:
     <span class="type"><a href="qstring.html">QString</a></span> fn;
     <span class="type"><a href="qstring.html">QString</a></span> sn;
     <span class="type">int</span> sal;
 };

 <span class="type">Q3PtrList</span><span class="operator">&lt;</span>Employee<span class="operator">&gt;</span> list;
 list<span class="operator">.</span><a href="q3ptrcollection.html#setAutoDelete">setAutoDelete</a>( TRUE ); <span class="comment">// the list owns the objects</span>

 list<span class="operator">.</span><a href="q3ptrlist.html#append">append</a>( <span class="keyword">new</span> Employee(<span class="string">&quot;John&quot;</span><span class="operator">,</span> <span class="string">&quot;Doe&quot;</span><span class="operator">,</span> <span class="number">50000</span>) );
 list<span class="operator">.</span><a href="q3ptrlist.html#append">append</a>( <span class="keyword">new</span> Employee(<span class="string">&quot;Jane&quot;</span><span class="operator">,</span> <span class="string">&quot;Williams&quot;</span><span class="operator">,</span> <span class="number">80000</span>) );
 list<span class="operator">.</span><a href="q3ptrlist.html#append">append</a>( <span class="keyword">new</span> Employee(<span class="string">&quot;Tom&quot;</span><span class="operator">,</span> <span class="string">&quot;Jones&quot;</span><span class="operator">,</span> <span class="number">60000</span>) );

 Employee <span class="operator">*</span>employee;
 <span class="keyword">for</span> ( employee <span class="operator">=</span> list<span class="operator">.</span>first(); employee; employee <span class="operator">=</span> list<span class="operator">.</span>next() )
     cout <span class="operator">&lt;</span><span class="operator">&lt;</span> employee<span class="operator">-</span><span class="operator">&gt;</span>surname()<span class="operator">.</span>latin1() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;, &quot;</span> <span class="operator">&lt;</span><span class="operator">&lt;</span>
             employee<span class="operator">-</span><span class="operator">&gt;</span>forename()<span class="operator">.</span>latin1() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot; earns &quot;</span> <span class="operator">&lt;</span><span class="operator">&lt;</span>
             employee<span class="operator">-</span><span class="operator">&gt;</span>salary() <span class="operator">&lt;</span><span class="operator">&lt;</span> endl;
 cout <span class="operator">&lt;</span><span class="operator">&lt;</span> endl;

 <span class="comment">// very inefficient for big lists</span>
 <span class="keyword">for</span> ( <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> i <span class="operator">=</span> <span class="number">0</span>; i <span class="operator">&lt;</span> list<span class="operator">.</span>count(); <span class="operator">+</span><span class="operator">+</span>i )
     <span class="keyword">if</span> ( list<span class="operator">.</span>at(i) )
         cout <span class="operator">&lt;</span><span class="operator">&lt;</span> list<span class="operator">.</span><a href="q3ptrlist.html#at">at</a>( i )<span class="operator">-</span><span class="operator">&gt;</span>surname()<span class="operator">.</span>latin1() <span class="operator">&lt;</span><span class="operator">&lt;</span> endl;</pre>
<p>The output is</p>
<pre class="cpp"> Doe<span class="operator">,</span> John earns <span class="number">50000</span>
 Williams<span class="operator">,</span> Jane earns <span class="number">80000</span>
 Jones<span class="operator">,</span> Tom earns <span class="number">60000</span>

 Doe
 Williams
 Jones</pre>
<p>Q3PtrList has several member functions for traversing the list, but using a <a href="q3ptrlistiterator.html">Q3PtrListIterator</a> can be more practical. Multiple list iterators may traverse the same list, independently of each other and of the current list item.</p>
<p>In the example above we make the call setAutoDelete(true). Enabling auto-deletion tells the list to delete items that are removed. The default is to not delete items when they are removed but this would cause a memory leak in the example because there are no other references to the list items.</p>
<p>When inserting an item into a list only the pointer is copied, not the item itself, i.e&#x2e; a shallow copy. It is possible to make the list copy all of the item's data (deep copy) when an item is inserted. <a href="q3ptrlist.html#insert">insert</a>(), <a href="q3ptrlist.html#inSort">inSort</a>() and <a href="q3ptrlist.html#append">append</a>() call the virtual function <a href="q3ptrcollection.html#newItem">Q3PtrCollection::newItem</a>() for the item to be inserted. Inherit a list and reimplement <a href="q3ptrcollection.html#newItem">newItem</a>() to have deep copies.</p>
<p>When removing an item from a list, the virtual function <a href="q3ptrcollection.html#deleteItem">Q3PtrCollection::deleteItem</a>() is called. Q3PtrList's default implementation is to delete the item if auto-deletion is enabled.</p>
<p>The virtual function <a href="q3ptrlist.html#compareItems">compareItems</a>() can be reimplemented to compare two list items. This function is called from all list functions that need to compare list items, for instance remove(const type*). If you only want to deal with pointers, there are functions that compare pointers instead, for instance removeRef(const type*). These functions are somewhat faster than those that call <a href="q3ptrlist.html#compareItems">compareItems</a>().</p>
<p>List items are stored as <tt>void*</tt> in an internal Q3LNode, which also holds pointers to the next and previous list items. The functions <a href="q3ptrlist.html#currentNode">currentNode</a>(), <a href="q3ptrlist.html#removeNode">removeNode</a>(), and <a href="q3ptrlist.html#takeNode">takeNode</a>() operate directly on the Q3LNode, but they should be used with care. The data component of the node is available through Q3LNode's getData() function.</p>
<p>The <a href="q3strlist.html">Q3StrList</a> class is a list of <tt>char*</tt>. It reimplements <a href="q3ptrcollection.html#newItem">newItem</a>(), <a href="q3ptrcollection.html#deleteItem">deleteItem</a>() and <a href="q3ptrlist.html#compareItems">compareItems</a>(). (But see <a href="qstringlist.html">QStringList</a> for a list of Unicode QStrings.)</p>
</div>
<p><b>See also </b><a href="q3ptrlistiterator.html">Q3PtrListIterator</a>.</p>
<!-- @@@Q3PtrList -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$Q3PtrList[overload1]$$$Q3PtrList -->
<h3 class="fn"><a name="Q3PtrList"></a>Q3PtrList::<span class="name">Q3PtrList</span> ()</h3>
<p>Constructs an empty list.</p>
<!-- @@@Q3PtrList -->
<!-- $$$Q3PtrList$$$Q3PtrListconstQ3PtrList<type>& -->
<h3 class="fn"><a name="Q3PtrList-2"></a>Q3PtrList::<span class="name">Q3PtrList</span> ( const <span class="type">Q3PtrList</span>&lt;<span class="type">type</span>&gt; &amp; <i>list</i> )</h3>
<p>Constructs a copy of <i>list</i>.</p>
<p>Each item in <i>list</i> is <a href="q3ptrlist.html#append">appended</a> to this list. Only the pointers are copied (shallow copy).</p>
<!-- @@@Q3PtrList -->
<!-- $$$~Q3PtrList[overload1]$$$~Q3PtrList -->
<h3 class="fn"><a name="dtor.Q3PtrList"></a>Q3PtrList::<span class="name">~Q3PtrList</span> ()</h3>
<p>Removes all items from the list and destroys the list.</p>
<p>All list iterators that access this list will be reset.</p>
<p><b>See also </b><a href="q3ptrcollection.html#setAutoDelete">setAutoDelete</a>().</p>
<!-- @@@~Q3PtrList -->
<!-- $$$append[overload1]$$$appendconsttype* -->
<h3 class="fn"><a name="append"></a><span class="type">void</span> Q3PtrList::<span class="name">append</span> ( const <span class="type">type</span> * <i>item</i> )</h3>
<p>Inserts the <i>item</i> at the end of the list.</p>
<p>The inserted item becomes the current list item. This is equivalent to <tt>insert( count(), item )</tt>.</p>
<p><i>item</i> must not be 0.</p>
<p><b>See also </b><a href="q3ptrlist.html#insert">insert</a>(), <a href="q3ptrlist.html#current">current</a>(), and <a href="q3ptrlist.html#prepend">prepend</a>().</p>
<!-- @@@append -->
<!-- $$$at[overload1]$$$atuint -->
<h3 class="fn"><a name="at"></a><span class="type">type</span> * Q3PtrList::<span class="name">at</span> ( <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> <i>index</i> )</h3>
<p>Returns a pointer to the item at position <i>index</i> in the list, or 0 if the index is out of range.</p>
<p>Sets the current list item to this item if <i>index</i> is valid. The valid range is <tt>0..(count() - 1)</tt> inclusive.</p>
<p>This function is very efficient. It starts scanning from the first item, last item, or current item, whichever is closest to <i>index</i>.</p>
<p><b>See also </b><a href="q3ptrlist.html#current">current</a>().</p>
<!-- @@@at -->
<!-- $$$at$$$at -->
<h3 class="fn"><a name="at-2"></a><span class="type">int</span> Q3PtrList::<span class="name">at</span> () const</h3>
<p>This is an overloaded function.</p>
<p>Returns the index of the current list item. The returned value is -1 if the current item is 0.</p>
<p><b>See also </b><a href="q3ptrlist.html#current">current</a>().</p>
<!-- @@@at -->
<!-- $$$clear[overload1]$$$clear -->
<h3 class="fn"><a name="clear"></a><span class="type">void</span> Q3PtrList::<span class="name">clear</span> ()<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="q3ptrcollection.html#clear">Q3PtrCollection::clear</a>().</p>
<p>Removes all items from the list.</p>
<p>The removed items are deleted if <a href="q3ptrcollection.html#setAutoDelete">auto-deletion</a> is enabled.</p>
<p>All list iterators that access this list will be reset.</p>
<p><b>See also </b><a href="q3ptrlist.html#remove">remove</a>(), <a href="q3ptrlist.html#take">take</a>(), and <a href="q3ptrcollection.html#setAutoDelete">setAutoDelete</a>().</p>
<!-- @@@clear -->
<!-- $$$compareItems[overload1]$$$compareItemsQ3PtrCollection::ItemQ3PtrCollection::Item -->
<h3 class="fn"><a name="compareItems"></a><span class="type">int</span> Q3PtrList::<span class="name">compareItems</span> ( <span class="type"><a href="q3ptrcollection.html#Item-typedef">Q3PtrCollection::Item</a></span> <i>item1</i>, <span class="type"><a href="q3ptrcollection.html#Item-typedef">Q3PtrCollection::Item</a></span> <i>item2</i> )<tt> [virtual protected]</tt></h3>
<p>This virtual function compares two list items.</p>
<p>Returns:</p>
<ul>
<li>zero if <i>item1</i> == <i>item2</i></li>
<li>nonzero if <i>item1</i> != <i>item2</i></li>
</ul>
<p>This function returns <i>int</i> rather than <i>bool</i> so that reimplementations can return three values and use it to sort by:</p>
<ul>
<li>0 if <i>item1</i> == <i>item2</i></li>
<li>&gt; 0 (positive integer) if <i>item1</i> &gt; <i>item2</i></li>
<li>&lt; 0 (negative integer) if <i>item1</i> &lt; <i>item2</i></li>
</ul>
<p><a href="q3ptrlist.html#inSort">inSort</a>() requires that compareItems() is implemented as described here.</p>
<p>This function should not modify the list because some const functions call compareItems().</p>
<p>The default implementation compares the pointers.</p>
<!-- @@@compareItems -->
<!-- $$$contains[overload1]$$$containsconsttype* -->
<h3 class="fn"><a name="contains"></a><span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> Q3PtrList::<span class="name">contains</span> ( const <span class="type">type</span> * <i>item</i> ) const</h3>
<p>Returns the number of occurrences of <i>item</i> in the list.</p>
<p>The <a href="q3ptrlist.html#compareItems">compareItems</a>() function is called when looking for the <i>item</i> in the list. If <a href="q3ptrlist.html#compareItems">compareItems</a>() is not reimplemented, it is more efficient to call <a href="q3ptrlist.html#containsRef">containsRef</a>().</p>
<p>This function does not affect the current list item.</p>
<p><b>See also </b><a href="q3ptrlist.html#containsRef">containsRef</a>() and <a href="q3ptrlist.html#compareItems">compareItems</a>().</p>
<!-- @@@contains -->
<!-- $$$containsRef[overload1]$$$containsRefconsttype* -->
<h3 class="fn"><a name="containsRef"></a><span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> Q3PtrList::<span class="name">containsRef</span> ( const <span class="type">type</span> * <i>item</i> ) const</h3>
<p>Returns the number of occurrences of <i>item</i> in the list.</p>
<p>Calling this function is much faster than <a href="q3ptrlist.html#contains">contains</a>() because <a href="q3ptrlist.html#contains">contains</a>() compares <i>item</i> with each list item using <a href="q3ptrlist.html#compareItems">compareItems</a>(), whereas his function only compares the pointers.</p>
<p>This function does not affect the current list item.</p>
<p><b>See also </b><a href="q3ptrlist.html#contains">contains</a>().</p>
<!-- @@@containsRef -->
<!-- $$$count[overload1]$$$count -->
<h3 class="fn"><a name="count"></a><span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> Q3PtrList::<span class="name">count</span> () const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="q3ptrcollection.html#count">Q3PtrCollection::count</a>().</p>
<p>Returns the number of items in the list.</p>
<p><b>See also </b><a href="q3ptrlist.html#isEmpty">isEmpty</a>().</p>
<!-- @@@count -->
<!-- $$$current[overload1]$$$current -->
<h3 class="fn"><a name="current"></a><span class="type">type</span> * Q3PtrList::<span class="name">current</span> () const</h3>
<p>Returns a pointer to the current list item. The current item may be 0 (implies that the current index is -1).</p>
<p><b>See also </b><a href="q3ptrlist.html#at">at</a>().</p>
<!-- @@@current -->
<!-- $$$currentNode[overload1]$$$currentNode -->
<h3 class="fn"><a name="currentNode"></a><span class="type">Q3LNode</span> * Q3PtrList::<span class="name">currentNode</span> () const</h3>
<p>Returns a pointer to the current list node.</p>
<p>The node can be kept and removed later using <a href="q3ptrlist.html#removeNode">removeNode</a>(). The advantage is that the item can be removed directly without searching the list.</p>
<p><b>Warning:</b> Do not call this function unless you are an expert.</p>
<p><b>See also </b><a href="q3ptrlist.html#removeNode">removeNode</a>(), <a href="q3ptrlist.html#takeNode">takeNode</a>(), and <a href="q3ptrlist.html#current">current</a>().</p>
<!-- @@@currentNode -->
<!-- $$$find[overload1]$$$findconsttype* -->
<h3 class="fn"><a name="find"></a><span class="type">int</span> Q3PtrList::<span class="name">find</span> ( const <span class="type">type</span> * <i>item</i> )</h3>
<p>Finds the first occurrence of <i>item</i> in the list.</p>
<p>If the item is found, the list sets the current item to point to the found item and returns the index of this item. If the item is not found, the list sets the current item to 0, the current index to -1, and returns -1.</p>
<p>The <a href="q3ptrlist.html#compareItems">compareItems</a>() function is called when searching for the item in the list. If <a href="q3ptrlist.html#compareItems">compareItems</a>() is not reimplemented, it is more efficient to call <a href="q3ptrlist.html#findRef">findRef</a>().</p>
<p><b>See also </b><a href="q3ptrlist.html#findNext">findNext</a>(), <a href="q3ptrlist.html#findRef">findRef</a>(), <a href="q3ptrlist.html#compareItems">compareItems</a>(), and <a href="q3ptrlist.html#current">current</a>().</p>
<!-- @@@find -->
<!-- $$$findNext[overload1]$$$findNextconsttype* -->
<h3 class="fn"><a name="findNext"></a><span class="type">int</span> Q3PtrList::<span class="name">findNext</span> ( const <span class="type">type</span> * <i>item</i> )</h3>
<p>Finds the next occurrence of <i>item</i> in the list, starting from the current list item.</p>
<p>If the item is found, the list sets the current item to point to the found item and returns the index of this item. If the item is not found, the list sets the current item to 0, the current index to -1, and returns -1.</p>
<p>The <a href="q3ptrlist.html#compareItems">compareItems</a>() function is called when searching for the item in the list. If <a href="q3ptrlist.html#compareItems">compareItems</a>() is not reimplemented, it is more efficient to call <a href="q3ptrlist.html#findNextRef">findNextRef</a>().</p>
<p><b>See also </b><a href="q3ptrlist.html#find">find</a>(), <a href="q3ptrlist.html#findNextRef">findNextRef</a>(), <a href="q3ptrlist.html#compareItems">compareItems</a>(), and <a href="q3ptrlist.html#current">current</a>().</p>
<!-- @@@findNext -->
<!-- $$$findNextRef[overload1]$$$findNextRefconsttype* -->
<h3 class="fn"><a name="findNextRef"></a><span class="type">int</span> Q3PtrList::<span class="name">findNextRef</span> ( const <span class="type">type</span> * <i>item</i> )</h3>
<p>Finds the next occurrence of <i>item</i> in the list, starting from the current list item.</p>
<p>If the item is found, the list sets the current item to point to the found item and returns the index of this item. If the item is not found, the list sets the current item to 0, the current index to -1, and returns -1.</p>
<p>Calling this function is much faster than <a href="q3ptrlist.html#findNext">findNext</a>() because <a href="q3ptrlist.html#findNext">findNext</a>() compares <i>item</i> with each list item using <a href="q3ptrlist.html#compareItems">compareItems</a>(), whereas this function only compares the pointers.</p>
<p><b>See also </b><a href="q3ptrlist.html#findRef">findRef</a>(), <a href="q3ptrlist.html#findNext">findNext</a>(), and <a href="q3ptrlist.html#current">current</a>().</p>
<!-- @@@findNextRef -->
<!-- $$$findRef[overload1]$$$findRefconsttype* -->
<h3 class="fn"><a name="findRef"></a><span class="type">int</span> Q3PtrList::<span class="name">findRef</span> ( const <span class="type">type</span> * <i>item</i> )</h3>
<p>Finds the first occurrence of <i>item</i> in the list.</p>
<p>If the item is found, the list sets the current item to point to the found item and returns the index of this item. If the item is not found, the list sets the current item to 0, the current index to -1, and returns -1.</p>
<p>Calling this function is much faster than <a href="q3ptrlist.html#find">find</a>() because <a href="q3ptrlist.html#find">find</a>() compares <i>item</i> with each list item using <a href="q3ptrlist.html#compareItems">compareItems</a>(), whereas this function only compares the pointers.</p>
<p><b>See also </b><a href="q3ptrlist.html#findNextRef">findNextRef</a>(), <a href="q3ptrlist.html#find">find</a>(), and <a href="q3ptrlist.html#current">current</a>().</p>
<!-- @@@findRef -->
<!-- $$$first[overload1]$$$first -->
<h3 class="fn"><a name="first"></a><span class="type">type</span> * Q3PtrList::<span class="name">first</span> ()</h3>
<p>Returns a pointer to the first item in the list and makes this the current list item; returns 0 if the list is empty.</p>
<p><b>See also </b><a href="q3ptrlist.html#getFirst">getFirst</a>(), <a href="q3ptrlist.html#last">last</a>(), <a href="q3ptrlist.html#next">next</a>(), <a href="q3ptrlist.html#prev">prev</a>(), and <a href="q3ptrlist.html#current">current</a>().</p>
<!-- @@@first -->
<!-- $$$getFirst[overload1]$$$getFirst -->
<h3 class="fn"><a name="getFirst"></a><span class="type">type</span> * Q3PtrList::<span class="name">getFirst</span> () const</h3>
<p>Returns a pointer to the first item in the list, or 0 if the list is empty.</p>
<p>This function does not affect the current list item.</p>
<p><b>See also </b><a href="q3ptrlist.html#first">first</a>() and <a href="q3ptrlist.html#getLast">getLast</a>().</p>
<!-- @@@getFirst -->
<!-- $$$getLast[overload1]$$$getLast -->
<h3 class="fn"><a name="getLast"></a><span class="type">type</span> * Q3PtrList::<span class="name">getLast</span> () const</h3>
<p>Returns a pointer to the last item in the list, or 0 if the list is empty.</p>
<p>This function does not affect the current list item.</p>
<p><b>See also </b><a href="q3ptrlist.html#last">last</a>() and <a href="q3ptrlist.html#getFirst">getFirst</a>().</p>
<!-- @@@getLast -->
<!-- $$$inSort[overload1]$$$inSortconsttype* -->
<h3 class="fn"><a name="inSort"></a><span class="type">void</span> Q3PtrList::<span class="name">inSort</span> ( const <span class="type">type</span> * <i>item</i> )</h3>
<p>Inserts the <i>item</i> at its sorted position in the list.</p>
<p>The sort order depends on the virtual <a href="q3ptrlist.html#compareItems">compareItems</a>() function. All items must be inserted with inSort() to maintain the sorting order.</p>
<p>The inserted item becomes the current list item.</p>
<p><i>item</i> must not be 0.</p>
<p><b>Warning:</b> Using inSort() is slow. An alternative, especially if you have lots of items, is to simply <a href="q3ptrlist.html#append">append</a>() or <a href="q3ptrlist.html#insert">insert</a>() them and then use <a href="q3ptrlist.html#sort">sort</a>(). inSort() takes up to O(n) compares. That means inserting n items in your list will need O(n^2) compares whereas <a href="q3ptrlist.html#sort">sort</a>() only needs O(n*log n) for the same task. So use inSort() only if you already have a presorted list and want to insert just a few additional items.</p>
<p><b>See also </b><a href="q3ptrlist.html#insert">insert</a>(), <a href="q3ptrlist.html#compareItems">compareItems</a>(), <a href="q3ptrlist.html#current">current</a>(), and <a href="q3ptrlist.html#sort">sort</a>().</p>
<!-- @@@inSort -->
<!-- $$$insert[overload1]$$$insertuintconsttype* -->
<h3 class="fn"><a name="insert"></a><span class="type">bool</span> Q3PtrList::<span class="name">insert</span> ( <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> <i>index</i>, const <span class="type">type</span> * <i>item</i> )</h3>
<p>Inserts the <i>item</i> at position <i>index</i> in the list.</p>
<p>Returns TRUE if successful, i.e&#x2e; if <i>index</i> is in range; otherwise returns FALSE. The valid range is 0 to <a href="q3ptrlist.html#count">count</a>() (inclusively). The item is appended if <i>index</i> == <a href="q3ptrlist.html#count">count</a>().</p>
<p>The inserted item becomes the current list item.</p>
<p><i>item</i> must not be 0.</p>
<p><b>See also </b><a href="q3ptrlist.html#append">append</a>(), <a href="q3ptrlist.html#current">current</a>(), and <a href="q3ptrlist.html#replace">replace</a>().</p>
<!-- @@@insert -->
<!-- $$$isEmpty[overload1]$$$isEmpty -->
<h3 class="fn"><a name="isEmpty"></a><span class="type">bool</span> Q3PtrList::<span class="name">isEmpty</span> () const</h3>
<p>Returns TRUE if the list is empty; otherwise returns FALSE.</p>
<p><b>See also </b><a href="q3ptrlist.html#count">count</a>().</p>
<!-- @@@isEmpty -->
<!-- $$$last[overload1]$$$last -->
<h3 class="fn"><a name="last"></a><span class="type">type</span> * Q3PtrList::<span class="name">last</span> ()</h3>
<p>Returns a pointer to the last item in the list and makes this the current list item; returns 0 if the list is empty.</p>
<p><b>See also </b><a href="q3ptrlist.html#getLast">getLast</a>(), <a href="q3ptrlist.html#first">first</a>(), <a href="q3ptrlist.html#next">next</a>(), <a href="q3ptrlist.html#prev">prev</a>(), and <a href="q3ptrlist.html#current">current</a>().</p>
<!-- @@@last -->
<!-- $$$next[overload1]$$$next -->
<h3 class="fn"><a name="next"></a><span class="type">type</span> * Q3PtrList::<span class="name">next</span> ()</h3>
<p>Returns a pointer to the item succeeding the current item. Returns 0 if the current item is 0 or equal to the last item.</p>
<p>Makes the succeeding item current. If the current item before this function call was the last item, the current item will be set to 0. If the current item was 0, this function does nothing.</p>
<p><b>See also </b><a href="q3ptrlist.html#first">first</a>(), <a href="q3ptrlist.html#last">last</a>(), <a href="q3ptrlist.html#prev">prev</a>(), and <a href="q3ptrlist.html#current">current</a>().</p>
<!-- @@@next -->
<!-- $$$prepend[overload1]$$$prependconsttype* -->
<h3 class="fn"><a name="prepend"></a><span class="type">void</span> Q3PtrList::<span class="name">prepend</span> ( const <span class="type">type</span> * <i>item</i> )</h3>
<p>Inserts the <i>item</i> at the start of the list.</p>
<p>The inserted item becomes the current list item. This is equivalent to <tt>insert( 0, item )</tt>.</p>
<p><i>item</i> must not be 0.</p>
<p><b>See also </b><a href="q3ptrlist.html#append">append</a>(), <a href="q3ptrlist.html#insert">insert</a>(), and <a href="q3ptrlist.html#current">current</a>().</p>
<!-- @@@prepend -->
<!-- $$$prev[overload1]$$$prev -->
<h3 class="fn"><a name="prev"></a><span class="type">type</span> * Q3PtrList::<span class="name">prev</span> ()</h3>
<p>Returns a pointer to the item preceding the current item. Returns 0 if the current item is 0 or equal to the first item.</p>
<p>Makes the preceding item current. If the current item before this function call was the first item, the current item will be set to 0. If the current item was 0, this function does nothing.</p>
<p><b>See also </b><a href="q3ptrlist.html#first">first</a>(), <a href="q3ptrlist.html#last">last</a>(), <a href="q3ptrlist.html#next">next</a>(), and <a href="q3ptrlist.html#current">current</a>().</p>
<!-- @@@prev -->
<!-- $$$read[overload1]$$$readQDataStream&Q3PtrCollection::Item& -->
<h3 class="fn"><a name="read"></a><span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; Q3PtrList::<span class="name">read</span> ( <span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <i>s</i>, <span class="type"><a href="q3ptrcollection.html#Item-typedef">Q3PtrCollection::Item</a></span> &amp; <i>item</i> )<tt> [virtual protected]</tt></h3>
<p>Reads a list item from the stream <i>s</i> and returns a reference to the stream.</p>
<p>The default implementation sets <i>item</i> to 0.</p>
<p><b>See also </b><a href="q3ptrlist.html#write">write</a>().</p>
<!-- @@@read -->
<!-- $$$remove[overload1]$$$removeuint -->
<h3 class="fn"><a name="remove"></a><span class="type">bool</span> Q3PtrList::<span class="name">remove</span> ( <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> <i>index</i> )</h3>
<p>Removes the item at position <i>index</i> in the list.</p>
<p>Returns TRUE if successful, i.e&#x2e; if <i>index</i> is in range; otherwise returns FALSE. The valid range is <tt>0..(count() - 1)</tt> inclusive.</p>
<p>The removed item is deleted if <a href="q3ptrcollection.html#setAutoDelete">auto-deletion</a> is enabled.</p>
<p>The item after the removed item becomes the new current list item if the removed item is not the last item in the list. If the last item is removed, the new last item becomes the current item.</p>
<p>All list iterators that refer to the removed item will be set to point to the new current item.</p>
<p><b>See also </b><a href="q3ptrlist.html#take">take</a>(), <a href="q3ptrlist.html#clear">clear</a>(), <a href="q3ptrcollection.html#setAutoDelete">setAutoDelete</a>(), <a href="q3ptrlist.html#current">current</a>(), and <a href="q3ptrlist.html#removeRef">removeRef</a>().</p>
<!-- @@@remove -->
<!-- $$$remove$$$remove -->
<h3 class="fn"><a name="remove-2"></a><span class="type">bool</span> Q3PtrList::<span class="name">remove</span> ()</h3>
<p>This is an overloaded function.</p>
<p>Removes the current list item.</p>
<p>Returns TRUE if successful, i.e&#x2e; if the current item isn't 0; otherwise returns FALSE.</p>
<p>The removed item is deleted if <a href="q3ptrcollection.html#setAutoDelete">auto-deletion</a> is enabled.</p>
<p>The item after the removed item becomes the new current list item if the removed item is not the last item in the list. If the last item is removed, the new last item becomes the current item. The current item is set to 0 if the list becomes empty.</p>
<p>All list iterators that refer to the removed item will be set to point to the new current item.</p>
<p><b>See also </b><a href="q3ptrlist.html#take">take</a>(), <a href="q3ptrlist.html#clear">clear</a>(), <a href="q3ptrcollection.html#setAutoDelete">setAutoDelete</a>(), <a href="q3ptrlist.html#current">current</a>(), and <a href="q3ptrlist.html#removeRef">removeRef</a>().</p>
<!-- @@@remove -->
<!-- $$$remove$$$removeconsttype* -->
<h3 class="fn"><a name="remove-3"></a><span class="type">bool</span> Q3PtrList::<span class="name">remove</span> ( const <span class="type">type</span> * <i>item</i> )</h3>
<p>This is an overloaded function.</p>
<p>Removes the first occurrence of <i>item</i> from the list.</p>
<p>Returns TRUE if successful, i.e&#x2e; if <i>item</i> is in the list; otherwise returns FALSE.</p>
<p>The removed item is deleted if <a href="q3ptrcollection.html#setAutoDelete">auto-deletion</a> is enabled.</p>
<p>The <a href="q3ptrlist.html#compareItems">compareItems</a>() function is called when searching for the item in the list. If <a href="q3ptrlist.html#compareItems">compareItems</a>() is not reimplemented, it is more efficient to call <a href="q3ptrlist.html#removeRef">removeRef</a>().</p>
<p>If <i>item</i> is NULL then the current item is removed from the list.</p>
<p>The item after the removed item becomes the new current list item if the removed item is not the last item in the list. If the last item is removed, the new last item becomes the current item. The current item is set to 0 if the list becomes empty.</p>
<p>All list iterators that refer to the removed item will be set to point to the new current item.</p>
<p><b>See also </b><a href="q3ptrlist.html#removeRef">removeRef</a>(), <a href="q3ptrlist.html#take">take</a>(), <a href="q3ptrlist.html#clear">clear</a>(), <a href="q3ptrcollection.html#setAutoDelete">setAutoDelete</a>(), <a href="q3ptrlist.html#compareItems">compareItems</a>(), and <a href="q3ptrlist.html#current">current</a>().</p>
<!-- @@@remove -->
<!-- $$$removeFirst[overload1]$$$removeFirst -->
<h3 class="fn"><a name="removeFirst"></a><span class="type">bool</span> Q3PtrList::<span class="name">removeFirst</span> ()</h3>
<p>Removes the first item from the list. Returns TRUE if successful, i.e&#x2e; if the list isn't empty; otherwise returns FALSE.</p>
<p>The removed item is deleted if <a href="q3ptrcollection.html#setAutoDelete">auto-deletion</a> is enabled.</p>
<p>The first item in the list becomes the new current list item. The current item is set to 0 if the list becomes empty.</p>
<p>All list iterators that refer to the removed item will be set to point to the new current item.</p>
<p><b>See also </b><a href="q3ptrlist.html#removeLast">removeLast</a>(), <a href="q3ptrcollection.html#setAutoDelete">setAutoDelete</a>(), <a href="q3ptrlist.html#current">current</a>(), and <a href="q3ptrlist.html#remove">remove</a>().</p>
<!-- @@@removeFirst -->
<!-- $$$removeLast[overload1]$$$removeLast -->
<h3 class="fn"><a name="removeLast"></a><span class="type">bool</span> Q3PtrList::<span class="name">removeLast</span> ()</h3>
<p>Removes the last item from the list. Returns TRUE if successful, i.e&#x2e; if the list isn't empty; otherwise returns FALSE.</p>
<p>The removed item is deleted if <a href="q3ptrcollection.html#setAutoDelete">auto-deletion</a> is enabled.</p>
<p>The last item in the list becomes the new current list item. The current item is set to 0 if the list becomes empty.</p>
<p>All list iterators that refer to the removed item will be set to point to the new current item.</p>
<p><b>See also </b><a href="q3ptrlist.html#removeFirst">removeFirst</a>(), <a href="q3ptrcollection.html#setAutoDelete">setAutoDelete</a>(), and <a href="q3ptrlist.html#current">current</a>().</p>
<!-- @@@removeLast -->
<!-- $$$removeNode[overload1]$$$removeNodeQ3LNode* -->
<h3 class="fn"><a name="removeNode"></a><span class="type">void</span> Q3PtrList::<span class="name">removeNode</span> ( <span class="type">Q3LNode</span> * <i>node</i> )</h3>
<p>Removes the <i>node</i> from the list.</p>
<p>This node must exist in the list, otherwise the program may crash.</p>
<p>The removed item is deleted if <a href="q3ptrcollection.html#setAutoDelete">auto-deletion</a> is enabled.</p>
<p>The first item in the list will become the new current list item. The current item is set to 0 if the list becomes empty.</p>
<p>All list iterators that refer to the removed item will be set to point to the item succeeding this item or to the preceding item if the removed item was the last item.</p>
<p><b>Warning:</b> Do not call this function unless you are an expert.</p>
<p><b>See also </b><a href="q3ptrlist.html#takeNode">takeNode</a>(), <a href="q3ptrlist.html#currentNode">currentNode</a>(), <a href="q3ptrlist.html#remove">remove</a>(), and <a href="q3ptrlist.html#removeRef">removeRef</a>().</p>
<!-- @@@removeNode -->
<!-- $$$removeRef[overload1]$$$removeRefconsttype* -->
<h3 class="fn"><a name="removeRef"></a><span class="type">bool</span> Q3PtrList::<span class="name">removeRef</span> ( const <span class="type">type</span> * <i>item</i> )</h3>
<p>Removes the first occurrence of <i>item</i> from the list.</p>
<p>Returns TRUE if successful, i.e&#x2e; if <i>item</i> is in the list; otherwise returns FALSE.</p>
<p>The removed item is deleted if <a href="q3ptrcollection.html#setAutoDelete">auto-deletion</a> is enabled.</p>
<p>Equivalent to:</p>
<pre class="cpp"> <span class="keyword">if</span> ( list<span class="operator">.</span>findRef( item ) <span class="operator">!</span><span class="operator">=</span> <span class="operator">-</span><span class="number">1</span> )
     list<span class="operator">.</span><a href="q3ptrlist.html#remove">remove</a>();</pre>
<p>The item after the removed item becomes the new current list item if the removed item is not the last item in the list. If the last item is removed, the new last item becomes the current item. The current item is set to 0 if the list becomes empty.</p>
<p>All list iterators that refer to the removed item will be set to point to the new current item.</p>
<p><b>See also </b><a href="q3ptrlist.html#remove">remove</a>(), <a href="q3ptrlist.html#clear">clear</a>(), <a href="q3ptrcollection.html#setAutoDelete">setAutoDelete</a>(), and <a href="q3ptrlist.html#current">current</a>().</p>
<!-- @@@removeRef -->
<!-- $$$replace[overload1]$$$replaceuintconsttype* -->
<h3 class="fn"><a name="replace"></a><span class="type">bool</span> Q3PtrList::<span class="name">replace</span> ( <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> <i>index</i>, const <span class="type">type</span> * <i>item</i> )</h3>
<p>Replaces the item at position <i>index</i> with the new <i>item</i>.</p>
<p>Returns TRUE if successful, i.e&#x2e; <i>index</i> is in the range 0 to <a href="q3ptrlist.html#count">count</a>()-1.</p>
<p><b>See also </b><a href="q3ptrlist.html#append">append</a>(), <a href="q3ptrlist.html#current">current</a>(), and <a href="q3ptrlist.html#insert">insert</a>().</p>
<!-- @@@replace -->
<!-- $$$sort[overload1]$$$sort -->
<h3 class="fn"><a name="sort"></a><span class="type">void</span> Q3PtrList::<span class="name">sort</span> ()</h3>
<p>Sorts the list by the result of the virtual <a href="q3ptrlist.html#compareItems">compareItems</a>() function.</p>
<p>The heap sort algorithm is used for sorting. It sorts n items with O(n*log n) comparisons. This is the asymptotic optimal solution of the sorting problem.</p>
<p>If the items in your list support operator&lt;() and operator==(), you might be better off with Q3SortedList because it implements the <a href="q3ptrlist.html#compareItems">compareItems</a>() function for you using these two operators.</p>
<p><b>See also </b><a href="q3ptrlist.html#inSort">inSort</a>().</p>
<!-- @@@sort -->
<!-- $$$take[overload1]$$$takeuint -->
<h3 class="fn"><a name="take"></a><span class="type">type</span> * Q3PtrList::<span class="name">take</span> ( <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> <i>index</i> )</h3>
<p>Takes the item at position <i>index</i> out of the list without deleting it (even if <a href="q3ptrcollection.html#setAutoDelete">auto-deletion</a> is enabled).</p>
<p>Returns a pointer to the item taken out of the list, or 0 if the index is out of range. The valid range is <tt>0..(count() - 1)</tt> inclusive.</p>
<p>The item after the removed item becomes the new current list item if the removed item is not the last item in the list. If the last item is removed, the new last item becomes the current item. The current item is set to 0 if the list becomes empty.</p>
<p>All list iterators that refer to the taken item will be set to point to the new current item.</p>
<p><b>See also </b><a href="q3ptrlist.html#remove">remove</a>(), <a href="q3ptrlist.html#clear">clear</a>(), and <a href="q3ptrlist.html#current">current</a>().</p>
<!-- @@@take -->
<!-- $$$take$$$take -->
<h3 class="fn"><a name="take-2"></a><span class="type">type</span> * Q3PtrList::<span class="name">take</span> ()</h3>
<p>This is an overloaded function.</p>
<p>Takes the current item out of the list without deleting it (even if <a href="q3ptrcollection.html#setAutoDelete">auto-deletion</a> is enabled).</p>
<p>Returns a pointer to the item taken out of the list, or 0 if the current item is 0.</p>
<p>The item after the removed item becomes the new current list item if the removed item is not the last item in the list. If the last item is removed, the new last item becomes the current item. The current item is set to 0 if the list becomes empty.</p>
<p>All list iterators that refer to the taken item will be set to point to the new current item.</p>
<p><b>See also </b><a href="q3ptrlist.html#remove">remove</a>(), <a href="q3ptrlist.html#clear">clear</a>(), and <a href="q3ptrlist.html#current">current</a>().</p>
<!-- @@@take -->
<!-- $$$takeNode[overload1]$$$takeNodeQ3LNode* -->
<h3 class="fn"><a name="takeNode"></a><span class="type">type</span> * Q3PtrList::<span class="name">takeNode</span> ( <span class="type">Q3LNode</span> * <i>node</i> )</h3>
<p>Takes the <i>node</i> out of the list without deleting its item (even if <a href="q3ptrcollection.html#setAutoDelete">auto-deletion</a> is enabled). Returns a pointer to the item taken out of the list.</p>
<p>This node must exist in the list, otherwise the program may crash.</p>
<p>The first item in the list becomes the new current list item.</p>
<p>All list iterators that refer to the taken item will be set to point to the item succeeding this item or to the preceding item if the taken item was the last item.</p>
<p><b>Warning:</b> Do not call this function unless you are an expert.</p>
<p><b>See also </b><a href="q3ptrlist.html#removeNode">removeNode</a>() and <a href="q3ptrlist.html#currentNode">currentNode</a>().</p>
<!-- @@@takeNode -->
<!-- $$$toVector[overload1]$$$toVectorQ3GVector* -->
<h3 class="fn"><a name="toVector"></a><span class="type">void</span> Q3PtrList::<span class="name">toVector</span> ( <span class="type">Q3GVector</span> * <i>vec</i> ) const</h3>
<p>Stores all list items in the vector <i>vec</i>.</p>
<p>The vector must be of the same item type, otherwise the result will be undefined.</p>
<!-- @@@toVector -->
<!-- $$$write[overload1]$$$writeQDataStream&Q3PtrCollection::Item -->
<h3 class="fn"><a name="write"></a><span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; Q3PtrList::<span class="name">write</span> ( <span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <i>s</i>, <span class="type"><a href="q3ptrcollection.html#Item-typedef">Q3PtrCollection::Item</a></span> <i>item</i> ) const<tt> [virtual protected]</tt></h3>
<p>Writes a list item, <i>item</i> to the stream <i>s</i> and returns a reference to the stream.</p>
<p>The default implementation does nothing.</p>
<p><b>See also </b><a href="q3ptrlist.html#read">read</a>().</p>
<!-- @@@write -->
<!-- $$$operator!=[overload1]$$$operator!=constQ3PtrList<type>& -->
<h3 class="fn"><a name="operator-not-eq"></a><span class="type">bool</span> Q3PtrList::<span class="name">operator!=</span> ( const <span class="type">Q3PtrList</span>&lt;<span class="type">type</span>&gt; &amp; <i>list</i> ) const</h3>
<p>Compares this list with <i>list</i>. Returns TRUE if the lists contain different data; otherwise returns FALSE.</p>
<!-- @@@operator!= -->
<!-- $$$operator=[overload1]$$$operator=constQ3PtrList<type>& -->
<h3 class="fn"><a name="operator-eq"></a><span class="type">Q3PtrList</span>&lt;<span class="type">type</span>&gt; &amp; Q3PtrList::<span class="name">operator=</span> ( const <span class="type">Q3PtrList</span>&lt;<span class="type">type</span>&gt; &amp; <i>list</i> )</h3>
<p>Assigns <i>list</i> to this list and returns a reference to this list.</p>
<p>This list is first cleared and then each item in <i>list</i> is <a href="q3ptrlist.html#append">appended</a> to this list. Only the pointers are copied (shallow copy) unless <a href="q3ptrcollection.html#newItem">newItem</a>() has been reimplemented.</p>
<!-- @@@operator= -->
<!-- $$$operator==[overload1]$$$operator==constQ3PtrList<type>& -->
<h3 class="fn"><a name="operator-eq-eq"></a><span class="type">bool</span> Q3PtrList::<span class="name">operator==</span> ( const <span class="type">Q3PtrList</span>&lt;<span class="type">type</span>&gt; &amp; <i>list</i> ) const</h3>
<p>Compares this list with <i>list</i>. Returns TRUE if the lists contain the same data; otherwise returns FALSE.</p>
<!-- @@@operator== -->
</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>