00001
00002
00003 #ifndef __XList_h
00004 #define __XList_h
00005
00006 class _List
00007 {
00008 class Item
00009 {
00010 public:
00011 Item *Next, *Prev;
00012 void *Ptr;
00013 } *_First, *_Last, *Cur;
00014 int Count;
00015
00016 public:
00017 _List();
00018 virtual ~_List();
00019
00020 void *First();
00021 void *Last();
00022 void *Next();
00023 void *Prev();
00024 void *ItemAt(int i);
00025 void Insert(void *p, int where);
00026 bool Delete(void *p);
00027 int Items();
00028 void Empty();
00029 bool HasItem(void *p);
00030 int IndexOf(void *p);
00031 };
00032
00033 template <class c>
00034 class XList : public _List
00035 {
00036 public:
00037 c *First() { return (c*) _List::First(); }
00038 c *Last() { return (c*) _List::Last(); }
00039 c *Next() { return (c*) _List::Next(); }
00040 c *Prev() { return (c*) _List::Prev(); }
00041 c *ItemAt(int i) { return (c*) _List::ItemAt(i); }
00042 void Insert(c *p, int where = -1) { _List::Insert(p, where); }
00043 bool Delete(c *p) { return _List::Delete(p); }
00044 bool HasItem(c *p) { return _List::HasItem(p); }
00045 void DeleteObjects() { c *p; while (p = First()) { Delete(p); DeleteObj(p); } }
00046 int IndexOf(c *p) { return _List::IndexOf(p); }
00047 };
00048
00049 #endif