mirror of
https://github.com/minetest/irrlicht.git
synced 2024-11-14 06:20:26 +01:00
504 lines
51 KiB
HTML
504 lines
51 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<title>Irrlicht 3D Engine: irrList.h Source File</title>
|
|
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
<link href="navtree.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="resize.js"></script>
|
|
<script type="text/javascript" src="navtree.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(initResizable);
|
|
</script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() { searchBox.OnSelectItem(0); });
|
|
</script>
|
|
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div! -->
|
|
|
|
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 56px;">
|
|
|
|
<td id="projectlogo"><img alt="Logo" src="irrlichtlogo.png"/></td>
|
|
|
|
|
|
<td style="padding-left: 0.5em;">
|
|
<div id="projectname">Irrlicht 3D Engine
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
<td> <div id="MSearchBox" class="MSearchBoxInactive">
|
|
<span class="left">
|
|
<img id="MSearchSelect" src="search/mag_sel.png"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
alt=""/>
|
|
<input type="text" id="MSearchField" value="Search" accesskey="S"
|
|
onfocus="searchBox.OnSearchFieldFocus(true)"
|
|
onblur="searchBox.OnSearchFieldFocus(false)"
|
|
onkeyup="searchBox.OnSearchFieldChange(event)"/>
|
|
</span><span class="right">
|
|
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
|
|
</span>
|
|
</div>
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- Generated by Doxygen 1.7.5.1 -->
|
|
<script type="text/javascript">
|
|
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
|
</script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
</div>
|
|
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
|
<div id="nav-tree">
|
|
<div id="nav-tree-contents">
|
|
</div>
|
|
</div>
|
|
<div id="splitbar" style="-moz-user-select:none;"
|
|
class="ui-resizable-handle">
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
initNavTree('irr_list_8h.html','');
|
|
</script>
|
|
<div id="doc-content">
|
|
<div class="header">
|
|
<div class="headertitle">
|
|
<div class="title">irrList.h</div> </div>
|
|
</div>
|
|
<div class="contents">
|
|
<a href="irr_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">// Copyright (C) 2002-2012 Nikolaus Gebhardt</span>
|
|
<a name="l00002"></a>00002 <span class="comment">// This file is part of the "Irrlicht Engine".</span>
|
|
<a name="l00003"></a>00003 <span class="comment">// For conditions of distribution and use, see copyright notice in irrlicht.h</span>
|
|
<a name="l00004"></a>00004
|
|
<a name="l00005"></a>00005 <span class="preprocessor">#ifndef __IRR_LIST_H_INCLUDED__</span>
|
|
<a name="l00006"></a>00006 <span class="preprocessor"></span><span class="preprocessor">#define __IRR_LIST_H_INCLUDED__</span>
|
|
<a name="l00007"></a>00007 <span class="preprocessor"></span>
|
|
<a name="l00008"></a>00008 <span class="preprocessor">#include "<a class="code" href="irr_types_8h.html">irrTypes.h</a>"</span>
|
|
<a name="l00009"></a>00009 <span class="preprocessor">#include "<a class="code" href="irr_allocator_8h.html">irrAllocator.h</a>"</span>
|
|
<a name="l00010"></a>00010 <span class="preprocessor">#include "<a class="code" href="irr_math_8h.html">irrMath.h</a>"</span>
|
|
<a name="l00011"></a>00011
|
|
<a name="l00012"></a>00012 <span class="keyword">namespace </span>irr
|
|
<a name="l00013"></a>00013 {
|
|
<a name="l00014"></a>00014 <span class="keyword">namespace </span>core
|
|
<a name="l00015"></a>00015 {
|
|
<a name="l00016"></a>00016
|
|
<a name="l00017"></a>00017
|
|
<a name="l00019"></a>00019 <span class="keyword">template</span> <<span class="keyword">class</span> T>
|
|
<a name="l00020"></a><a class="code" href="classirr_1_1core_1_1list.html">00020</a> <span class="keyword">class </span><a class="code" href="classirr_1_1core_1_1list.html" title="Doubly linked list template.">list</a>
|
|
<a name="l00021"></a>00021 {
|
|
<a name="l00022"></a>00022 <span class="keyword">private</span>:
|
|
<a name="l00023"></a>00023
|
|
<a name="l00025"></a>00025 <span class="keyword">struct </span>SKListNode
|
|
<a name="l00026"></a>00026 {
|
|
<a name="l00027"></a>00027 SKListNode(<span class="keyword">const</span> T& e) : Next(0), Prev(0), Element(e) {}
|
|
<a name="l00028"></a>00028
|
|
<a name="l00029"></a>00029 SKListNode* Next;
|
|
<a name="l00030"></a>00030 SKListNode* Prev;
|
|
<a name="l00031"></a>00031 T Element;
|
|
<a name="l00032"></a>00032 };
|
|
<a name="l00033"></a>00033
|
|
<a name="l00034"></a>00034 <span class="keyword">public</span>:
|
|
<a name="l00035"></a>00035 <span class="keyword">class </span><a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html" title="List iterator for const access.">ConstIterator</a>;
|
|
<a name="l00036"></a>00036
|
|
<a name="l00038"></a><a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html">00038</a> <span class="keyword">class </span><a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html" title="List iterator.">Iterator</a>
|
|
<a name="l00039"></a>00039 {
|
|
<a name="l00040"></a>00040 <span class="keyword">public</span>:
|
|
<a name="l00041"></a><a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#a13ecef6ce4eb939c748df9ec753dcc1e">00041</a> <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#a13ecef6ce4eb939c748df9ec753dcc1e">Iterator</a>() : Current(0) {}
|
|
<a name="l00042"></a>00042
|
|
<a name="l00043"></a><a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#a3d9a0e89be1ca80a0e4ca6321723ca46">00043</a> <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html" title="List iterator.">Iterator</a>& <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#a3d9a0e89be1ca80a0e4ca6321723ca46">operator ++</a>() { Current = Current->Next; <span class="keywordflow">return</span> *<span class="keyword">this</span>; }
|
|
<a name="l00044"></a><a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#a8faef85eda196959b528c3879ff04ba2">00044</a> <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html" title="List iterator.">Iterator</a>& <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#a8faef85eda196959b528c3879ff04ba2">operator --</a>() { Current = Current->Prev; <span class="keywordflow">return</span> *<span class="keyword">this</span>; }
|
|
<a name="l00045"></a><a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#a9313eb2751b512cb35baf01edcd83cc9">00045</a> <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html" title="List iterator.">Iterator</a> <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#a3d9a0e89be1ca80a0e4ca6321723ca46">operator ++</a>(<a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a>) { <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html" title="List iterator.">Iterator</a> tmp = *<span class="keyword">this</span>; Current = Current->Next; <span class="keywordflow">return</span> tmp; }
|
|
<a name="l00046"></a><a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#a34ed22dcfb28ab5313dd82557c7d06e4">00046</a> <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html" title="List iterator.">Iterator</a> <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#a8faef85eda196959b528c3879ff04ba2">operator --</a>(<a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a>) { <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html" title="List iterator.">Iterator</a> tmp = *<span class="keyword">this</span>; Current = Current->Prev; <span class="keywordflow">return</span> tmp; }
|
|
<a name="l00047"></a>00047
|
|
<a name="l00048"></a><a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#a1c96267d7500c946e35230032a87689f">00048</a> <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html" title="List iterator.">Iterator</a>& <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#a1c96267d7500c946e35230032a87689f">operator +=</a>(<a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> num)
|
|
<a name="l00049"></a>00049 {
|
|
<a name="l00050"></a>00050 <span class="keywordflow">if</span>(num > 0)
|
|
<a name="l00051"></a>00051 {
|
|
<a name="l00052"></a>00052 <span class="keywordflow">while</span> (num-- && this->Current != 0) ++(*this);
|
|
<a name="l00053"></a>00053 }
|
|
<a name="l00054"></a>00054 <span class="keywordflow">else</span>
|
|
<a name="l00055"></a>00055 {
|
|
<a name="l00056"></a>00056 <span class="keywordflow">while</span>(num++ && this->Current != 0) --(*this);
|
|
<a name="l00057"></a>00057 }
|
|
<a name="l00058"></a>00058 <span class="keywordflow">return</span> *<span class="keyword">this</span>;
|
|
<a name="l00059"></a>00059 }
|
|
<a name="l00060"></a>00060
|
|
<a name="l00061"></a><a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#a5a851ff3ab7772d737081b9a43fd1966">00061</a> <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html" title="List iterator.">Iterator</a> <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#a5a851ff3ab7772d737081b9a43fd1966">operator + </a>(<a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> num)<span class="keyword"> const </span>{ <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html" title="List iterator.">Iterator</a> tmp = *<span class="keyword">this</span>; <span class="keywordflow">return</span> tmp += num; }
|
|
<a name="l00062"></a><a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#ab20ca9b8ae2d25f1c71e07f16d6a4756">00062</a> <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html" title="List iterator.">Iterator</a>& <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#ab20ca9b8ae2d25f1c71e07f16d6a4756">operator -=</a>(<a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> num) { <span class="keywordflow">return</span> (*<span class="keyword">this</span>)+=(-num); }
|
|
<a name="l00063"></a><a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#ac8ce969b3206702e2fc9126e12bf3f05">00063</a> <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html" title="List iterator.">Iterator</a> <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#ac8ce969b3206702e2fc9126e12bf3f05">operator - </a>(<a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> num)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (*<span class="keyword">this</span>)+ (-num); }
|
|
<a name="l00064"></a>00064
|
|
<a name="l00065"></a><a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#ac78b31a3d252ad80d2cbab9e4ccb6e2f">00065</a> <span class="keywordtype">bool</span> <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#ac78b31a3d252ad80d2cbab9e4ccb6e2f">operator ==</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html" title="List iterator.">Iterator</a>& other)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> Current == other.Current; }
|
|
<a name="l00066"></a><a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#ad2a098b5ca3b48caf7515a418439f228">00066</a> <span class="keywordtype">bool</span> <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#ad2a098b5ca3b48caf7515a418439f228">operator !=</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html" title="List iterator.">Iterator</a>& other)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> Current != other.Current; }
|
|
<a name="l00067"></a><a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#adf8c0162b8a04c67dde72a097bef4f1e">00067</a> <span class="keywordtype">bool</span> <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#ac78b31a3d252ad80d2cbab9e4ccb6e2f">operator ==</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html" title="List iterator for const access.">ConstIterator</a>& other)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> Current == other.Current; }
|
|
<a name="l00068"></a><a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#ae3cda104f0aedc5f2983aaa8c7d38b2e">00068</a> <span class="keywordtype">bool</span> <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#ad2a098b5ca3b48caf7515a418439f228">operator !=</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html" title="List iterator for const access.">ConstIterator</a>& other)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> Current != other.Current; }
|
|
<a name="l00069"></a>00069
|
|
<a name="l00070"></a>00070 <span class="preprocessor"> #if defined (_MSC_VER) && (_MSC_VER < 1300)</span>
|
|
<a name="l00071"></a>00071 <span class="preprocessor"></span><span class="preprocessor"> #pragma warning(disable:4284) // infix notation problem when using iterator operator -></span>
|
|
<a name="l00072"></a>00072 <span class="preprocessor"></span><span class="preprocessor"> #endif</span>
|
|
<a name="l00073"></a>00073 <span class="preprocessor"></span>
|
|
<a name="l00074"></a><a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#a6a7b856e9c9cc597e84604dbfaf9dabf">00074</a> T & <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#a6a7b856e9c9cc597e84604dbfaf9dabf">operator * </a>() { <span class="keywordflow">return</span> Current->Element; }
|
|
<a name="l00075"></a><a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#a5ae27bad569cb829ece1d55d74c62ace">00075</a> T * <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#a5ae27bad569cb829ece1d55d74c62ace">operator -></a>() { <span class="keywordflow">return</span> &Current->Element; }
|
|
<a name="l00076"></a>00076
|
|
<a name="l00077"></a>00077 <span class="keyword">private</span>:
|
|
<a name="l00078"></a>00078 <span class="keyword">explicit</span> <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#a13ecef6ce4eb939c748df9ec753dcc1e">Iterator</a>(SKListNode* <a class="code" href="classirr_1_1core_1_1list.html#aebd05a0f5e5ead6e1d5b6e3973da8039" title="Gets first node.">begin</a>) : Current(begin) {}
|
|
<a name="l00079"></a>00079
|
|
<a name="l00080"></a>00080 SKListNode* Current;
|
|
<a name="l00081"></a>00081
|
|
<a name="l00082"></a><a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#ab6cf03d50c50087700b0fb872accfa7b">00082</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classirr_1_1core_1_1list.html" title="Doubly linked list template.">list</a><T>;
|
|
<a name="l00083"></a><a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html#a5485970bb9da6b5d782fa28638b5658f">00083</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html" title="List iterator for const access.">ConstIterator</a>;
|
|
<a name="l00084"></a>00084 };
|
|
<a name="l00085"></a>00085
|
|
<a name="l00087"></a><a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html">00087</a> <span class="keyword">class </span><a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html" title="List iterator for const access.">ConstIterator</a>
|
|
<a name="l00088"></a>00088 {
|
|
<a name="l00089"></a>00089 <span class="keyword">public</span>:
|
|
<a name="l00090"></a>00090
|
|
<a name="l00091"></a><a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#a7afc570d9ea053e82783c5950b87e76d">00091</a> <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#a7afc570d9ea053e82783c5950b87e76d">ConstIterator</a>() : Current(0) {}
|
|
<a name="l00092"></a><a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#acf9f597d398738e731a5911225fd4205">00092</a> <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#acf9f597d398738e731a5911225fd4205">ConstIterator</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html" title="List iterator.">Iterator</a>& iter) : Current(iter.Current) {}
|
|
<a name="l00093"></a>00093
|
|
<a name="l00094"></a><a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#a81399bb49cfd5086f681915088f86e9a">00094</a> <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html" title="List iterator for const access.">ConstIterator</a>& <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#a81399bb49cfd5086f681915088f86e9a">operator ++</a>() { Current = Current->Next; <span class="keywordflow">return</span> *<span class="keyword">this</span>; }
|
|
<a name="l00095"></a><a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#a64394500b4c45852fe77a1b7e9f96bad">00095</a> <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html" title="List iterator for const access.">ConstIterator</a>& <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#a64394500b4c45852fe77a1b7e9f96bad">operator --</a>() { Current = Current->Prev; <span class="keywordflow">return</span> *<span class="keyword">this</span>; }
|
|
<a name="l00096"></a><a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#a21710432f6c9618479bb8a76ea89f598">00096</a> <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html" title="List iterator for const access.">ConstIterator</a> <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#a81399bb49cfd5086f681915088f86e9a">operator ++</a>(<a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a>) { <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html" title="List iterator for const access.">ConstIterator</a> tmp = *<span class="keyword">this</span>; Current = Current->Next; <span class="keywordflow">return</span> tmp; }
|
|
<a name="l00097"></a><a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#a36ff8397c373597162503f0eefdd626b">00097</a> <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html" title="List iterator for const access.">ConstIterator</a> <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#a64394500b4c45852fe77a1b7e9f96bad">operator --</a>(<a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a>) { <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html" title="List iterator for const access.">ConstIterator</a> tmp = *<span class="keyword">this</span>; Current = Current->Prev; <span class="keywordflow">return</span> tmp; }
|
|
<a name="l00098"></a>00098
|
|
<a name="l00099"></a><a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#af473621024114d0592f1cb2a6a503139">00099</a> <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html" title="List iterator for const access.">ConstIterator</a>& <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#af473621024114d0592f1cb2a6a503139">operator +=</a>(<a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> num)
|
|
<a name="l00100"></a>00100 {
|
|
<a name="l00101"></a>00101 <span class="keywordflow">if</span>(num > 0)
|
|
<a name="l00102"></a>00102 {
|
|
<a name="l00103"></a>00103 <span class="keywordflow">while</span>(num-- && this->Current != 0) ++(*this);
|
|
<a name="l00104"></a>00104 }
|
|
<a name="l00105"></a>00105 <span class="keywordflow">else</span>
|
|
<a name="l00106"></a>00106 {
|
|
<a name="l00107"></a>00107 <span class="keywordflow">while</span>(num++ && this->Current != 0) --(*this);
|
|
<a name="l00108"></a>00108 }
|
|
<a name="l00109"></a>00109 <span class="keywordflow">return</span> *<span class="keyword">this</span>;
|
|
<a name="l00110"></a>00110 }
|
|
<a name="l00111"></a>00111
|
|
<a name="l00112"></a><a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#a551d6c729ebbfd6195dccad1254f5f5d">00112</a> <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html" title="List iterator for const access.">ConstIterator</a> <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#a551d6c729ebbfd6195dccad1254f5f5d">operator + </a>(<a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> num)<span class="keyword"> const </span>{ <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html" title="List iterator for const access.">ConstIterator</a> tmp = *<span class="keyword">this</span>; <span class="keywordflow">return</span> tmp += num; }
|
|
<a name="l00113"></a><a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#a3b68232b0c39696ffe97d5f2679a5bad">00113</a> <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html" title="List iterator for const access.">ConstIterator</a>& <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#a3b68232b0c39696ffe97d5f2679a5bad">operator -=</a>(<a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> num) { <span class="keywordflow">return</span> (*<span class="keyword">this</span>)+=(-num); }
|
|
<a name="l00114"></a><a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#af3a8433fd6cbe00cc3da1f5c946d4575">00114</a> <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html" title="List iterator for const access.">ConstIterator</a> <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#af3a8433fd6cbe00cc3da1f5c946d4575">operator - </a>(<a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> num)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (*<span class="keyword">this</span>)+ (-num); }
|
|
<a name="l00115"></a>00115
|
|
<a name="l00116"></a><a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#a70cd8a93665cda2f65b3fb6e870d0963">00116</a> <span class="keywordtype">bool</span> <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#a70cd8a93665cda2f65b3fb6e870d0963">operator ==</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html" title="List iterator for const access.">ConstIterator</a>& other)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> Current == other.Current; }
|
|
<a name="l00117"></a><a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#ac545434dc87ded0f9bd3fe513956c695">00117</a> <span class="keywordtype">bool</span> <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#ac545434dc87ded0f9bd3fe513956c695">operator !=</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html" title="List iterator for const access.">ConstIterator</a>& other)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> Current != other.Current; }
|
|
<a name="l00118"></a><a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#a2f5b81b5ecf7eb38f5a87729981e0994">00118</a> <span class="keywordtype">bool</span> <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#a70cd8a93665cda2f65b3fb6e870d0963">operator ==</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html" title="List iterator.">Iterator</a>& other)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> Current == other.Current; }
|
|
<a name="l00119"></a><a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#abb07e3438ee97211f478c5bf58b14e8c">00119</a> <span class="keywordtype">bool</span> <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#ac545434dc87ded0f9bd3fe513956c695">operator !=</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html" title="List iterator.">Iterator</a>& other)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> Current != other.Current; }
|
|
<a name="l00120"></a>00120
|
|
<a name="l00121"></a><a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#aca0141b366f403b7406b5b4f137f623a">00121</a> <span class="keyword">const</span> T & <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#aca0141b366f403b7406b5b4f137f623a">operator * </a>() { <span class="keywordflow">return</span> Current->Element; }
|
|
<a name="l00122"></a><a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#a9f2fce6eb3279389b34c3a35b3d3ff8e">00122</a> <span class="keyword">const</span> T * <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#a9f2fce6eb3279389b34c3a35b3d3ff8e">operator -></a>() { <span class="keywordflow">return</span> &Current->Element; }
|
|
<a name="l00123"></a>00123
|
|
<a name="l00124"></a><a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#a203907f016f941b0f944f5b10304f392">00124</a> <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html" title="List iterator for const access.">ConstIterator</a> & <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#a203907f016f941b0f944f5b10304f392">operator =</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html" title="List iterator.">Iterator</a> & iterator) { Current = iterator.Current; <span class="keywordflow">return</span> *<span class="keyword">this</span>; }
|
|
<a name="l00125"></a>00125
|
|
<a name="l00126"></a>00126 <span class="keyword">private</span>:
|
|
<a name="l00127"></a>00127 <span class="keyword">explicit</span> <a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#a7afc570d9ea053e82783c5950b87e76d">ConstIterator</a>(SKListNode* <a class="code" href="classirr_1_1core_1_1list.html#aebd05a0f5e5ead6e1d5b6e3973da8039" title="Gets first node.">begin</a>) : Current(begin) {}
|
|
<a name="l00128"></a>00128
|
|
<a name="l00129"></a>00129 SKListNode* Current;
|
|
<a name="l00130"></a>00130
|
|
<a name="l00131"></a><a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#a9830fc407400559db7e7783cc10a9394">00131</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classirr_1_1core_1_1list_1_1_iterator.html" title="List iterator.">Iterator</a>;
|
|
<a name="l00132"></a><a class="code" href="classirr_1_1core_1_1list_1_1_const_iterator.html#ab6cf03d50c50087700b0fb872accfa7b">00132</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classirr_1_1core_1_1list.html" title="Doubly linked list template.">list</a><T>;
|
|
<a name="l00133"></a>00133 };
|
|
<a name="l00134"></a>00134
|
|
<a name="l00136"></a><a class="code" href="classirr_1_1core_1_1list.html#aa4de347b726e57c72270377e1a07d41a">00136</a> <a class="code" href="classirr_1_1core_1_1list.html#aa4de347b726e57c72270377e1a07d41a" title="Default constructor for empty list.">list</a>()
|
|
<a name="l00137"></a>00137 : First(0), Last(0), Size(0) {}
|
|
<a name="l00138"></a>00138
|
|
<a name="l00139"></a>00139
|
|
<a name="l00141"></a><a class="code" href="classirr_1_1core_1_1list.html#a28c5e720eb16cee8bf8c26c233de3722">00141</a> <a class="code" href="classirr_1_1core_1_1list.html#aa4de347b726e57c72270377e1a07d41a" title="Default constructor for empty list.">list</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1list.html" title="Doubly linked list template.">list<T></a>& other) : First(0), Last(0), Size(0)
|
|
<a name="l00142"></a>00142 {
|
|
<a name="l00143"></a>00143 *<span class="keyword">this</span> = other;
|
|
<a name="l00144"></a>00144 }
|
|
<a name="l00145"></a>00145
|
|
<a name="l00146"></a>00146
|
|
<a name="l00148"></a><a class="code" href="classirr_1_1core_1_1list.html#a5c760fcc63fb6446a33d91e950736a57">00148</a> <a class="code" href="classirr_1_1core_1_1list.html#a5c760fcc63fb6446a33d91e950736a57" title="Destructor.">~list</a>()
|
|
<a name="l00149"></a>00149 {
|
|
<a name="l00150"></a>00150 <a class="code" href="classirr_1_1core_1_1list.html#aad18996ed41454bf7bb8e1d3199f4e73" title="Clears the list, deletes all elements in the list.">clear</a>();
|
|
<a name="l00151"></a>00151 }
|
|
<a name="l00152"></a>00152
|
|
<a name="l00153"></a>00153
|
|
<a name="l00155"></a><a class="code" href="classirr_1_1core_1_1list.html#a43d98ff46af6eb5f4b1f9f71e2f0601c">00155</a> <span class="keywordtype">void</span> <a class="code" href="classirr_1_1core_1_1list.html#a43d98ff46af6eb5f4b1f9f71e2f0601c" title="Assignment operator.">operator=</a>(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1list.html" title="Doubly linked list template.">list<T></a>& other)
|
|
<a name="l00156"></a>00156 {
|
|
<a name="l00157"></a>00157 <span class="keywordflow">if</span>(&other == <span class="keyword">this</span>)
|
|
<a name="l00158"></a>00158 {
|
|
<a name="l00159"></a>00159 <span class="keywordflow">return</span>;
|
|
<a name="l00160"></a>00160 }
|
|
<a name="l00161"></a>00161
|
|
<a name="l00162"></a>00162 <a class="code" href="classirr_1_1core_1_1list.html#aad18996ed41454bf7bb8e1d3199f4e73" title="Clears the list, deletes all elements in the list.">clear</a>();
|
|
<a name="l00163"></a>00163
|
|
<a name="l00164"></a>00164 SKListNode* node = other.First;
|
|
<a name="l00165"></a>00165 <span class="keywordflow">while</span>(node)
|
|
<a name="l00166"></a>00166 {
|
|
<a name="l00167"></a>00167 <a class="code" href="classirr_1_1core_1_1list.html#a0f73ebd87279766f339cb1462c2a24d1" title="Adds an element at the end of the list.">push_back</a>(node->Element);
|
|
<a name="l00168"></a>00168 node = node->Next;
|
|
<a name="l00169"></a>00169 }
|
|
<a name="l00170"></a>00170 }
|
|
<a name="l00171"></a>00171
|
|
<a name="l00172"></a>00172
|
|
<a name="l00174"></a>00174
|
|
<a name="l00175"></a><a class="code" href="classirr_1_1core_1_1list.html#a64aee4e4c37522119f460c109b955767">00175</a> <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> <a class="code" href="classirr_1_1core_1_1list.html#a64aee4e4c37522119f460c109b955767" title="Returns amount of elements in list.">size</a>()<span class="keyword"> const</span>
|
|
<a name="l00176"></a>00176 <span class="keyword"> </span>{
|
|
<a name="l00177"></a>00177 <span class="keywordflow">return</span> Size;
|
|
<a name="l00178"></a>00178 }
|
|
<a name="l00179"></a><a class="code" href="classirr_1_1core_1_1list.html#abbbf6ae6253ced60b259a35c34302af3">00179</a> <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> <a class="code" href="classirr_1_1core_1_1list.html#abbbf6ae6253ced60b259a35c34302af3">getSize</a>()<span class="keyword"> const</span>
|
|
<a name="l00180"></a>00180 <span class="keyword"> </span>{
|
|
<a name="l00181"></a>00181 <span class="keywordflow">return</span> Size;
|
|
<a name="l00182"></a>00182 }
|
|
<a name="l00183"></a>00183
|
|
<a name="l00184"></a>00184
|
|
<a name="l00186"></a>00186
|
|
<a name="l00187"></a><a class="code" href="classirr_1_1core_1_1list.html#aad18996ed41454bf7bb8e1d3199f4e73">00187</a> <span class="keywordtype">void</span> <a class="code" href="classirr_1_1core_1_1list.html#aad18996ed41454bf7bb8e1d3199f4e73" title="Clears the list, deletes all elements in the list.">clear</a>()
|
|
<a name="l00188"></a>00188 {
|
|
<a name="l00189"></a>00189 <span class="keywordflow">while</span>(First)
|
|
<a name="l00190"></a>00190 {
|
|
<a name="l00191"></a>00191 SKListNode * next = First->Next;
|
|
<a name="l00192"></a>00192 allocator.<a class="code" href="classirr_1_1core_1_1irr_allocator.html#a59e37e05219bd2ef3e57e66db4b994eb" title="Destruct an element.">destruct</a>(First);
|
|
<a name="l00193"></a>00193 allocator.<a class="code" href="classirr_1_1core_1_1irr_allocator.html#a7670f5dc0be9162c669eb6ac5eae00a8" title="Deallocate memory for an array of objects.">deallocate</a>(First);
|
|
<a name="l00194"></a>00194 First = next;
|
|
<a name="l00195"></a>00195 }
|
|
<a name="l00196"></a>00196
|
|
<a name="l00197"></a>00197 <span class="comment">//First = 0; handled by loop</span>
|
|
<a name="l00198"></a>00198 Last = 0;
|
|
<a name="l00199"></a>00199 Size = 0;
|
|
<a name="l00200"></a>00200 }
|
|
<a name="l00201"></a>00201
|
|
<a name="l00202"></a>00202
|
|
<a name="l00204"></a>00204
|
|
<a name="l00205"></a><a class="code" href="classirr_1_1core_1_1list.html#a4a51f1a7101bc5e22b65e1c18cc6fb7d">00205</a> <span class="keywordtype">bool</span> <a class="code" href="classirr_1_1core_1_1list.html#a4a51f1a7101bc5e22b65e1c18cc6fb7d" title="Checks for empty list.">empty</a>()<span class="keyword"> const</span>
|
|
<a name="l00206"></a>00206 <span class="keyword"> </span>{
|
|
<a name="l00207"></a>00207 <span class="keywordflow">return</span> (First == 0);
|
|
<a name="l00208"></a>00208 }
|
|
<a name="l00209"></a>00209
|
|
<a name="l00210"></a>00210
|
|
<a name="l00212"></a>00212
|
|
<a name="l00213"></a><a class="code" href="classirr_1_1core_1_1list.html#a0f73ebd87279766f339cb1462c2a24d1">00213</a> <span class="keywordtype">void</span> <a class="code" href="classirr_1_1core_1_1list.html#a0f73ebd87279766f339cb1462c2a24d1" title="Adds an element at the end of the list.">push_back</a>(<span class="keyword">const</span> T& element)
|
|
<a name="l00214"></a>00214 {
|
|
<a name="l00215"></a>00215 SKListNode* node = allocator.<a class="code" href="classirr_1_1core_1_1irr_allocator.html#ac4b471d893b1f19da361302af977c5c1" title="Allocate memory for an array of objects.">allocate</a>(1);
|
|
<a name="l00216"></a>00216 allocator.<a class="code" href="classirr_1_1core_1_1irr_allocator.html#a24601bd03410855534207c3e5ad7a24b" title="Construct an element.">construct</a>(node, element);
|
|
<a name="l00217"></a>00217
|
|
<a name="l00218"></a>00218 ++Size;
|
|
<a name="l00219"></a>00219
|
|
<a name="l00220"></a>00220 <span class="keywordflow">if</span> (First == 0)
|
|
<a name="l00221"></a>00221 First = node;
|
|
<a name="l00222"></a>00222
|
|
<a name="l00223"></a>00223 node->Prev = Last;
|
|
<a name="l00224"></a>00224
|
|
<a name="l00225"></a>00225 <span class="keywordflow">if</span> (Last != 0)
|
|
<a name="l00226"></a>00226 Last->Next = node;
|
|
<a name="l00227"></a>00227
|
|
<a name="l00228"></a>00228 Last = node;
|
|
<a name="l00229"></a>00229 }
|
|
<a name="l00230"></a>00230
|
|
<a name="l00231"></a>00231
|
|
<a name="l00233"></a>00233
|
|
<a name="l00234"></a><a class="code" href="classirr_1_1core_1_1list.html#aec58963596cbc0435e706d1d00777b61">00234</a> <span class="keywordtype">void</span> <a class="code" href="classirr_1_1core_1_1list.html#aec58963596cbc0435e706d1d00777b61" title="Adds an element at the begin of the list.">push_front</a>(<span class="keyword">const</span> T& element)
|
|
<a name="l00235"></a>00235 {
|
|
<a name="l00236"></a>00236 SKListNode* node = allocator.<a class="code" href="classirr_1_1core_1_1irr_allocator.html#ac4b471d893b1f19da361302af977c5c1" title="Allocate memory for an array of objects.">allocate</a>(1);
|
|
<a name="l00237"></a>00237 allocator.<a class="code" href="classirr_1_1core_1_1irr_allocator.html#a24601bd03410855534207c3e5ad7a24b" title="Construct an element.">construct</a>(node, element);
|
|
<a name="l00238"></a>00238
|
|
<a name="l00239"></a>00239 ++Size;
|
|
<a name="l00240"></a>00240
|
|
<a name="l00241"></a>00241 <span class="keywordflow">if</span> (First == 0)
|
|
<a name="l00242"></a>00242 {
|
|
<a name="l00243"></a>00243 Last = node;
|
|
<a name="l00244"></a>00244 First = node;
|
|
<a name="l00245"></a>00245 }
|
|
<a name="l00246"></a>00246 <span class="keywordflow">else</span>
|
|
<a name="l00247"></a>00247 {
|
|
<a name="l00248"></a>00248 node->Next = First;
|
|
<a name="l00249"></a>00249 First->Prev = node;
|
|
<a name="l00250"></a>00250 First = node;
|
|
<a name="l00251"></a>00251 }
|
|
<a name="l00252"></a>00252 }
|
|
<a name="l00253"></a>00253
|
|
<a name="l00254"></a>00254
|
|
<a name="l00256"></a>00256
|
|
<a name="l00257"></a><a class="code" href="classirr_1_1core_1_1list.html#aebd05a0f5e5ead6e1d5b6e3973da8039">00257</a> Iterator <a class="code" href="classirr_1_1core_1_1list.html#aebd05a0f5e5ead6e1d5b6e3973da8039" title="Gets first node.">begin</a>()
|
|
<a name="l00258"></a>00258 {
|
|
<a name="l00259"></a>00259 <span class="keywordflow">return</span> Iterator(First);
|
|
<a name="l00260"></a>00260 }
|
|
<a name="l00261"></a>00261
|
|
<a name="l00262"></a>00262
|
|
<a name="l00264"></a>00264
|
|
<a name="l00265"></a><a class="code" href="classirr_1_1core_1_1list.html#afd5e08fa782786d898aad30d8c09cf42">00265</a> ConstIterator <a class="code" href="classirr_1_1core_1_1list.html#aebd05a0f5e5ead6e1d5b6e3973da8039" title="Gets first node.">begin</a>()<span class="keyword"> const</span>
|
|
<a name="l00266"></a>00266 <span class="keyword"> </span>{
|
|
<a name="l00267"></a>00267 <span class="keywordflow">return</span> ConstIterator(First);
|
|
<a name="l00268"></a>00268 }
|
|
<a name="l00269"></a>00269
|
|
<a name="l00270"></a>00270
|
|
<a name="l00272"></a>00272
|
|
<a name="l00273"></a><a class="code" href="classirr_1_1core_1_1list.html#aa80509dac5224fa57cc548e39480a115">00273</a> Iterator <a class="code" href="classirr_1_1core_1_1list.html#aa80509dac5224fa57cc548e39480a115" title="Gets end node.">end</a>()
|
|
<a name="l00274"></a>00274 {
|
|
<a name="l00275"></a>00275 <span class="keywordflow">return</span> Iterator(0);
|
|
<a name="l00276"></a>00276 }
|
|
<a name="l00277"></a>00277
|
|
<a name="l00278"></a>00278
|
|
<a name="l00280"></a>00280
|
|
<a name="l00281"></a><a class="code" href="classirr_1_1core_1_1list.html#a68b3da8c4e3e283ac6fd73a71d7a49bf">00281</a> ConstIterator <a class="code" href="classirr_1_1core_1_1list.html#aa80509dac5224fa57cc548e39480a115" title="Gets end node.">end</a>()<span class="keyword"> const</span>
|
|
<a name="l00282"></a>00282 <span class="keyword"> </span>{
|
|
<a name="l00283"></a>00283 <span class="keywordflow">return</span> ConstIterator(0);
|
|
<a name="l00284"></a>00284 }
|
|
<a name="l00285"></a>00285
|
|
<a name="l00286"></a>00286
|
|
<a name="l00288"></a>00288
|
|
<a name="l00289"></a><a class="code" href="classirr_1_1core_1_1list.html#a6ba09d4c7865a451e40b5bd5f4c2dd50">00289</a> Iterator <a class="code" href="classirr_1_1core_1_1list.html#a6ba09d4c7865a451e40b5bd5f4c2dd50" title="Gets last element.">getLast</a>()
|
|
<a name="l00290"></a>00290 {
|
|
<a name="l00291"></a>00291 <span class="keywordflow">return</span> Iterator(Last);
|
|
<a name="l00292"></a>00292 }
|
|
<a name="l00293"></a>00293
|
|
<a name="l00294"></a>00294
|
|
<a name="l00296"></a>00296
|
|
<a name="l00297"></a><a class="code" href="classirr_1_1core_1_1list.html#a23497b9de2726df5ec64c457470d49a0">00297</a> ConstIterator <a class="code" href="classirr_1_1core_1_1list.html#a6ba09d4c7865a451e40b5bd5f4c2dd50" title="Gets last element.">getLast</a>()<span class="keyword"> const</span>
|
|
<a name="l00298"></a>00298 <span class="keyword"> </span>{
|
|
<a name="l00299"></a>00299 <span class="keywordflow">return</span> ConstIterator(Last);
|
|
<a name="l00300"></a>00300 }
|
|
<a name="l00301"></a>00301
|
|
<a name="l00302"></a>00302
|
|
<a name="l00304"></a>00304
|
|
<a name="l00308"></a><a class="code" href="classirr_1_1core_1_1list.html#aa4b91d7a9191fc98266425366b774c8a">00308</a> <span class="keywordtype">void</span> <a class="code" href="classirr_1_1core_1_1list.html#aa4b91d7a9191fc98266425366b774c8a" title="Inserts an element after an element.">insert_after</a>(<span class="keyword">const</span> Iterator& it, <span class="keyword">const</span> T& element)
|
|
<a name="l00309"></a>00309 {
|
|
<a name="l00310"></a>00310 SKListNode* node = allocator.<a class="code" href="classirr_1_1core_1_1irr_allocator.html#ac4b471d893b1f19da361302af977c5c1" title="Allocate memory for an array of objects.">allocate</a>(1);
|
|
<a name="l00311"></a>00311 allocator.<a class="code" href="classirr_1_1core_1_1irr_allocator.html#a24601bd03410855534207c3e5ad7a24b" title="Construct an element.">construct</a>(node, element);
|
|
<a name="l00312"></a>00312
|
|
<a name="l00313"></a>00313 node->Next = it.Current->Next;
|
|
<a name="l00314"></a>00314
|
|
<a name="l00315"></a>00315 <span class="keywordflow">if</span> (it.Current->Next)
|
|
<a name="l00316"></a>00316 it.Current->Next->Prev = node;
|
|
<a name="l00317"></a>00317
|
|
<a name="l00318"></a>00318 node->Prev = it.Current;
|
|
<a name="l00319"></a>00319 it.Current->Next = node;
|
|
<a name="l00320"></a>00320 ++Size;
|
|
<a name="l00321"></a>00321
|
|
<a name="l00322"></a>00322 <span class="keywordflow">if</span> (it.Current == Last)
|
|
<a name="l00323"></a>00323 Last = node;
|
|
<a name="l00324"></a>00324 }
|
|
<a name="l00325"></a>00325
|
|
<a name="l00326"></a>00326
|
|
<a name="l00328"></a>00328
|
|
<a name="l00332"></a><a class="code" href="classirr_1_1core_1_1list.html#a366070e0356029f0b355f5dd81710b29">00332</a> <span class="keywordtype">void</span> <a class="code" href="classirr_1_1core_1_1list.html#a366070e0356029f0b355f5dd81710b29" title="Inserts an element before an element.">insert_before</a>(<span class="keyword">const</span> Iterator& it, <span class="keyword">const</span> T& element)
|
|
<a name="l00333"></a>00333 {
|
|
<a name="l00334"></a>00334 SKListNode* node = allocator.<a class="code" href="classirr_1_1core_1_1irr_allocator.html#ac4b471d893b1f19da361302af977c5c1" title="Allocate memory for an array of objects.">allocate</a>(1);
|
|
<a name="l00335"></a>00335 allocator.<a class="code" href="classirr_1_1core_1_1irr_allocator.html#a24601bd03410855534207c3e5ad7a24b" title="Construct an element.">construct</a>(node, element);
|
|
<a name="l00336"></a>00336
|
|
<a name="l00337"></a>00337 node->Prev = it.Current->Prev;
|
|
<a name="l00338"></a>00338
|
|
<a name="l00339"></a>00339 <span class="keywordflow">if</span> (it.Current->Prev)
|
|
<a name="l00340"></a>00340 it.Current->Prev->Next = node;
|
|
<a name="l00341"></a>00341
|
|
<a name="l00342"></a>00342 node->Next = it.Current;
|
|
<a name="l00343"></a>00343 it.Current->Prev = node;
|
|
<a name="l00344"></a>00344 ++Size;
|
|
<a name="l00345"></a>00345
|
|
<a name="l00346"></a>00346 <span class="keywordflow">if</span> (it.Current == First)
|
|
<a name="l00347"></a>00347 First = node;
|
|
<a name="l00348"></a>00348 }
|
|
<a name="l00349"></a>00349
|
|
<a name="l00350"></a>00350
|
|
<a name="l00352"></a>00352
|
|
<a name="l00354"></a><a class="code" href="classirr_1_1core_1_1list.html#a407935fc79a35ce7caa19e4f6ce25c3f">00354</a> Iterator <a class="code" href="classirr_1_1core_1_1list.html#a407935fc79a35ce7caa19e4f6ce25c3f" title="Erases an element.">erase</a>(Iterator& it)
|
|
<a name="l00355"></a>00355 {
|
|
<a name="l00356"></a>00356 <span class="comment">// suggest changing this to a const Iterator& and</span>
|
|
<a name="l00357"></a>00357 <span class="comment">// working around line: it.Current = 0 (possibly with a mutable, or just let it be garbage?)</span>
|
|
<a name="l00358"></a>00358
|
|
<a name="l00359"></a>00359 Iterator returnIterator(it);
|
|
<a name="l00360"></a>00360 ++returnIterator;
|
|
<a name="l00361"></a>00361
|
|
<a name="l00362"></a>00362 <span class="keywordflow">if</span>(it.Current == First)
|
|
<a name="l00363"></a>00363 {
|
|
<a name="l00364"></a>00364 First = it.Current->Next;
|
|
<a name="l00365"></a>00365 }
|
|
<a name="l00366"></a>00366 <span class="keywordflow">else</span>
|
|
<a name="l00367"></a>00367 {
|
|
<a name="l00368"></a>00368 it.Current->Prev->Next = it.Current->Next;
|
|
<a name="l00369"></a>00369 }
|
|
<a name="l00370"></a>00370
|
|
<a name="l00371"></a>00371 <span class="keywordflow">if</span>(it.Current == Last)
|
|
<a name="l00372"></a>00372 {
|
|
<a name="l00373"></a>00373 Last = it.Current->Prev;
|
|
<a name="l00374"></a>00374 }
|
|
<a name="l00375"></a>00375 <span class="keywordflow">else</span>
|
|
<a name="l00376"></a>00376 {
|
|
<a name="l00377"></a>00377 it.Current->Next->Prev = it.Current->Prev;
|
|
<a name="l00378"></a>00378 }
|
|
<a name="l00379"></a>00379
|
|
<a name="l00380"></a>00380 allocator.<a class="code" href="classirr_1_1core_1_1irr_allocator.html#a59e37e05219bd2ef3e57e66db4b994eb" title="Destruct an element.">destruct</a>(it.Current);
|
|
<a name="l00381"></a>00381 allocator.<a class="code" href="classirr_1_1core_1_1irr_allocator.html#a7670f5dc0be9162c669eb6ac5eae00a8" title="Deallocate memory for an array of objects.">deallocate</a>(it.Current);
|
|
<a name="l00382"></a>00382 it.Current = 0;
|
|
<a name="l00383"></a>00383 --Size;
|
|
<a name="l00384"></a>00384
|
|
<a name="l00385"></a>00385 <span class="keywordflow">return</span> returnIterator;
|
|
<a name="l00386"></a>00386 }
|
|
<a name="l00387"></a>00387
|
|
<a name="l00389"></a>00389
|
|
<a name="l00393"></a><a class="code" href="classirr_1_1core_1_1list.html#a860e4dab70f2ac5f13b9385f7f63d5b9">00393</a> <span class="keywordtype">void</span> <a class="code" href="classirr_1_1core_1_1list.html#a860e4dab70f2ac5f13b9385f7f63d5b9" title="Swap the content of this list container with the content of another list.">swap</a>(<a class="code" href="classirr_1_1core_1_1list.html" title="Doubly linked list template.">list<T></a>& other)
|
|
<a name="l00394"></a>00394 {
|
|
<a name="l00395"></a>00395 <a class="code" href="classirr_1_1core_1_1list.html#a860e4dab70f2ac5f13b9385f7f63d5b9" title="Swap the content of this list container with the content of another list.">core::swap</a>(First, other.First);
|
|
<a name="l00396"></a>00396 <a class="code" href="classirr_1_1core_1_1list.html#a860e4dab70f2ac5f13b9385f7f63d5b9" title="Swap the content of this list container with the content of another list.">core::swap</a>(Last, other.Last);
|
|
<a name="l00397"></a>00397 <a class="code" href="classirr_1_1core_1_1list.html#a860e4dab70f2ac5f13b9385f7f63d5b9" title="Swap the content of this list container with the content of another list.">core::swap</a>(Size, other.Size);
|
|
<a name="l00398"></a>00398 <a class="code" href="classirr_1_1core_1_1list.html#a860e4dab70f2ac5f13b9385f7f63d5b9" title="Swap the content of this list container with the content of another list.">core::swap</a>(allocator, other.allocator); <span class="comment">// memory is still released by the same allocator used for allocation</span>
|
|
<a name="l00399"></a>00399 }
|
|
<a name="l00400"></a>00400
|
|
<a name="l00401"></a>00401
|
|
<a name="l00402"></a>00402 <span class="keyword">private</span>:
|
|
<a name="l00403"></a>00403
|
|
<a name="l00404"></a>00404 SKListNode* First;
|
|
<a name="l00405"></a>00405 SKListNode* Last;
|
|
<a name="l00406"></a>00406 <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> Size;
|
|
<a name="l00407"></a>00407 <a class="code" href="classirr_1_1core_1_1irr_allocator.html">irrAllocator<SKListNode></a> allocator;
|
|
<a name="l00408"></a>00408
|
|
<a name="l00409"></a>00409 };
|
|
<a name="l00410"></a>00410
|
|
<a name="l00411"></a>00411
|
|
<a name="l00412"></a>00412 } <span class="comment">// end namespace core</span>
|
|
<a name="l00413"></a>00413 }<span class="comment">// end namespace irr</span>
|
|
<a name="l00414"></a>00414
|
|
<a name="l00415"></a>00415 <span class="preprocessor">#endif</span>
|
|
<a name="l00416"></a>00416 <span class="preprocessor"></span>
|
|
</pre></div></div>
|
|
</div>
|
|
<div id="nav-path" class="navpath">
|
|
<ul>
|
|
<li class="navelem"><a class="el" href="irr_list_8h.html">irrList.h</a> </li>
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark"> </span>Defines</a></div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
|
|
<li class="footer">
|
|
<a href="http://irrlicht.sourceforge.net" target="_blank">Irrlicht
|
|
Engine</a> Documentation © 2003-2012 by Nikolaus Gebhardt. Generated on Sat Jul 9 2016 18:18:19 for Irrlicht 3D Engine by
|
|
<a href="http://www.doxygen.org/index.html" target="_blank">Doxygen</a> 1.7.5.1 </li>
|
|
</ul>
|
|
</div>
|
|
|
|
|
|
</body>
|
|
</html>
|