home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / zip / gnu / gperf.lzh / GPERF / ITERATOR.H < prev    next >
C/C++ Source or Header  |  1993-07-30  |  2KB  |  50 lines

  1. /* This may look like C code, but it is really -*- C++ -*- */
  2.  
  3. /* Provides an Iterator for keyword characters.
  4.  
  5.    Copyright (C) 1989 Free Software Foundation, Inc.
  6.    written by Douglas C. Schmidt (schmidt@ics.uci.edu)
  7.  
  8. This file is part of GNU GPERF.
  9.  
  10. GNU GPERF is free software; you can redistribute it and/or modify
  11. it under the terms of the GNU General Public License as published by
  12. the Free Software Foundation; either version 1, or (at your option)
  13. any later version.
  14.  
  15. GNU GPERF is distributed in the hope that it will be useful,
  16. but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18. GNU General Public License for more details.
  19.  
  20. You should have received a copy of the GNU General Public License
  21. along with GNU GPERF; see the file COPYING.  If not, write to
  22. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  23.  
  24. /* Provides an Iterator that expands and decodes a control string containing digits
  25.    and ranges, returning an integer every time the generator function is called.
  26.    This is used to decode the user's key position requests.  For example:
  27.    "-k 1,2,5-10,$"  will return 1, 2, 5, 6, 7, 8, 9, 10, and 0 ( representing
  28.    the abstract ``last character of the key'' on successive calls to the
  29.    member function operator ().
  30.    No errors are handled in these routines, they are passed back to the
  31.    calling routines via a user-supplied Error_Value */
  32.  
  33. #pragma once
  34.  
  35. class Iterator 
  36. {
  37. private:
  38.   char *str;                    /* A pointer to the string provided by the user. */
  39.   int   end;                    /* Value returned after last key is processed. */
  40.   int   end_word;               /* A value marking the abstract ``end of word'' ( usually '$'). */
  41.   int   error_value;            /* Error value returned when input is syntactically erroneous. */
  42.   int   hi_bound;               /* Greatest possible value, inclusive. */
  43.   int   lo_bound;               /* Smallest possible value, inclusive. */
  44.  
  45. public:
  46.         Iterator (char *s, int lo, int hi, int word_end, int bad_val, int key_end);
  47.   int   operator () (void);
  48. };
  49.  
  50.