parse_cl.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 _e;
  34. bool _n;
  35. std::string _s;
  36. int _t;
  37. std::string _w;
  38. int _x;
  39. bool _h;
  40. bool _v;
  41. /* other stuff to keep track of */
  42. std::string _program_name;
  43. int _optind;
  44. public:
  45. /* constructor and destructor */
  46. Cmdline (int, char **); // ISO C++17 not allowed: throw (std::string);
  47. ~Cmdline (){}
  48. /* usage function */
  49. void usage (int status);
  50. /* version function */
  51. void version (int status);
  52. /* return next (non-option) parameter */
  53. int next_param () { return _optind; }
  54. bool echoDataChannelMessages () const { return _e; }
  55. bool noStun () const { return _n; }
  56. std::string stunServer () const { return _s; }
  57. int stunPort () const { return _t; }
  58. std::string webSocketServer () const { return _w; }
  59. int webSocketPort () const { return _x; }
  60. bool h () const { return _h; }
  61. bool v () const { return _v; }
  62. };
  63. #endif