📄 lists_8h-source.html
字号:
00605 <a class="code" href="object_8h.html#a27">PCLASSINFO</a>(PStack, <a class="code" href="classPAbstractList.html">PAbstractList</a>);00606 00607 <span class="keyword">public</span>:00616 PStack()00617 : <a class="code" href="classPAbstractList.html">PAbstractList</a>() { <a class="code" href="classPCollection.html#z75_11">DisallowDeleteObjects</a>(); }00619 00625 <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>00626 <span class="keyword"> </span>{ <span class="keywordflow">return</span> <a class="code" href="object_8h.html#a18">PNEW</a> PStack(0, <span class="keyword">this</span>); }00628 00635 <span class="keyword">virtual</span> <span class="keywordtype">void</span> Push(00636 T * obj 00637 ) { <a class="code" href="classPAbstractList.html#z175_2">PAbstractList::InsertAt</a>(0, obj); }00638 00644 <span class="keyword">virtual</span> T * Pop()00645 { <span class="keywordflow">return</span> (T *)<a class="code" href="classPAbstractList.html#z175_4">PAbstractList::RemoveAt</a>(0); }00646 00653 <span class="keyword">virtual</span> T & Top()00654 { <a class="code" href="object_8h.html#a5">PAssert</a>(<a class="code" href="classPContainer.html#z69_0">GetSize</a>() > 0, <a class="code" href="object_8h.html#a70a47">PStackEmpty</a>); <span class="keywordflow">return</span> *(T *)<a class="code" href="classPAbstractList.html#z175_7">GetAt</a>(0); }00656 00657 <span class="keyword">protected</span>:00658 PStack(<span class="keywordtype">int</span> dummy, <span class="keyword">const</span> PStack * c)00659 : <a class="code" href="classPAbstractList.html">PAbstractList</a>(dummy, c)00660 { reference->deleteObjects = c->reference->deleteObjects; }00661 };00662 00663 00676 <span class="preprocessor">#define PSTACK(cls, T) typedef PStack<T> cls</span>00677 <span class="preprocessor"></span>00678 00691 <span class="preprocessor">#define PDECLARE_STACK(cls, T) \</span>00692 <span class="preprocessor"> PSTACK(cls##_PTemplate, T); \</span>00693 <span class="preprocessor"> PDECLARE_CLASS(cls, cls##_PTemplate) \</span>00694 <span class="preprocessor"> protected: \</span>00695 <span class="preprocessor"> cls(int dummy, const cls * c) \</span>00696 <span class="preprocessor"> : cls##_PTemplate(dummy, c) { } \</span>00697 <span class="preprocessor"> public: \</span>00698 <span class="preprocessor"> cls() \</span>00699 <span class="preprocessor"> : cls##_PTemplate() { } \</span>00700 <span class="preprocessor"> virtual PObject * Clone() const \</span>00701 <span class="preprocessor"> { return PNEW cls(0, this); } \</span>00702 <span class="preprocessor"></span>00703 <span class="preprocessor"></span>00704 <span class="preprocessor">#else // PHAS_TEMPLATES</span>00705 <span class="preprocessor"></span>00706 <a name="l00707"></a><a class="code" href="lists_8h.html#a0">00707</a> <span class="preprocessor">#define PLIST(cls, T) \</span>00708 <span class="preprocessor"> class cls : public PAbstractList { \</span>00709 <span class="preprocessor"> PCLASSINFO(cls, PAbstractList); \</span>00710 <span class="preprocessor"> protected: \</span>00711 <span class="preprocessor"> inline cls(int dummy, const cls * c) \</span>00712 <span class="preprocessor"> : PAbstractList(dummy, c) { } \</span>00713 <span class="preprocessor"> public: \</span>00714 <span class="preprocessor"> inline cls() \</span>00715 <span class="preprocessor"> : PAbstractList() { } \</span>00716 <span class="preprocessor"> virtual PObject * Clone() const \</span>00717 <span class="preprocessor"> { return PNEW cls(0, this); } \</span>00718 <span class="preprocessor"> inline T & operator[](PINDEX index) const \</span>00719 <span class="preprocessor"> { return (T &)GetReferenceAt(index); } \</span>00720 <span class="preprocessor"> }</span>00721 <span class="preprocessor"></span><a name="l00722"></a><a class="code" href="lists_8h.html#a1">00722</a> <span class="preprocessor">#define PDECLARE_LIST(cls, T) \</span>00723 <span class="preprocessor"> PLIST(cls##_PTemplate, T); \</span>00724 <span class="preprocessor"> PDECLARE_CLASS(cls, cls##_PTemplate) \</span>00725 <span class="preprocessor"> protected: \</span>00726 <span class="preprocessor"> cls(int dummy, const cls * c) \</span>00727 <span class="preprocessor"> : cls##_PTemplate(dummy, c) { } \</span>00728 <span class="preprocessor"> public: \</span>00729 <span class="preprocessor"> cls() \</span>00730 <span class="preprocessor"> : cls##_PTemplate() { } \</span>00731 <span class="preprocessor"> virtual PObject * Clone() const \</span>00732 <span class="preprocessor"> { return PNEW cls(0, this); } \</span>00733 <span class="preprocessor"></span>00734 <span class="preprocessor"></span><a name="l00735"></a><a class="code" href="lists_8h.html#a2">00735</a> <span class="preprocessor">#define PQUEUE(cls, T) \</span>00736 <span class="preprocessor"> class cls : public PAbstractList { \</span>00737 <span class="preprocessor"> PCLASSINFO(cls, PAbstractList); \</span>00738 <span class="preprocessor"> protected: \</span>00739 <span class="preprocessor"> inline cls(int dummy, const cls * c) \</span>00740 <span class="preprocessor"> : PAbstractList(dummy, c) \</span>00741 <span class="preprocessor"> { reference->deleteObjects = c->reference->deleteObjects; } \</span>00742 <span class="preprocessor"> public: \</span>00743 <span class="preprocessor"> inline cls() \</span>00744 <span class="preprocessor"> : PAbstractList() { DisallowDeleteObjects(); } \</span>00745 <span class="preprocessor"> virtual PObject * Clone() const \</span>00746 <span class="preprocessor"> { return PNEW cls(0, this); } \</span>00747 <span class="preprocessor"> virtual void Enqueue(T * t) \</span>00748 <span class="preprocessor"> { PAbstractList::Append(t); } \</span>00749 <span class="preprocessor"> virtual T * Dequeue() \</span>00750 <span class="preprocessor"> { if (GetSize() == 0) return NULL; else return (T *)PAbstractList::RemoveAt(0);} \</span>00751 <span class="preprocessor"> }</span>00752 <span class="preprocessor"></span><a name="l00753"></a><a class="code" href="lists_8h.html#a3">00753</a> <span class="preprocessor">#define PDECLARE_QUEUE(cls, T) \</span>00754 <span class="preprocessor"> PQUEUE(cls##_PTemplate, T); \</span>00755 <span class="preprocessor"> PDECLARE_CLASS(cls, cls##_PTemplate) \</span>00756 <span class="preprocessor"> protected: \</span>00757 <span class="preprocessor"> cls(int dummy, const cls * c) \</span>00758 <span class="preprocessor"> : cls##_PTemplate(dummy, c) { } \</span>00759 <span class="preprocessor"> public: \</span>00760 <span class="preprocessor"> cls() \</span>00761 <span class="preprocessor"> : cls##_PTemplate() { } \</span>00762 <span class="preprocessor"> virtual PObject * Clone() const \</span>00763 <span class="preprocessor"> { return PNEW cls(0, this); } \</span>00764 <span class="preprocessor"></span><a name="l00765"></a><a class="code" href="lists_8h.html#a4">00765</a> <span class="preprocessor"></span><span class="preprocessor">#define PSTACK(cls, T) \</span>00766 <span class="preprocessor"> class cls : public PAbstractList { \</span>00767 <span class="preprocessor"> PCLASSINFO(cls, PAbstractList); \</span>00768 <span class="preprocessor"> protected: \</span>00769 <span class="preprocessor"> inline cls(int dummy, const cls * c) \</span>00770 <span class="preprocessor"> : PAbstractList(dummy, c) \</span>00771 <span class="preprocessor"> { reference->deleteObjects = c->reference->deleteObjects; } \</span>00772 <span class="preprocessor"> public: \</span>00773 <span class="preprocessor"> inline cls() \</span>00774 <span class="preprocessor"> : PAbstractList() { DisallowDeleteObjects(); } \</span>00775 <span class="preprocessor"> virtual PObject * Clone() const \</span>00776 <span class="preprocessor"> { return PNEW cls(0, this); } \</span>00777 <span class="preprocessor"> virtual void Push(T * t) \</span>00778 <span class="preprocessor"> { PAbstractList::InsertAt(0, t); } \</span>00779 <span class="preprocessor"> virtual T * Pop() \</span>00780 <span class="preprocessor"> { PAssert(GetSize() > 0, PStackEmpty); return (T *)PAbstractList::RemoveAt(0); } \</span>00781 <span class="preprocessor"> virtual T & Top() \</span>00782 <span class="preprocessor"> { PAssert(GetSize() > 0, PStackEmpty); return *(T *)GetAt(0); } \</span>00783 <span class="preprocessor"> }</span>00784 <span class="preprocessor"></span><a name="l00785"></a><a class="code" href="lists_8h.html#a5">00785</a> <span class="preprocessor">#define PDECLARE_STACK(cls, T) \</span>00786 <span class="preprocessor"> PSTACK(cls##_PTemplate, T); \</span>00787 <span class="preprocessor"> PDECLARE_CLASS(cls, cls##_PTemplate) \</span>00788 <span class="preprocessor"> protected: \</span>00789 <span class="preprocessor"> cls(int dummy, const cls * c) \</span>00790 <span class="preprocessor"> : cls##_PTemplate(dummy, c) { } \</span>00791 <span class="preprocessor"> public: \</span>00792 <span class="preprocessor"> cls() \</span>00793 <span class="preprocessor"> : cls##_PTemplate() { } \</span>00794 <span class="preprocessor"> virtual PObject * Clone() const \</span>00795 <span class="preprocessor"> { return PNEW cls(0, this); } \</span>00796 <span class="preprocessor"></span>00797 <span class="preprocessor"></span>00798 <span class="preprocessor">#endif // PHAS_TEMPLATES</span>00799 <span class="preprocessor"></span>00800 00802 <span class="comment">// Sorted List of PObjects</span>00803 <a name="l00830"></a><a class="code" href="classPAbstractSortedList.html">00830</a> <span class="keyword">class </span><a class="code" href="classPAbstractSortedList.html">PAbstractSortedList</a> : <span class="keyword">public</span> <a class="code" href="classPCollection.html">PCollection</a>00831 {00832 <a class="code" href="contain_8h.html#a0">PCONTAINERINFO</a>(<a class="code" href="classPAbstractSortedList.html">PAbstractSortedList</a>, <a class="code" href="classPCollection.html">PCollection</a>);00833 00834 <span class="keyword">public</span>:00842 <a class="code" href="classPAbstractSortedList.html#z177_0">PAbstractSortedList</a>();00844 00874 <span class="keyword">virtual</span> <a class="code" href="classPObject.html#z199_0">Comparison</a> <a class="code" href="classPAbstractSortedList.html#z179_0">Compare</a>(<span class="keyword">const</span> <a class="code" href="classPObject.html">PObject</a> & obj) <span class="keyword">const</span>;00876 00886 <span class="keyword">virtual</span> BOOL <a class="code" href="classPAbstractSortedList.html#z181_0">SetSize</a>(00887 PINDEX newSize <span class="comment">// New size for the sorted list, this is ignored.</span>00888 );00890
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -