DCL
3.7.4
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
extern
DCLCVAR
const
struct
__endl
endl
;
88
89
#if __DCL_HAVE_THIS_FILE__
90
#undef __THIS_FILE__
91
static
const
char_t
* __pszOutputStream_h__ =
__T
(
"dcl/OutputStream.h"
);
92
#define __THIS_FILE__ __pszOutputStream_h__
93
#endif
94
95
DCLCAPI
OutputStream
&
operator <<
(
OutputStream
& out,
const
__endl
&)
96
__DCL_THROWS1
(
IOException
*);
97
98
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
const
char
* _psz)
99
__DCL_THROWS1
(
IOException
*)
100
{
101
__DCL_ASSERT
(_psz !=
NULL
);
102
return
_out.write(_psz, ByteString::length(_psz));
103
}
104
105
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
const
ByteString& _str)
106
__DCL_THROWS1
(
IOException
*)
107
{
108
return
_out.write(_str.data(), _str.length());
109
}
110
111
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
const
ByteStringBuilder& _sb)
112
__DCL_THROWS1
(
IOException
*)
113
{
114
return
_out.write(_sb.data(), _sb.length());
115
}
116
117
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
char
_ch)
118
__DCL_THROWS1
(
IOException
*)
119
{
120
return
_out.write(&_ch,
sizeof
(
char
));
121
}
122
123
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
unsigned
char
_ch)
124
__DCL_THROWS1
(
IOException
*)
125
{
126
return
_out.write(&_ch,
sizeof
(
unsigned
char
));
127
}
128
129
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
short
int
_n)
130
__DCL_THROWS1
(
IOException
*)
131
{
132
return
_out.write(&_n,
sizeof
(_n));
133
}
134
135
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
unsigned
short
int
_n)
136
__DCL_THROWS1
(
IOException
*)
137
{
138
return
_out.write(&_n,
sizeof
(_n));
139
}
140
141
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
int
_n)
142
__DCL_THROWS1
(
IOException
*)
143
{
144
return
_out.write(&_n,
sizeof
(_n));
145
}
146
147
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
unsigned
int
_n)
148
__DCL_THROWS1
(
IOException
*)
149
{
150
return
_out.write(&_n,
sizeof
(_n));
151
}
152
153
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
long
_n)
154
__DCL_THROWS1
(
IOException
*)
155
{
156
return
_out.write(&_n,
sizeof
(_n));
157
}
158
159
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
unsigned
long
_n)
160
__DCL_THROWS1
(
IOException
*)
161
{
162
return
_out.write(&_n,
sizeof
(_n));
163
}
164
165
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
long
long
_n)
166
__DCL_THROWS1
(
IOException
*)
167
{
168
return
_out.write(&_n,
sizeof
(_n));
169
}
170
171
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
unsigned
long
long
_n)
172
__DCL_THROWS1
(
IOException
*)
173
{
174
return
_out.write(&_n,
sizeof
(_n));
175
}
176
177
#if 0
178
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out, int32_t _n)
179
__DCL_THROWS1
(
IOException
*)
180
{
181
return
_out.write(&_n,
sizeof
(_n));
182
}
183
184
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out, uint32_t _n)
185
__DCL_THROWS1
(
IOException
*)
186
{
187
return
_out.write(&_n,
sizeof
(_n));
188
}
189
190
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out, int64_t _n)
191
__DCL_THROWS1
(
IOException
*)
192
{
193
return
_out.write(&_n,
sizeof
(_n));
194
}
195
196
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out, uint64_t _n)
197
__DCL_THROWS1
(
IOException
*)
198
{
199
return
_out.write(&_n,
sizeof
(_n));
200
}
201
#endif
202
203
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
float
_n)
204
__DCL_THROWS1
(
IOException
*)
205
{
206
return
_out.write(&_n,
sizeof
(_n));
207
}
208
209
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
double
_n)
210
__DCL_THROWS1
(
IOException
*)
211
{
212
return
_out.write(&_n,
sizeof
(_n));
213
}
214
215
DCLCAPI
inline
OutputStream
&
operator <<
(
OutputStream
& _out,
long
double
_n)
216
__DCL_THROWS1
(
IOException
*)
217
{
218
return
_out.write(&_n,
sizeof
(_n));
219
}
220
221
#if __DCL_HAVE_THIS_FILE__
222
#undef __THIS_FILE__
223
#define __THIS_FILE__ __T(__FILE__)
224
#endif
225
226
__DCL_END_NAMESPACE
227
228
#endif
// __DCL_OUTPUT_STREAM_H__
NULL
#define NULL
Definition
Config.h:312
DCLCVAR
#define DCLCVAR
Definition
Config.h:96
DCLCAPI
#define DCLCAPI
Definition
Config.h:95
char_t
wchar_t char_t
Definition
Config.h:247
__DCL_THROWS1
#define __DCL_THROWS1(e)
Definition
Config.h:152
Exception.h
Object.h
DECLARE_CLASSINFO
#define DECLARE_CLASSINFO(class_name)
Definition
Object.h:227
__DCL_ASSERT
#define __DCL_ASSERT(expr)
Definition
Object.h:394
__T
#define __T(str)
Definition
Object.h:60
operator<<
DCLCAPI OutputStream & operator<<(OutputStream &out, const __endl &) __DCL_THROWS1(IOException *)
Definition
OutputStream.cpp:58
endl
DCLCVAR const struct __endl endl
Definition
OutputStream.cpp:66
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