7#ifndef MYGUI_LOG_LEVEL_H_
8#define MYGUI_LOG_LEVEL_H_
34 LogLevel(Enum _value) :
39 static LogLevel parse(std::string_view _value)
45 std::string_view name = type.getValueName(value);
46 if (name.empty() || name == _value)
50 type.mValue =
static_cast<Enum>(value);
54 friend bool operator<(LogLevel
const& a, LogLevel
const& b)
56 return a.mValue < b.mValue;
59 friend bool operator>=(LogLevel
const& a, LogLevel
const& b)
64 friend bool operator>(LogLevel
const& a, LogLevel
const& b)
69 friend bool operator<=(LogLevel
const& a, LogLevel
const& b)
74 friend bool operator==(LogLevel
const& a, LogLevel
const& b)
76 return !(a < b) && !(a > b);
79 friend bool operator!=(LogLevel
const& a, LogLevel
const& b)
84 friend std::ostream& operator<<(std::ostream& _stream,
const LogLevel& _value)
86 _stream << _value.getValueName(_value.mValue);
90 friend std::istream& operator>>(std::istream& _stream, LogLevel& _value)
94 _value = parse(value);
98 std::string_view print()
const
100 return getValueName(mValue);
109 std::string_view getValueName(
int _index)
const
111 if (_index < 0 || _index >= MAX)
113 static const std::string_view values[MAX] = {
"Info",
"Warning",
"Error",
"Critical"};
114 return values[_index];