Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

skAlist.h

00001 /*
00002   Copyright 1996-2003
00003   Simon Whiteside
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Lesser General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Lesser General Public License for more details.
00014 
00015     You should have received a copy of the GNU Lesser General Public
00016     License along with this library; if not, write to the Free Software
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 
00019 * $Id: skAlist_8h-source.html,v 1.5 2003/01/23 15:31:03 simkin_cvs Exp $
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 

Generated on Thu Jan 23 15:25:38 2003 for Simkin by doxygen1.3-rc1