home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / yacl-012.zip / base / iterator.h < prev    next >
C/C++ Source or Header  |  1995-04-08  |  861b  |  42 lines

  1.  
  2.  
  3.  
  4.  
  5. #ifndef _iterator_h_ /* Sat Nov 12 14:32:19 1994 */
  6. #define _iterator_h_
  7.  
  8.  
  9.  
  10. // {\tt CL_Iterator} is an abstract class providing the basic interface for
  11. // all YACL iterators. It is a template class with template parameter {\tt
  12. // T}, and its {\tt Next} method returns a reference to an object of type
  13. // {\tt T}.
  14.  
  15.  
  16. #ifdef __GNUC__
  17. #pragma implementation
  18. #endif
  19.  
  20. #include "base/object.h"
  21.  
  22.  
  23. template <class T>
  24. class CL_EXPORT CL_Iterator: public CL_Object {
  25.  
  26. public:
  27.     ~CL_Iterator() {};
  28.     
  29.     virtual void      Reset () = 0;
  30.     // Reset the iterator to the beginning.
  31.  
  32.     virtual bool      More  () = 0;
  33.     // Return TRUE if there are more elements to be returned. (Pure
  34.     // virtual.)
  35.  
  36.     virtual const T&  Next  () = 0;
  37.     // Return the next element.  (Pure virtual.)
  38.     
  39. };
  40.  
  41. #endif /* _iterator_h_ */
  42.