home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_10_01 / 1001024a < prev    next >
Text File  |  1991-11-18  |  1KB  |  40 lines

  1. //////////////////////////////////////////////////////
  2. // LISTCLAS.H
  3. //
  4. // D_List Class - Similar to list class
  5. // developed for CUJ July, 1990
  6. //
  7. // Dave's List.
  8. //
  9. //////////////////////////////////////////////////////
  10. #ifndef LISTCLAS_H
  11. #define LISTCLAS_H
  12. #include <stdio.h>
  13. enum Boolean {false, true};
  14.  
  15. class D_List {
  16.     public:
  17.         virtual  Boolean at_top()
  18.         { return ((Boolean) (tell() == 0L));}
  19.     virtual  Boolean at_end() = 0;
  20.         virtual  Boolean is_empty()
  21.         { return ((Boolean) (total() == 0L)); }
  22.     virtual  Boolean find(void *key) = 0;
  23.     virtual void  prev() = 0,
  24.         next() = 0,
  25.         seek(long where, int start),
  26.         top() = 0,
  27.         end() = 0,
  28.         add() = 0,
  29.         replace(void *member) = 0,
  30.         remove() = 0;
  31.     virtual void  *current() = 0;
  32.         long virtual  total(),
  33.                       tell() = 0;
  34.         void * operator[] (long where)
  35.         { seek(where,SEEK_SET); return current(); }
  36.         void * operator[] (void *key)
  37.         { return (find(key) ? current() : NULL); }
  38. };
  39. #endif
  40.