38 const void*,
const char*);
41__rw_put_groups (
char **, _RWSTD_SIZE_T, _RWSTD_SIZE_T,
42 const char*,
const char*);
50template <
class _CharT,
class _OutputIter>
51_RW::__rw_facet_id money_put<_CharT, _OutputIter>::id;
56template <
class _CharT,
class _OutputIter>
57 money_put<_CharT, _OutputIter>::
64template <
class _CharT,
class _OutputIter>
65 typename money_put<_CharT, _OutputIter>::iter_type
66money_put<_CharT, _OutputIter>::
67_C_put (iter_type __it,
int __opts, ios_base &__flags, char_type __fill,
68 const char_type *__s, _RWSTD_SIZE_T __n,
int __fd,
69 const char *__groups, _RWSTD_SIZE_T __ngroups)
const
74 const bool __intl = 0 != (__opts & _C_intl);
75 const bool __num = 0 != (__opts & _C_ldbl);
77 typedef moneypunct<_CharT, false> _Punct0;
78 typedef moneypunct<_CharT, true> _Punct1;
80 const _Punct0* __pun0;
81 const _Punct1* __pun1;
99 const ctype<_CharT> &__ctp =
102 const char __signchar = __ctp.narrow (*__s,
'\0');
104 money_base::pattern __fmat;
107 if (
'-' == __signchar) {
109 __fmat = __pun1->neg_format ();
110 __sign = __pun1->negative_sign ();
113 __fmat = __pun0->neg_format ();
114 __sign = __pun0->negative_sign ();
121 __fmat = __pun1->pos_format ();
122 __sign = __pun1->positive_sign ();
125 __fmat = __pun0->pos_format ();
126 __sign = __pun0->positive_sign ();
128 if (
'+' == __signchar) {
136 __intl ? __pun1->curr_symbol () : __pun0->curr_symbol ()
140 long __dint = long (__n - __fd);
148 __flags.width () - __curr.size () - __sign.size ()
149 - !__dint - !!__fd - (__dint > 0 ? __dint : -__dint) - __fd
150 - ( money_base::space == __fmat.field [1]
151 || money_base::space == __fmat.field [2])
158 for (; __pad > 0; --__pad, ++__it)
162 for (_RWSTD_SIZE_T __i = 0, __j; __i !=
sizeof __fmat; ++__i) {
164 switch (__fmat.field [__i]) {
166 case money_base::symbol:
167 for (__j = 0; __j != __curr.size (); ++__j, ++__it)
168 *__it = __curr [__j];
171 case money_base::sign:
172 if (__sign.size ()) {
179 case money_base::space:
189 *__it = __ctp.widen (
' ');
192 case money_base::none:
200 &&
sizeof __fmat != __i - 1)
201 for (; __pad > 0; --__pad, ++__it)
206 case money_base::value: {
208 if (__dint < 0 || 0 == __dint && __fd > 0) {
209 const char_type __zero = __ctp.widen (
'0');
216 __pun1->decimal_point () : __pun0->decimal_point ();
220 for (; __dint++; ++__it)
227 _RWSTD_SIZE_T __grplen = 0;
229 for (
const char_type *__e = __s + __n; __s != __e; ++__it, ++__s) {
231 if (!__num && !__ctp.is (ctype_base::digit, *__s))
234 typedef unsigned char _UChar;
240 if (*__groups && __grplen == _UChar (*__groups)) {
241 *__it = __intl ? __pun1->thousands_sep ()
242 : __pun0->thousands_sep ();
248 else if (0 == __dint) {
249 *__it = __intl ? __pun1->decimal_point ()
250 : __pun0->decimal_point ();
263 *__it = __intl ? __pun1->decimal_point ()
264 : __pun0->decimal_point ();
268 *__it = __intl ? __pun1->thousands_sep ()
269 : __pun0->thousands_sep ();
272 default: *__it = *__s;
282 for (_RWSTD_SIZE_T __k = 1; __k < __sign.size (); ++__k, ++__it)
283 *__it = __sign [__k];
286 for (; __pad > 0; --__pad, ++__it)
296template <
class _CharT,
class _OutputIter>
297 typename money_put<_CharT, _OutputIter>::iter_type
298money_put<_CharT, _OutputIter>::
299do_put (iter_type __i,
bool __intl, ios_base &__flags, char_type __fill,
300 long double __val)
const
306 typedef moneypunct<_CharT, true> _Punct;
309 __fd = __pun.frac_digits ();
310 __grouping = __pun.grouping ();
313 typedef moneypunct<_CharT, false> _Punct;
316 __fd = __pun.frac_digits ();
317 __grouping = __pun.grouping ();
321 char_type __wbuf [
sizeof __buf];
323 char *__pbuf = __buf;
327 const _RWSTD_SIZE_T __n =
331 &__val, __grouping.c_str ());
334 const ctype<_CharT> &__ctp =
337 __ctp.widen (__buf, __buf + __n, __wbuf);
341 return _C_put (__i, (__intl ? _C_intl : 0) | _C_ldbl,
342 __flags, __fill, __wbuf, __n, 0,
"", 1);
346template <
class _CharT,
class _OutputIter>
347 typename money_put<_CharT, _OutputIter>::iter_type
348money_put<_CharT, _OutputIter>::
349do_put (iter_type __i,
bool __intl, ios_base &__flags, char_type __fill,
350 const string_type &__str)
const
358 typedef moneypunct<_CharT, true> _Punct;
362 __fd = __pun.frac_digits ();
363 __grouping = __pun.grouping ();
366 typedef moneypunct<_CharT, false> _Punct;
370 __fd = __pun.frac_digits ();
371 __grouping = __pun.grouping ();
374 _RWSTD_SIZE_T __ngroups = 1;
375 _RWSTD_SIZE_T __strdigs = 0;
377 typedef string::traits_type _Traits;
378 typedef typename string_type::const_iterator _StringIter;
381 static char __nul =
'\0';
382 char *__groups = __grouping.size () ? __buf : &__nul;
384 const ctype<_CharT> &__ctp =
388 for (_StringIter __it = __str.begin (); __it != __str.end (); ++__it) {
389 if (__ctp.is (ctype_base::digit, *__it)) {
390 if (__groups != &__nul)
391 _Traits::assign (*__groups++, __ctp.narrow (*__it,
'\0'));
393 else if (__str.begin () != __it ||
'-' != __ctp.narrow (*__it,
'\0'))
398 if (__groups != &__nul && __fd >= 0 && __fd < __groups - __buf) {
406 char *__pbuf = __buf;
411 _RW::__rw_put_groups (&__pbuf, __groups - __pbuf,
sizeof __buf,
412 0, __grouping.c_str ());
413 __pbuf [__ngroups] =
'\0';
417 return _C_put (__i, __intl ? _C_intl : 0,
418 __flags, __fill, __str.c_str (), __strdigs,
419 __fd, __groups, __ngroups);
#define _RWSTD_IOS_ADJUSTFIELD
#define _RWSTD_REQUIRES(pred, args)
#define _RWSTD_USE_FACET(type, arg)
#define _RWSTD_STATIC_CAST(T, x)
#define _RWSTD_NAMESPACE(name)
#define _RWSTD_STREAMSIZE
#define _RWSTD_IOS_SHOWBASE
#define _RWSTD_FUNC(ignore)
#define _RWSTD_ASSERT(ignore)
#define _RWSTD_IOS_INTERNAL
#define _RWSTD_ERROR_RUNTIME_ERROR