DCL
4.0
Loading...
Searching...
No Matches
Writer.h
Go to the documentation of this file.
1
#ifndef __DCL_WRITER_H__
2
#define __DCL_WRITER_H__ 20071008
3
4
#ifndef __DCL_OBJECT_H__
5
#include <
dcl/Object.h
>
6
#endif
7
#ifndef __DCL_EXCEPTION_H__
8
#include <
dcl/Exception.h
>
9
#endif
10
#ifndef __DCL_STRING_H__
11
#include <
dcl/String.h
>
12
#endif
13
#ifndef __DCL_OUTPUT_STREAM_H__
// for endl
14
#include <
dcl/OutputStream.h
>
15
#endif
16
#ifndef __DCL_NUMERIC_H__
17
#include <
dcl/Numeric.h
>
18
#endif
19
20
__DCL_BEGIN_NAMESPACE
21
30
class
DCLCAPI
Writer
:
public
Object
31
{
32
DECLARE_CLASSINFO
(
Writer
)
33
public
:
38
virtual
void
close()
39
__DCL_THROWS1
(
IOException
*);
40
45
virtual
void
flush()
46
__DCL_THROWS1
(
IOException
*);
47
59
virtual
Writer
& write(
const
wchar_t
* _buf,
size_t
_n)
60
__DCL_THROWS1
(
IOException
*) = 0;
61
71
virtual
int
vprintf(
const
wchar_t
* _format, va_list _arglist)
72
__DCL_THROWS1
(
IOException
*);
73
77
int
printf(
const
wchar_t
* _format, ...)
78
__DCL_THROWS1
(
IOException
*);
79
};
80
81
#if __DCL_DEBUG
82
static
const
wchar_t
* __pszWriter_h__ =
__T
(
"dcl/Writer.h"
);
83
#undef __THIS_FILE__
84
#define __THIS_FILE__ __pszWriter_h__
85
#endif
86
87
DCLCAPI
Writer
&
operator <<
(
Writer
& _writer,
const
__endl
&)
88
__DCL_THROWS1
(
IOException
*);
89
90
DCLCAPI
inline
Writer
&
operator <<
(
Writer
& _writer,
const
wchar_t
* _psz)
91
__DCL_THROWS1
(
IOException
*)
92
{
93
__DCL_ASSERT
(_psz !=
NULL
);
94
return
_writer.write(_psz, String::length(_psz));
95
}
96
97
DCLCAPI
inline
Writer
&
operator <<
(
Writer
& _writer,
const
String& _str)
98
__DCL_THROWS1
(
IOException
*)
99
{
100
return
_writer.write(_str.data(), _str.length());
101
}
102
103
DCLCAPI
inline
Writer
&
operator <<
(
Writer
& _writer,
const
StringBuilder& _sb)
104
__DCL_THROWS1
(
IOException
*)
105
{
106
return
_writer.write(_sb.data(), _sb.length());
107
}
108
109
DCLCAPI
inline
Writer
&
operator <<
(
Writer
& _writer,
const
Object
& _obj)
110
__DCL_THROWS1
(
IOException
*)
111
{
112
return
_writer << _obj.
toString
();
113
}
114
115
DCLCAPI
inline
Writer
&
operator <<
(
Writer
& _writer,
short
int
_n)
116
__DCL_THROWS1
(
IOException
*)
117
{
118
return
_writer << String::valueOf(_n);
119
}
120
121
DCLCAPI
inline
Writer
&
operator <<
(
Writer
& _writer,
unsigned
short
int
_n)
122
__DCL_THROWS1
(
IOException
*)
123
{
124
return
_writer << String::valueOf(_n);
125
}
126
127
DCLCAPI
inline
Writer
&
operator <<
(
Writer
& _writer,
int
_n)
128
__DCL_THROWS1
(
IOException
*)
129
{
130
return
_writer << String::valueOf(_n);
131
}
132
133
DCLCAPI
inline
Writer
&
operator <<
(
Writer
& _writer,
unsigned
int
_n)
134
__DCL_THROWS1
(
IOException
*)
135
{
136
return
_writer << String::valueOf(_n);
137
}
138
139
DCLCAPI
inline
Writer
&
operator <<
(
Writer
& _writer,
long
_n)
140
__DCL_THROWS1
(
IOException
*)
141
{
142
return
_writer << String::valueOf(_n);
143
}
144
145
DCLCAPI
inline
Writer
&
operator <<
(
Writer
& _writer,
unsigned
long
_n)
146
__DCL_THROWS1
(
IOException
*)
147
{
148
return
_writer << String::valueOf(_n);
149
}
150
151
DCLCAPI
inline
Writer
&
operator <<
(
Writer
& _writer,
long
long
_n)
152
__DCL_THROWS1
(
IOException
*)
153
{
154
return
_writer << String::valueOf(_n);
155
}
156
157
DCLCAPI
inline
Writer
&
operator <<
(
Writer
& _writer,
unsigned
long
long
_n)
158
__DCL_THROWS1
(
IOException
*)
159
{
160
return
_writer << String::valueOf(_n);
161
}
162
163
DCLCAPI
inline
Writer
&
operator <<
(
Writer
& _writer,
float
_n)
164
__DCL_THROWS1
(
IOException
*)
165
{
166
return
_writer << String::valueOf(_n);
167
}
168
169
DCLCAPI
inline
Writer
&
operator <<
(
Writer
& _writer,
double
_n)
170
__DCL_THROWS1
(
IOException
*)
171
{
172
return
_writer << String::valueOf(_n);
173
}
174
175
DCLCAPI
inline
Writer
&
operator <<
(
Writer
& _writer,
long
double
_n)
176
__DCL_THROWS1
(
IOException
*)
177
{
178
return
_writer << String::valueOf(_n);
179
}
180
181
#if __DCL_DEBUG
182
#undef __THIS_FILE__
183
#define __THIS_FILE__ __T(__FILE__)
184
#endif
185
186
__DCL_END_NAMESPACE
187
188
#endif
// __DCL_WRITER_H__
NULL
#define NULL
Definition
Config.h:340
DCLCAPI
#define DCLCAPI
Definition
Config.h:100
__DCL_THROWS1
#define __DCL_THROWS1(e)
Definition
Config.h:167
Exception.h
Numeric.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
OutputStream.h
String.h
operator<<
DCLCAPI Writer & operator<<(Writer &_writer, const __endl &) __DCL_THROWS1(IOException *)
Definition
Writer.cpp:52
IOException
Definition
Exception.h:93
Object
Definition
Object.h:118
Object::Object
Object()
Definition
Object.cpp:183
Object::toString
virtual String toString() const
Definition
Object.cpp:187
Writer
Definition
Writer.h:31
__endl
Definition
OutputStream.h:82
include
dcl
Writer.h
Generated by
1.14.0