MyLang
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
source
parser
lib
ccc.hpp
Go to the documentation of this file.
1
#ifndef CCC_HPP
2
#define CCC_HPP
3
4
#include <iostream>
5
6
#if defined(__unix) || defined(__unix__) || defined(unix) ||\
7
defined(__linux) || defined(__linux__) || defined(linux) ||\
8
defined(__MACH__) || defined(BSD) || defined(__GNU__)
9
#define CCC_UNIX
10
#endif
11
12
#if defined(_WIN64) || defined(_WIN32) || defined(_WIN16) ||\
13
defined(__WIN64__) || defined(__WIN32__) || defined(__WIN16__) ||\
14
defined(WINDOWS) || defined(__WINDOWS__)
15
#define CCC_WINDOWS
16
#include <windows.h>
17
#endif
18
19
namespace
ccc {
20
21
enum
Style
{
22
// font
23
f_0
= 10,
24
f_1
,
25
f_2
,
26
f_3
,
27
f_4
,
28
f_5
,
29
f_6
,
30
f_7
,
31
f_8
,
32
f_9
,
33
34
// foreground color
35
cf_black
= 30,
36
cf_red
,
37
cf_green
,
38
cf_yellow
,
39
cf_blue
,
40
cf_magenta
,
41
cf_cyan
,
42
cf_white
,
43
44
// background color
45
cb_black
= 40,
46
cb_red
,
47
cb_green
,
48
cb_yellow
,
49
cb_blue
,
50
cb_magenta
,
51
cb_cyan
,
52
cb_white
,
53
54
// enable style
55
s_bold
= 1,
56
s_faint
= 2,
57
58
s_italic
= 3,
59
s_fraktur
= 20,
60
61
s_underline_single
= 4,
62
s_underline_double
= 21,
63
64
s_blink_slow
= 5,
65
s_blink_rapid
= 6,
66
67
s_framed
= 51,
68
s_encircled
= 52,
69
70
s_negative
= 7,
71
s_conceal
= 8,
72
s_delete
= 9,
73
s_overlined
= 53,
74
75
// disable style
76
d_all
= 0,
77
d_font
= 10,
78
d_color_f
= 39,
79
d_color_b
= 49,
80
81
d_intensity
= 22,
82
d_fontstyle
= 23,
83
d_underline
= 24,
84
d_blink
= 25,
85
d_border
= 54,
86
87
d_negative
= 27,
88
d_conceal
= 28,
89
d_delete
= 29,
90
d_overlined
= 55
91
};
92
93
static
std::ostream &
operator<<
(std::ostream &s,
const
Style
&style) {
94
#if defined(CCC_UNIX)
95
return
s <<
'\x1b'
<<
'['
<< (int) style <<
'm'
;
96
#elif defined(CCC_WINDOWS)
97
// not implemented
98
99
return
s;
100
#endif
101
}
102
103
template
<
class
T>
104
class
alsoStyle
{
105
public
:
106
const
T
_object
;
107
const
Style
_style
;
108
109
inline
alsoStyle
(
const
T &
object
,
const
Style
&style):
110
_object
(object),
_style
(style) {}
111
};
112
113
template
<
class
T>
114
static
const
alsoStyle<T>
operator+
(
const
T &
object
,
const
Style
&style) {
115
return
alsoStyle<T>
(object, style);
116
}
117
118
template
<
class
T>
119
inline
std::ostream &operator<<(std::ostream &s, const alsoStyle<T> &target) {
120
return
s << target.
_object
<< target._style;
121
}
122
123
}
124
125
#endif
ccc::f_0
Definition:
ccc.hpp:23
ccc::alsoStyle::_style
const Style _style
Definition:
ccc.hpp:107
ccc::d_all
Definition:
ccc.hpp:76
ccc::f_9
Definition:
ccc.hpp:32
ccc::cf_magenta
Definition:
ccc.hpp:40
ccc::s_framed
Definition:
ccc.hpp:67
ccc::d_intensity
Definition:
ccc.hpp:81
ccc::cb_red
Definition:
ccc.hpp:46
ccc::cf_cyan
Definition:
ccc.hpp:41
ccc::s_blink_rapid
Definition:
ccc.hpp:65
ccc::d_border
Definition:
ccc.hpp:85
ccc::s_fraktur
Definition:
ccc.hpp:59
ccc::s_delete
Definition:
ccc.hpp:72
ccc::d_overlined
Definition:
ccc.hpp:90
ccc::s_bold
Definition:
ccc.hpp:55
ccc::d_conceal
Definition:
ccc.hpp:88
ccc::f_1
Definition:
ccc.hpp:24
ccc::cb_magenta
Definition:
ccc.hpp:50
ccc::cf_red
Definition:
ccc.hpp:36
ccc::cb_green
Definition:
ccc.hpp:47
ccc::s_encircled
Definition:
ccc.hpp:68
ccc::s_blink_slow
Definition:
ccc.hpp:64
ccc::cb_cyan
Definition:
ccc.hpp:51
ccc::s_conceal
Definition:
ccc.hpp:71
ccc::d_color_b
Definition:
ccc.hpp:79
ccc::d_delete
Definition:
ccc.hpp:89
ccc::cf_blue
Definition:
ccc.hpp:39
ccc::s_underline_single
Definition:
ccc.hpp:61
ccc::operator+
static const alsoStyle< T > operator+(const T &object, const Style &style)
Definition:
ccc.hpp:114
ccc::cb_blue
Definition:
ccc.hpp:49
ccc::cf_black
Definition:
ccc.hpp:35
ccc::cf_white
Definition:
ccc.hpp:42
ccc::f_8
Definition:
ccc.hpp:31
ccc::f_7
Definition:
ccc.hpp:30
ccc::s_underline_double
Definition:
ccc.hpp:62
ccc::cb_yellow
Definition:
ccc.hpp:48
ccc::f_5
Definition:
ccc.hpp:28
ccc::s_italic
Definition:
ccc.hpp:58
ccc::f_3
Definition:
ccc.hpp:26
ccc::f_6
Definition:
ccc.hpp:29
ccc::d_fontstyle
Definition:
ccc.hpp:82
ccc::Style
Style
Definition:
ccc.hpp:21
ccc::d_blink
Definition:
ccc.hpp:84
ccc::cf_yellow
Definition:
ccc.hpp:38
ccc::d_underline
Definition:
ccc.hpp:83
ccc::cb_white
Definition:
ccc.hpp:52
ccc::s_faint
Definition:
ccc.hpp:56
ccc::alsoStyle
Definition:
ccc.hpp:104
ccc::s_negative
Definition:
ccc.hpp:70
ccc::operator<<
static std::ostream & operator<<(std::ostream &s, const Style &style)
Definition:
ccc.hpp:93
ccc::f_4
Definition:
ccc.hpp:27
ccc::d_negative
Definition:
ccc.hpp:87
ccc::f_2
Definition:
ccc.hpp:25
ccc::cb_black
Definition:
ccc.hpp:45
ccc::alsoStyle::alsoStyle
alsoStyle(const T &object, const Style &style)
Definition:
ccc.hpp:109
ccc::d_font
Definition:
ccc.hpp:77
ccc::s_overlined
Definition:
ccc.hpp:73
ccc::d_color_f
Definition:
ccc.hpp:78
ccc::alsoStyle::_object
const T _object
Definition:
ccc.hpp:106
ccc::cf_green
Definition:
ccc.hpp:37
Generated on Thu Nov 27 2014 16:32:26 for MyLang by
1.8.6