MyGUI
3.4.2
Main Page
Related Pages
Namespaces
Data Structures
Files
Examples
File List
Globals
MyGUIEngine
include
MyGUI_LogLevel.h
Go to the documentation of this file.
1
/*
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)
5
*/
6
7
#ifndef MYGUI_LOG_LEVEL_H_
8
#define MYGUI_LOG_LEVEL_H_
9
10
#include "
MyGUI_Prerequest.h
"
11
#include <string>
12
#include <cstring>
13
#include <iostream>
14
15
namespace
MyGUI
16
{
17
18
struct
MYGUI_EXPORT
LogLevel
19
{
20
enum
Enum
21
{
22
Info
,
// Информационное сообщение.
23
Warning
,
// Несущественная проблема.
24
Error
,
// Устранимая ошибка.
25
Critical
,
// Неустранимая ошибка или сбой в работе приложения.
26
MAX
27
};
28
29
LogLevel
() :
30
mValue(Info)
31
{
32
}
33
34
LogLevel
(
Enum
_value
) :
35
mValue(
_value
)
36
{
37
}
38
39
static
LogLevel
parse
(
const
std::string&
_value
)
40
{
41
LogLevel
type;
42
int
value = 0;
43
while
(
true
)
44
{
45
const
char
* name = type.getValueName(value);
46
if
(
strcmp
(name,
""
) == 0 || name ==
_value
)
47
break
;
48
value++;
49
}
50
type.mValue = (
Enum
)value;
51
return
type;
52
}
53
54
friend
bool
operator <
(
LogLevel
const
&
a
,
LogLevel
const
&
b
)
55
{
56
return
a
.mValue <
b
.mValue;
57
}
58
59
friend
bool
operator >=
(
LogLevel
const
&
a
,
LogLevel
const
&
b
)
60
{
61
return
!(
a
<
b
);
62
}
63
64
friend
bool
operator >
(
LogLevel
const
&
a
,
LogLevel
const
&
b
)
65
{
66
return
(
b
<
a
);
67
}
68
69
friend
bool
operator <=
(
LogLevel
const
&
a
,
LogLevel
const
&
b
)
70
{
71
return
!(
a
>
b
);
72
}
73
74
friend
bool
operator ==
(
LogLevel
const
&
a
,
LogLevel
const
&
b
)
75
{
76
return
!(
a
<
b
) && !(
a
>
b
);
77
}
78
79
friend
bool
operator !=
(
LogLevel
const
&
a
,
LogLevel
const
&
b
)
80
{
81
return
!(
a
==
b
);
82
}
83
84
friend
std::ostream&
operator <<
(std::ostream&
_stream
,
const
LogLevel
&
_value
)
85
{
86
_stream
<<
_value
.getValueName(
_value
.mValue);
87
return
_stream
;
88
}
89
90
friend
std::istream&
operator >>
(std::istream&
_stream
,
LogLevel
&
_value
)
91
{
92
std::string value;
93
_stream
>> value;
94
_value
= parse(value);
95
return
_stream
;
96
}
97
98
std::string
print
()
const
99
{
100
return
getValueName(mValue);
101
}
102
103
int
getValue
()
const
104
{
105
return
mValue;
106
}
107
108
private
:
109
const
char
* getValueName(
int
_index
)
const
110
{
111
static
const
char
*
values
[MAX + 1] = {
"Info"
,
"Warning"
,
"Error"
,
"Critical"
,
""
};
112
return
values[(_index < MAX && _index >= 0) ? _index : MAX];
113
}
114
115
private
:
116
Enum
mValue;
117
};
118
119
}
// namespace MyGUI
120
121
#endif
// MYGUI_LOG_LEVEL_H_
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition
MyGUI_Platform.h:77
MyGUI_Prerequest.h
MyGUI::Enumerator
Definition
MyGUI_Enumerator.h:49
MyGUI::FontCodeType::Enum
Enum
Definition
MyGUI_FontData.h:20
MyGUI
Definition
MyGUI_ActionController.h:15
MyGUI::LogLevel
Definition
MyGUI_LogLevel.h:19
MyGUI::LogLevel::LogLevel
LogLevel()
Definition
MyGUI_LogLevel.h:29
MyGUI::LogLevel::getValue
int getValue() const
Definition
MyGUI_LogLevel.h:103
MyGUI::LogLevel::print
std::string print() const
Definition
MyGUI_LogLevel.h:98
MyGUI::LogLevel::Enum
Enum
Definition
MyGUI_LogLevel.h:21
MyGUI::LogLevel::Info
@ Info
Definition
MyGUI_LogLevel.h:22
MyGUI::LogLevel::Error
@ Error
Definition
MyGUI_LogLevel.h:24
MyGUI::LogLevel::Warning
@ Warning
Definition
MyGUI_LogLevel.h:23
MyGUI::LogLevel::Critical
@ Critical
Definition
MyGUI_LogLevel.h:25
MyGUI::LogLevel::parse
static LogLevel parse(const std::string &_value)
Definition
MyGUI_LogLevel.h:39
MyGUI::LogLevel::LogLevel
LogLevel(Enum _value)
Definition
MyGUI_LogLevel.h:34
Generated by
1.9.8