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

  1. #ifndef __RWCOLCLASS_H__
  2. #define __RWCOLCLASS_H__
  3. pragma push_align_members(64);
  4.  
  5. /*
  6.  * Base class for the Smalltalk(TM)-like collection classes.
  7.  *
  8.  * $Header:   E:/vcs/rw/colclass.h_v   1.3   18 Feb 1992 09:54:12   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/colclass.h_v  $
  23.  * 
  24.  *    Rev 1.3   18 Feb 1992 09:54:12   KEFFER
  25.  * 
  26.  *    Rev 1.2   28 Oct 1991 09:08:08   keffer
  27.  * Changed inclusions to <rw/xxx.h>
  28.  * 
  29.  *    Rev 1.1   29 Jul 1991 13:53:02   keffer
  30.  * Changed return type of asBag(), asOrderedCollection(), asSet() and
  31.  * asSortedCollection() to their RW names.
  32.  * 
  33.  *    Rev 1.0   28 Jul 1991 08:13:12   keffer
  34.  * Tools.h++ V4.0.5 PVCS baseline version
  35.  *
  36.  */
  37.  
  38. #include "rw/collect.h"
  39.  
  40. class RWExport RWCollection : public RWCollectable {
  41. public:
  42.   static const unsigned        DEFAULT_CAPACITY;
  43.   static const unsigned        DEFAULT_RESIZE;
  44. public:
  45.  
  46.   /************* Virtual function inherited from RWCollectable *****************/
  47.   virtual unsigned        binaryStoreSize() const;
  48.   virtual ClassID        isA() const {return __RWCOLLECTION;}
  49.   virtual void            restoreGuts(RWvistream&);
  50.   virtual void            restoreGuts(RWFile&);
  51.   virtual void            saveGuts(RWvostream&) const;
  52.   virtual void            saveGuts(RWFile&) const;
  53.  
  54.   /****************  Added virtual functions for RWCollections ****************/
  55.   virtual void            apply(RWapplyCollectable, void*) = 0;
  56.   virtual void            clear() = 0;
  57.   virtual void            clearAndDestroy();
  58.   virtual RWBoolean        contains(const RWCollectable*) const;
  59.   virtual unsigned        entries() const = 0;    // Total entries
  60.   virtual RWCollectable*    find(const RWCollectable*) const = 0;        // First occurrence
  61.   virtual RWCollectable*    insert(RWCollectable*) = 0;
  62.   virtual RWBoolean        isEmpty() const = 0;
  63.   virtual unsigned        occurrencesOf(const RWCollectable*) const = 0;
  64.   virtual RWCollectable*    remove(const RWCollectable*) = 0;    // Remove first occurrence
  65.   virtual void            removeAndDestroy(const RWCollectable*); 
  66.  
  67.   /************************ Special functions *******************************/
  68.   void                operator+=(const RWCollection& c); // Add items of c to self
  69.   void                operator-=(const RWCollection& c); // Remove items of c from self
  70.   void                addContentsTo(RWCollection*) const;
  71.   RWBag                asBag() const;
  72.   RWOrdered            asOrderedCollection() const;
  73.   RWSet                asSet() const;
  74.   RWBinaryTree            asSortedCollection() const;
  75.   RWCollection*            select(RWtestCollectable, void*) const;
  76. };      
  77.  
  78. typedef void (*RWapplyKeyAndValue)(RWCollectable*, RWCollectable*, void*);
  79.  
  80. pragma pop_align_members();
  81. #endif /* __RWCOLCLASS_H__ */
  82.