LogLevel.hpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-08-20
  6. * Changed: 2022-05-11
  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. namespace ls
  15. {
  16. namespace std
  17. {
  18. namespace io
  19. {
  20. class LogLevel : public ls::std::core::Class
  21. {
  22. public:
  23. explicit LogLevel(const ls::std::io::LogLevelValue &_value);
  24. LogLevel();
  25. ~LogLevel() override = default;
  26. operator unsigned char() const;
  27. ls::std::io::LogLevel &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. 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. void setLogLevel(const ls::std::io::LogLevelValue &_value);
  34. void setLogLevel(const ::std::string &_value);
  35. ::std::string toString() const;
  36. private:
  37. ::std::unordered_map<uint8_t, ::std::string> level{};
  38. ls::std::io::LogLevelValue value{};
  39. ls::std::io::LogLevelValue _getValueFromString(const ::std::string &_value);
  40. void _init();
  41. bool _isValidLogLevelString(const ::std::string &_value);
  42. };
  43. }
  44. }
  45. }
  46. #endif