7
This file is part of MyGUI.
9
MyGUI is free software: you can redistribute it and/or modify
10
it under the terms of the GNU Lesser General Public License as published by
11
the Free Software Foundation, either version 3 of the License, or
12
(at your option) any later version.
14
MyGUI is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
GNU Lesser General Public License for more details.
19
You should have received a copy of the GNU Lesser General Public License
20
along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
22
#ifndef __MYGUI_LOG_LEVEL_H__
23
#define __MYGUI_LOG_LEVEL_H__
25
#include "MyGUI_Prerequest.h"
30
struct MYGUI_EXPORT LogLevel
34
Info, // Информационное сообщение.
35
Warning, // Несущественная проблема.
36
Error, // Устранимая ошибка.
37
Critical, // Неустранимая ошибка или сбой в работе приложения.
46
LogLevel(Enum _value) :
51
static LogLevel parse(const std::string& _value)
57
const char* name = type.getValueName(value);
58
if (strcmp(name, "") == 0 || name == _value)
62
type.value = (Enum)value;
66
friend bool operator < (LogLevel const& a, LogLevel const& b)
68
return a.value < b.value;
71
friend bool operator >= (LogLevel const& a, LogLevel const& b)
76
friend bool operator > (LogLevel const& a, LogLevel const& b)
81
friend bool operator <= (LogLevel const& a, LogLevel const& b)
86
friend bool operator == (LogLevel const& a, LogLevel const& b)
88
return !(a < b) && !(a > b);
91
friend bool operator != (LogLevel const& a, LogLevel const& b)
96
friend std::ostream& operator << (std::ostream& _stream, const LogLevel& _value)
98
_stream << _value.getValueName(_value.value);
102
friend std::istream& operator >> (std::istream& _stream, LogLevel& _value)
106
_value = parse(value);
110
std::string print() const
112
return getValueName(value);
116
const char* getValueName(int _index) const
118
static const char* values[MAX + 1] = { "Info", "Warning", "Error", "Critical", "" };
119
return values[(_index < MAX && _index >= 0) ? _index : MAX];
128
#endif // __MYGUI_LOG_LEVEL_H__
2
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
3
* Distributed under the MIT License
4
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
7
#ifndef __MYGUI_LOG_LEVEL_H__
8
#define __MYGUI_LOG_LEVEL_H__
10
#include "MyGUI_Prerequest.h"
15
struct MYGUI_EXPORT LogLevel
19
Info, // Информационное сообщение.
20
Warning, // Несущественная проблема.
21
Error, // Устранимая ошибка.
22
Critical, // Неустранимая ошибка или сбой в работе приложения.
31
LogLevel(Enum _value) :
36
static LogLevel parse(const std::string& _value)
42
const char* name = type.getValueName(value);
43
if (strcmp(name, "") == 0 || name == _value)
47
type.mValue = (Enum)value;
51
friend bool operator < (LogLevel const& a, LogLevel const& b)
53
return a.mValue < b.mValue;
56
friend bool operator >= (LogLevel const& a, LogLevel const& b)
61
friend bool operator > (LogLevel const& a, LogLevel const& b)
66
friend bool operator <= (LogLevel const& a, LogLevel const& b)
71
friend bool operator == (LogLevel const& a, LogLevel const& b)
73
return !(a < b) && !(a > b);
76
friend bool operator != (LogLevel const& a, LogLevel const& b)
81
friend std::ostream& operator << (std::ostream& _stream, const LogLevel& _value)
83
_stream << _value.getValueName(_value.mValue);
87
friend std::istream& operator >> (std::istream& _stream, LogLevel& _value)
91
_value = parse(value);
95
std::string print() const
97
return getValueName(mValue);
106
const char* getValueName(int _index) const
108
static const char* values[MAX + 1] = { "Info", "Warning", "Error", "Critical", "" };
109
return values[(_index < MAX && _index >= 0) ? _index : MAX];
118
#endif // __MYGUI_LOG_LEVEL_H__