options.hpp 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef IS_OPTIONS_H_
  2. #include <string>
  3. #include <cstdio>
  4. namespace slop {
  5. class Options {
  6. public:
  7. Options();
  8. int parseOptions( int argc, char** argv );
  9. void printHelp();
  10. std::string m_version;
  11. int m_borderSize;
  12. int m_padding;
  13. int m_tolerance;
  14. int m_minimumsize;
  15. int m_maximumsize;
  16. int m_maxsize;
  17. float m_red;
  18. float m_green;
  19. float m_blue;
  20. float m_alpha;
  21. std::string m_xdisplay;
  22. float m_gracetime;
  23. bool m_keyboard;
  24. bool m_decorations;
  25. bool m_highlight;
  26. private:
  27. int parseInt( std::string arg, int* returnInt );
  28. int parseFloat( std::string arg, float* returnFloat );
  29. int parseString( std::string arg, std::string* returnString );
  30. int parseGeometry( std::string arg, int* x, int* y, int* w, int* h );
  31. int parseColor( std::string arg, float* r, float* g, float* b, float* a );
  32. bool matches( std::string arg, std::string shorthand, std::string longhand );
  33. };
  34. }
  35. extern slop::Options* options;
  36. #endif // IS_OPTIONS_H_