summaryrefslogtreecommitdiff
path: root/utils/DList.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils/DList.h')
-rw-r--r--utils/DList.h156
1 files changed, 77 insertions, 79 deletions
diff --git a/utils/DList.h b/utils/DList.h
index cba72f1..8483db3 100644
--- a/utils/DList.h
+++ b/utils/DList.h
@@ -18,26 +18,26 @@
#include "cplus_bugs.h"
#include <sys/types.h>
-class CcuAllocator;
+class IvlAllocator;
-typedef void CcuDListItem;
+typedef void IvlDListItem;
#ifdef CPLUS_BUG20
-class CcuDListLink;
+class IvlDListLink;
#endif
-class CcuDList {
-friend class CcuDListIter;
+class IvlDList {
+friend class IvlDListIter;
#ifndef CPLUS_BUG20
- class CcuDListLink {
- static CcuAllocator* DListLinkMem;
+ class IvlDListLink {
+ static IvlAllocator* DListLinkMem;
public:
- CcuDListItem* Entry;
- CcuDListLink* Previous;
- CcuDListLink* Next;
- inline CcuDListLink (CcuDListItem* e, CcuDListLink* p) : Entry (e), Previous (p), Next (p->Next) { Previous->Next = Next->Previous = this; }
- inline CcuDListLink (CcuDListItem* e) : Entry (e), Previous (this), Next (this) {}
+ IvlDListItem* Entry;
+ IvlDListLink* Previous;
+ IvlDListLink* Next;
+ inline IvlDListLink (IvlDListItem* e, IvlDListLink* p) : Entry (e), Previous (p), Next (p->Next) { Previous->Next = Next->Previous = this; }
+ inline IvlDListLink (IvlDListItem* e) : Entry (e), Previous (this), Next (this) {}
void* operator new (size_t);
void operator delete (void*);
};
@@ -49,112 +49,110 @@ public:
private:
- CcuDListLink* LastLink;
+ IvlDListLink* LastLink;
dlist_status StatusFlag;
- void InsertAfterLink (CcuDListLink*, CcuDListItem*);
- CcuDListItem* RemoveLink (CcuDListLink*);
+ void InsertAfterLink (IvlDListLink*, IvlDListItem*);
+ IvlDListItem* RemoveLink (IvlDListLink*);
public:
-inline CcuDList () : LastLink (0), StatusFlag (NoError) { }
- CcuDList (CcuDListItem*);
- CcuDList (const CcuDList&);
- ~CcuDList ();
- CcuDList& operator = (const CcuDList&);
+inline IvlDList () : LastLink (0), StatusFlag (NoError) { }
+ IvlDList (IvlDListItem*);
+ IvlDList (const IvlDList&);
+ ~IvlDList ();
+ IvlDList& operator = (const IvlDList&);
inline dlist_status GetStatus () const { return StatusFlag; }
inline int IsEmpty () const { return !LastLink; }
- CcuDListItem* First ();
- CcuDListItem* Last ();
- CcuDListItem* Nth (int n);
+ IvlDListItem* First ();
+ IvlDListItem* Last ();
+ IvlDListItem* Nth (int n);
int Length () const;
- int Find (CcuDListItem*) const;
+ int Find (IvlDListItem*) const;
- void Append (CcuDListItem*);
- void Prepend (CcuDListItem*);
-inline CcuDList& operator << (CcuDListItem* it) { Append (it); return *this; }
+ void Append (IvlDListItem*);
+ void Prepend (IvlDListItem*);
+inline IvlDList& operator << (IvlDListItem* it) { Append (it); return *this; }
- CcuDListItem* RemoveFirst ();
- CcuDListItem* RemoveLast ();
- int Remove (CcuDListItem*, int = 1);
- int Remove (int (*) (CcuDListItem*), int = 1);
+ IvlDListItem* RemoveFirst ();
+ IvlDListItem* RemoveLast ();
+ int Remove (IvlDListItem*, int = 1);
+ int Remove (int (*) (IvlDListItem*), int = 1);
void Clear ();
- void InsertAfter (const CcuDListIter&, CcuDListItem*);
- void InsertBefore (const CcuDListIter&, CcuDListItem*);
- CcuDListItem* RemoveAfter (const CcuDListIter&);
- CcuDListItem* RemoveAt (CcuDListIter&);
+ void InsertAfter (const IvlDListIter&, IvlDListItem*);
+ void InsertBefore (const IvlDListIter&, IvlDListItem*);
+ IvlDListItem* RemoveAfter (const IvlDListIter&);
+ IvlDListItem* RemoveAt (IvlDListIter&);
};
-class CcuDListIter {
-friend class CcuDList;
+class IvlDListIter {
+friend class IvlDList;
public:
enum dlistiter_status { Normal, StartOfList, EndOfList };
private:
- const CcuDList* TheList;
+ const IvlDList* TheList;
#ifdef CPLUS_BUG20
- CcuDListLink* CurLink;
+ IvlDListLink* CurLink;
#else
- CcuDList::CcuDListLink* CurLink;
+ IvlDList::IvlDListLink* CurLink;
#endif
dlistiter_status StatusFlag;
public:
-inline CcuDListIter (const CcuDList& l) : TheList (&l), CurLink (0), StatusFlag (StartOfList) {}
+inline IvlDListIter (const IvlDList& l) : TheList (&l), CurLink (0), StatusFlag (StartOfList) {}
inline void Reset () { CurLink = 0; StatusFlag = StartOfList; }
inline void GotoEnd () { CurLink = TheList->LastLink; StatusFlag = CurLink ? EndOfList : StartOfList; }
-inline CcuDListIter& operator = (const CcuDList& l) { TheList = &l; CurLink = 0; StatusFlag = StartOfList; return *this; }
-inline CcuDListIter& operator = (const CcuDListIter& li) { TheList = li.TheList; CurLink = li.CurLink; StatusFlag = li.StatusFlag; return *this; }
- CcuDListIter& operator ++ ();
- CcuDListIter& operator -- ();
- int Find (CcuDListItem*);
- int FindBack (CcuDListItem*);
- CcuDListItem* operator * () const;
+inline IvlDListIter& operator = (const IvlDList& l) { TheList = &l; CurLink = 0; StatusFlag = StartOfList; return *this; }
+inline IvlDListIter& operator = (const IvlDListIter& li) { TheList = li.TheList; CurLink = li.CurLink; StatusFlag = li.StatusFlag; return *this; }
+ IvlDListIter& operator ++ ();
+ IvlDListIter& operator -- ();
+ int Find (IvlDListItem*);
+ int FindBack (IvlDListItem*);
+ IvlDListItem* operator * () const;
inline dlistiter_status GetStatus () const { return StatusFlag; }
inline operator int () const { return StatusFlag == Normal; }
};
-
#ifndef CPLUS_BUG19
-template <class ITEM> class CcuDListIterOf;
+template <class ITEM> class IvlDListIterOf;
-template <class ITEM> class CcuDListOf : public CcuDList {
+template <class ITEM> class IvlDListOf : public IvlDList {
public:
-inline CcuDListOf () : CcuDList () {}
-inline CcuDListOf (ITEM* it) : CcuDList (it) {}
-inline ITEM* First () { return (ITEM*) (CcuDList::First ()); }
-inline ITEM* Last () { return (ITEM*) (CcuDList::Last ()); }
-inline ITEM* Nth (int n) { return (ITEM*) (CcuDList::Nth (n)); }
-inline int Find (ITEM* it) const { return CcuDList::Find (it); }
-
-inline void Append (ITEM* it) { CcuDList::Append (it); }
-inline void Prepend (ITEM* it) { CcuDList::Prepend (it); }
-inline CcuDListOf <ITEM>& operator << (ITEM* it) { CcuDList::Append (it); return *this; }
-
-inline ITEM* RemoveFirst () { return (ITEM*) (CcuDList::RemoveFirst ()); }
-inline ITEM* RemoveLast () { return (ITEM*) (CcuDList::RemoveLast ()); }
-inline int Remove (ITEM* it, int nb = 1) { return CcuDList::Remove (it, nb); }
-inline int Remove (int (*p) (ITEM*), int nb = 1) { return CcuDList::Remove ((int (*) (ITEM*)) p, nb); }
-
-inline void InsertAfter (const CcuDListIterOf <ITEM>& li, ITEM*it) { CcuDList::InsertAfter (li, it); }
-inline void InsertBefore (const CcuDListIterOf <ITEM>& li, ITEM* it) { CcuDList::InsertBefore (li, it); }
-inline ITEM* RemoveAfter (const CcuDListIterOf <ITEM>& li) { return (ITEM*) CcuDList::RemoveAfter (li); }
-inline ITEM* RemoveAt (CcuDListIterOf <ITEM>& li) { return (ITEM*) CcuDList::RemoveAfter (li); }
+inline IvlDListOf () : IvlDList () {}
+inline IvlDListOf (ITEM* it) : IvlDList (it) {}
+inline ITEM* First () { return (ITEM*) (IvlDList::First ()); }
+inline ITEM* Last () { return (ITEM*) (IvlDList::Last ()); }
+inline ITEM* Nth (int n) { return (ITEM*) (IvlDList::Nth (n)); }
+inline int Find (ITEM* it) const { return IvlDList::Find (it); }
+
+inline void Append (ITEM* it) { IvlDList::Append (it); }
+inline void Prepend (ITEM* it) { IvlDList::Prepend (it); }
+inline IvlDListOf <ITEM>& operator << (ITEM* it) { IvlDList::Append (it); return *this; }
+
+inline ITEM* RemoveFirst () { return (ITEM*) (IvlDList::RemoveFirst ()); }
+inline ITEM* RemoveLast () { return (ITEM*) (IvlDList::RemoveLast ()); }
+inline int Remove (ITEM* it, int nb = 1) { return IvlDList::Remove (it, nb); }
+inline int Remove (int (*p) (ITEM*), int nb = 1) { return IvlDList::Remove ((int (*) (ITEM*)) p, nb); }
+
+inline void InsertAfter (const IvlDListIterOf <ITEM>& li, ITEM*it) { IvlDList::InsertAfter (li, it); }
+inline void InsertBefore (const IvlDListIterOf <ITEM>& li, ITEM* it) { IvlDList::InsertBefore (li, it); }
+inline ITEM* RemoveAfter (const IvlDListIterOf <ITEM>& li) { return (ITEM*) IvlDList::RemoveAfter (li); }
+inline ITEM* RemoveAt (IvlDListIterOf <ITEM>& li) { return (ITEM*) IvlDList::RemoveAfter (li); }
};
-template <class ITEM> class CcuDListIterOf : public CcuDListIter {
+template <class ITEM> class IvlDListIterOf : public IvlDListIter {
public:
-inline CcuDListIterOf (const CcuDListOf <ITEM>& l) : CcuDListIter (l) { }
-inline CcuDListIterOf <ITEM>& operator = (const CcuDListOf <ITEM>& l) { return (CcuDListIterOf <ITEM>&) CcuDListIter::operator = (l); }
-inline CcuDListIterOf <ITEM>& operator = (const CcuDListIterOf <ITEM>& li) { return (CcuDListIterOf <ITEM>&) CcuDListIter::operator = (li); }
-inline ITEM* operator * () const { return (ITEM*) CcuDListIter::operator * (); }
-inline int Find (ITEM* it) { return CcuDListIter::Find (it); }
-inline int FindBack (ITEM* it) { return CcuDListIter::FindBack (it); }
+inline IvlDListIterOf (const IvlDListOf <ITEM>& l) : IvlDListIter (l) { }
+inline IvlDListIterOf <ITEM>& operator = (const IvlDListOf <ITEM>& l) { return (IvlDListIterOf <ITEM>&) IvlDListIter::operator = (l); }
+inline IvlDListIterOf <ITEM>& operator = (const IvlDListIterOf <ITEM>& li) { return (IvlDListIterOf <ITEM>&) IvlDListIter::operator = (li); }
+inline ITEM* operator * () const { return (ITEM*) IvlDListIter::operator * (); }
+inline int Find (ITEM* it) { return IvlDListIter::Find (it); }
+inline int FindBack (ITEM* it) { return IvlDListIter::FindBack (it); }
};
#endif /* CPLUS_BUG19 */
-
#endif /* DList_H_ */