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

  1. #ifndef __RWIDLIST_H__
  2. #define __RWIDLIST_H__
  3. pragma push_align_members(64);
  4.  
  5. /*
  6.  * RWIsvDlist: An intrusive doubly-linked list.
  7.  *
  8.  * $Header:   E:/vcs/rw/idlist.h_v   1.0   11 Mar 1992 14:10:44   KEFFER  $
  9.  *
  10.  ****************************************************************************
  11.  *
  12.  * Rogue Wave Software, Inc.
  13.  * P.O. Box 2328
  14.  * Corvallis, OR 97339
  15.  *
  16.  * Copyright (C) 1992. This software is subject to copyright 
  17.  * protection under the laws of the United States and other countries.
  18.  *
  19.  ***************************************************************************
  20.  *
  21.  * $Log:   E:/vcs/rw/idlist.h_v  $
  22.  * 
  23.  *    Rev 1.0   11 Mar 1992 14:10:44   KEFFER
  24.  * Initial revision.
  25.  */
  26.  
  27. #include "rw/idlink.h"
  28. #include "rw/islist.h"
  29.  
  30. /****************************************************************
  31.  *                                *
  32.  *        Declarations for RWIsvDlist            *
  33.  *                                *
  34.  ****************************************************************/
  35.  
  36. class RWExport RWIsvDlist : public RWIsvSlist {
  37.  
  38.   friend class RWExport RWIsvDlistIterator;
  39.  
  40. private:
  41.  
  42.   RWIsvDlist(const RWIsvDlist&);    // Hide the copy constructor and assignment operator
  43.   void            operator=(const RWIsvDlist&);
  44.  
  45. protected:
  46.  
  47.   RWIsvSlist::_lastDlink;
  48.   void            insertAfterLink(RWIsvDlink*, RWIsvDlink*);
  49.  
  50. public:
  51.  
  52.   RWIsvDlist() { }
  53.   RWIsvDlist(RWIsvDlink* a);
  54.  
  55.   /********************* Member functions **************************/
  56.   void            append(RWIsvDlink* a)    {RWIsvDlist::insertAfterLink(_lastDlink, a);}
  57.   RWIsvDlink*        at(int i) const     {return (RWIsvDlink*)RWIsvSlist::at(i);}
  58.   RWIsvSlist::clear;
  59.   RWIsvSlist::entries;
  60.   RWIsvDlink*        first() const        {return (RWIsvDlink*)RWIsvSlist::first();}
  61.   RWIsvDlink*        get()            {return removeFirst();}
  62.   void            insert(RWIsvDlink* a)    {RWIsvDlist::append(a);}
  63.   void            insertAfter(int, RWIsvDlink*);
  64.   void            insertAt(int, RWIsvDlink*);
  65.   RWIsvSlist::isEmpty;
  66.   RWIsvDlink*        last() const        {return _lastDlink;}
  67.   void            prepend(RWIsvDlink*);
  68.   RWIsvDlink*        removeAt(int);
  69.   RWIsvDlink*         removeFirst();        // Remove and return link at head of list
  70.   RWIsvDlink*        removeLast();        // Remove and return the last link
  71.   RWIsvDlink*        removeReference(const RWIsvDlink* a);    // Remove and return link; link MUST be in list
  72. };
  73.  
  74.  
  75. /****************************************************************
  76.  *                                *
  77.  *        Declarations for RWIsvDlistIterator        *
  78.  *                                *
  79.  ****************************************************************/
  80.  
  81. class RWExport RWIsvDlistIterator : public RWIsvSlistIterator {
  82.  
  83.   typedef RWIsvSlistIterator BASE;
  84.  
  85.   // Disallow postfix increment.  Unless we hide it, some compilers will
  86.   // substitute the prefix increment operator in its place.
  87.   RWBoolean        operator++(int);
  88.  
  89. public:
  90.  
  91.   // Constructor: starts with iterator positioned at last link.
  92.   RWIsvDlistIterator(RWIsvDlist& s) : RWIsvSlistIterator(s) { }
  93.   
  94.   // Operators:
  95.   RWBoolean        operator++()        {return BASE::operator++();}
  96.   RWIsvDlink*        operator()()        {return (RWIsvDlink*)BASE::operator()();}
  97.   RWBoolean        operator+=(int n)    {return BASE::operator+=(n);}
  98.  
  99.   RWIsvDlist*        container() const {return _dlist;}
  100.   void            insertAfterPoint(RWIsvDlink*);
  101.   RWIsvDlink*        key() const    {return (RWIsvDlink*)BASE::key();}
  102.   void            operator--();
  103.   void            operator-=(int n);
  104.   RWIsvDlink*         remove();
  105.   RWIsvDlink*        removeNextReference(const RWIsvDlink*);
  106.   void            reset()            {BASE::reset();}
  107.   void            reset(RWIsvDlist& s)    {BASE::reset(s);}
  108. };
  109.  
  110. pragma pop_align_members();
  111. #endif    /* __RWIDLIST_H__ */
  112.