37 _GLIBCXX_BEGIN_NAMESPACE_VERSION
41 template<
typename _Facet>
45 operator() (
const locale& __loc)
const;
49 template<
typename _CharT>
50 struct __use_cache<__numpunct_cache<_CharT> >
52 const __numpunct_cache<_CharT>*
53 operator() (
const locale& __loc)
const
56 const locale::facet** __caches = __loc._M_impl->_M_caches;
59 __numpunct_cache<_CharT>* __tmp = 0;
62 __tmp =
new __numpunct_cache<_CharT>;
63 __tmp->_M_cache(__loc);
70 __loc._M_impl->_M_install_cache(__tmp, __i);
72 return static_cast<const __numpunct_cache<_CharT>*
>(__caches[__i]);
76 template<
typename _CharT>
78 __numpunct_cache<_CharT>::_M_cache(
const locale& __loc)
82 const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc);
85 _CharT* __truename = 0;
86 _CharT* __falsename = 0;
89 _M_grouping_size = __np.grouping().size();
90 __grouping =
new char[_M_grouping_size];
91 __np.grouping().copy(__grouping, _M_grouping_size);
92 _M_grouping = __grouping;
93 _M_use_grouping = (_M_grouping_size
94 &&
static_cast<signed char>(_M_grouping[0]) > 0
96 != __gnu_cxx::__numeric_traits<char>::__max));
98 _M_truename_size = __np.truename().size();
99 __truename =
new _CharT[_M_truename_size];
100 __np.truename().copy(__truename, _M_truename_size);
101 _M_truename = __truename;
103 _M_falsename_size = __np.falsename().size();
104 __falsename =
new _CharT[_M_falsename_size];
105 __np.falsename().copy(__falsename, _M_falsename_size);
106 _M_falsename = __falsename;
108 _M_decimal_point = __np.decimal_point();
109 _M_thousands_sep = __np.thousands_sep();
111 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__loc);
112 __ct.widen(__num_base::_S_atoms_out,
113 __num_base::_S_atoms_out
114 + __num_base::_S_oend, _M_atoms_out);
115 __ct.widen(__num_base::_S_atoms_in,
116 __num_base::_S_atoms_in
117 + __num_base::_S_iend, _M_atoms_in);
121 delete [] __grouping;
122 delete [] __truename;
123 delete [] __falsename;
137 __verify_grouping(
const char* __grouping,
size_t __grouping_size,
138 const string& __grouping_tmp)
throw ();
140 _GLIBCXX_BEGIN_NAMESPACE_LDBL
142 template<
typename _CharT,
typename _InIter>
144 num_get<_CharT, _InIter>::
145 _M_extract_float(_InIter __beg, _InIter __end, ios_base& __io,
146 ios_base::iostate& __err,
string& __xtrc)
const
148 typedef char_traits<_CharT> __traits_type;
149 typedef __numpunct_cache<_CharT> __cache_type;
150 __use_cache<__cache_type> __uc;
151 const locale& __loc = __io._M_getloc();
152 const __cache_type* __lc = __uc(__loc);
153 const _CharT* __lit = __lc->_M_atoms_in;
154 char_type __c = char_type();
157 bool __testeof = __beg == __end;
163 const bool __plus = __c == __lit[__num_base::_S_iplus];
164 if ((__plus || __c == __lit[__num_base::_S_iminus])
165 && !(__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
166 && !(__c == __lc->_M_decimal_point))
168 __xtrc += __plus ?
'+' :
'-';
169 if (++__beg != __end)
177 bool __found_mantissa =
false;
181 if ((__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
182 || __c == __lc->_M_decimal_point)
184 else if (__c == __lit[__num_base::_S_izero])
186 if (!__found_mantissa)
189 __found_mantissa =
true;
193 if (++__beg != __end)
203 bool __found_dec =
false;
204 bool __found_sci =
false;
205 string __found_grouping;
206 if (__lc->_M_use_grouping)
207 __found_grouping.reserve(32);
208 const char_type* __lit_zero = __lit + __num_base::_S_izero;
210 if (!__lc->_M_allocated)
214 const int __digit = _M_find(__lit_zero, 10, __c);
217 __xtrc +=
'0' + __digit;
218 __found_mantissa =
true;
220 else if (__c == __lc->_M_decimal_point
221 && !__found_dec && !__found_sci)
226 else if ((__c == __lit[__num_base::_S_ie]
227 || __c == __lit[__num_base::_S_iE])
228 && !__found_sci && __found_mantissa)
235 if (++__beg != __end)
238 const bool __plus = __c == __lit[__num_base::_S_iplus];
239 if (__plus || __c == __lit[__num_base::_S_iminus])
240 __xtrc += __plus ?
'+' :
'-';
253 if (++__beg != __end)
263 if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
265 if (!__found_dec && !__found_sci)
271 __found_grouping +=
static_cast<char>(__sep_pos);
285 else if (__c == __lc->_M_decimal_point)
287 if (!__found_dec && !__found_sci)
292 if (__found_grouping.size())
293 __found_grouping += static_cast<char>(__sep_pos);
302 const char_type* __q =
303 __traits_type::find(__lit_zero, 10, __c);
306 __xtrc +=
'0' + (__q - __lit_zero);
307 __found_mantissa =
true;
310 else if ((__c == __lit[__num_base::_S_ie]
311 || __c == __lit[__num_base::_S_iE])
312 && !__found_sci && __found_mantissa)
315 if (__found_grouping.size() && !__found_dec)
316 __found_grouping += static_cast<char>(__sep_pos);
321 if (++__beg != __end)
324 const bool __plus = __c == __lit[__num_base::_S_iplus];
325 if ((__plus || __c == __lit[__num_base::_S_iminus])
326 && !(__lc->_M_use_grouping
327 && __c == __lc->_M_thousands_sep)
328 && !(__c == __lc->_M_decimal_point))
329 __xtrc += __plus ?
'+' :
'-';
343 if (++__beg != __end)
351 if (__found_grouping.size())
354 if (!__found_dec && !__found_sci)
355 __found_grouping +=
static_cast<char>(__sep_pos);
357 if (!std::__verify_grouping(__lc->_M_grouping,
358 __lc->_M_grouping_size,
360 __err = ios_base::failbit;
366 template<
typename _CharT,
typename _InIter>
367 template<
typename _ValueT>
369 num_get<_CharT, _InIter>::
370 _M_extract_int(_InIter __beg, _InIter __end, ios_base& __io,
371 ios_base::iostate& __err, _ValueT& __v)
const
373 typedef char_traits<_CharT> __traits_type;
374 using __gnu_cxx::__add_unsigned;
375 typedef typename __add_unsigned<_ValueT>::__type __unsigned_type;
376 typedef __numpunct_cache<_CharT> __cache_type;
377 __use_cache<__cache_type> __uc;
378 const locale& __loc = __io._M_getloc();
379 const __cache_type* __lc = __uc(__loc);
380 const _CharT* __lit = __lc->_M_atoms_in;
381 char_type __c = char_type();
384 const ios_base::fmtflags __basefield = __io.flags()
385 & ios_base::basefield;
386 const bool __oct = __basefield == ios_base::oct;
387 int __base = __oct ? 8 : (__basefield == ios_base::hex ? 16 : 10);
390 bool __testeof = __beg == __end;
393 bool __negative =
false;
397 __negative = __c == __lit[__num_base::_S_iminus];
398 if ((__negative || __c == __lit[__num_base::_S_iplus])
399 && !(__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
400 && !(__c == __lc->_M_decimal_point))
402 if (++__beg != __end)
411 bool __found_zero =
false;
415 if ((__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
416 || __c == __lc->_M_decimal_point)
418 else if (__c == __lit[__num_base::_S_izero]
419 && (!__found_zero || __base == 10))
423 if (__basefield == 0)
428 else if (__found_zero
429 && (__c == __lit[__num_base::_S_ix]
430 || __c == __lit[__num_base::_S_iX]))
432 if (__basefield == 0)
436 __found_zero =
false;
445 if (++__beg != __end)
457 const size_t __len = (__base == 16 ? __num_base::_S_iend
458 - __num_base::_S_izero :
__base);
461 string __found_grouping;
462 if (__lc->_M_use_grouping)
463 __found_grouping.reserve(32);
464 bool __testfail =
false;
465 bool __testoverflow =
false;
466 const __unsigned_type __max =
467 (__negative && __gnu_cxx::__numeric_traits<_ValueT>::__is_signed)
468 ? -__gnu_cxx::__numeric_traits<_ValueT>::__min
469 : __gnu_cxx::__numeric_traits<_ValueT>::__max;
470 const __unsigned_type __smax = __max /
__base;
471 __unsigned_type __result = 0;
473 const char_type* __lit_zero = __lit + __num_base::_S_izero;
475 if (!__lc->_M_allocated)
479 __digit = _M_find(__lit_zero, __len, __c);
483 if (__result > __smax)
484 __testoverflow =
true;
488 __testoverflow |= __result > __max - __digit;
493 if (++__beg != __end)
503 if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
509 __found_grouping +=
static_cast<char>(__sep_pos);
518 else if (__c == __lc->_M_decimal_point)
522 const char_type* __q =
523 __traits_type::find(__lit_zero, __len, __c);
527 __digit = __q - __lit_zero;
530 if (__result > __smax)
531 __testoverflow =
true;
535 __testoverflow |= __result > __max - __digit;
541 if (++__beg != __end)
549 if (__found_grouping.size())
552 __found_grouping +=
static_cast<char>(__sep_pos);
554 if (!std::__verify_grouping(__lc->_M_grouping,
555 __lc->_M_grouping_size,
557 __err = ios_base::failbit;
562 if ((!__sep_pos && !__found_zero && !__found_grouping.size())
566 __err = ios_base::failbit;
568 else if (__testoverflow)
571 && __gnu_cxx::__numeric_traits<_ValueT>::__is_signed)
572 __v = __gnu_cxx::__numeric_traits<_ValueT>::__min;
574 __v = __gnu_cxx::__numeric_traits<_ValueT>::__max;
575 __err = ios_base::failbit;
578 __v = __negative ? -__result : __result;
581 __err |= ios_base::eofbit;
587 template<
typename _CharT,
typename _InIter>
589 num_get<_CharT, _InIter>::
590 do_get(iter_type __beg, iter_type __end, ios_base& __io,
591 ios_base::iostate& __err,
bool& __v)
const
593 if (!(__io.flags() & ios_base::boolalpha))
599 __beg = _M_extract_int(__beg, __end, __io, __err, __l);
600 if (__l == 0 || __l == 1)
607 __err = ios_base::failbit;
609 __err |= ios_base::eofbit;
615 typedef __numpunct_cache<_CharT> __cache_type;
616 __use_cache<__cache_type> __uc;
617 const locale& __loc = __io._M_getloc();
618 const __cache_type* __lc = __uc(__loc);
622 bool __donef = __lc->_M_falsename_size == 0;
623 bool __donet = __lc->_M_truename_size == 0;
624 bool __testeof =
false;
626 while (!__donef || !__donet)
634 const char_type __c = *__beg;
637 __testf = __c == __lc->_M_falsename[__n];
639 if (!__testf && __donet)
643 __testt = __c == __lc->_M_truename[__n];
645 if (!__testt && __donef)
648 if (!__testt && !__testf)
654 __donef = !__testf || __n >= __lc->_M_falsename_size;
655 __donet = !__testt || __n >= __lc->_M_truename_size;
657 if (__testf && __n == __lc->_M_falsename_size && __n)
660 if (__testt && __n == __lc->_M_truename_size)
661 __err = ios_base::failbit;
663 __err = __testeof ? ios_base::eofbit : ios_base::goodbit;
665 else if (__testt && __n == __lc->_M_truename_size && __n)
668 __err = __testeof ? ios_base::eofbit : ios_base::goodbit;
675 __err = ios_base::failbit;
677 __err |= ios_base::eofbit;
683 template<
typename _CharT,
typename _InIter>
685 num_get<_CharT, _InIter>::
686 do_get(iter_type __beg, iter_type __end, ios_base& __io,
687 ios_base::iostate& __err,
float& __v)
const
691 __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);
692 std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());
694 __err |= ios_base::eofbit;
698 template<
typename _CharT,
typename _InIter>
700 num_get<_CharT, _InIter>::
701 do_get(iter_type __beg, iter_type __end, ios_base& __io,
702 ios_base::iostate& __err,
double& __v)
const
706 __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);
707 std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());
709 __err |= ios_base::eofbit;
713 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
714 template<
typename _CharT,
typename _InIter>
716 num_get<_CharT, _InIter>::
717 __do_get(iter_type __beg, iter_type __end, ios_base& __io,
718 ios_base::iostate& __err,
double& __v)
const
722 __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);
723 std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());
725 __err |= ios_base::eofbit;
730 template<
typename _CharT,
typename _InIter>
732 num_get<_CharT, _InIter>::
733 do_get(iter_type __beg, iter_type __end, ios_base& __io,
734 ios_base::iostate& __err,
long double& __v)
const
738 __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);
739 std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());
741 __err |= ios_base::eofbit;
745 template<
typename _CharT,
typename _InIter>
747 num_get<_CharT, _InIter>::
748 do_get(iter_type __beg, iter_type __end, ios_base& __io,
749 ios_base::iostate& __err,
void*& __v)
const
752 typedef ios_base::fmtflags fmtflags;
753 const fmtflags __fmt = __io.flags();
754 __io.flags((__fmt & ~ios_base::basefield) | ios_base::hex);
756 typedef __gnu_cxx::__conditional_type<(
sizeof(
void*)
757 <=
sizeof(
unsigned long)),
758 unsigned long,
unsigned long long>::__type _UIntPtrType;
761 __beg = _M_extract_int(__beg, __end, __io, __err, __ul);
766 __v =
reinterpret_cast<void*
>(__ul);
772 template<
typename _CharT,
typename _OutIter>
774 num_put<_CharT, _OutIter>::
775 _M_pad(_CharT __fill, streamsize __w, ios_base& __io,
776 _CharT* __new,
const _CharT* __cs,
int& __len)
const
780 __pad<_CharT, char_traits<_CharT> >::_S_pad(__io, __fill, __new,
782 __len =
static_cast<int>(__w);
785 _GLIBCXX_END_NAMESPACE_LDBL
787 template<
typename _CharT,
typename _ValueT>
789 __int_to_char(_CharT* __bufend, _ValueT __v,
const _CharT* __lit,
790 ios_base::fmtflags __flags,
bool __dec)
792 _CharT* __buf = __bufend;
793 if (__builtin_expect(__dec,
true))
798 *--__buf = __lit[(__v % 10) + __num_base::_S_odigits];
803 else if ((__flags & ios_base::basefield) == ios_base::oct)
808 *--__buf = __lit[(__v & 0x7) + __num_base::_S_odigits];
816 const bool __uppercase = __flags & ios_base::uppercase;
817 const int __case_offset = __uppercase ? __num_base::_S_oudigits
818 : __num_base::_S_odigits;
821 *--__buf = __lit[(__v & 0xf) + __case_offset];
826 return __bufend - __buf;
829 _GLIBCXX_BEGIN_NAMESPACE_LDBL
831 template<
typename _CharT,
typename _OutIter>
833 num_put<_CharT, _OutIter>::
834 _M_group_int(
const char* __grouping,
size_t __grouping_size, _CharT __sep,
835 ios_base&, _CharT* __new, _CharT* __cs,
int& __len)
const
837 _CharT* __p = std::__add_grouping(__new, __sep, __grouping,
838 __grouping_size, __cs, __cs + __len);
842 template<
typename _CharT,
typename _OutIter>
843 template<
typename _ValueT>
845 num_put<_CharT, _OutIter>::
846 _M_insert_int(_OutIter __s, ios_base& __io, _CharT __fill,
849 using __gnu_cxx::__add_unsigned;
850 typedef typename __add_unsigned<_ValueT>::__type __unsigned_type;
851 typedef __numpunct_cache<_CharT> __cache_type;
852 __use_cache<__cache_type> __uc;
853 const locale& __loc = __io._M_getloc();
854 const __cache_type* __lc = __uc(__loc);
855 const _CharT* __lit = __lc->_M_atoms_out;
856 const ios_base::fmtflags __flags = __io.flags();
859 const int __ilen = 5 *
sizeof(_ValueT);
860 _CharT* __cs =
static_cast<_CharT*
>(__builtin_alloca(
sizeof(_CharT)
865 const ios_base::fmtflags __basefield = __flags & ios_base::basefield;
866 const bool __dec = (__basefield != ios_base::oct
867 && __basefield != ios_base::hex);
868 const __unsigned_type __u = ((__v > 0 || !__dec)
869 ? __unsigned_type(__v)
870 : -__unsigned_type(__v));
871 int __len = __int_to_char(__cs + __ilen, __u, __lit, __flags, __dec);
872 __cs += __ilen - __len;
875 if (__lc->_M_use_grouping)
879 _CharT* __cs2 =
static_cast<_CharT*
>(__builtin_alloca(
sizeof(_CharT)
882 _M_group_int(__lc->_M_grouping, __lc->_M_grouping_size,
883 __lc->_M_thousands_sep, __io, __cs2 + 2, __cs, __len);
888 if (__builtin_expect(__dec,
true))
893 if (
bool(__flags & ios_base::showpos)
894 && __gnu_cxx::__numeric_traits<_ValueT>::__is_signed)
895 *--__cs = __lit[__num_base::_S_oplus], ++__len;
898 *--__cs = __lit[__num_base::_S_ominus], ++__len;
900 else if (
bool(__flags & ios_base::showbase) && __v)
902 if (__basefield == ios_base::oct)
903 *--__cs = __lit[__num_base::_S_odigits], ++__len;
907 const bool __uppercase = __flags & ios_base::uppercase;
908 *--__cs = __lit[__num_base::_S_ox + __uppercase];
910 *--__cs = __lit[__num_base::_S_odigits];
916 const streamsize __w = __io.width();
917 if (__w > static_cast<streamsize>(__len))
919 _CharT* __cs3 =
static_cast<_CharT*
>(__builtin_alloca(
sizeof(_CharT)
921 _M_pad(__fill, __w, __io, __cs3, __cs, __len);
931 template<
typename _CharT,
typename _OutIter>
933 num_put<_CharT, _OutIter>::
934 _M_group_float(
const char* __grouping,
size_t __grouping_size,
935 _CharT __sep,
const _CharT* __p, _CharT* __new,
936 _CharT* __cs,
int& __len)
const
941 const int __declen = __p ? __p - __cs : __len;
942 _CharT* __p2 = std::__add_grouping(__new, __sep, __grouping,
944 __cs, __cs + __declen);
947 int __newlen = __p2 - __new;
950 char_traits<_CharT>::copy(__p2, __p, __len - __declen);
951 __newlen += __len - __declen;
966 template<
typename _CharT,
typename _OutIter>
967 template<
typename _ValueT>
969 num_put<_CharT, _OutIter>::
970 _M_insert_float(_OutIter __s, ios_base& __io, _CharT __fill,
char __mod,
973 typedef __numpunct_cache<_CharT> __cache_type;
974 __use_cache<__cache_type> __uc;
975 const locale& __loc = __io._M_getloc();
976 const __cache_type* __lc = __uc(__loc);
979 const streamsize __prec = __io.precision() < 0 ? 6 : __io.precision();
981 const int __max_digits =
982 __gnu_cxx::__numeric_traits<_ValueT>::__digits10;
988 __num_base::_S_format_float(__io, __fbuf, __mod);
990 #ifdef _GLIBCXX_USE_C99
993 int __cs_size = __max_digits * 3;
994 char* __cs =
static_cast<char*
>(__builtin_alloca(__cs_size));
995 __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
996 __fbuf, __prec, __v);
999 if (__len >= __cs_size)
1001 __cs_size = __len + 1;
1002 __cs =
static_cast<char*
>(__builtin_alloca(__cs_size));
1003 __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
1004 __fbuf, __prec, __v);
1008 const bool __fixed = __io.flags() & ios_base::fixed;
1009 const int __max_exp =
1010 __gnu_cxx::__numeric_traits<_ValueT>::__max_exponent10;
1018 const int __cs_size = __fixed ? __max_exp + __prec + 4
1019 : __max_digits * 2 + __prec;
1020 char* __cs =
static_cast<char*
>(__builtin_alloca(__cs_size));
1021 __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, __fbuf,
1027 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
1029 _CharT* __ws =
static_cast<_CharT*
>(__builtin_alloca(
sizeof(_CharT)
1031 __ctype.widen(__cs, __cs + __len, __ws);
1035 const char* __p = char_traits<char>::find(__cs, __len,
'.');
1038 __wp = __ws + (__p - __cs);
1039 *__wp = __lc->_M_decimal_point;
1045 if (__lc->_M_use_grouping
1046 && (__wp || __len < 3 || (__cs[1] <=
'9' && __cs[2] <=
'9'
1047 && __cs[1] >=
'0' && __cs[2] >=
'0')))
1051 _CharT* __ws2 =
static_cast<_CharT*
>(__builtin_alloca(
sizeof(_CharT)
1054 streamsize __off = 0;
1055 if (__cs[0] ==
'-' || __cs[0] ==
'+')
1062 _M_group_float(__lc->_M_grouping, __lc->_M_grouping_size,
1063 __lc->_M_thousands_sep, __wp, __ws2 + __off,
1064 __ws + __off, __len);
1071 const streamsize __w = __io.width();
1072 if (__w > static_cast<streamsize>(__len))
1074 _CharT* __ws3 =
static_cast<_CharT*
>(__builtin_alloca(
sizeof(_CharT)
1076 _M_pad(__fill, __w, __io, __ws3, __ws, __len);
1086 template<
typename _CharT,
typename _OutIter>
1088 num_put<_CharT, _OutIter>::
1089 do_put(iter_type __s, ios_base& __io, char_type __fill,
bool __v)
const
1091 const ios_base::fmtflags __flags = __io.flags();
1092 if ((__flags & ios_base::boolalpha) == 0)
1094 const long __l = __v;
1095 __s = _M_insert_int(__s, __io, __fill, __l);
1099 typedef __numpunct_cache<_CharT> __cache_type;
1100 __use_cache<__cache_type> __uc;
1101 const locale& __loc = __io._M_getloc();
1102 const __cache_type* __lc = __uc(__loc);
1104 const _CharT* __name = __v ? __lc->_M_truename
1105 : __lc->_M_falsename;
1106 int __len = __v ? __lc->_M_truename_size
1107 : __lc->_M_falsename_size;
1109 const streamsize __w = __io.width();
1110 if (__w > static_cast<streamsize>(__len))
1112 const streamsize __plen = __w - __len;
1114 =
static_cast<_CharT*
>(__builtin_alloca(
sizeof(_CharT)
1117 char_traits<_CharT>::assign(__ps, __plen, __fill);
1120 if ((__flags & ios_base::adjustfield) == ios_base::left)
1138 template<
typename _CharT,
typename _OutIter>
1140 num_put<_CharT, _OutIter>::
1141 do_put(iter_type __s, ios_base& __io, char_type __fill,
double __v)
const
1142 {
return _M_insert_float(__s, __io, __fill,
char(), __v); }
1144 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
1145 template<
typename _CharT,
typename _OutIter>
1147 num_put<_CharT, _OutIter>::
1148 __do_put(iter_type __s, ios_base& __io, char_type __fill,
double __v)
const
1149 {
return _M_insert_float(__s, __io, __fill,
char(), __v); }
1152 template<
typename _CharT,
typename _OutIter>
1154 num_put<_CharT, _OutIter>::
1155 do_put(iter_type __s, ios_base& __io, char_type __fill,
1156 long double __v)
const
1157 {
return _M_insert_float(__s, __io, __fill,
'L', __v); }
1159 template<
typename _CharT,
typename _OutIter>
1161 num_put<_CharT, _OutIter>::
1162 do_put(iter_type __s, ios_base& __io, char_type __fill,
1163 const void* __v)
const
1165 const ios_base::fmtflags __flags = __io.flags();
1166 const ios_base::fmtflags __fmt = ~(ios_base::basefield
1167 | ios_base::uppercase);
1168 __io.flags((__flags & __fmt) | (ios_base::hex | ios_base::showbase));
1170 typedef __gnu_cxx::__conditional_type<(
sizeof(
const void*)
1171 <=
sizeof(
unsigned long)),
1172 unsigned long,
unsigned long long>::__type _UIntPtrType;
1174 __s = _M_insert_int(__s, __io, __fill,
1175 reinterpret_cast<_UIntPtrType>(__v));
1176 __io.flags(__flags);
1180 _GLIBCXX_END_NAMESPACE_LDBL
1189 template<
typename _CharT,
typename _Traits>
1191 __pad<_CharT, _Traits>::_S_pad(ios_base& __io, _CharT __fill,
1192 _CharT* __news,
const _CharT* __olds,
1193 streamsize __newlen, streamsize __oldlen)
1195 const size_t __plen =
static_cast<size_t>(__newlen - __oldlen);
1196 const ios_base::fmtflags __adjust = __io.flags() & ios_base::adjustfield;
1199 if (__adjust == ios_base::left)
1201 _Traits::copy(__news, __olds, __oldlen);
1202 _Traits::assign(__news + __oldlen, __plen, __fill);
1207 if (__adjust == ios_base::internal)
1212 const locale& __loc = __io._M_getloc();
1213 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
1215 if (__ctype.widen(
'-') == __olds[0]
1216 || __ctype.widen(
'+') == __olds[0])
1218 __news[0] = __olds[0];
1222 else if (__ctype.widen(
'0') == __olds[0]
1224 && (__ctype.widen(
'x') == __olds[1]
1225 || __ctype.widen(
'X') == __olds[1]))
1227 __news[0] = __olds[0];
1228 __news[1] = __olds[1];
1234 _Traits::assign(__news, __plen, __fill);
1235 _Traits::copy(__news + __plen, __olds + __mod, __oldlen - __mod);
1238 template<
typename _CharT>
1240 __add_grouping(_CharT* __s, _CharT __sep,
1241 const char* __gbeg,
size_t __gsize,
1242 const _CharT* __first,
const _CharT* __last)
1247 while (__last - __first > __gbeg[__idx]
1248 && static_cast<signed char>(__gbeg[__idx]) > 0
1249 && __gbeg[__idx] != __gnu_cxx::__numeric_traits<char>::__max)
1251 __last -= __gbeg[__idx];
1252 __idx < __gsize - 1 ? ++__idx : ++__ctr;
1255 while (__first != __last)
1256 *__s++ = *__first++;
1261 for (
char __i = __gbeg[__idx]; __i > 0; --__i)
1262 *__s++ = *__first++;
1268 for (
char __i = __gbeg[__idx]; __i > 0; --__i)
1269 *__s++ = *__first++;
1277 #if _GLIBCXX_EXTERN_TEMPLATE
1278 extern template class numpunct<char>;
1279 extern template class numpunct_byname<char>;
1280 extern template class _GLIBCXX_NAMESPACE_LDBL num_get<char>;
1281 extern template class _GLIBCXX_NAMESPACE_LDBL num_put<char>;
1282 extern template class ctype_byname<char>;
1286 use_facet<ctype<char> >(
const locale&);
1289 const numpunct<char>&
1290 use_facet<numpunct<char> >(
const locale&);
1293 const num_put<char>&
1294 use_facet<num_put<char> >(
const locale&);
1297 const num_get<char>&
1298 use_facet<num_get<char> >(
const locale&);
1302 has_facet<ctype<char> >(
const locale&);
1306 has_facet<numpunct<char> >(
const locale&);
1310 has_facet<num_put<char> >(
const locale&);
1314 has_facet<num_get<char> >(
const locale&);
1316 #ifdef _GLIBCXX_USE_WCHAR_T
1317 extern template class numpunct<wchar_t>;
1318 extern template class numpunct_byname<wchar_t>;
1319 extern template class _GLIBCXX_NAMESPACE_LDBL num_get<wchar_t>;
1320 extern template class _GLIBCXX_NAMESPACE_LDBL num_put<wchar_t>;
1321 extern template class ctype_byname<wchar_t>;
1324 const ctype<wchar_t>&
1325 use_facet<ctype<wchar_t> >(
const locale&);
1328 const numpunct<wchar_t>&
1329 use_facet<numpunct<wchar_t> >(
const locale&);
1332 const num_put<wchar_t>&
1333 use_facet<num_put<wchar_t> >(
const locale&);
1336 const num_get<wchar_t>&
1337 use_facet<num_get<wchar_t> >(
const locale&);
1341 has_facet<ctype<wchar_t> >(
const locale&);
1345 has_facet<numpunct<wchar_t> >(
const locale&);
1349 has_facet<num_put<wchar_t> >(
const locale&);
1353 has_facet<num_get<wchar_t> >(
const locale&);
1357 _GLIBCXX_END_NAMESPACE_VERSION
void __write(FILE *__f, __stack_t __stack)
Definition: profiler_node.h:78
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
Definition: functions.h:446
#define __try
Definition: exception_defines.h:35
#define __throw_exception_again
Definition: exception_defines.h:37
#define bool
Definition: stdbool.h:33
#define __catch(X)
Definition: exception_defines.h:36