home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / oclsrc15.zip / OCL / Include / OList.hpp < prev    next >
C/C++ Source or Header  |  1996-08-12  |  3KB  |  108 lines

  1. // OCL - OS/2 Class Library
  2. // (c) Cubus 1995
  3. // All Rights Reserved
  4. // OList.hpp
  5.  
  6. /*
  7.  * Redistribution and use in source and binary forms, with or without
  8.  * modification, are permitted provided that the following conditions
  9.  * are met:
  10.  * 1. Redistributions of source code must retain the above copyright
  11.  *    notice, this list of conditions and the following disclaimer.
  12.  * 2. Neither the name Cubus nor the name Team OCL may be used to
  13.  *    endorse or promote products derived from this software
  14.  *    without specific prior written permission.
  15.  * 3. See OCL.INF for a detailed copyright notice.
  16.  *
  17.  *              THIS SOFTWARE IS PROVIDED ``AS IS'' AND
  18.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  19.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  20.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  21.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  22.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  23.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  24.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  25.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  26.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  27.  * SUCH DAMAGE.
  28.  */
  29.  
  30. // $Header: W:/Projects/OCL/Include/rcs/OList.hpp 1.50 1996/08/11 23:47:19 B.STEIN Release $
  31.  
  32. #ifndef OLIST_INCLUDED
  33.   #define OLIST_INCLUDED
  34.  
  35.  
  36. #ifndef OCOLLECTION_INCLUDED
  37.   #include <OCollection.hpp>
  38. #endif
  39.  
  40. #ifndef OCONSTITERATOR_INCLUDED
  41.   #include <OConstIterator.hpp>
  42. #endif
  43.  
  44. #ifndef OITERATOR_INCLUDED
  45.   #include <OIterator.hpp>
  46. #endif
  47.  
  48. template <class T>
  49. class OList
  50.   : public OCollection
  51. {
  52.  protected:
  53.     void freeItem(PVOID elem);
  54.  
  55.  public:
  56.     OList                  (BOOL copyElements = FALSE);
  57.     OList                  (OList<T>& list,
  58.                             BOOL copyElements = FALSE);
  59.  
  60.     virtual
  61.        ~OList              ();
  62.  
  63.     virtual
  64.        PSZ isOfType        () const; 
  65.  
  66.     virtual T
  67.        *getFirst           (),
  68.        *getLast            (),
  69.        *get                (),
  70.        *getNext            (),
  71.        *getNext            (T *elem),
  72.        *getPrev            (),
  73.        *getPrev            (T *elem),
  74.        *getItem            (ULONG itemNum);
  75.  
  76.     virtual OListItem<T>
  77.        *first              () const,
  78.        *actual             () const,
  79.        *last               () const,
  80.        *getNextListItem    (T *elem),
  81.        *getPrevListItem    (T *elem);
  82.  
  83.     virtual OList<T>
  84.        &operator <<        (T* elem),
  85.        &operator <<        (T& elem),
  86.        &operator >>        (T& elem),
  87.        &operator >>        (T* elem);
  88.  
  89.     virtual void
  90.        add                 (T& elem),
  91.        add                 (T* elem),
  92.        allElementsDo       (void (*function)(const T* elem)) const,
  93.        allElementsDo       (OConstIterator<T>& iter) const,
  94.        allElementsDo       (void (*function)(T* elem)),
  95.        allElementsDo       (OIterator<T>& iter);
  96. };
  97.  
  98.  
  99.  
  100. #ifdef __OCL_RESOLVE_TEMPLATES__
  101.   #include <OList.inl>
  102. #endif
  103.  
  104.  
  105. #endif // OLIST_INCLUDED
  106.  
  107. // end of source
  108.