Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
_num_put.h
Go to the documentation of this file.
1
32#ifndef _RWSTD_LOC_NUM_PUT_H_INCLUDED
33#define _RWSTD_LOC_NUM_PUT_H_INCLUDED
34
35
36#if __GNUG__ >= 3
37# pragma GCC system_header
38#endif // gcc >= 3
39
40
41#include <streambuf>
42
43#include <rw/_ioiter.h>
44#include <loc/_facet.h>
45#include <loc/_numpunct.h>
46#include <rw/_defs.h>
47
48
50
51// 22.2.2.2
53template <class _CharT, class _OutputIter = ostreambuf_iterator<_CharT> >
54struct num_put: _RW::__rw_facet
55{
56 typedef _CharT char_type;
57 typedef _OutputIter iter_type;
58
59 explicit num_put (_RWSTD_SIZE_T __refs = 0)
60 : _RW::__rw_facet (__refs) { }
61
62 virtual ~num_put ();
63
64#ifndef _RWSTD_NO_BOOL
65
66 iter_type put (iter_type __it, ios_base& __flags, char_type __fill,
67 bool __val) const {
68 return do_put (__it, __flags, __fill, __val);
69 }
70
71#endif // _RWSTD_NO_BOOL
72
73 iter_type put (iter_type __it, ios_base &__flags, char_type __fill,
74 long __val) const {
75 return do_put (__it, __flags, __fill, __val);
76 }
77
78 iter_type put (iter_type __it, ios_base &__flags, char_type __fill,
79 unsigned long __val) const {
80 return do_put (__it, __flags, __fill, __val);
81 }
82
83 iter_type put (iter_type __it, ios_base &__flags, char_type __fill,
84 double __val) const {
85 return do_put (__it, __flags, __fill, __val);
86 }
87
88#ifndef _RWSTD_NO_LONG_DOUBLE
89
90 iter_type put (iter_type __it, ios_base &__flags, char_type __fill,
91 long double __val) const {
92 return do_put (__it, __flags, __fill, __val);
93 }
94
95#endif // _RWSTD_NO_LONG_DOUBLE
96
97 iter_type put (iter_type __it, ios_base &__flags, char_type __fill,
98 const void* __val) const {
99 return do_put (__it, __flags, __fill, __val);
100 }
101
102// prevent gcc warning: cast to pointer from integer of different size
103#define _TO_VOID(x) \
104 _RWSTD_REINTERPRET_CAST (const void*, _RWSTD_STATIC_CAST (_RWSTD_SIZE_T, x))
105
106#ifdef _RWSTD_LONG_LONG
107
108 // extensions
109 iter_type put (iter_type __it, ios_base &__flags, char_type __fill,
110 _RWSTD_LONG_LONG __val) const {
111 return do_put (__it, __flags, __fill, __val);
112 }
113
114 iter_type put (iter_type __it, ios_base &__flags, char_type __fill,
115 unsigned _RWSTD_LONG_LONG __val) const {
116 return do_put (__it, __flags, __fill, __val);
117 }
118
119#endif // _RWSTD_LONG_LONG
120
121 static _RW::__rw_facet_id id;
122
123protected:
124
125#ifndef _RWSTD_NO_BOOL
126
127 virtual iter_type
128 do_put (iter_type __it, ios_base &__flags, char_type __fill,
129 bool __val) const {
130 return _C_put (__it, __flags, __fill,
131 __flags.flags () & _RWSTD_IOS_BOOLALPHA
132 ? _C_bool : _C_int, _TO_VOID (__val));
133 }
134
135#endif // _RWSTD_NO_BOOL
136
137 virtual iter_type
138 do_put (iter_type __it, ios_base &__flags, char_type __fill,
139 long __val) const {
140 return _C_put (__it, __flags, __fill, _C_long, _TO_VOID (__val));
141 }
142
143 virtual iter_type
144 do_put (iter_type __it, ios_base &__flags, char_type __fill,
145 unsigned long __val) const {
146 return _C_put (__it, __flags, __fill, _C_ulong, _TO_VOID (__val));
147 }
148
149 virtual iter_type
150 do_put (iter_type __it, ios_base &__flags, char_type __fill,
151 double __val) const {
152 return _C_put (__it, __flags, __fill, _C_double | _C_ptr, &__val);
153 }
154
155#ifndef _RWSTD_NO_LONG_DOUBLE
156
157 virtual iter_type
158 do_put (iter_type __it, ios_base &__flags, char_type __fill,
159 long double __val) const {
160 return _C_put (__it, __flags, __fill, _C_ldouble | _C_ptr, &__val);
161 }
162
163#endif // _RWSTD_NO_LONG_DOUBLE
164
165 virtual iter_type
166 do_put (iter_type __it, ios_base &__flags, char_type __fill,
167 const void *__val) const {
168 return _C_put (__it, __flags, __fill, _C_pvoid, __val);
169 }
170
171#ifdef _RWSTD_LONG_LONG
172
173 // extensions
174 virtual iter_type
175 do_put (iter_type __it, ios_base &__flags, char_type __fill,
176 _RWSTD_LONG_LONG __val) const {
177 return _C_put (__it, __flags, __fill, _C_llong, &__val);
178 }
179
180 virtual iter_type
181 do_put (iter_type __it, ios_base &__flags, char_type __fill,
182 unsigned _RWSTD_LONG_LONG __val) const {
183 return _C_put (__it, __flags, __fill, _C_ullong, &__val);
184 }
185
186#endif // _RWSTD_LONG_LONG
187
188#undef _TO_VOID
189
190private:
191
192 iter_type _C_put (iter_type, ios_base&, char_type, int, const void*) const;
193};
194
195
196#ifndef _RWSTD_NO_SPECIALIZED_FACET_ID
197
199_RW::__rw_facet_id num_put<char, ostreambuf_iterator<char> >::id;
200
201# ifndef _RWSTD_NO_WCHAR_T
202
204_RW::__rw_facet_id num_put<wchar_t, ostreambuf_iterator<wchar_t> >::id;
205
206# endif // _RWSTD_NO_WCHAR_T
207#endif // _RWSTD_NO_SPECIALIZED_FACET_ID
208
209} // namespace std
210
211
212#if _RWSTD_DEFINE_TEMPLATE_FIRST (_NUM_PUT)
213# include <loc/_num_put.cc>
214#endif // _RWSTD_DEFINE_TEMPLATE_FIRST (_NUM_PUT)
215
216
217#ifdef _RWSTD_MSVC
218# pragma warning (push)
219# pragma warning (disable: 4231)
220#endif // _RWSTD_MSVC
221
222
224
225#if _RWSTD_INSTANTIATE (_NUM_PUT, _CHAR)
226
227_RWSTD_INSTANTIATE_1 (struct _RWSTD_TI_EXPORT num_put<char>);
228
229#endif // _RWSTD_INSTANTIATE (_NUM_PUT, _CHAR)
230
231#if _RWSTD_INSTANTIATE (_NUM_PUT, _WCHAR_T)
232
233_RWSTD_INSTANTIATE_1 (struct _RWSTD_TI_EXPORT num_put<wchar_t>);
234
235#endif // _RWSTD_INSTANTIATE (_NUM_PUT, _WCHAR_T)
236
237} // namespace std
238
239
240#ifdef _RWSTD_MSVC
241# pragma warning (pop)
242#endif // _RWSTD_MSVC
243
244
245#if _RWSTD_DEFINE_TEMPLATE_LAST (_NUM_PUT)
246# include <loc/_num_put.cc>
247#endif // _RWSTD_DEFINE_TEMPLATE_LAST (_NUM_PUT)
248
249
250#endif // _RWSTD_LOC_NUM_PUT_H_INCLUDED
#define _RWSTD_SPECIALIZED_CLASS
#define _RWSTD_LONG_LONG
#define _RWSTD_IOS_BOOLALPHA
Definition _defs.h:766
#define _RWSTD_INSTANTIATE_1(arg)
Definition _defs.h:1374
#define _RWSTD_NAMESPACE(name)
Definition _defs.h:567
#define _EXPORT
Definition _defs.h:498
#define _RWSTD_TI_EXPORT
Definition _defs.h:1331
#define _TO_VOID(x)
Definition json.h:5363