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
00033 class CLASSEXPORT skAListIterator
00034 {
00035 public:
00039 void reset();
00043 virtual ~skAListIterator();
00044 protected:
00048 skAListIterator(const skAList&);
00052 skAListIterator& operator=(const skAListIterator&);
00056 void * operator()();
00057 private:
00061 USize m_Current;
00065 const skAList& m_AList;
00066 };
00071 class CLASSEXPORT skAList
00072 {
00073 public:
00077 skAList();
00083 skAList(USize initial_size,USize growth_increment);
00087 virtual ~skAList();
00091 void clearAndDestroy();
00095 void clear();
00099 USize entries() const;
00103 void deleteElt(USize n);
00107 void test() const;
00111 void growTo(USize size);
00112 protected:
00116 void insert(void *,USize index);
00120 void prepend(void *);
00124 void append(void *);
00128 void remove(void *);
00132 void removeAndDestroy(void *);
00136 void * operator[](USize n) const;
00140 int index(const void *) const;
00144 bool contains(const void *) const;
00148 virtual void deleteItem(void *)=0;
00149 friend class skAListIterator;
00153 int findElt(const void * i) const;
00157 void grow();
00161 void ** m_Array;
00165 USize m_ArraySize;
00169 USize m_Entries;
00173 USize m_GrowthIncrement;
00174
00175 private:
00179 static const USize DEFAULT_SIZE;
00183 static const USize DEFAULT_GROWTH_INCREMENT;
00187 skAList(const skAList&);
00191 skAList& operator=(const skAList&);
00192 };
00196 template <class T> class CLASSEXPORT skTAList : public skAList
00197 {
00198 public:
00202 skTAList();
00206 skTAList(USize initial_size,USize growth_increment);
00210 virtual ~skTAList();
00214 void insert(T *,USize index);
00218 void prepend(T *);
00222 void append(T *);
00226 void remove(T *);
00230 void removeAndDestroy(T *);
00234 T * operator[](USize n) const;
00238 int index(const T *) const;
00242 bool contains(const T *) const;
00243 protected:
00247 void deleteItem(void *);
00248 private:
00252 skTAList<T>& operator=(const skTAList<T>& l);
00256 skTAList(const skTAList<T>&);
00257 };
00261 template <class T> class CLASSEXPORT skTAListIterator : public skAListIterator
00262 {
00263 public:
00267 skTAListIterator(const skTAList<T>&);
00271 T * operator()();
00272 };
00273
00274 #include "skAlist.inl"
00275
00276 #endif
00277
00278
00279
00280