LogLevel.hpp 1.7 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: 2024-05-25
  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 <string_view>
  15. #include <unordered_map>
  16. /*
  17. * @class(name: 'LogLevel', package: 'io')
  18. * */
  19. namespace ls::std::io
  20. {
  21. class LS_STD_DYNAMIC_GOAL LogLevel : public ls::std::core::Class
  22. {
  23. public:
  24. explicit LogLevel(const ls::std::io::LogLevelValue &_value);
  25. LogLevel();
  26. ~LogLevel() noexcept override;
  27. ls::std::io::LogLevel &operator=(const ls::std::io::LogLevelValue &_value);
  28. bool operator<(const ls::std::io::LogLevelValue &_value) const;
  29. bool operator<=(const ls::std::io::LogLevelValue &_value) const;
  30. bool operator>(const ls::std::io::LogLevelValue &_value) const;
  31. bool operator>=(const ls::std::io::LogLevelValue &_value) const;
  32. bool operator==(const ls::std::io::LogLevelValue &_value) const;
  33. [[nodiscard]] ls::std::io::LogLevelValue getValue() const;
  34. void setLogLevel(const ls::std::io::LogLevelValue &_value);
  35. void setLogLevel(const ::std::string &_value);
  36. [[nodiscard]] ::std::string toString() const;
  37. private:
  38. ::std::unordered_map<ls::std::io::LogLevelValue, ::std::string> level{};
  39. ls::std::io::LogLevelValue value{};
  40. [[nodiscard]] ls::std::io::LogLevelValue _getValueFromString(const ::std::string &_value);
  41. void _init();
  42. [[nodiscard]] bool _isValidLogLevelString(::std::string_view _value) const;
  43. };
  44. }
  45. #endif