00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef skALIST_H
00023 #define skALIST_H
00024
00025
00026 #include "skGeneral.h"
00027
00028 class CLASSEXPORT skAList;
00029
00030 const USize DEFAULT_SIZE=0;
00031 const USize DEFAULT_GROWTH_INCREMENT=4;
00032
00033
00037 class CLASSEXPORT skAListIterator
00038 {
00039 public:
00043 void reset();
00047 virtual ~skAListIterator();
00048 protected:
00052 skAListIterator(const skAList&);
00056 skAListIterator& operator=(const skAListIterator&);
00060 void * operator()();
00061 private:
00065 USize m_Current;
00069 const skAList& m_AList;
00070 };
00075 class CLASSEXPORT skAList
00076 {
00077 public:
00081 skAList();
00087 skAList(USize initial_size,USize growth_increment);
00091 virtual ~skAList();
00095 void clearAndDestroy();
00099 void clear();
00103 USize entries() const;
00107 void deleteElt(USize n);
00111 void test() const;
00115 void growTo(USize size);
00116 protected:
00120 void insert(void *,USize index);
00124 void prepend(void *);
00128 void append(void *);
00132 void remove(void *);
00136 void removeAndDestroy(void *);
00140 void * operator[](USize n) const;
00144 int index(const void *) const;
00148 bool contains(const void *) const;
00152 virtual void deleteItem(void *)=0;
00153 friend class skAListIterator;
00157 int findElt(const void * i) const;
00161 void grow();
00165 void ** m_Array;
00169 USize m_ArraySize;
00173 USize m_Entries;
00177 USize m_GrowthIncrement;
00178
00179 private:
00183 skAList(const skAList&);
00187 skAList& operator=(const skAList&);
00188 };
00192 template <class T> class CLASSEXPORT skTAList : public skAList
00193 {
00194 public:
00198 skTAList();
00202 skTAList(USize initial_size,USize growth_increment);
00206 virtual ~skTAList();
00210 void insert(T *,USize index);
00214 void prepend(T *);
00218 void append(T *);
00222 void remove(T *);
00226 void removeAndDestroy(T *);
00230 T * operator[](USize n) const;
00234 int index(const T *) const;
00238 bool contains(const T *) const;
00239 protected:
00243 void deleteItem(void *);
00244 private:
00248 skTAList<T>& operator=(const skTAList<T>& l);
00252 skTAList(const skTAList<T>&);
00253 };
00257 template <class T> class CLASSEXPORT skTAListIterator : public skAListIterator
00258 {
00259 public:
00263 skTAListIterator(const skTAList<T>&);
00267 T * operator()();
00268 };
00269
00270 #include "skAlist.inl"
00271
00272 #endif
00273
00274
00275
00276