parse_cl.h 1.6 KB

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