home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c221 / 6.ddi / MWHC.006 / 82 < prev    next >
Encoding:
Text File  |  1992-06-07  |  5.7 KB  |  139 lines

  1. #ifndef  __RWSLISTCOL_H__
  2. #define  __RWSLISTCOL_H__
  3. pragma push_align_members(64);
  4.  
  5. /*
  6.  * Declarations for Singly linked list of RWCollectables.
  7.  *
  8.  * $Header:   E:/vcs/rw/slistcol.h_v   1.2   18 Feb 1992 09:54:46   KEFFER  $
  9.  *
  10.  ****************************************************************************
  11.  *
  12.  * Rogue Wave 
  13.  * P.O. Box 2328
  14.  * Corvallis, OR 97339
  15.  * Voice: (503) 754-3010    FAX: (503) 757-6650
  16.  *
  17.  * Copyright (C) 1989, 1990, 1991. This software is subject to copyright 
  18.  * protection under the laws of the United States and other countries.
  19.  *
  20.  ***************************************************************************
  21.  *
  22.  * $Log:   E:/vcs/rw/slistcol.h_v  $
  23.  * 
  24.  *    Rev 1.2   18 Feb 1992 09:54:46   KEFFER
  25.  * 
  26.  *    Rev 1.1   28 Oct 1991 09:08:24   keffer
  27.  * Changed inclusions to <rw/xxx.h>
  28.  * 
  29.  *    Rev 1.0   28 Jul 1991 08:17:10   keffer
  30.  * Tools.h++ V4.0.5 PVCS baseline version
  31.  *
  32.  */
  33.  
  34. #include "rw/slist.h"
  35. #include "rw/seqcltn.h"
  36. #include "rw/iterator.h"
  37.  
  38. class RWExport RWSlistCollectables : public RWSequenceable, public RWSlist {
  39. friend class RWExport RWSlistCollectablesIterator;
  40. public:     
  41.   RWSlistCollectables();
  42.   RWSlistCollectables(RWCollectable* a) :            RWSlist(a)    { }
  43.   ~RWSlistCollectables();
  44.  
  45.   RWBoolean        operator==(const RWSlistCollectables&) const;
  46.  
  47.   /***************  Member virtual functions ***********************/
  48.   virtual RWCollectable*    append(RWCollectable* a)    // Add at tail of list.
  49.     {return (RWCollectable*)RWSlist::append(a);}
  50.   virtual void            apply(RWapplyCollectable ap, void* x) 
  51.     { RWSlist::apply((RWapplyGeneric)ap, x); }
  52.   virtual RWCollectable*&    at(int i)
  53.     { return (RWCollectable*&)RWSlist::at(i); }
  54. #ifdef CONST_OVERLOADS
  55.   virtual const RWCollectable*    at(int i) const
  56.     { return (const RWCollectable*)RWSlist::at(i); }
  57. #endif
  58.   virtual void             clear() 
  59.     { RWSlist::clear(); }
  60. //virtual void            clearAndDestroy();
  61.   virtual RWBoolean        contains(const RWCollectable* a) const
  62.     {return RWCollection::contains(a);}
  63.   virtual unsigned        entries() const 
  64.     {return RWSlist::entries();}
  65.   virtual RWCollectable*    find(const RWCollectable* a) const
  66.     { return (RWCollectable*)RWSlist::find(rwIsEqualFun, a); }
  67.   virtual RWCollectable*     first() const        // Return value at head of list.
  68.     {return (RWCollectable*) RWSlist::first();}
  69.   virtual int            index(const RWCollectable* a) const
  70.     { return RWSlist::index(rwIsEqualFun, a); }
  71.   virtual RWCollectable*    insert(RWCollectable* a)
  72.     { return (RWCollectable*)RWSlist::append(a); }
  73.   virtual RWCollectable*    insertAfter(int i, RWCollectable* a)
  74.     { return (RWCollectable*)RWSlist::insertAfter(i,a); }
  75.   virtual ClassID        isA() const
  76.     {return __RWSLISTCOLLECTABLES;}
  77.   virtual RWBoolean        isEmpty() const 
  78.     {return RWSlist::isEmpty();}
  79.   virtual RWCollectable*    last() const    // Return value at tail of list.
  80.     {return (RWCollectable*) RWSlist::last();}
  81.   virtual RWCollectable*    newSpecies() const;
  82.   virtual unsigned    occurrencesOf(const RWCollectable* a) const
  83.     { return RWSlist::occurrencesOf(rwIsEqualFun, a); }
  84.   virtual RWCollectable*    prepend(RWCollectable* a)
  85.     { return (RWCollectable*)RWSlist::prepend(a); }
  86.   virtual RWCollectable*    remove(const RWCollectable* a)
  87.     { return (RWCollectable*)RWSlist::remove(rwIsEqualFun, a); }
  88.   //virtual void        removeAndDestroy(const RWCollectable* a);
  89.   
  90. /****************  (Redefined) Special Functions *****************/
  91.   RWBoolean             containsReference(const RWCollectable* a) const
  92.     { return RWSlist::containsReference(a); }
  93.   RWCollectable*        findReference(const RWCollectable* a) const 
  94.     { return (RWCollectable*)RWSlist::findReference(a); }
  95.   RWCollectable*        get()        // Return value and delete link at head of list.
  96.     {return (RWCollectable*) RWSlist::get();}
  97.   unsigned             occurrencesOfReference(const RWCollectable* a) const
  98.     { return RWSlist::occurrencesOfReference(a); }
  99.   RWCollectable*        removeReference(const RWCollectable* a)
  100.     { return (RWCollectable*)RWSlist::removeReference(a); }
  101. /*****************************************************************/
  102. };
  103.  
  104. /*
  105.  * Iterator for singly-linked list (moves iterator through the list);
  106.  * starts by pointing at last link.
  107.  */
  108. class RWExport RWSlistCollectablesIterator : public RWIterator, public RWSlistIterator {
  109. public:
  110.   RWSlistCollectablesIterator(RWSlistCollectables& s);
  111.   
  112. /******************** (Redefined) Standard Iterator functions *********************/
  113.   virtual RWCollectable*    findNext(const RWCollectable* a)
  114.     { return (RWCollectable*)RWSlistIterator::findNext(rwIsEqualFun, a); }
  115.   virtual RWCollectable*    key() const                // Return current item
  116.     { return (RWCollectable*)RWSlistIterator::key(); }
  117.   virtual RWCollectable*    operator()()                // Advance iterator
  118.     { return (RWCollectable*)RWSlistIterator::operator()(); }
  119.   virtual void            reset()
  120.     { RWSlistIterator::reset(); }
  121.   
  122. /****************** (Redefined) Special RWSlistIterator functions ********************/
  123.  
  124.   RWCollectable*        findNextReference(const RWCollectable* a)
  125.     { return (RWCollectable*)RWSlistIterator::findNextReference(a); }
  126.   RWCollectable*        insertAfterPoint(RWCollectable* a)    // Insert item behind iterator.
  127.     { return (RWCollectable*)RWSlistIterator::insertAfterPoint(a); }
  128.   RWCollectable*        remove()                // Remove current item
  129.     { return (RWCollectable*)RWSlistIterator::remove(); }
  130.   RWCollectable*        removeNext(const RWCollectable* a)
  131.     { return (RWCollectable*)RWSlistIterator::removeNext(rwIsEqualFun, a); }
  132.   RWCollectable*        removeNextReference(const RWCollectable* a)
  133.     { return (RWCollectable*)RWSlistIterator::removeNextReference(a); }
  134. /*****************************************************************/
  135. };
  136.  
  137. pragma pop_align_members();
  138. #endif  /* __RWSLISTCOL_H__ */
  139.