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: 2023-02-22
  7. *
  8. * */
  9. #ifndef LS_STD_LOG_LEVEL_HPP
  10. #define LS_STD_LOG_LEVEL_HPP
  11. #include "LogLevelValue.hpp"
  12. #include <ls-std/core/Class.hpp>
  13. #include <ls-std/os/dynamic-goal.hpp>
  14. #include <unordered_map>
  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;
  23. ;
  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. [[nodiscard]] ls::std::io::LogLevelValue getValue();
  31. void setLogLevel(const ls::std::io::LogLevelValue &_value);
  32. void setLogLevel(const ::std::string &_value);
  33. [[nodiscard]] ::std::string toString() const;
  34. private:
  35. ::std::unordered_map<uint8_t, ::std::string> level{};
  36. ls::std::io::LogLevelValue value{};
  37. [[nodiscard]] ls::std::io::LogLevelValue _getValueFromString(const ::std::string &_value);
  38. void _init();
  39. [[nodiscard]] bool _isValidLogLevelString(const ::std::string &_value);
  40. };
  41. }
  42. #endif