LogLevel.hpp 1.4 KB

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