ogetoptv.hpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*====================================================================*
  2. *
  3. * ogetoptv.hpp - ogetoptv class declaration;
  4. *
  5. * implement the POSIX standard getopt() function for C++;
  6. *
  7. * Motley Tools by Charles Maier <cmaier@cmassoc.net>;
  8. * Copyright 2001-2006 by Charles Maier Associates;
  9. * Licensed under the Internet Software Consortium License;
  10. *
  11. *--------------------------------------------------------------------*/
  12. #ifndef oGETOPTV_HEADER
  13. #define oGETOPTV_HEADER
  14. /*====================================================================*
  15. * custom header files;
  16. *--------------------------------------------------------------------*/
  17. #include "../classes/stdafx.hpp"
  18. #include "../classes/oputoptv.hpp"
  19. #include "../classes/oversion.hpp"
  20. /*====================================================================*
  21. * class constants;
  22. *--------------------------------------------------------------------*/
  23. #define oGETOPTV_VERSION 1
  24. #define oGETOPTV_SUMMARY 1
  25. #define oGETOPTV_C_OPTIONS ('-')
  26. #define oGETOPTV_C_OPERAND (':')
  27. #define oGETOPTV_C_ILLEGAL ('?')
  28. #define oGETOPTV_C_VERSION ('!')
  29. #define oGETOPTV_C_SUMMARY ('?')
  30. /*====================================================================*
  31. * class declaration;
  32. *--------------------------------------------------------------------*/
  33. class __declspec (dllexport) ogetoptv: private oputoptv, private oversion
  34. {
  35. public:
  36. ogetoptv ();
  37. virtual ~ ogetoptv ();
  38. int argc () const;
  39. char const ** argv () const;
  40. char const * args ();
  41. signed optind () const;
  42. signed opterr () const;
  43. signed optmin () const;
  44. signed optopt () const;
  45. char const *optarg () const;
  46. signed operator++ (signed);
  47. int getoptv (int argc, char const * argv [], char const * optv []);
  48. ogetoptv & optind (const signed);
  49. ogetoptv & opterr (const signed);
  50. ogetoptv & optmin (const signed);
  51. private:
  52. char const * mstring;
  53. int margc;
  54. char const ** margv;
  55. char * margs;
  56. char const * moptarg;
  57. int mopterr;
  58. int moptind;
  59. int moptmin;
  60. int moptopt;
  61. int mcount;
  62. int mindex;
  63. };
  64. /*====================================================================*
  65. * end declaration;
  66. *--------------------------------------------------------------------*/
  67. #endif