home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tlx501.zip / TEMPLATE / ITEMITER.CPP < prev    next >
C/C++ Source or Header  |  1996-01-05  |  4KB  |  117 lines

  1. /****************************************************************************
  2.     $Id: itemiter.cpp 501.0 1995/03/07 12:26:58 RON Exp $
  3.  
  4.     Copyright (c) 1991-95 Tarma Software Research. All rights reserved.
  5.  
  6.     Project:    Tarma Library for C++ V5.0
  7.     Author:    Ron van der Wal
  8.  
  9.     Implementation of item pseudo-iterator templates:
  10.  
  11.     - TLItemIter
  12.     - TLItemIterConst
  13.  
  14.     $Log: itemiter.cpp $
  15.     Revision 501.0  1995/03/07 12:26:58  RON
  16.     Updated for TLX 5.01
  17.     Revision 1.4  1995/01/31 16:30:44  RON
  18.     Update for release 012
  19.     Added partial support for SunPro C++ compiler
  20.     Revision 1.3  1994/10/06  17:50:44  ron
  21.     Changed #defined name
  22.  
  23.     Revision 1.2  1994/09/27  20:27:14  ron
  24.     Changed path separator from / to \
  25.  
  26.     Revision 1.1  1994/09/26  15:31:16  ron
  27.     Initial revision
  28.  
  29. ****************************************************************************/
  30.  
  31. #ifndef _TLX_ITEMITER_CPP
  32. #define _TLX_ITEMITER_CPP
  33.  
  34. #ifndef _TLX_VALITER_CPP
  35. #include <tlx\501\template\valiter.cpp>
  36. #endif
  37.  
  38. /*-------------------------------------------------------------------------*/
  39.     template<class T> TLItemIter<T>::TLItemIter(T &aItem)
  40.  
  41. /*  Constructor. Links to the given item.
  42. ---------------------------------------------------------------------------*/
  43. : mItem(aItem)
  44. {
  45. }
  46.  
  47. /*-------------------------------------------------------------------------*/
  48.     template<class T> bool TLItemIter<T>::FirstPos()
  49.  
  50. /*  Sets the iterator to the first available position (if any), returning
  51.     true if that move succeeds.
  52. ---------------------------------------------------------------------------*/
  53. {
  54.     return true;
  55. }
  56.  
  57. /*-------------------------------------------------------------------------*/
  58.     template<class T> bool TLItemIter<T>::NextPos()
  59.  
  60. /*  Advances the iterator to the next available position (if any), returning
  61.     true if that move succeeds.
  62. ---------------------------------------------------------------------------*/
  63. {
  64.     return false;
  65. }
  66.  
  67. /*-------------------------------------------------------------------------*/
  68.     template<class T> T &TLItemIter<T>::Peek() const
  69.  
  70. /*  Returns a reference to the currently iterated element.
  71. ---------------------------------------------------------------------------*/
  72. {
  73.     TLX_ASSERT(IsValid());
  74.     return mItem;
  75. }
  76.  
  77. /*-------------------------------------------------------------------------*/
  78.     template<class T> TLItemIterConst<T>::TLItemIterConst(const T &aItem)
  79.  
  80. /*  Constructor. Links to the given item.
  81. ---------------------------------------------------------------------------*/
  82. : mItem(aItem)
  83. {
  84. }
  85.  
  86. /*-------------------------------------------------------------------------*/
  87.     template<class T> bool TLItemIterConst<T>::FirstPos()
  88.  
  89. /*  Sets the iterator to the first available position (if any), returning
  90.     true if that move succeeds.
  91. ---------------------------------------------------------------------------*/
  92. {
  93.     return true;
  94. }
  95.  
  96. /*-------------------------------------------------------------------------*/
  97.     template<class T> bool TLItemIterConst<T>::NextPos()
  98.  
  99. /*  Advances the iterator to the next available position (if any), returning
  100.     true if that move succeeds.
  101. ---------------------------------------------------------------------------*/
  102. {
  103.     return false;
  104. }
  105.  
  106. /*-------------------------------------------------------------------------*/
  107.     template<class T> const T &TLItemIterConst<T>::Peek() const
  108.  
  109. /*  Returns a reference to the currently iterated element.
  110. ---------------------------------------------------------------------------*/
  111. {
  112.     TLX_ASSERT(IsValid());
  113.     return mItem;
  114. }
  115.  
  116. #endif    // _TLX_ITEMITER_CPP
  117.