⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lists_8h-source.html

📁 pwlib开发文档
💻 HTML
📖 第 1 页 / 共 4 页
字号:
00899     <span class="keyword">virtual</span> PINDEX <a class="code" href="classPAbstractSortedList.html#z183_0">Append</a>(00900       <a class="code" href="classPObject.html">PObject</a> * obj   <span class="comment">// New object to place into the collection.</span>00901     );00902 00912     <span class="keyword">virtual</span> PINDEX <a class="code" href="classPAbstractSortedList.html#z183_1">Insert</a>(00913       <span class="keyword">const</span> <a class="code" href="classPObject.html">PObject</a> &amp; before,   <span class="comment">// Object value to insert before.</span>00914       <a class="code" href="classPObject.html">PObject</a> * obj             <span class="comment">// New object to place into the collection.</span>00915     );00916 00926     <span class="keyword">virtual</span> PINDEX <a class="code" href="classPAbstractSortedList.html#z183_2">InsertAt</a>(00927       PINDEX index,   <span class="comment">// Index position in collection to place the object.</span>00928       <a class="code" href="classPObject.html">PObject</a> * obj   <span class="comment">// New object to place into the collection.</span>00929     );00930 00941     <span class="keyword">virtual</span> BOOL <a class="code" href="classPAbstractSortedList.html#z183_3">Remove</a>(00942       <span class="keyword">const</span> <a class="code" href="classPObject.html">PObject</a> * obj   <span class="comment">// Existing object to remove from the collection.</span>00943     );00944 00954     <span class="keyword">virtual</span> <a class="code" href="classPObject.html">PObject</a> * <a class="code" href="classPAbstractSortedList.html#z183_4">RemoveAt</a>(00955       PINDEX index   <span class="comment">// Index position in collection to place the object.</span>00956     );00957 00964     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPAbstractSortedList.html#z183_5">RemoveAll</a>();00965 00972     <span class="keyword">virtual</span> BOOL <a class="code" href="classPAbstractSortedList.html#z183_6">SetAt</a>(00973       PINDEX index,   <span class="comment">// Index position in collection to set.</span>00974       <a class="code" href="classPObject.html">PObject</a> * val   <span class="comment">// New value to place into the collection.</span>00975     );00976 00983     <span class="keyword">virtual</span> <a class="code" href="classPObject.html">PObject</a> * <a class="code" href="classPAbstractSortedList.html#z183_7">GetAt</a>(00984       PINDEX index  <span class="comment">// Index position in the collection of the object.</span>00985     ) <span class="keyword">const</span>;00986 00998     <span class="keyword">virtual</span> PINDEX <a class="code" href="classPAbstractSortedList.html#z183_8">GetObjectsIndex</a>(00999       <span class="keyword">const</span> <a class="code" href="classPObject.html">PObject</a> * obj01000     ) <span class="keyword">const</span>;01001 01010     <span class="keyword">virtual</span> PINDEX <a class="code" href="classPAbstractSortedList.html#z183_9">GetValuesIndex</a>(01011       <span class="keyword">const</span> <a class="code" href="classPObject.html">PObject</a> &amp; obj01012     ) <span class="keyword">const</span>;01014 01015   <span class="keyword">protected</span>:<a name="l01016"></a><a class="code" href="structPAbstractSortedList_1_1Element.html">01016</a>     <span class="keyword">struct </span><a class="code" href="structPAbstractSortedList_1_1Element.html">Element</a> {<a name="l01017"></a><a class="code" href="structPAbstractSortedList_1_1Element.html#l0">01017</a>       <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="structPAbstractSortedList_1_1Info.html">Info</a>;<a name="l01018"></a><a class="code" href="structPAbstractSortedList_1_1Element.html#m0">01018</a>       <a class="code" href="structPAbstractSortedList_1_1Element.html">Element</a> * <a class="code" href="structPAbstractSortedList_1_1Element.html#m0">parent</a>;<a name="l01019"></a><a class="code" href="structPAbstractSortedList_1_1Element.html#m1">01019</a>       <a class="code" href="structPAbstractSortedList_1_1Element.html">Element</a> * <a class="code" href="structPAbstractSortedList_1_1Element.html#m1">left</a>;<a name="l01020"></a><a class="code" href="structPAbstractSortedList_1_1Element.html#m2">01020</a>       <a class="code" href="structPAbstractSortedList_1_1Element.html">Element</a> * <a class="code" href="structPAbstractSortedList_1_1Element.html#m2">right</a>;<a name="l01021"></a><a class="code" href="structPAbstractSortedList_1_1Element.html#m3">01021</a>       <a class="code" href="classPObject.html">PObject</a> * <a class="code" href="structPAbstractSortedList_1_1Element.html#m3">data</a>;<a name="l01022"></a><a class="code" href="structPAbstractSortedList_1_1Element.html#m4">01022</a>       PINDEX <a class="code" href="structPAbstractSortedList_1_1Element.html#m4">subTreeSize</a>;01023       <span class="keyword">enum</span> { <a class="code" href="structPAbstractSortedList_1_1Element.html#s2s0">Red</a>, <a class="code" href="structPAbstractSortedList_1_1Element.html#s2s1">Black</a> } <a class="code" href="structPAbstractSortedList_1_1Element.html#m5">colour</a>;01024     };01025 <a name="l01026"></a><a class="code" href="structPAbstractSortedList_1_1Info.html">01026</a>     <span class="keyword">struct </span><a class="code" href="structPAbstractSortedList_1_1Info.html">Info</a> {<a name="l01027"></a><a class="code" href="structPAbstractSortedList_1_1Info.html#m0">01027</a>       <a class="code" href="structPAbstractSortedList_1_1Element.html">Element</a> * <a class="code" href="structPAbstractSortedList_1_1Info.html#m0">root</a>;<a name="l01028"></a><a class="code" href="structPAbstractSortedList_1_1Info.html#m1">01028</a>       <a class="code" href="structPAbstractSortedList_1_1Element.html">Element</a> * <a class="code" href="structPAbstractSortedList_1_1Info.html#m1">lastElement</a>;<a name="l01029"></a><a class="code" href="structPAbstractSortedList_1_1Info.html#m2">01029</a>       PINDEX    <a class="code" href="structPAbstractSortedList_1_1Info.html#m2">lastIndex</a>;<a name="l01030"></a><a class="code" href="structPAbstractSortedList_1_1Info.html#m3">01030</a>       <a class="code" href="structPAbstractSortedList_1_1Element.html">Element</a>   <a class="code" href="structPAbstractSortedList_1_1Info.html#m3">nil</a>;01031     } * <a class="code" href="classPAbstractSortedList.html#n0">info</a>;01032 01033     <span class="comment">// New functions for class</span>01034     <span class="keywordtype">void</span> <a class="code" href="classPAbstractSortedList.html#b0">RemoveElement</a>(Element * node);01035     <span class="keywordtype">void</span> <a class="code" href="classPAbstractSortedList.html#b1">LeftRotate</a>(Element * node);01036     <span class="keywordtype">void</span> <a class="code" href="classPAbstractSortedList.html#b2">RightRotate</a>(Element * node);01037     <span class="keywordtype">void</span> <a class="code" href="classPAbstractSortedList.html#b3">DeleteSubTrees</a>(Element * node, BOOL deleteObject);01038     Element * <a class="code" href="classPAbstractSortedList.html#b4">Successor</a>(<span class="keyword">const</span> Element * node) <span class="keyword">const</span>;01039     Element * <a class="code" href="classPAbstractSortedList.html#b5">Predecessor</a>(<span class="keyword">const</span> Element * node) <span class="keyword">const</span>;01040     Element * <a class="code" href="classPAbstractSortedList.html#b6">OrderSelect</a>(Element * node, PINDEX index) <span class="keyword">const</span>;01041     PINDEX <a class="code" href="classPAbstractSortedList.html#b7">ValueSelect</a>(<span class="keyword">const</span> Element * node, <span class="keyword">const</span> <a class="code" href="classPObject.html">PObject</a> &amp; obj, <span class="keyword">const</span> Element ** lastElement) <span class="keyword">const</span>;01042 };01043 01044 01045 <span class="preprocessor">#ifdef PHAS_TEMPLATES</span>01046 <span class="preprocessor"></span>01054 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt; <span class="keyword">class </span>PSortedList : <span class="keyword">public</span> <a class="code" href="classPAbstractSortedList.html">PAbstractSortedList</a>01055 {01056   <a class="code" href="object_8h.html#a27">PCLASSINFO</a>(PSortedList, <a class="code" href="classPAbstractSortedList.html">PAbstractSortedList</a>);01057 01058   <span class="keyword">public</span>:01066     PSortedList()01067       : <a class="code" href="classPAbstractSortedList.html">PAbstractSortedList</a>() { }01069 01075     <span class="keyword">virtual</span> <a class="code" href="classPObject.html">PObject</a> * <a class="code" href="classPObject.html#z203_0">Clone</a>()<span class="keyword"> const</span>01076 <span class="keyword">      </span>{ <span class="keywordflow">return</span> <a class="code" href="object_8h.html#a18">PNEW</a> PSortedList(0, <span class="keyword">this</span>); }01078 01091     T &amp; operator[](PINDEX index)<span class="keyword"> const</span>01092 <span class="keyword">      </span>{ <span class="keywordflow">return</span> *(T *)<a class="code" href="classPAbstractSortedList.html#z183_7">GetAt</a>(index); }01094 01095   <span class="keyword">protected</span>:01096     PSortedList(<span class="keywordtype">int</span> dummy, <span class="keyword">const</span> PSortedList * c)01097       : <a class="code" href="classPAbstractSortedList.html">PAbstractSortedList</a>(dummy, c) { }01098 };01099 01100 01112 <span class="preprocessor">#define PSORTED_LIST(cls, T) typedef PSortedList&lt;T&gt; cls</span>01113 <span class="preprocessor"></span>01114 01127 <span class="preprocessor">#define PDECLARE_SORTED_LIST(cls, T) \</span>01128 <span class="preprocessor">  PSORTED_LIST(cls##_PTemplate, T); \</span>01129 <span class="preprocessor">  PDECLARE_CLASS(cls, PSortedList&lt;T&gt;) \</span>01130 <span class="preprocessor">  protected: \</span>01131 <span class="preprocessor">    cls(int dummy, const cls * c) \</span>01132 <span class="preprocessor">      : PSortedList&lt;T&gt;(dummy, c) { } \</span>01133 <span class="preprocessor">  public: \</span>01134 <span class="preprocessor">    cls() \</span>01135 <span class="preprocessor">      : PSortedList&lt;T&gt;() { } \</span>01136 <span class="preprocessor">    virtual PObject * Clone() const \</span>01137 <span class="preprocessor">      { return PNEW cls(0, this); } \</span>01138 <span class="preprocessor"></span>01139 <span class="preprocessor"></span>01140 <span class="preprocessor">#else // PHAS_TEMPLATES</span>01141 <span class="preprocessor"></span>01142 <a name="l01143"></a><a class="code" href="lists_8h.html#a6">01143</a> <span class="preprocessor">#define PSORTED_LIST(cls, T) \</span>01144 <span class="preprocessor">  class cls : public PAbstractSortedList { \</span>01145 <span class="preprocessor">  PCLASSINFO(cls, PAbstractSortedList); \</span>01146 <span class="preprocessor">  protected: \</span>01147 <span class="preprocessor">    inline cls(int dummy, const cls * c) \</span>01148 <span class="preprocessor">      : PAbstractSortedList(dummy, c) { } \</span>01149 <span class="preprocessor">  public: \</span>01150 <span class="preprocessor">    inline cls() \</span>01151 <span class="preprocessor">      : PAbstractSortedList() { } \</span>01152 <span class="preprocessor">    virtual PObject * Clone() const \</span>01153 <span class="preprocessor">      { return PNEW cls(0, this); } \</span>01154 <span class="preprocessor">    inline T &amp; operator[](PINDEX index) const \</span>01155 <span class="preprocessor">      { return *(T *)GetAt(index); } \</span>01156 <span class="preprocessor">  }</span>01157 <span class="preprocessor"></span><a name="l01158"></a><a class="code" href="lists_8h.html#a7">01158</a> <span class="preprocessor">#define PDECLARE_SORTED_LIST(cls, T) \</span>01159 <span class="preprocessor">  PSORTED_LIST(cls##_PTemplate, T); \</span>01160 <span class="preprocessor">  PDECLARE_CLASS(cls, cls##_PTemplate) \</span>01161 <span class="preprocessor">  protected: \</span>01162 <span class="preprocessor">    cls(int dummy, const cls * c) \</span>01163 <span class="preprocessor">      : cls##_PTemplate(dummy, c) { } \</span>01164 <span class="preprocessor">  public: \</span>01165 <span class="preprocessor">    cls() \</span>01166 <span class="preprocessor">      : cls##_PTemplate() { } \</span>01167 <span class="preprocessor">    virtual PObject * Clone() const \</span>01168 <span class="preprocessor">      { return PNEW cls(0, this); } \</span>01169 <span class="preprocessor"></span>01170 <span class="preprocessor"></span>01171 <span class="preprocessor">#endif  // PHAS_TEMPLATES</span>01172 <span class="preprocessor"></span>01173 01174 <span class="comment">// End Of File ///////////////////////////////////////////////////////////////</span></pre></div><hr><address style="align: right;"><small>Generated on Wed Sep 29 22:44:11 2004 for PWLib by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.18 </small></address></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -