From 721ef647d0af6a3b67eb87801ef7c79ad9d589fc Mon Sep 17 00:00:00 2001 From: chatty Date: Mon, 11 Mar 1996 15:49:21 +0000 Subject: Added experimental CcuListIndex Removed pragma interface --- utils/List.h | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) (limited to 'utils/List.h') diff --git a/utils/List.h b/utils/List.h index de0e1d5..5067da6 100644 --- a/utils/List.h +++ b/utils/List.h @@ -15,16 +15,13 @@ #ifndef List_H_ #define List_H_ -#ifdef __GNUG__ -#pragma interface -#endif - #include "cplus_bugs.h" #include class CcuAllocator; typedef void CcuListItem; +typedef void* CcuListIndex; #ifdef CPLUS_BUG20 class CcuListLink; @@ -55,8 +52,8 @@ private: CcuListLink* LastLink; list_status StatusFlag; - void InsertAfterLink (CcuListLink*, CcuListItem*); - void InsertBeforeLink (CcuListLink*, CcuListItem*); + CcuListIndex InsertAfterLink (CcuListLink*, CcuListItem*); + CcuListIndex InsertBeforeLink (CcuListLink*, CcuListItem*); CcuListItem* RemoveAfterLink (CcuListLink*); public: @@ -74,8 +71,8 @@ inline int IsEmpty () const { return !LastLink; } int Length () const; int Find (CcuListItem*, int* = 0) const; - void Append (CcuListItem*); - void Prepend (CcuListItem*); + CcuListIndex Append (CcuListItem*); + CcuListIndex Prepend (CcuListItem*); inline CcuList& operator << (CcuListItem* it) { Append (it); return *this; } CcuListItem* RemoveFirst (); @@ -84,8 +81,8 @@ inline CcuList& operator << (CcuListItem* it) { Append (it); return *this; } int Remove (int (*) (CcuListItem*), int = 1); void Clear (); - void InsertAfter (const CcuListIter&, CcuListItem*); - void InsertBefore (const CcuListIter&, CcuListItem*); + CcuListIndex InsertAfter (const CcuListIter&, CcuListItem*); + CcuListIndex InsertBefore (const CcuListIter&, CcuListItem*); CcuListItem* RemoveAfter (const CcuListIter&); }; @@ -106,6 +103,7 @@ private: public: inline CcuListIter (const CcuList& l) : TheList (&l), CurLink (0), StatusFlag (StartOfList) { } + CcuListIter (const CcuList&, CcuListIndex); inline void Reset () { CurLink = 0; StatusFlag = StartOfList; } inline CcuListIter& operator = (const CcuList& l) { TheList = &l; CurLink = 0; StatusFlag = StartOfList; return *this; } inline CcuListIter& operator = (const CcuListIter& li) { TheList = li.TheList; CurLink = li.CurLink; StatusFlag = li.StatusFlag; return *this; } @@ -119,7 +117,6 @@ inline listiter_status GetStatus () const { return StatusFlag; } inline operator int () const { return StatusFlag == Normal; } }; - #ifndef CPLUS_BUG19 template class CcuListIterOf; @@ -132,8 +129,8 @@ inline ITEM* Last () { return (ITEM*) (CcuList::Last ()); } inline ITEM* Nth (int n) { return (ITEM*) (CcuList::Nth (n)); } inline int Find (ITEM* it, int* r = 0) const { return CcuList::Find (it, r); } -inline void Append (ITEM* it) { CcuList::Append (it); } -inline void Prepend (ITEM* it) { CcuList::Prepend (it); } +inline CcuListIndex Append (ITEM* it) { return CcuList::Append (it); } +inline CcuListIndex Prepend (ITEM* it) { return CcuList::Prepend (it); } inline CcuListOf& operator << (ITEM* it) { CcuList::Append (it); return *this; } inline ITEM* RemoveFirst () { return (ITEM*) (CcuList::RemoveFirst ()); } @@ -141,8 +138,8 @@ inline ITEM* RemoveLast () { return (ITEM*) (CcuList::RemoveLast ()); } inline int Remove (ITEM* it, int nb = 1) { return CcuList::Remove (it, nb); } inline int Remove (int (*p) (ITEM*), int nb = 1) { return CcuList::Remove ((int (*) (void*)) p, nb); } -inline void InsertAfter (const CcuListIterOf & li, ITEM*it) { CcuList::InsertAfter (li, it); } -inline void InsertBefore (const CcuListIterOf & li, ITEM* it) { CcuList::InsertBefore (li, it); } +inline CcuListIndex InsertAfter (const CcuListIterOf & li, ITEM*it) { return CcuList::InsertAfter (li, it); } +inline CcuListIndex InsertBefore (const CcuListIterOf & li, ITEM* it) { return CcuList::InsertBefore (li, it); } inline ITEM* RemoveAfter (const CcuListIterOf & li) { return (ITEM*) CcuList::RemoveAfter (li); } }; @@ -157,8 +154,6 @@ inline int Find (ITEM* it) { return CcuListIter::Find (it); } }; #endif /* CPLUS_BUG19 */ - - typedef CcuListItem CcuStackItem; /* CPLUS_BUG10 */ -- cgit v1.1