appContext.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #pragma once
  2. #define __DEBUG 1
  3. #include <string>
  4. namespace knacki::cd{
  5. class ArgumentException;
  6. class AppContext
  7. {
  8. public:
  9. AppContext(char **);
  10. static std::string GetAbsolutePath(const std::string &, const std::string &);
  11. struct Args {
  12. public:
  13. bool usageOnly;
  14. bool historyOnly;
  15. bool getHistoryFile;
  16. bool flush;
  17. bool verbose;
  18. std::string histDir;
  19. std::string histFile;
  20. std::string histAbsolutePath;
  21. std::string pushArg;
  22. Args(){};
  23. Args(bool _usageOnly, bool _historyOnly, bool _getHistoryFile, bool _flush, bool _verbose, const std::string &_histDir, const std::string &_histFile, const std::string &_pushArg):
  24. usageOnly(_usageOnly),
  25. historyOnly(_historyOnly),
  26. getHistoryFile(_getHistoryFile),
  27. flush(_flush),
  28. verbose(_verbose),
  29. histDir(_histDir),
  30. histFile(_histFile),
  31. histAbsolutePath(GetAbsolutePath(histDir, histFile)),
  32. pushArg(_pushArg)
  33. {};
  34. };
  35. const Args &GetArgs() const;
  36. bool IsReadOnly() const;
  37. protected:
  38. Args fArgs;
  39. private:
  40. AppContext();
  41. };
  42. }