LogLevel.hpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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-03
  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::std::io
  16. {
  17. class LS_STD_DYNAMIC_GOAL LogLevel : public ls::std::core::Class
  18. {
  19. public:
  20. explicit LogLevel(const ls::std::io::LogLevelValue &_value);
  21. LogLevel();
  22. ~LogLevel() override = default;
  23. operator unsigned char() const;
  24. ls::std::io::LogLevel &operator=(const ls::std::io::LogLevelValue &_value);
  25. bool operator<(const ls::std::io::LogLevelValue &_value);
  26. bool operator<=(const ls::std::io::LogLevelValue &_value);
  27. bool operator>(const ls::std::io::LogLevelValue &_value);
  28. bool operator>=(const ls::std::io::LogLevelValue &_value);
  29. bool operator==(const ls::std::io::LogLevelValue &_value);
  30. void setLogLevel(const ls::std::io::LogLevelValue &_value);
  31. void setLogLevel(const ::std::string &_value);
  32. ::std::string toString() const;
  33. private:
  34. ::std::unordered_map<uint8_t, ::std::string> level{};
  35. ls::std::io::LogLevelValue value{};
  36. ls::std::io::LogLevelValue _getValueFromString(const ::std::string &_value);
  37. void _init();
  38. bool _isValidLogLevelString(const ::std::string &_value);
  39. };
  40. }
  41. #endif