OOStuBS - Technische Informatik II (TI-II)
2.4
Hauptseite
Zusätzliche Informationen
Klassen
Dateien
Auflistung der Dateien
Datei-Elemente
include
common
o_stream.h
gehe zur Dokumentation dieser Datei
1
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
2
* Technische Informatik II *
3
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
4
* *
5
* O _ S T R E A M *
6
* *
7
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
8
9
#ifndef __o_stream_include__
10
#define __o_stream_include__
11
12
/* INCLUDES */
13
#include "
common/strbuf.h
"
14
15
/* CLASSES */
16
26
enum
Colors
{
27
BLACK
,
BLUE
,
GREEN
,
CYAN
,
RED
,
MAGENTA
,
BROWN
,
LIGHTGREY
,
28
DARKGREY
,
LIGHTBLUE
,
LIGHTGREEN
,
LIGHTCYAN
,
LIGHTRED
,
LIGHTMAGENTA
,
YELLOW
,
WHITE
29
};
30
38
class
FGColor
{
39
public
:
43
Colors
color
;
48
FGColor
(
Colors
color
) : color(color){}
49
};
50
58
class
BGColor
{
59
public
:
63
Colors
color
;
68
BGColor
(
Colors
color
) : color(color){}
69
};
70
78
class
Blink
{
79
public
:
83
bool
blink
;
88
Blink
(
bool
blink
) : blink(blink){}
89
};
90
91
102
class
O_Stream
:
public
Stringbuffer
{
103
protected
:
106
int
fgColor
;
109
int
bgColor
;
112
bool
blink
;
113
147
virtual
void
setAttributes
(
int
fgColor
,
int
bgColor
,
bool
blink
) = 0;
148
149
public
:
150
154
enum
Base
{
155
bin
=2,
156
oct
=8,
157
dec
=10,
158
hex
=16
159
};
160
164
Base
base
;
165
169
O_Stream
();
170
174
virtual
~O_Stream
();
175
187
O_Stream
&
operator <<
(
char
value);
188
190
O_Stream
&
operator <<
(
unsigned
char
value);
191
193
O_Stream
&
operator <<
(
char
* value);
194
196
O_Stream
&
operator <<
(
const
char
* value);
197
199
O_Stream
&
operator <<
(
unsigned
short
value);
200
202
O_Stream
&
operator <<
(
short
value);
203
205
O_Stream
&
operator <<
(
unsigned
int
value);
206
208
O_Stream
&
operator <<
(
int
value);
209
211
O_Stream
&
operator <<
(
unsigned
long
value);
212
214
O_Stream
&
operator <<
(
long
value);
215
217
O_Stream
&
operator <<
(
void
* value);
218
226
O_Stream
&
operator <<
(
FGColor
fgColor
);
227
235
O_Stream
&
operator <<
(
BGColor
bgColor
);
236
244
O_Stream
&
operator <<
(
Blink
blink
);
245
255
O_Stream
&
operator <<
(
O_Stream
& (*f) (
O_Stream
&));
256
257
/* declaration for manipulator functions */
258
friend
O_Stream
&
endl
(
O_Stream
&);
259
friend
O_Stream
&
bin
(
O_Stream
&);
260
friend
O_Stream
&
oct
(
O_Stream
&);
261
friend
O_Stream
&
dec
(
O_Stream
&);
262
friend
O_Stream
&
hex
(
O_Stream
&);
263
};
264
265
266
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
267
* M A N I P U L A T O R E N *
268
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
269
270
/*
271
* The following methods receive and return a referenz to the current O_Stream
272
* object. Class O_Stream defines an operator that can be used to call this so
273
* called manipulators. It is eveen possible to embedd the output of the method
274
* into the input of the stream.
275
* Main goal of the manipulators is to influence the display of the following
276
* output (eg. by choosing a basis for the display of digits).
277
*/
278
280
O_Stream
&
endl
(
O_Stream
&out);
281
283
O_Stream
&
bin
(
O_Stream
&out);
284
286
O_Stream
&
oct
(
O_Stream
&out);
287
289
O_Stream
&
dec
(
O_Stream
&out);
290
292
O_Stream
&
hex
(
O_Stream
&out);
293
294
#endif
Erzeugt am Mon Jun 30 2014 07:13:28 für OOStuBS - Technische Informatik II (TI-II) von
1.8.1.2