Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > bad97183153701b09df5fae1052b1c30 > files > 1984

crystalspace-doc-1.2.1-5mdv2010.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Crystal Space 1.2.1: csutil/list.h Source File (Crystal Space 1.2.1 Public API Reference)</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<table border="0" cellpadding="0" cellspacing="0" width="100%" class="head">
 <tr height="59">
  <td class="head" width="202" valign="bottom" style="padding-left:0;"><a href="http://www.crystalspace3d.org/"><img src="csblur.png" width="236" height="59" alt="CrystalSpace" border="0"></a></td>
  <td class="head"><h2>Public API Reference</h2></td>
 </tr>
 <tr height="11">
  <td colspan="2" class="headshadow" valign="top" style="padding-left:0;"><img src="csblurb.png" width="236" height="11" alt="" border="0"></td>
 </tr>
</table>
<div class="content">
<!-- Generated by Doxygen 1.5.3 -->
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="modules.html"><span>Modules</span></a></li>
    <li><a href="namespaces.html"><span>Namespaces</span></a></li>
    <li><a href="classes.html"><span>Classes</span></a></li>
    <li class="current"><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  </ul>
</div>
<h1>csutil/list.h</h1><a href="list_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment">    Copyright (C) 2003 by Marten Svanfeldt</span>
<a name="l00003"></a>00003 <span class="comment">    influenced by Aapl by Adrian Thurston &lt;adriant@ragel.ca&gt;</span>
<a name="l00004"></a>00004 <span class="comment"></span>
<a name="l00005"></a>00005 <span class="comment">    This library is free software; you can redistribute it and/or</span>
<a name="l00006"></a>00006 <span class="comment">    modify it under the terms of the GNU Library General Public</span>
<a name="l00007"></a>00007 <span class="comment">    License as published by the Free Software Foundation; either</span>
<a name="l00008"></a>00008 <span class="comment">    version 2 of the License, or (at your option) any later version.</span>
<a name="l00009"></a>00009 <span class="comment">    </span>
<a name="l00010"></a>00010 <span class="comment">    This library is distributed in the hope that it will be useful,</span>
<a name="l00011"></a>00011 <span class="comment">    but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00012"></a>00012 <span class="comment">    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
<a name="l00013"></a>00013 <span class="comment">    Library General Public License for more details.</span>
<a name="l00014"></a>00014 <span class="comment">    </span>
<a name="l00015"></a>00015 <span class="comment">    You should have received a copy of the GNU Library General Public</span>
<a name="l00016"></a>00016 <span class="comment">    License along with this library; if not, write to the Free</span>
<a name="l00017"></a>00017 <span class="comment">    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</span>
<a name="l00018"></a>00018 <span class="comment">*/</span>
<a name="l00019"></a>00019 
<a name="l00020"></a>00020 <span class="preprocessor">#ifndef __CS_UTIL_LIST_H__</span>
<a name="l00021"></a>00021 <span class="preprocessor"></span><span class="preprocessor">#define __CS_UTIL_LIST_H__</span>
<a name="l00022"></a>00022 <span class="preprocessor"></span>
<a name="l00027"></a>00027 <span class="preprocessor">#include "csextern.h"</span>
<a name="l00028"></a>00028 
<a name="l00033"></a>00033 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00034"></a><a class="code" href="classcsList.html">00034</a> <span class="keyword">class </span><a class="code" href="classcsList.html" title="A lightweight double-linked list template.">csList</a>
<a name="l00035"></a>00035 {
<a name="l00036"></a>00036 <span class="keyword">protected</span>:
<a name="l00041"></a><a class="code" href="structcsList_1_1csListElement.html">00041</a>   <span class="keyword">struct </span><a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>
<a name="l00042"></a>00042   {
<a name="l00044"></a><a class="code" href="structcsList_1_1csListElement.html#d7f99db72ae65c349532fbd5d44e49b7">00044</a>     <a class="code" href="structcsList_1_1csListElement.html#d7f99db72ae65c349532fbd5d44e49b7" title="Use specified data.">csListElement</a>(<span class="keyword">const</span> T&amp; d, <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>* newnext, <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>* newprev) :
<a name="l00045"></a>00045       <a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a>(newnext), <a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a>(newprev), <a class="code" href="structcsList_1_1csListElement.html#aca74448c7de3df16a81e878d8bce7a7" title="Stored data.">data</a>(d) {}
<a name="l00046"></a>00046 
<a name="l00048"></a><a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661">00048</a>     <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>* <a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a>;
<a name="l00049"></a>00049 
<a name="l00051"></a><a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75">00051</a>     <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>* <a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a>;
<a name="l00052"></a>00052 
<a name="l00054"></a><a class="code" href="structcsList_1_1csListElement.html#aca74448c7de3df16a81e878d8bce7a7">00054</a>     T <a class="code" href="structcsList_1_1csListElement.html#aca74448c7de3df16a81e878d8bce7a7" title="Stored data.">data</a>;
<a name="l00055"></a>00055   };
<a name="l00056"></a>00056 
<a name="l00058"></a>00058   <span class="keywordtype">void</span> <a class="code" href="classcsList.html#f499b092f84e7bb2cca0c645f9d692aa" title="Remove specific item by explicit ref.">Delete</a> (<a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a> *el);
<a name="l00059"></a>00059 
<a name="l00060"></a>00060 <span class="keyword">public</span>:
<a name="l00062"></a><a class="code" href="classcsList.html#25d9fb6fda739858c66e81abdf68cd9a">00062</a>   <a class="code" href="classcsList.html#25d9fb6fda739858c66e81abdf68cd9a" title="Default constructor.">csList</a>() : head(0), tail(0) {}
<a name="l00063"></a>00063 
<a name="l00065"></a>00065   <a class="code" href="classcsList.html#25d9fb6fda739858c66e81abdf68cd9a" title="Default constructor.">csList</a>(<span class="keyword">const</span> <a class="code" href="classcsList.html" title="A lightweight double-linked list template.">csList&lt;T&gt;</a> &amp;other);
<a name="l00066"></a>00066 
<a name="l00068"></a><a class="code" href="classcsList.html#434daeb8a87b2cbe0f1aa9ec2129c32b">00068</a>   <a class="code" href="classcsList.html#434daeb8a87b2cbe0f1aa9ec2129c32b" title="Destructor.">~csList</a>()
<a name="l00069"></a>00069   { <a class="code" href="classcsList.html#492cbe560e1a91585f84d49d8d1ed563" title="Empty an list.">DeleteAll</a> (); }
<a name="l00070"></a>00070 
<a name="l00072"></a><a class="code" href="classcsList_1_1Iterator.html">00072</a>   <span class="keyword">class </span><a class="code" href="classcsList_1_1Iterator.html" title="Iterator for the list.">Iterator</a>
<a name="l00073"></a>00073   {
<a name="l00074"></a>00074   <span class="keyword">public</span>:
<a name="l00076"></a><a class="code" href="classcsList_1_1Iterator.html#e09258ade698ae2a6bdeb8378f0eace2">00076</a>     <a class="code" href="classcsList_1_1Iterator.html#e09258ade698ae2a6bdeb8378f0eace2" title="Constructor.">Iterator</a>() : ptr(0), visited(false), reversed(false)
<a name="l00077"></a>00077     { }
<a name="l00079"></a><a class="code" href="classcsList_1_1Iterator.html#65b10a161b0a3f0df3ce77e59711f301">00079</a>     <a class="code" href="classcsList_1_1Iterator.html#e09258ade698ae2a6bdeb8378f0eace2" title="Constructor.">Iterator</a>(<span class="keyword">const</span> <a class="code" href="classcsList_1_1Iterator.html" title="Iterator for the list.">Iterator</a>&amp; r)
<a name="l00080"></a>00080     { ptr = r.<a class="code" href="classcsList_1_1Iterator.html#cd19d8645eb91f9e8599d5a213569d27">ptr</a>; visited = r.<a class="code" href="classcsList_1_1Iterator.html#87120f398735706c085d17b7a3587a17">visited</a>; reversed = r.<a class="code" href="classcsList_1_1Iterator.html#0811aa2d6ae4d99b8813c8ae932c68d4">reversed</a>; }
<a name="l00082"></a><a class="code" href="classcsList_1_1Iterator.html#cf503a919a01a74823ba98a4b48aa476">00082</a>     <a class="code" href="classcsList_1_1Iterator.html#e09258ade698ae2a6bdeb8378f0eace2" title="Constructor.">Iterator</a>(<span class="keyword">const</span> <a class="code" href="classcsList.html" title="A lightweight double-linked list template.">csList&lt;T&gt;</a> &amp;list, <span class="keywordtype">bool</span> reverse = <span class="keyword">false</span>) :
<a name="l00083"></a>00083       visited(false), reversed(reverse)
<a name="l00084"></a>00084     {
<a name="l00085"></a>00085       <span class="keywordflow">if</span> (reverse) ptr = list.<a class="code" href="classcsList.html#9578ce39babd94d4cf3facd83edb4904">tail</a>;
<a name="l00086"></a>00086       <span class="keywordflow">else</span> ptr = list.<a class="code" href="classcsList.html#a9159b2936ca2b137199914a50651e4c">head</a>;
<a name="l00087"></a>00087     }
<a name="l00089"></a><a class="code" href="classcsList_1_1Iterator.html#8021cbb517d939ba6f839f97ea6ad9c8">00089</a>     <a class="code" href="classcsList_1_1Iterator.html" title="Iterator for the list.">Iterator</a>&amp; <a class="code" href="classcsList_1_1Iterator.html#8021cbb517d939ba6f839f97ea6ad9c8" title="Assignment operator.">operator= </a>(<span class="keyword">const</span> <a class="code" href="classcsList_1_1Iterator.html" title="Iterator for the list.">Iterator</a>&amp; r)
<a name="l00090"></a>00090     { ptr = r.<a class="code" href="classcsList_1_1Iterator.html#cd19d8645eb91f9e8599d5a213569d27">ptr</a>; visited = r.<a class="code" href="classcsList_1_1Iterator.html#87120f398735706c085d17b7a3587a17">visited</a>; reversed = r.<a class="code" href="classcsList_1_1Iterator.html#0811aa2d6ae4d99b8813c8ae932c68d4">reversed</a>; <span class="keywordflow">return</span> *<span class="keyword">this</span>; }
<a name="l00092"></a><a class="code" href="classcsList_1_1Iterator.html#5d1301d35065281aecbdf8f9347c0ad8">00092</a>     <span class="keywordtype">bool</span> <a class="code" href="classcsList_1_1Iterator.html#5d1301d35065281aecbdf8f9347c0ad8" title="Test if the Iterator is set to a valid element.">HasCurrent</a>()<span class="keyword"> const</span>
<a name="l00093"></a>00093 <span class="keyword">    </span>{ <span class="keywordflow">return</span> visited &amp;&amp; ptr != 0; }
<a name="l00095"></a><a class="code" href="classcsList_1_1Iterator.html#fd95d7d380d889fb2a66247e8b1b15c2">00095</a>     <span class="keywordtype">bool</span> <a class="code" href="classcsList_1_1Iterator.html#fd95d7d380d889fb2a66247e8b1b15c2" title="Test if there is a next element.">HasNext</a>()<span class="keyword"> const</span>
<a name="l00096"></a>00096 <span class="keyword">    </span>{ <span class="keywordflow">return</span> ptr &amp;&amp; (ptr-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a> || !visited); }
<a name="l00098"></a><a class="code" href="classcsList_1_1Iterator.html#2ed3bdb58f713e8937d049562caddfb2">00098</a>     <span class="keywordtype">bool</span> <a class="code" href="classcsList_1_1Iterator.html#2ed3bdb58f713e8937d049562caddfb2" title="Test if there is a previous element.">HasPrevious</a>()<span class="keyword"> const</span>
<a name="l00099"></a>00099 <span class="keyword">    </span>{ <span class="keywordflow">return</span> ptr &amp;&amp; (ptr-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a> || !visited); }
<a name="l00101"></a><a class="code" href="classcsList_1_1Iterator.html#35bc8483f634490e7358211598f339e9">00101</a>     <span class="keywordtype">bool</span> <a class="code" href="classcsList_1_1Iterator.html#35bc8483f634490e7358211598f339e9" title="Test if the Iterator is set to the first element.">IsFirst</a>()<span class="keyword"> const</span>
<a name="l00102"></a>00102 <span class="keyword">    </span>{ <span class="keywordflow">return</span> ptr &amp;&amp; ptr-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a> == 0; }
<a name="l00104"></a><a class="code" href="classcsList_1_1Iterator.html#a76e547d9f62c3842b433b93d983c0cb">00104</a>     <span class="keywordtype">bool</span> <a class="code" href="classcsList_1_1Iterator.html#a76e547d9f62c3842b433b93d983c0cb" title="Test if the Iterator is set to the last element.">IsLast</a>()<span class="keyword"> const</span>
<a name="l00105"></a>00105 <span class="keyword">    </span>{ <span class="keywordflow">return</span> ptr &amp;&amp; ptr-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a> == 0; }
<a name="l00107"></a><a class="code" href="classcsList_1_1Iterator.html#5bb0d4f32711fc30b4946d3fab7d2fd3">00107</a>     <span class="keywordtype">bool</span> <a class="code" href="classcsList_1_1Iterator.html#5bb0d4f32711fc30b4946d3fab7d2fd3" title="Test if the iterator is reversed.">IsReverse</a>()<span class="keyword"> const</span>
<a name="l00108"></a>00108 <span class="keyword">    </span>{ <span class="keywordflow">return</span> reversed; }
<a name="l00109"></a>00109 
<a name="l00111"></a><a class="code" href="classcsList_1_1Iterator.html#88a8947f489cbbf3e2006a2126c36e88">00111</a>     <a class="code" href="classcsList_1_1Iterator.html#88a8947f489cbbf3e2006a2126c36e88" title="Cast operator.">operator T*</a>()<span class="keyword"> const</span>
<a name="l00112"></a>00112 <span class="keyword">    </span>{ <span class="keywordflow">return</span> visited &amp;&amp; ptr ? &amp;ptr-&gt;<a class="code" href="structcsList_1_1csListElement.html#aca74448c7de3df16a81e878d8bce7a7" title="Stored data.">data</a> : 0; }
<a name="l00114"></a><a class="code" href="classcsList_1_1Iterator.html#fb69008dee36b44ef2cfae40bef6618c">00114</a>     T&amp; <a class="code" href="classcsList_1_1Iterator.html#fb69008dee36b44ef2cfae40bef6618c" title="Dereference operator (*).">operator *</a>()<span class="keyword"> const</span>
<a name="l00115"></a>00115 <span class="keyword">    </span>{ <a class="code" href="cssysdef_8h.html#c380bd47888ecfe73e7b7a40b6f827a1" title="Assertion.">CS_ASSERT</a>(ptr != 0); <span class="keywordflow">return</span> ptr-&gt;<a class="code" href="structcsList_1_1csListElement.html#aca74448c7de3df16a81e878d8bce7a7" title="Stored data.">data</a>; }
<a name="l00117"></a><a class="code" href="classcsList_1_1Iterator.html#cc01f06ff37b948b974c4c99d065ca90">00117</a>     T* <a class="code" href="classcsList_1_1Iterator.html#cc01f06ff37b948b974c4c99d065ca90" title="Dereference operator (-&amp;gt;).">operator-&gt;</a>()<span class="keyword"> const</span>
<a name="l00118"></a>00118 <span class="keyword">    </span>{ <span class="keywordflow">return</span> visited &amp;&amp; ptr ? &amp;ptr-&gt;<a class="code" href="structcsList_1_1csListElement.html#aca74448c7de3df16a81e878d8bce7a7" title="Stored data.">data</a> : 0; }
<a name="l00119"></a>00119 
<a name="l00121"></a><a class="code" href="classcsList_1_1Iterator.html#d13a2e35b77552b122b3942b2a8f0795">00121</a>     <span class="keywordtype">void</span> <a class="code" href="classcsList_1_1Iterator.html#d13a2e35b77552b122b3942b2a8f0795" title="Set iterator to non-existent element. HasCurrent() will return false.">Clear</a> ()
<a name="l00122"></a>00122     {
<a name="l00123"></a>00123       ptr = 0;
<a name="l00124"></a>00124       visited = <span class="keyword">true</span>;
<a name="l00125"></a>00125     }
<a name="l00127"></a><a class="code" href="classcsList_1_1Iterator.html#5071ae5c107bf8463fd754343990e050">00127</a>     T&amp; <a class="code" href="classcsList_1_1Iterator.html#5071ae5c107bf8463fd754343990e050" title="Advance to next element and return it.">Next</a> ()
<a name="l00128"></a>00128     {
<a name="l00129"></a>00129       <span class="keywordflow">if</span> (visited &amp;&amp; ptr != 0)
<a name="l00130"></a>00130         ptr = ptr-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a>;
<a name="l00131"></a>00131       visited = <span class="keyword">true</span>;
<a name="l00132"></a>00132       <a class="code" href="cssysdef_8h.html#c380bd47888ecfe73e7b7a40b6f827a1" title="Assertion.">CS_ASSERT</a>(ptr != 0);
<a name="l00133"></a>00133       <span class="keywordflow">return</span> ptr-&gt;<a class="code" href="structcsList_1_1csListElement.html#aca74448c7de3df16a81e878d8bce7a7" title="Stored data.">data</a>;
<a name="l00134"></a>00134     }
<a name="l00136"></a><a class="code" href="classcsList_1_1Iterator.html#e97b41628c5a338da21fbcb190d838fa">00136</a>     T&amp; <a class="code" href="classcsList_1_1Iterator.html#e97b41628c5a338da21fbcb190d838fa" title="Backup to previous element and return it.">Previous</a>()
<a name="l00137"></a>00137     {
<a name="l00138"></a>00138       <span class="keywordflow">if</span> (visited &amp;&amp; ptr != 0)
<a name="l00139"></a>00139         ptr = ptr-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a>;
<a name="l00140"></a>00140       visited = <span class="keyword">true</span>;
<a name="l00141"></a>00141       <a class="code" href="cssysdef_8h.html#c380bd47888ecfe73e7b7a40b6f827a1" title="Assertion.">CS_ASSERT</a>(ptr != 0);
<a name="l00142"></a>00142       <span class="keywordflow">return</span> ptr-&gt;<a class="code" href="structcsList_1_1csListElement.html#aca74448c7de3df16a81e878d8bce7a7" title="Stored data.">data</a>;
<a name="l00143"></a>00143     }
<a name="l00144"></a><a class="code" href="classcsList_1_1Iterator.html#a692dce69fc5f46827c78317a66b302d">00144</a>     T&amp; <a class="code" href="classcsList_1_1Iterator.html#a692dce69fc5f46827c78317a66b302d">Prev</a>() { <span class="keywordflow">return</span> <a class="code" href="classcsList_1_1Iterator.html#e97b41628c5a338da21fbcb190d838fa" title="Backup to previous element and return it.">Previous</a>(); } <span class="comment">// Backward compatibility.</span>
<a name="l00145"></a>00145 
<a name="l00147"></a><a class="code" href="classcsList_1_1Iterator.html#83f0ba5ac23144139e901d83ceb20cba">00147</a>     <a class="code" href="classcsList_1_1Iterator.html" title="Iterator for the list.">Iterator</a>&amp; <a class="code" href="classcsList_1_1Iterator.html#83f0ba5ac23144139e901d83ceb20cba" title="Advance to next element and return it.">operator++</a>()
<a name="l00148"></a>00148     {
<a name="l00149"></a>00149       <span class="keywordflow">if</span> (visited &amp;&amp; ptr != 0)
<a name="l00150"></a>00150         ptr = ptr-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a>;
<a name="l00151"></a>00151       visited = <span class="keyword">true</span>;
<a name="l00152"></a>00152       <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00153"></a>00153     }
<a name="l00155"></a><a class="code" href="classcsList_1_1Iterator.html#fc1611953c164eb7ce02c5b1ecdcc7e4">00155</a>     <a class="code" href="classcsList_1_1Iterator.html" title="Iterator for the list.">Iterator</a>&amp; <a class="code" href="classcsList_1_1Iterator.html#fc1611953c164eb7ce02c5b1ecdcc7e4" title="Backup to previous element and return it.">operator--</a>()
<a name="l00156"></a>00156     {
<a name="l00157"></a>00157       <span class="keywordflow">if</span> (visited &amp;&amp; ptr != 0)
<a name="l00158"></a>00158         ptr = ptr-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a>;
<a name="l00159"></a>00159       visited = <span class="keyword">true</span>;
<a name="l00160"></a>00160       <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00161"></a>00161     }
<a name="l00162"></a>00162 
<a name="l00167"></a><a class="code" href="classcsList_1_1Iterator.html#262b213cde3c61260361b26813d08204">00167</a>     T&amp; <a class="code" href="classcsList_1_1Iterator.html#262b213cde3c61260361b26813d08204" title="Return current element.">FetchCurrent</a> ()<span class="keyword"> const</span>
<a name="l00168"></a>00168 <span class="keyword">    </span>{
<a name="l00169"></a>00169       <a class="code" href="cssysdef_8h.html#c380bd47888ecfe73e7b7a40b6f827a1" title="Assertion.">CS_ASSERT</a>(visited &amp;&amp; ptr != 0);
<a name="l00170"></a>00170       <span class="keywordflow">return</span> ptr-&gt;<a class="code" href="structcsList_1_1csListElement.html#aca74448c7de3df16a81e878d8bce7a7" title="Stored data.">data</a>;
<a name="l00171"></a>00171     }
<a name="l00176"></a><a class="code" href="classcsList_1_1Iterator.html#d76d979bddb408a658853c431f954aec">00176</a>     T&amp; <a class="code" href="classcsList_1_1Iterator.html#d76d979bddb408a658853c431f954aec" title="Return next element but don&amp;#39;t modify iterator.">FetchNext</a> ()<span class="keyword"> const</span>
<a name="l00177"></a>00177 <span class="keyword">    </span>{
<a name="l00178"></a>00178       <a class="code" href="cssysdef_8h.html#c380bd47888ecfe73e7b7a40b6f827a1" title="Assertion.">CS_ASSERT</a>(ptr != 0);
<a name="l00179"></a>00179       <span class="keywordflow">return</span> visited ? ptr-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a>-&gt;<a class="code" href="structcsList_1_1csListElement.html#aca74448c7de3df16a81e878d8bce7a7" title="Stored data.">data</a> : ptr-&gt;<a class="code" href="structcsList_1_1csListElement.html#aca74448c7de3df16a81e878d8bce7a7" title="Stored data.">data</a>;
<a name="l00180"></a>00180     }
<a name="l00185"></a><a class="code" href="classcsList_1_1Iterator.html#7688a397a009ba8f37f19accc47d0f67">00185</a>     T&amp; <a class="code" href="classcsList_1_1Iterator.html#7688a397a009ba8f37f19accc47d0f67" title="Return previous element but don&amp;#39;t modify iterator.">FetchPrevious</a> ()<span class="keyword"> const</span>
<a name="l00186"></a>00186 <span class="keyword">    </span>{
<a name="l00187"></a>00187       <a class="code" href="cssysdef_8h.html#c380bd47888ecfe73e7b7a40b6f827a1" title="Assertion.">CS_ASSERT</a>(ptr != 0);
<a name="l00188"></a>00188       <span class="keywordflow">return</span> visited ? ptr-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a>-&gt;<a class="code" href="structcsList_1_1csListElement.html#aca74448c7de3df16a81e878d8bce7a7" title="Stored data.">data</a> : ptr-&gt;<a class="code" href="structcsList_1_1csListElement.html#aca74448c7de3df16a81e878d8bce7a7" title="Stored data.">data</a>;
<a name="l00189"></a>00189     }
<a name="l00190"></a><a class="code" href="classcsList_1_1Iterator.html#27b73a9c2c29636a514735f5dd3b2a50">00190</a>     T&amp; <a class="code" href="classcsList_1_1Iterator.html#27b73a9c2c29636a514735f5dd3b2a50">FetchPrev</a> ()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classcsList_1_1Iterator.html#7688a397a009ba8f37f19accc47d0f67" title="Return previous element but don&amp;#39;t modify iterator.">FetchPrevious</a>(); } <span class="comment">// Backward compat.</span>
<a name="l00191"></a>00191 
<a name="l00192"></a>00192   <span class="keyword">protected</span>:
<a name="l00193"></a><a class="code" href="classcsList_1_1Iterator.html#a42dc8e1fd88aae2e4410d8fb7157f6f">00193</a>     <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classcsList.html" title="A lightweight double-linked list template.">csList</a>&lt;T&gt;;
<a name="l00194"></a><a class="code" href="classcsList_1_1Iterator.html#20bab9878f45cba62bc09504e67c4c7f">00194</a>     <a class="code" href="classcsList_1_1Iterator.html#e09258ade698ae2a6bdeb8378f0eace2" title="Constructor.">Iterator</a> (<a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>* element, <span class="keywordtype">bool</span> visit = <span class="keyword">true</span>, <span class="keywordtype">bool</span> rev = <span class="keyword">false</span>) :
<a name="l00195"></a>00195       ptr(element), visited(visit), reversed(rev)
<a name="l00196"></a>00196     {}
<a name="l00197"></a>00197 
<a name="l00198"></a>00198   <span class="keyword">private</span>:
<a name="l00199"></a>00199     <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>* ptr;
<a name="l00200"></a>00200     <span class="keywordtype">bool</span> visited;
<a name="l00201"></a>00201     <span class="keywordtype">bool</span> reversed;
<a name="l00202"></a>00202   };
<a name="l00203"></a>00203 
<a name="l00205"></a>00205   <a class="code" href="classcsList.html" title="A lightweight double-linked list template.">csList</a>&amp; <a class="code" href="classcsList.html#d7cb8d111c68780123fefb200a30ef07" title="Assignment, shallow copy.">operator=</a>(<span class="keyword">const</span> <a class="code" href="classcsList.html" title="A lightweight double-linked list template.">csList&lt;T&gt;</a>&amp; other);
<a name="l00206"></a>00206 
<a name="l00208"></a>00208   <a class="code" href="classcsList.html#9830fc407400559db7e7783cc10a9394">Iterator</a> <a class="code" href="classcsList.html#c22e673fec392316de4fc3504e82f7a3" title="Add an item first in list. Copy T into the listdata.">PushFront</a> (<span class="keyword">const</span> T&amp; item);
<a name="l00209"></a>00209 
<a name="l00211"></a>00211   <a class="code" href="classcsList.html#9830fc407400559db7e7783cc10a9394">Iterator</a> <a class="code" href="classcsList.html#02303fc82d290f9bf65e7c3117fd5799" title="Add an item last in list. Copy T into the listdata.">PushBack</a> (<span class="keyword">const</span> T&amp; item);
<a name="l00212"></a>00212 
<a name="l00214"></a>00214   <span class="keywordtype">void</span> <a class="code" href="classcsList.html#a6d214dbdc462282c4329c28c0a9b85c" title="Insert an item before the item the iterator is set to.">InsertBefore</a>(<a class="code" href="classcsList.html#9830fc407400559db7e7783cc10a9394">Iterator</a>&amp; it, <span class="keyword">const</span> T&amp; item);
<a name="l00215"></a>00215 
<a name="l00217"></a>00217   <span class="keywordtype">void</span> <a class="code" href="classcsList.html#59555bc917d77abec07289db8f603b7d" title="Insert an item after the item the iterator is set to.">InsertAfter</a>(<a class="code" href="classcsList.html#9830fc407400559db7e7783cc10a9394">Iterator</a>&amp; it, <span class="keyword">const</span> T&amp; item);
<a name="l00218"></a>00218 
<a name="l00220"></a>00220   <span class="keywordtype">void</span> <a class="code" href="classcsList.html#2f170c7324e08ab7991c9ebe52b4a1b1" title="Move an item (as iterator) before the item the iterator is set to.">MoveBefore</a>(<span class="keyword">const</span> <a class="code" href="classcsList.html#9830fc407400559db7e7783cc10a9394">Iterator</a>&amp; it, <span class="keyword">const</span> <a class="code" href="classcsList.html#9830fc407400559db7e7783cc10a9394">Iterator</a>&amp; item);
<a name="l00221"></a>00221 
<a name="l00223"></a>00223   <span class="keywordtype">void</span> <a class="code" href="classcsList.html#05fcfb027e72e08573fb02e3b712e6a5" title="Move an item (as iterator) after the item the iterator is set to.">MoveAfter</a>(<span class="keyword">const</span> <a class="code" href="classcsList.html#9830fc407400559db7e7783cc10a9394">Iterator</a>&amp; it, <span class="keyword">const</span> <a class="code" href="classcsList.html#9830fc407400559db7e7783cc10a9394">Iterator</a>&amp; item);
<a name="l00224"></a>00224 
<a name="l00226"></a>00226   <span class="keywordtype">void</span> <a class="code" href="classcsList.html#f499b092f84e7bb2cca0c645f9d692aa" title="Remove specific item by explicit ref.">Delete</a> (<a class="code" href="classcsList.html#9830fc407400559db7e7783cc10a9394">Iterator</a>&amp; it);
<a name="l00227"></a>00227 
<a name="l00229"></a>00229   <span class="keywordtype">void</span> <a class="code" href="classcsList.html#492cbe560e1a91585f84d49d8d1ed563" title="Empty an list.">DeleteAll</a>();
<a name="l00230"></a>00230 
<a name="l00232"></a><a class="code" href="classcsList.html#2470e0f3c9b2e5c5810ab23c13a1af98">00232</a>   T&amp; <a class="code" href="classcsList.html#2470e0f3c9b2e5c5810ab23c13a1af98" title="Return first element of the list.">Front</a> ()<span class="keyword"> const</span>
<a name="l00233"></a>00233 <span class="keyword">  </span>{ <span class="keywordflow">return</span> head-&gt;<a class="code" href="structcsList_1_1csListElement.html#aca74448c7de3df16a81e878d8bce7a7" title="Stored data.">data</a>; }
<a name="l00235"></a><a class="code" href="classcsList.html#1ab7f69adf3b67f84c0b628586632405">00235</a>   T&amp; <a class="code" href="classcsList.html#1ab7f69adf3b67f84c0b628586632405" title="Return last element of the list.">Last</a> ()<span class="keyword"> const</span>
<a name="l00236"></a>00236 <span class="keyword">  </span>{ <span class="keywordflow">return</span> tail-&gt;<a class="code" href="structcsList_1_1csListElement.html#aca74448c7de3df16a81e878d8bce7a7" title="Stored data.">data</a>; }
<a name="l00237"></a>00237 
<a name="l00239"></a><a class="code" href="classcsList.html#3ba57d74ccf1ee850b343f4dcc7bd383">00239</a>   <span class="keywordtype">bool</span> <a class="code" href="classcsList.html#3ba57d74ccf1ee850b343f4dcc7bd383" title="Deletes the first element of the list.">PopFront</a> ()
<a name="l00240"></a>00240   {
<a name="l00241"></a>00241     <span class="keywordflow">if</span> (!head)
<a name="l00242"></a>00242       <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00243"></a>00243     <a class="code" href="classcsList.html#f499b092f84e7bb2cca0c645f9d692aa" title="Remove specific item by explicit ref.">Delete</a> (head);
<a name="l00244"></a>00244     <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00245"></a>00245   }
<a name="l00246"></a>00246 
<a name="l00248"></a><a class="code" href="classcsList.html#b30369adfd70e49bf3788e32d8cce825">00248</a>   <span class="keywordtype">bool</span> <a class="code" href="classcsList.html#b30369adfd70e49bf3788e32d8cce825" title="Deletes the last element of the list.">PopBack</a> ()
<a name="l00249"></a>00249   {
<a name="l00250"></a>00250     <span class="keywordflow">if</span> (!tail)
<a name="l00251"></a>00251       <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00252"></a>00252     <a class="code" href="classcsList.html#f499b092f84e7bb2cca0c645f9d692aa" title="Remove specific item by explicit ref.">Delete</a> (tail);
<a name="l00253"></a>00253     <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00254"></a>00254   }
<a name="l00255"></a>00255   
<a name="l00256"></a><a class="code" href="classcsList.html#7a7b6e76147c34c1f6b8e2b3cb33167e">00256</a>   <span class="keywordtype">bool</span> <a class="code" href="classcsList.html#7a7b6e76147c34c1f6b8e2b3cb33167e">IsEmpty</a> ()<span class="keyword"> const</span>
<a name="l00257"></a>00257 <span class="keyword">  </span>{
<a name="l00258"></a>00258     <a class="code" href="cssysdef_8h.html#c380bd47888ecfe73e7b7a40b6f827a1" title="Assertion.">CS_ASSERT</a>((head == 0 &amp;&amp; tail == 0) || (head !=0 &amp;&amp; tail != 0));
<a name="l00259"></a>00259     <span class="keywordflow">return</span> head == 0;
<a name="l00260"></a>00260   }
<a name="l00261"></a>00261 
<a name="l00262"></a>00262 <span class="keyword">private</span>:
<a name="l00263"></a><a class="code" href="classcsList.html#9830fc407400559db7e7783cc10a9394">00263</a>   <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classcsList.html#9830fc407400559db7e7783cc10a9394">Iterator</a>;
<a name="l00264"></a>00264   csListElement *head, *tail;
<a name="l00265"></a>00265 };
<a name="l00266"></a>00266 
<a name="l00268"></a>00268 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00269"></a><a class="code" href="classcsList.html#9f984613115c6690fe2f00c74c102587">00269</a> <span class="keyword">inline</span> <a class="code" href="classcsList.html#25d9fb6fda739858c66e81abdf68cd9a" title="Default constructor.">csList&lt;T&gt;::csList</a>(<span class="keyword">const</span> <a class="code" href="classcsList.html" title="A lightweight double-linked list template.">csList&lt;T&gt;</a> &amp;other) : head(0), tail(0)
<a name="l00270"></a>00270 {
<a name="l00271"></a>00271   <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>* e = other.<a class="code" href="classcsList.html#a9159b2936ca2b137199914a50651e4c">head</a>;
<a name="l00272"></a>00272   <span class="keywordflow">while</span> (e != 0)
<a name="l00273"></a>00273   {
<a name="l00274"></a>00274     <a class="code" href="classcsList.html#02303fc82d290f9bf65e7c3117fd5799" title="Add an item last in list. Copy T into the listdata.">PushBack</a> (e-&gt;<a class="code" href="structcsList_1_1csListElement.html#aca74448c7de3df16a81e878d8bce7a7" title="Stored data.">data</a>);
<a name="l00275"></a>00275     e = e-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a>;
<a name="l00276"></a>00276   }
<a name="l00277"></a>00277 }
<a name="l00278"></a>00278 
<a name="l00280"></a>00280 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00281"></a><a class="code" href="classcsList.html#d7cb8d111c68780123fefb200a30ef07">00281</a> <span class="keyword">inline</span> <a class="code" href="classcsList.html" title="A lightweight double-linked list template.">csList&lt;T&gt;</a>&amp; <a class="code" href="classcsList.html#d7cb8d111c68780123fefb200a30ef07" title="Assignment, shallow copy.">csList&lt;T&gt;::operator= </a>(<span class="keyword">const</span> <a class="code" href="classcsList.html" title="A lightweight double-linked list template.">csList&lt;T&gt;</a> &amp;other)
<a name="l00282"></a>00282 {
<a name="l00283"></a>00283   <a class="code" href="classcsList.html#492cbe560e1a91585f84d49d8d1ed563" title="Empty an list.">DeleteAll</a> ();
<a name="l00284"></a>00284   <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>* e = other.<a class="code" href="classcsList.html#a9159b2936ca2b137199914a50651e4c">head</a>;
<a name="l00285"></a>00285   <span class="keywordflow">while</span> (e != 0)
<a name="l00286"></a>00286   {
<a name="l00287"></a>00287     <a class="code" href="classcsList.html#02303fc82d290f9bf65e7c3117fd5799" title="Add an item last in list. Copy T into the listdata.">PushBack</a> (e-&gt;<a class="code" href="structcsList_1_1csListElement.html#aca74448c7de3df16a81e878d8bce7a7" title="Stored data.">data</a>);
<a name="l00288"></a>00288     e = e-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a>;
<a name="l00289"></a>00289   }
<a name="l00290"></a>00290   <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00291"></a>00291 }
<a name="l00292"></a>00292 
<a name="l00294"></a>00294 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00295"></a><a class="code" href="classcsList.html#492cbe560e1a91585f84d49d8d1ed563">00295</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classcsList.html#492cbe560e1a91585f84d49d8d1ed563" title="Empty an list.">csList&lt;T&gt;::DeleteAll</a> ()
<a name="l00296"></a>00296 {
<a name="l00297"></a>00297   <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a> *cur = head, *next = 0;
<a name="l00298"></a>00298   <span class="keywordflow">while</span> (cur != 0)
<a name="l00299"></a>00299   {
<a name="l00300"></a>00300     next = cur-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a>;
<a name="l00301"></a>00301     <span class="keyword">delete</span> cur;
<a name="l00302"></a>00302     cur = next;
<a name="l00303"></a>00303   }
<a name="l00304"></a>00304   head = tail = 0;
<a name="l00305"></a>00305 }
<a name="l00306"></a>00306 
<a name="l00308"></a>00308 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00309"></a><a class="code" href="classcsList.html#02303fc82d290f9bf65e7c3117fd5799">00309</a> <span class="keyword">inline</span> <span class="keyword">typename</span> <a class="code" href="classcsList.html" title="A lightweight double-linked list template.">csList&lt;T&gt;::Iterator</a> <a class="code" href="classcsList.html#02303fc82d290f9bf65e7c3117fd5799" title="Add an item last in list. Copy T into the listdata.">csList&lt;T&gt;::PushBack</a> (<span class="keyword">const</span> T&amp; e)
<a name="l00310"></a>00310 {
<a name="l00311"></a>00311   <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>* el = <span class="keyword">new</span> <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a> (e, 0, tail);
<a name="l00312"></a>00312   <span class="keywordflow">if</span> (tail)
<a name="l00313"></a>00313     tail-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a> = el;
<a name="l00314"></a>00314   <span class="keywordflow">else</span>
<a name="l00315"></a>00315     head = el;
<a name="l00316"></a>00316   tail = el;
<a name="l00317"></a>00317   <span class="keywordflow">return</span> <a class="code" href="classcsList.html#9830fc407400559db7e7783cc10a9394">Iterator</a>(el);
<a name="l00318"></a>00318 }
<a name="l00319"></a>00319 
<a name="l00321"></a>00321 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00322"></a><a class="code" href="classcsList.html#c22e673fec392316de4fc3504e82f7a3">00322</a> <span class="keyword">inline</span> <span class="keyword">typename</span> <a class="code" href="classcsList.html" title="A lightweight double-linked list template.">csList&lt;T&gt;::Iterator</a> <a class="code" href="classcsList.html#c22e673fec392316de4fc3504e82f7a3" title="Add an item first in list. Copy T into the listdata.">csList&lt;T&gt;::PushFront</a> (<span class="keyword">const</span> T&amp; e)
<a name="l00323"></a>00323 {
<a name="l00324"></a>00324   <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>* el = <span class="keyword">new</span> <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a> (e, head, 0);
<a name="l00325"></a>00325   <span class="keywordflow">if</span> (head)
<a name="l00326"></a>00326     head-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a> = el;
<a name="l00327"></a>00327   <span class="keywordflow">else</span>
<a name="l00328"></a>00328     tail = el;
<a name="l00329"></a>00329   head = el;
<a name="l00330"></a>00330   <span class="keywordflow">return</span> <a class="code" href="classcsList.html#9830fc407400559db7e7783cc10a9394">Iterator</a> (el);
<a name="l00331"></a>00331 }
<a name="l00332"></a>00332 
<a name="l00333"></a>00333 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00334"></a><a class="code" href="classcsList.html#59555bc917d77abec07289db8f603b7d">00334</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classcsList.html#59555bc917d77abec07289db8f603b7d" title="Insert an item after the item the iterator is set to.">csList&lt;T&gt;::InsertAfter</a> (<a class="code" href="classcsList_1_1Iterator.html" title="Iterator for the list.">Iterator</a> &amp;it, <span class="keyword">const</span> T&amp; item)
<a name="l00335"></a>00335 {
<a name="l00336"></a>00336   <a class="code" href="cssysdef_8h.html#c380bd47888ecfe73e7b7a40b6f827a1" title="Assertion.">CS_ASSERT</a>(it.<a class="code" href="classcsList_1_1Iterator.html#5d1301d35065281aecbdf8f9347c0ad8" title="Test if the Iterator is set to a valid element.">HasCurrent</a>());
<a name="l00337"></a>00337   <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>* el = it.<a class="code" href="classcsList_1_1Iterator.html#cd19d8645eb91f9e8599d5a213569d27">ptr</a>;
<a name="l00338"></a>00338   <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>* next = el-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a>;
<a name="l00339"></a>00339   <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>* prev = el;
<a name="l00340"></a>00340   <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>* newEl = <span class="keyword">new</span> <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a> (item, next, prev);
<a name="l00341"></a>00341   <span class="keywordflow">if</span> (!next) <span class="comment">// this is the last element</span>
<a name="l00342"></a>00342     tail = newEl;
<a name="l00343"></a>00343   <span class="keywordflow">else</span>
<a name="l00344"></a>00344     el-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a>-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a> = newEl;
<a name="l00345"></a>00345   el-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a> = newEl;
<a name="l00346"></a>00346 }
<a name="l00347"></a>00347 
<a name="l00348"></a>00348 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00349"></a><a class="code" href="classcsList.html#a6d214dbdc462282c4329c28c0a9b85c">00349</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classcsList.html#a6d214dbdc462282c4329c28c0a9b85c" title="Insert an item before the item the iterator is set to.">csList&lt;T&gt;::InsertBefore</a> (<a class="code" href="classcsList_1_1Iterator.html" title="Iterator for the list.">Iterator</a> &amp;it, <span class="keyword">const</span> T&amp; item)
<a name="l00350"></a>00350 {
<a name="l00351"></a>00351   <a class="code" href="cssysdef_8h.html#c380bd47888ecfe73e7b7a40b6f827a1" title="Assertion.">CS_ASSERT</a>(it.<a class="code" href="classcsList_1_1Iterator.html#5d1301d35065281aecbdf8f9347c0ad8" title="Test if the Iterator is set to a valid element.">HasCurrent</a>());
<a name="l00352"></a>00352   <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>* el = it.<a class="code" href="classcsList_1_1Iterator.html#cd19d8645eb91f9e8599d5a213569d27">ptr</a>;
<a name="l00353"></a>00353   <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>* next = el;
<a name="l00354"></a>00354   <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>* prev = el-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a>;
<a name="l00355"></a>00355   <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>* newEl = <span class="keyword">new</span> <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a> (item, next, prev);
<a name="l00356"></a>00356   <span class="keywordflow">if</span> (!prev) <span class="comment">// this is the first element</span>
<a name="l00357"></a>00357     head = newEl;
<a name="l00358"></a>00358   <span class="keywordflow">else</span>
<a name="l00359"></a>00359     el-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a>-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a> = newEl;
<a name="l00360"></a>00360   el-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a> = newEl;
<a name="l00361"></a>00361 }
<a name="l00362"></a>00362 
<a name="l00363"></a>00363 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00364"></a><a class="code" href="classcsList.html#05fcfb027e72e08573fb02e3b712e6a5">00364</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classcsList.html#05fcfb027e72e08573fb02e3b712e6a5" title="Move an item (as iterator) after the item the iterator is set to.">csList&lt;T&gt;::MoveAfter</a> (<span class="keyword">const</span> <a class="code" href="classcsList_1_1Iterator.html" title="Iterator for the list.">Iterator</a> &amp;it, <span class="keyword">const</span> <a class="code" href="classcsList_1_1Iterator.html" title="Iterator for the list.">Iterator</a> &amp;item)
<a name="l00365"></a>00365 {
<a name="l00366"></a>00366   <a class="code" href="cssysdef_8h.html#c380bd47888ecfe73e7b7a40b6f827a1" title="Assertion.">CS_ASSERT</a>(item.<a class="code" href="classcsList_1_1Iterator.html#5d1301d35065281aecbdf8f9347c0ad8" title="Test if the Iterator is set to a valid element.">HasCurrent</a>());
<a name="l00367"></a>00367   <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>* el_item = item.<a class="code" href="classcsList_1_1Iterator.html#cd19d8645eb91f9e8599d5a213569d27">ptr</a>;
<a name="l00368"></a>00368 
<a name="l00369"></a>00369   <span class="comment">// Unlink the item.</span>
<a name="l00370"></a>00370   <span class="keywordflow">if</span> (el_item-&gt;prev)
<a name="l00371"></a>00371     el_item-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a>-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a> = el_item-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a>;
<a name="l00372"></a>00372   <span class="keywordflow">else</span>
<a name="l00373"></a>00373     head = el_item-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a>;
<a name="l00374"></a>00374   <span class="keywordflow">if</span> (el_item-&gt;next)
<a name="l00375"></a>00375     el_item-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a>-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a> = el_item-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a>;
<a name="l00376"></a>00376   <span class="keywordflow">else</span>
<a name="l00377"></a>00377     tail = el_item-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a>;
<a name="l00378"></a>00378 
<a name="l00379"></a>00379   <a class="code" href="cssysdef_8h.html#c380bd47888ecfe73e7b7a40b6f827a1" title="Assertion.">CS_ASSERT</a>(it.<a class="code" href="classcsList_1_1Iterator.html#5d1301d35065281aecbdf8f9347c0ad8" title="Test if the Iterator is set to a valid element.">HasCurrent</a>());
<a name="l00380"></a>00380   <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>* el = it.<a class="code" href="classcsList_1_1Iterator.html#cd19d8645eb91f9e8599d5a213569d27">ptr</a>;
<a name="l00381"></a>00381   <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>* next = el-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a>;
<a name="l00382"></a>00382   <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>* prev = el;
<a name="l00383"></a>00383 
<a name="l00384"></a>00384   el_item-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a> = next;
<a name="l00385"></a>00385   el_item-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a> = prev;
<a name="l00386"></a>00386   <span class="keywordflow">if</span> (!next) <span class="comment">// this is the last element</span>
<a name="l00387"></a>00387     tail = el_item;
<a name="l00388"></a>00388   <span class="keywordflow">else</span>
<a name="l00389"></a>00389     el-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a>-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a> = el_item;
<a name="l00390"></a>00390   el-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a> = el_item;
<a name="l00391"></a>00391 }
<a name="l00392"></a>00392 
<a name="l00393"></a>00393 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00394"></a><a class="code" href="classcsList.html#2f170c7324e08ab7991c9ebe52b4a1b1">00394</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classcsList.html#2f170c7324e08ab7991c9ebe52b4a1b1" title="Move an item (as iterator) before the item the iterator is set to.">csList&lt;T&gt;::MoveBefore</a> (<span class="keyword">const</span> <a class="code" href="classcsList_1_1Iterator.html" title="Iterator for the list.">Iterator</a> &amp;it, <span class="keyword">const</span> <a class="code" href="classcsList_1_1Iterator.html" title="Iterator for the list.">Iterator</a> &amp;item)
<a name="l00395"></a>00395 {
<a name="l00396"></a>00396   <a class="code" href="cssysdef_8h.html#c380bd47888ecfe73e7b7a40b6f827a1" title="Assertion.">CS_ASSERT</a>(item.<a class="code" href="classcsList_1_1Iterator.html#5d1301d35065281aecbdf8f9347c0ad8" title="Test if the Iterator is set to a valid element.">HasCurrent</a>());
<a name="l00397"></a>00397   <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>* el_item = item.<a class="code" href="classcsList_1_1Iterator.html#cd19d8645eb91f9e8599d5a213569d27">ptr</a>;
<a name="l00398"></a>00398 
<a name="l00399"></a>00399   <span class="comment">// Unlink the item.</span>
<a name="l00400"></a>00400   <span class="keywordflow">if</span> (el_item-&gt;prev)
<a name="l00401"></a>00401     el_item-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a>-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a> = el_item-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a>;
<a name="l00402"></a>00402   <span class="keywordflow">else</span>
<a name="l00403"></a>00403     head = el_item-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a>;
<a name="l00404"></a>00404   <span class="keywordflow">if</span> (el_item-&gt;next)
<a name="l00405"></a>00405     el_item-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a>-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a> = el_item-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a>;
<a name="l00406"></a>00406   <span class="keywordflow">else</span>
<a name="l00407"></a>00407     tail = el_item-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a>;
<a name="l00408"></a>00408 
<a name="l00409"></a>00409   <a class="code" href="cssysdef_8h.html#c380bd47888ecfe73e7b7a40b6f827a1" title="Assertion.">CS_ASSERT</a>(it.<a class="code" href="classcsList_1_1Iterator.html#5d1301d35065281aecbdf8f9347c0ad8" title="Test if the Iterator is set to a valid element.">HasCurrent</a>());
<a name="l00410"></a>00410   <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>* el = it.<a class="code" href="classcsList_1_1Iterator.html#cd19d8645eb91f9e8599d5a213569d27">ptr</a>;
<a name="l00411"></a>00411   <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>* next = el;
<a name="l00412"></a>00412   <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>* prev = el-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a>;
<a name="l00413"></a>00413 
<a name="l00414"></a>00414   el_item-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a> = next;
<a name="l00415"></a>00415   el_item-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a> = prev;
<a name="l00416"></a>00416   <span class="keywordflow">if</span> (!prev) <span class="comment">// this is the first element</span>
<a name="l00417"></a>00417     head = el_item;
<a name="l00418"></a>00418   <span class="keywordflow">else</span>
<a name="l00419"></a>00419     el-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a>-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a> = el_item;
<a name="l00420"></a>00420   el-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a> = el_item;
<a name="l00421"></a>00421 }
<a name="l00422"></a>00422 
<a name="l00423"></a>00423 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00424"></a><a class="code" href="classcsList.html#2bc2aab0d4361b0b8229d8063a2ead9f">00424</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classcsList.html#f499b092f84e7bb2cca0c645f9d692aa" title="Remove specific item by explicit ref.">csList&lt;T&gt;::Delete</a> (<a class="code" href="classcsList_1_1Iterator.html" title="Iterator for the list.">Iterator</a> &amp;it)
<a name="l00425"></a>00425 {
<a name="l00426"></a>00426   <a class="code" href="cssysdef_8h.html#c380bd47888ecfe73e7b7a40b6f827a1" title="Assertion.">CS_ASSERT</a>(it.<a class="code" href="classcsList_1_1Iterator.html#5d1301d35065281aecbdf8f9347c0ad8" title="Test if the Iterator is set to a valid element.">HasCurrent</a>());
<a name="l00427"></a>00427   <a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a>* el = it.<a class="code" href="classcsList_1_1Iterator.html#cd19d8645eb91f9e8599d5a213569d27">ptr</a>;
<a name="l00428"></a>00428 
<a name="l00429"></a>00429   <span class="comment">// Advance the iterator so we can delete the data it's using</span>
<a name="l00430"></a>00430   <span class="keywordflow">if</span> (it.<a class="code" href="classcsList_1_1Iterator.html#5bb0d4f32711fc30b4946d3fab7d2fd3" title="Test if the iterator is reversed.">IsReverse</a>())
<a name="l00431"></a>00431     --it;
<a name="l00432"></a>00432   <span class="keywordflow">else</span>
<a name="l00433"></a>00433     ++it;
<a name="l00434"></a>00434 
<a name="l00435"></a>00435   <a class="code" href="classcsList.html#f499b092f84e7bb2cca0c645f9d692aa" title="Remove specific item by explicit ref.">Delete</a>(el);
<a name="l00436"></a>00436 }
<a name="l00437"></a>00437 
<a name="l00438"></a>00438 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00439"></a><a class="code" href="classcsList.html#f499b092f84e7bb2cca0c645f9d692aa">00439</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classcsList.html#f499b092f84e7bb2cca0c645f9d692aa" title="Remove specific item by explicit ref.">csList&lt;T&gt;::Delete</a> (<a class="code" href="structcsList_1_1csListElement.html" title="Template which describes the data stored in the linked list For example a list of...">csListElement</a> *el)
<a name="l00440"></a>00440 {
<a name="l00441"></a>00441   <a class="code" href="cssysdef_8h.html#c380bd47888ecfe73e7b7a40b6f827a1" title="Assertion.">CS_ASSERT</a>(el != 0);
<a name="l00442"></a>00442 
<a name="l00443"></a>00443   <span class="comment">// Fix the pointers of the 2 surrounding elements</span>
<a name="l00444"></a>00444   <span class="keywordflow">if</span> (el-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a>)
<a name="l00445"></a>00445     el-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a>-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a> = el-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a>;
<a name="l00446"></a>00446   <span class="keywordflow">else</span>
<a name="l00447"></a>00447     head = el-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a>;
<a name="l00448"></a>00448 
<a name="l00449"></a>00449   <span class="keywordflow">if</span> (el-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a>)
<a name="l00450"></a>00450     el-&gt;<a class="code" href="structcsList_1_1csListElement.html#1dc7cf55a7a341e3d6ebd9d6f3dd8661" title="Next element in list. If this is the last one, then next is 0.">next</a>-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a> = el-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a>;
<a name="l00451"></a>00451   <span class="keywordflow">else</span>
<a name="l00452"></a>00452     tail = el-&gt;<a class="code" href="structcsList_1_1csListElement.html#de3dcc09f29c50ae66cf55d31fa9fa75" title="Previous element in list. If this is the first one, prev is 0.">prev</a>;
<a name="l00453"></a>00453 
<a name="l00454"></a>00454   <span class="keyword">delete</span> el;
<a name="l00455"></a>00455 }
<a name="l00456"></a>00456 
<a name="l00457"></a>00457 <span class="preprocessor">#endif //__CS_UTIL_LIST_H__</span>
</pre></div><hr size="1"><address><small>Generated for Crystal Space 1.2.1 by 
<a href="http://www.doxygen.org/index.html">doxygen</a> 1.5.3 
</small></address> </div></body> </html>