DCL
4.0
Loading...
Searching...
No Matches
OutputStream.h
Go to the documentation of this file.
1
#ifndef __DCL_OUTPUT_STREAM_H__
2
#define __DCL_OUTPUT_STREAM_H__ 20071009
3
4
#ifndef __DCL_INCLUDED_STDARG_H
5
#include <stdarg.h>
6
#define __DCL_INCLUDED_STDARG_H
7
#endif
8
9
#ifndef __DCL_OBJECT_H__
10
#include <
dcl/Object.h
>
11
#endif
12
#ifndef __DCL_EXCEPTION_H__
13
#include <
dcl/Exception.h
>
14
#endif
15
#ifndef __DCL_STRING_H__
16
#include <
dcl/String.h
>
17
#endif
18
19
__DCL_BEGIN_NAMESPACE
20
30
class
DCLCAPI
OutputStream
:
public
Object
31
{
32
DECLARE_CLASSINFO
(
OutputStream
)
33
public
:
38
virtual
void
close()
39
__DCL_THROWS1
(
IOException
*);
40
45
virtual
void
flush()
46
__DCL_THROWS1
(
IOException
*);
47
59
virtual
OutputStream
& write(
const
void
* _buf,
size_t
_n)
60
__DCL_THROWS1
(
IOException
*) = 0;
61
71
virtual
int
vprintf(
const
char
* _format, va_list _arglist)
72
__DCL_THROWS1
(
IOException
*);
73
77
int
printf(
const
char
* _format, ...)
78
__DCL_THROWS1
(
IOException
*);
79
};
80
81
struct
DCLCAPI
__endl
82
{
83
char
__dummy
;
84
__endl
() { }
85
};
86
87
#if defined(__GNUC__) || defined(_WIN64)
88
extern
DCLCVAR
const
struct
__endl
endl
;
89
#else
90
DCLCAPI
const
struct
__endl
endl
();
91
#define endl endl()
92
#endif
93
94
#if __DCL_DEBUG
95
static
const
char_t
* __pszOutputStream_h__ =
__T
(
"dcl/OutputStream.h"
);
96
#undef __THIS_FILE__
97
#define __THIS_FILE__ __pszOutputStream_h__
98
#endif
99
100
DCLCAPI
OutputStream
&
operator <<
(
OutputStream
& out,
const
__endl
&)
101
__DCL_THROWS1
(
IOException
*);
102
103
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
const
char
* _psz)
104
__DCL_THROWS1
(
IOException
*)
105
{
106
__DCL_ASSERT
(_psz !=
NULL
);
107
return
_out.write(_psz, ByteString::length(_psz));
108
}
109
110
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
const
ByteString& _str)
111
__DCL_THROWS1
(
IOException
*)
112
{
113
return
_out.write(_str.data(), _str.length());
114
}
115
116
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
const
ByteStringBuilder& _sb)
117
__DCL_THROWS1
(
IOException
*)
118
{
119
return
_out.write(_sb.data(), _sb.length());
120
}
121
122
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
char
_ch)
123
__DCL_THROWS1
(
IOException
*)
124
{
125
return
_out.write(&_ch,
sizeof
(
char
));
126
}
127
128
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
unsigned
char
_ch)
129
__DCL_THROWS1
(
IOException
*)
130
{
131
return
_out.write(&_ch,
sizeof
(
unsigned
char
));
132
}
133
134
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
short
int
_n)
135
__DCL_THROWS1
(
IOException
*)
136
{
137
return
_out.write(&_n,
sizeof
(_n));
138
}
139
140
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
unsigned
short
int
_n)
141
__DCL_THROWS1
(
IOException
*)
142
{
143
return
_out.write(&_n,
sizeof
(_n));
144
}
145
146
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
int
_n)
147
__DCL_THROWS1
(
IOException
*)
148
{
149
return
_out.write(&_n,
sizeof
(_n));
150
}
151
152
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
unsigned
int
_n)
153
__DCL_THROWS1
(
IOException
*)
154
{
155
return
_out.write(&_n,
sizeof
(_n));
156
}
157
158
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
long
_n)
159
__DCL_THROWS1
(
IOException
*)
160
{
161
return
_out.write(&_n,
sizeof
(_n));
162
}
163
164
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
unsigned
long
_n)
165
__DCL_THROWS1
(
IOException
*)
166
{
167
return
_out.write(&_n,
sizeof
(_n));
168
}
169
170
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
long
long
_n)
171
__DCL_THROWS1
(
IOException
*)
172
{
173
return
_out.write(&_n,
sizeof
(_n));
174
}
175
176
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
unsigned
long
long
_n)
177
__DCL_THROWS1
(
IOException
*)
178
{
179
return
_out.write(&_n,
sizeof
(_n));
180
}
181
182
#if 0
183
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out, int32_t _n)
184
__DCL_THROWS1
(
IOException
*)
185
{
186
return
_out.write(&_n,
sizeof
(_n));
187
}
188
189
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out, uint32_t _n)
190
__DCL_THROWS1
(
IOException
*)
191
{
192
return
_out.write(&_n,
sizeof
(_n));
193
}
194
195
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out, int64_t _n)
196
__DCL_THROWS1
(
IOException
*)
197
{
198
return
_out.write(&_n,
sizeof
(_n));
199
}
200
201
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out, uint64_t _n)
202
__DCL_THROWS1
(
IOException
*)
203
{
204
return
_out.write(&_n,
sizeof
(_n));
205
}
206
#endif
207
208
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
float
_n)
209
__DCL_THROWS1
(
IOException
*)
210
{
211
return
_out.write(&_n,
sizeof
(_n));
212
}
213
214
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
double
_n)
215
__DCL_THROWS1
(
IOException
*)
216
{
217
return
_out.write(&_n,
sizeof
(_n));
218
}
219
220
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
long
double
_n)
221
__DCL_THROWS1
(
IOException
*)
222
{
223
return
_out.write(&_n,
sizeof
(_n));
224
}
225
226
__DCL_END_NAMESPACE
227
228
#endif
// __DCL_OUTPUT_STREAM_H__
NULL
#define NULL
Definition
Config.h:340
DCLCVAR
#define DCLCVAR
Definition
Config.h:101
DCLCAPI
#define DCLCAPI
Definition
Config.h:100
char_t
wchar_t char_t
Definition
Config.h:275
__DCL_THROWS1
#define __DCL_THROWS1(e)
Definition
Config.h:167
Exception.h
Object.h
DECLARE_CLASSINFO
#define DECLARE_CLASSINFO(class_name)
Definition
Object.h:210
__DCL_ASSERT
#define __DCL_ASSERT(expr)
Definition
Object.h:371
__T
#define __T(str)
Definition
Object.h:44
operator<<
DCLCAPI OutputStream & operator<<(OutputStream &out, const __endl &) __DCL_THROWS1(IOException *)
Definition
OutputStream.cpp:56
endl
#define endl
Definition
OutputStream.h:91
String.h
IOException
Definition
Exception.h:93
Object::Object
Object()
Definition
Object.cpp:183
OutputStream
Definition
OutputStream.h:31
__endl
Definition
OutputStream.h:82
__endl::__dummy
char __dummy
Definition
OutputStream.h:83
__endl::__endl
__endl()
Definition
OutputStream.h:84
include
dcl
OutputStream.h
Generated by
1.14.0