pcheck.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright 2001, 2002 Adrian Thurston <thurston@complang.org>
  3. */
  4. /* This file is part of Ragel.
  5. *
  6. * Ragel is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Ragel is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with Ragel; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. */
  20. #ifndef _PCHECK_H
  21. #define _PCHECK_H
  22. class ParamCheck
  23. {
  24. public:
  25. ParamCheck( const char *paramSpec, int argc, const char **argv);
  26. bool check();
  27. const char *paramArg; /* The argument to the parameter. */
  28. char parameter; /* The parameter matched. */
  29. enum { match, invalid, noparam } state;
  30. const char *argOffset; /* If we are reading params inside an
  31. * arg this points to the offset. */
  32. const char *curArg; /* Pointer to the current arg. */
  33. int iCurArg; /* Index to the current arg. */
  34. private:
  35. const char *paramSpec; /* Parameter spec supplied by the coder. */
  36. int argc; /* Arguement data from the command line. */
  37. const char **argv;
  38. };
  39. #endif