parse_cl.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /******************************************************************************
  2. **
  3. ** parse_cl.h
  4. **
  5. ** Thu Aug 6 19:42:25 2020
  6. ** Linux 5.4.0-42-generic (#46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020) x86_64
  7. ** cerik@Erik-VBox-Ubuntu (Erik Cota-Robles)
  8. **
  9. ** Copyright (c) 2020 Erik Cota-Robles
  10. **
  11. ** Header file for command line parser class
  12. **
  13. ** Automatically created by genparse v0.9.3
  14. **
  15. ** See http://genparse.sourceforge.net for details and updates
  16. **
  17. ******************************************************************************/
  18. #ifndef CMDLINE_H
  19. #define CMDLINE_H
  20. #include <iostream>
  21. #include <string>
  22. /*----------------------------------------------------------------------------
  23. **
  24. ** class Cmdline
  25. **
  26. ** command line parser class
  27. **
  28. **--------------------------------------------------------------------------*/
  29. class Cmdline
  30. {
  31. private:
  32. /* parameters */
  33. bool _n;
  34. std::string _s;
  35. int _t;
  36. std::string _w;
  37. int _x;
  38. bool _h;
  39. /* other stuff to keep track of */
  40. std::string _program_name;
  41. int _optind;
  42. public:
  43. /* constructor and destructor */
  44. Cmdline (int, char **); // ISO C++17 not allowed: throw (std::string);
  45. ~Cmdline (){}
  46. /* usage function */
  47. void usage (int status);
  48. /* return next (non-option) parameter */
  49. int next_param () { return _optind; }
  50. bool noStun () const { return _n; }
  51. std::string stunServer () const { return _s; }
  52. int stunPort () const { return _t; }
  53. std::string webSocketServer () const { return _w; }
  54. int webSocketPort () const { return _x; }
  55. bool h () const { return _h; }
  56. };
  57. #endif