home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume6 / lookup.c++ / lookup.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-03-04  |  392 b   |  28 lines

  1. #ifndef LOOKUPH
  2. #define LOOKUPH
  3.  
  4. #define ARG_TYPE const char *
  5. #define RET_TYPE int
  6.  
  7. typedef RET_TYPE (*proc)(ARG_TYPE);
  8.  
  9. struct entry {
  10.     const char *name;
  11.     proc f;
  12.     };
  13.  
  14. class lookup {
  15.     entry *table;
  16.     proc dflt;
  17.     int max;
  18. public:
  19.     lookup(entry *t) {
  20.         dflt = t->f;
  21.         max = int(t->name);
  22.         table = t + 1;
  23.         }
  24.     // This really does take a const char *
  25.     proc operator[](const char *);
  26.     };
  27. #endif
  28.