LogLevel.hpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-08-20
  6. * Changed: 2022-07-01
  7. *
  8. * */
  9. #ifndef LS_STD_LOG_LEVEL_HPP
  10. #define LS_STD_LOG_LEVEL_HPP
  11. #include <unordered_map>
  12. #include <ls_std/core/Class.hpp>
  13. #include "LogLevelValue.hpp"
  14. #include <ls_std/os/dynamic_goal.hpp>
  15. namespace ls
  16. {
  17. namespace std
  18. {
  19. namespace io
  20. {
  21. class DYNAMIC_GOAL LogLevel : public ls::std::core::Class
  22. {
  23. public:
  24. explicit LogLevel(const ls::std::io::LogLevelValue &_value);
  25. LogLevel();
  26. ~LogLevel() override = default;
  27. operator unsigned char() const;
  28. ls::std::io::LogLevel &operator=(const ls::std::io::LogLevelValue &_value);
  29. bool operator<(const ls::std::io::LogLevelValue &_value);
  30. bool operator<=(const ls::std::io::LogLevelValue &_value);
  31. bool operator>(const ls::std::io::LogLevelValue &_value);
  32. bool operator>=(const ls::std::io::LogLevelValue &_value);
  33. bool operator==(const ls::std::io::LogLevelValue &_value);
  34. void setLogLevel(const ls::std::io::LogLevelValue &_value);
  35. void setLogLevel(const ::std::string &_value);
  36. ::std::string toString() const;
  37. private:
  38. ::std::unordered_map<uint8_t, ::std::string> level{};
  39. ls::std::io::LogLevelValue value{};
  40. ls::std::io::LogLevelValue _getValueFromString(const ::std::string &_value);
  41. void _init();
  42. bool _isValidLogLevelString(const ::std::string &_value);
  43. };
  44. }
  45. }
  46. }
  47. #endif