30 #ifndef _LOCALE_FACETS_TCC
31 #define _LOCALE_FACETS_TCC 1
33 #ifdef _GLIBCXX_SYSHDR
34 #pragma GCC system_header
36 #pragma GCC diagnostic push
37 #pragma GCC diagnostic ignored "-Wc++11-extensions"
39 namespace std _GLIBCXX_VISIBILITY(default)
41 _GLIBCXX_BEGIN_NAMESPACE_VERSION
45 template<
typename _Facet>
49 operator() (
const locale& __loc)
const;
53 template<
typename _CharT>
54 struct __use_cache<__numpunct_cache<_CharT> >
56 const __numpunct_cache<_CharT>*
57 operator() (
const locale& __loc)
const
60 const locale::facet** __caches = __loc._M_impl->_M_caches;
63 __numpunct_cache<_CharT>* __tmp = 0;
66 __tmp =
new __numpunct_cache<_CharT>;
67 __tmp->_M_cache(__loc);
72 __throw_exception_again;
74 __loc._M_impl->_M_install_cache(__tmp, __i);
76 return static_cast<const __numpunct_cache<_CharT>*
>(__caches[__i]);
80 template<
typename _CharT>
82 __numpunct_cache<_CharT>::_M_cache(
const locale& __loc)
84 const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc);
87 _CharT* __truename = 0;
88 _CharT* __falsename = 0;
91 const string& __g = __np.grouping();
92 _M_grouping_size = __g.size();
93 __grouping =
new char[_M_grouping_size];
94 __g.copy(__grouping, _M_grouping_size);
95 _M_use_grouping = (_M_grouping_size
96 &&
static_cast<signed char>(__grouping[0]) > 0
98 != __gnu_cxx::__numeric_traits<char>::__max));
100 const basic_string<_CharT>& __tn = __np.truename();
101 _M_truename_size = __tn.size();
102 __truename =
new _CharT[_M_truename_size];
103 __tn.copy(__truename, _M_truename_size);
105 const basic_string<_CharT>& __fn = __np.falsename();
106 _M_falsename_size = __fn.size();
107 __falsename =
new _CharT[_M_falsename_size];
108 __fn.copy(__falsename, _M_falsename_size);
110 _M_decimal_point = __np.decimal_point();
111 _M_thousands_sep = __np.thousands_sep();
113 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__loc);
114 __ct.widen(__num_base::_S_atoms_out,
115 __num_base::_S_atoms_out
116 + __num_base::_S_oend, _M_atoms_out);
117 __ct.widen(__num_base::_S_atoms_in,
118 __num_base::_S_atoms_in
119 + __num_base::_S_iend, _M_atoms_in);
121 _M_grouping = __grouping;
122 _M_truename = __truename;
123 _M_falsename = __falsename;
128 delete [] __grouping;
129 delete [] __truename;
130 delete [] __falsename;
131 __throw_exception_again;
144 __verify_grouping(
const char* __grouping,
size_t __grouping_size,
145 const string& __grouping_tmp)
throw ();
147 _GLIBCXX_BEGIN_NAMESPACE_LDBL
149 template<
typename _CharT,
typename _InIter>
150 _GLIBCXX_DEFAULT_ABI_TAG
152 num_get<_CharT, _InIter>::
153 _M_extract_float(_InIter __beg, _InIter __end, ios_base& __io,
156 typedef char_traits<_CharT> __traits_type;
157 typedef __numpunct_cache<_CharT> __cache_type;
158 __use_cache<__cache_type> __uc;
159 const locale& __loc = __io._M_getloc();
160 const __cache_type* __lc = __uc(__loc);
161 const _CharT* __lit = __lc->_M_atoms_in;
162 char_type __c = char_type();
165 bool __testeof = __beg == __end;
171 const bool __plus = __c == __lit[__num_base::_S_iplus];
172 if ((__plus || __c == __lit[__num_base::_S_iminus])
173 && !(__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
174 && !(__c == __lc->_M_decimal_point))
176 __xtrc += __plus ?
'+' :
'-';
177 if (++__beg != __end)
185 bool __found_mantissa =
false;
189 if ((__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
190 || __c == __lc->_M_decimal_point)
192 else if (__c == __lit[__num_base::_S_izero])
194 if (!__found_mantissa)
197 __found_mantissa =
true;
201 if (++__beg != __end)
211 bool __found_dec =
false;
212 bool __found_sci =
false;
213 string __found_grouping;
214 if (__lc->_M_use_grouping)
215 __found_grouping.reserve(32);
216 const char_type* __lit_zero = __lit + __num_base::_S_izero;
218 if (!__lc->_M_allocated)
222 const int __digit = _M_find(__lit_zero, 10, __c);
225 __xtrc +=
'0' + __digit;
226 __found_mantissa =
true;
228 else if (__c == __lc->_M_decimal_point
229 && !__found_dec && !__found_sci)
234 else if ((__c == __lit[__num_base::_S_ie]
235 || __c == __lit[__num_base::_S_iE])
236 && !__found_sci && __found_mantissa)
243 if (++__beg != __end)
246 const bool __plus = __c == __lit[__num_base::_S_iplus];
247 if (__plus || __c == __lit[__num_base::_S_iminus])
248 __xtrc += __plus ?
'+' :
'-';
261 if (++__beg != __end)
271 if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
273 if (!__found_dec && !__found_sci)
279 __found_grouping +=
static_cast<char>(__sep_pos);
293 else if (__c == __lc->_M_decimal_point)
295 if (!__found_dec && !__found_sci)
300 if (__found_grouping.size())
301 __found_grouping +=
static_cast<char>(__sep_pos);
310 const char_type* __q =
311 __traits_type::find(__lit_zero, 10, __c);
314 __xtrc +=
'0' + (__q - __lit_zero);
315 __found_mantissa =
true;
318 else if ((__c == __lit[__num_base::_S_ie]
319 || __c == __lit[__num_base::_S_iE])
320 && !__found_sci && __found_mantissa)
323 if (__found_grouping.size() && !__found_dec)
324 __found_grouping +=
static_cast<char>(__sep_pos);
329 if (++__beg != __end)
332 const bool __plus = __c == __lit[__num_base::_S_iplus];
333 if ((__plus || __c == __lit[__num_base::_S_iminus])
334 && !(__lc->_M_use_grouping
335 && __c == __lc->_M_thousands_sep)
336 && !(__c == __lc->_M_decimal_point))
337 __xtrc += __plus ?
'+' :
'-';
351 if (++__beg != __end)
359 if (__found_grouping.size())
362 if (!__found_dec && !__found_sci)
363 __found_grouping +=
static_cast<char>(__sep_pos);
365 if (!std::__verify_grouping(__lc->_M_grouping,
366 __lc->_M_grouping_size,
374 template<
typename _CharT,
typename _InIter>
375 template<
typename _ValueT>
376 _GLIBCXX_DEFAULT_ABI_TAG
378 num_get<_CharT, _InIter>::
379 _M_extract_int(_InIter __beg, _InIter __end, ios_base& __io,
382 typedef char_traits<_CharT> __traits_type;
383 using __gnu_cxx::__add_unsigned;
384 typedef typename __add_unsigned<_ValueT>::__type __unsigned_type;
385 typedef __numpunct_cache<_CharT> __cache_type;
386 __use_cache<__cache_type> __uc;
387 const locale& __loc = __io._M_getloc();
388 const __cache_type* __lc = __uc(__loc);
389 const _CharT* __lit = __lc->_M_atoms_in;
390 char_type __c = char_type();
399 bool __testeof = __beg == __end;
402 bool __negative =
false;
406 __negative = __c == __lit[__num_base::_S_iminus];
407 if ((__negative || __c == __lit[__num_base::_S_iplus])
408 && !(__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
409 && !(__c == __lc->_M_decimal_point))
411 if (++__beg != __end)
420 bool __found_zero =
false;
424 if ((__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
425 || __c == __lc->_M_decimal_point)
427 else if (__c == __lit[__num_base::_S_izero]
428 && (!__found_zero ||
__base == 10))
432 if (__basefield == 0)
437 else if (__found_zero
438 && (__c == __lit[__num_base::_S_ix]
439 || __c == __lit[__num_base::_S_iX]))
441 if (__basefield == 0)
445 __found_zero =
false;
454 if (++__beg != __end)
466 const size_t __len = (
__base == 16 ? __num_base::_S_iend
467 - __num_base::_S_izero :
__base);
470 typedef __gnu_cxx::__numeric_traits<_ValueT> __num_traits;
471 string __found_grouping;
472 if (__lc->_M_use_grouping)
473 __found_grouping.reserve(32);
474 bool __testfail =
false;
475 bool __testoverflow =
false;
476 const __unsigned_type __max =
477 (__negative && __num_traits::__is_signed)
478 ? -
static_cast<__unsigned_type
>(__num_traits::__min)
479 : __num_traits::__max;
480 const __unsigned_type __smax = __max /
__base;
481 __unsigned_type __result = 0;
483 const char_type* __lit_zero = __lit + __num_base::_S_izero;
485 if (!__lc->_M_allocated)
489 __digit = _M_find(__lit_zero, __len, __c);
493 if (__result > __smax)
494 __testoverflow =
true;
498 __testoverflow |= __result > __max - __digit;
503 if (++__beg != __end)
513 if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
519 __found_grouping +=
static_cast<char>(__sep_pos);
528 else if (__c == __lc->_M_decimal_point)
532 const char_type* __q =
533 __traits_type::find(__lit_zero, __len, __c);
537 __digit = __q - __lit_zero;
540 if (__result > __smax)
541 __testoverflow =
true;
545 __testoverflow |= __result > __max - __digit;
551 if (++__beg != __end)
559 if (__found_grouping.size())
562 __found_grouping +=
static_cast<char>(__sep_pos);
564 if (!std::__verify_grouping(__lc->_M_grouping,
565 __lc->_M_grouping_size,
572 if ((!__sep_pos && !__found_zero && !__found_grouping.size())
578 else if (__testoverflow)
580 if (__negative && __num_traits::__is_signed)
581 __v = __num_traits::__min;
583 __v = __num_traits::__max;
587 __v = __negative ? -__result : __result;
596 template<
typename _CharT,
typename _InIter>
600 ios_base::iostate& __err,
bool& __v)
const
608 __beg = _M_extract_int(__beg, __end, __io, __err, __l);
609 if (__l == 0 || __l == 1)
624 typedef __numpunct_cache<_CharT> __cache_type;
625 __use_cache<__cache_type> __uc;
627 const __cache_type* __lc = __uc(__loc);
631 bool __donef = __lc->_M_falsename_size == 0;
632 bool __donet = __lc->_M_truename_size == 0;
633 bool __testeof =
false;
635 while (!__donef || !__donet)
646 __testf = __c == __lc->_M_falsename[__n];
648 if (!__testf && __donet)
652 __testt = __c == __lc->_M_truename[__n];
654 if (!__testt && __donef)
657 if (!__testt && !__testf)
663 __donef = !__testf || __n >= __lc->_M_falsename_size;
664 __donet = !__testt || __n >= __lc->_M_truename_size;
666 if (__testf && __n == __lc->_M_falsename_size && __n)
669 if (__testt && __n == __lc->_M_truename_size)
674 else if (__testt && __n == __lc->_M_truename_size && __n)
692 template<
typename _CharT,
typename _InIter>
696 ios_base::iostate& __err,
float& __v)
const
700 __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);
701 std::__convert_to_v(__xtrc.
c_str(), __v, __err, _S_get_c_locale());
707 template<
typename _CharT,
typename _InIter>
711 ios_base::iostate& __err,
double& __v)
const
715 __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);
716 std::__convert_to_v(__xtrc.
c_str(), __v, __err, _S_get_c_locale());
722 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
723 template<
typename _CharT,
typename _InIter>
727 ios_base::iostate& __err,
double& __v)
const
731 __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);
732 std::__convert_to_v(__xtrc.
c_str(), __v, __err, _S_get_c_locale());
739 template<
typename _CharT,
typename _InIter>
743 ios_base::iostate& __err,
long double& __v)
const
747 __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);
748 std::__convert_to_v(__xtrc.
c_str(), __v, __err, _S_get_c_locale());
754 template<
typename _CharT,
typename _InIter>
758 ios_base::iostate& __err,
void*& __v)
const
761 typedef ios_base::fmtflags fmtflags;
762 const fmtflags __fmt = __io.
flags();
765 #pragma GCC diagnostic push
766 #pragma GCC diagnostic ignored "-Wlong-long"
767 typedef __gnu_cxx::__conditional_type<(
sizeof(
void*)
768 <=
sizeof(
unsigned long)),
769 unsigned long,
unsigned long long>::__type _UIntPtrType;
770 #pragma GCC diagnostic pop
773 __beg = _M_extract_int(__beg, __end, __io, __err, __ul);
778 __v =
reinterpret_cast<void*
>(__ul);
782 #if defined _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT \
783 && defined __LONG_DOUBLE_IEEE128__
784 template<
typename _CharT,
typename _InIter>
788 ios_base::iostate& __err, __ibm128& __v)
const
792 __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);
793 std::__convert_to_v(__xtrc.
c_str(), __v, __err, _S_get_c_locale());
802 template<
typename _CharT,
typename _OutIter>
804 num_put<_CharT, _OutIter>::
805 _M_pad(_CharT __fill,
streamsize __w, ios_base& __io,
806 _CharT* __new,
const _CharT* __cs,
int& __len)
const
810 __pad<_CharT, char_traits<_CharT> >::_S_pad(__io, __fill, __new,
812 __len =
static_cast<int>(__w);
815 _GLIBCXX_END_NAMESPACE_LDBL
817 template<
typename _CharT,
typename _ValueT>
819 __int_to_char(_CharT* __bufend, _ValueT __v,
const _CharT* __lit,
822 _CharT* __buf = __bufend;
823 if (__builtin_expect(__dec,
true))
828 *--__buf = __lit[(__v % 10) + __num_base::_S_odigits];
838 *--__buf = __lit[(__v & 0x7) + __num_base::_S_odigits];
847 const int __case_offset = __uppercase ? __num_base::_S_oudigits
848 : __num_base::_S_odigits;
851 *--__buf = __lit[(__v & 0xf) + __case_offset];
856 return __bufend - __buf;
859 _GLIBCXX_BEGIN_NAMESPACE_LDBL
861 template<
typename _CharT,
typename _OutIter>
863 num_put<_CharT, _OutIter>::
864 _M_group_int(
const char* __grouping,
size_t __grouping_size, _CharT __sep,
865 ios_base&, _CharT* __new, _CharT* __cs,
int& __len)
const
867 _CharT* __p = std::__add_grouping(__new, __sep, __grouping,
868 __grouping_size, __cs, __cs + __len);
872 template<
typename _CharT,
typename _OutIter>
873 template<
typename _ValueT>
875 num_put<_CharT, _OutIter>::
876 _M_insert_int(_OutIter __s, ios_base& __io, _CharT __fill,
879 using __gnu_cxx::__add_unsigned;
880 typedef typename __add_unsigned<_ValueT>::__type __unsigned_type;
881 typedef __numpunct_cache<_CharT> __cache_type;
882 __use_cache<__cache_type> __uc;
883 const locale& __loc = __io._M_getloc();
884 const __cache_type* __lc = __uc(__loc);
885 const _CharT* __lit = __lc->_M_atoms_out;
889 const int __ilen = 5 *
sizeof(_ValueT);
890 _CharT* __cs =
static_cast<_CharT*
>(__builtin_alloca(
sizeof(_CharT)
898 const __unsigned_type __u = ((__v > 0 || !__dec)
899 ? __unsigned_type(__v)
900 : -__unsigned_type(__v));
901 int __len = __int_to_char(__cs + __ilen, __u, __lit, __flags, __dec);
902 __cs += __ilen - __len;
905 if (__lc->_M_use_grouping)
909 _CharT* __cs2 =
static_cast<_CharT*
>(__builtin_alloca(
sizeof(_CharT)
912 _M_group_int(__lc->_M_grouping, __lc->_M_grouping_size,
913 __lc->_M_thousands_sep, __io, __cs2 + 2, __cs, __len);
918 if (__builtin_expect(__dec,
true))
924 && __gnu_cxx::__numeric_traits<_ValueT>::__is_signed)
925 *--__cs = __lit[__num_base::_S_oplus], ++__len;
928 *--__cs = __lit[__num_base::_S_ominus], ++__len;
933 *--__cs = __lit[__num_base::_S_odigits], ++__len;
938 *--__cs = __lit[__num_base::_S_ox + __uppercase];
940 *--__cs = __lit[__num_base::_S_odigits];
949 _CharT* __cs3 =
static_cast<_CharT*
>(__builtin_alloca(
sizeof(_CharT)
951 _M_pad(__fill, __w, __io, __cs3, __cs, __len);
958 return std::__write(__s, __cs, __len);
961 template<
typename _CharT,
typename _OutIter>
963 num_put<_CharT, _OutIter>::
964 _M_group_float(
const char* __grouping,
size_t __grouping_size,
965 _CharT __sep,
const _CharT* __p, _CharT* __new,
966 _CharT* __cs,
int& __len)
const
971 const int __declen = __p ? __p - __cs : __len;
972 _CharT* __p2 = std::__add_grouping(__new, __sep, __grouping,
974 __cs, __cs + __declen);
977 int __newlen = __p2 - __new;
980 char_traits<_CharT>::copy(__p2, __p, __len - __declen);
981 __newlen += __len - __declen;
996 template<
typename _CharT,
typename _OutIter>
997 template<
typename _ValueT>
999 num_put<_CharT, _OutIter>::
1000 _M_insert_float(_OutIter __s, ios_base& __io, _CharT __fill,
char __mod,
1003 typedef __numpunct_cache<_CharT> __cache_type;
1004 __use_cache<__cache_type> __uc;
1005 const locale& __loc = __io._M_getloc();
1006 const __cache_type* __lc = __uc(__loc);
1009 const streamsize __prec = __io.precision() < 0 ? 6 : __io.precision();
1011 const int __max_digits =
1012 __gnu_cxx::__numeric_traits<_ValueT>::__digits10;
1018 __num_base::_S_format_float(__io, __fbuf, __mod);
1020 #if _GLIBCXX_USE_C99_STDIO && !_GLIBCXX_HAVE_BROKEN_VSNPRINTF
1022 const bool __use_prec =
1027 int __cs_size = __max_digits * 3;
1028 char* __cs =
static_cast<char*
>(__builtin_alloca(__cs_size));
1030 __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
1031 __fbuf, __prec, __v);
1033 __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
1037 if (__len >= __cs_size)
1039 __cs_size = __len + 1;
1040 __cs =
static_cast<char*
>(__builtin_alloca(__cs_size));
1042 __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
1043 __fbuf, __prec, __v);
1045 __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
1051 const int __max_exp =
1052 __gnu_cxx::__numeric_traits<_ValueT>::__max_exponent10;
1060 const int __cs_size = __fixed ? __max_exp + __prec + 4
1061 : __max_digits * 2 + __prec;
1062 char* __cs =
static_cast<char*
>(__builtin_alloca(__cs_size));
1063 __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, __fbuf,
1069 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
1071 _CharT* __ws =
static_cast<_CharT*
>(__builtin_alloca(
sizeof(_CharT)
1073 __ctype.widen(__cs, __cs + __len, __ws);
1077 const char* __p = char_traits<char>::find(__cs, __len,
'.');
1080 __wp = __ws + (__p - __cs);
1081 *__wp = __lc->_M_decimal_point;
1087 if (__lc->_M_use_grouping
1088 && (__wp || __len < 3 || (__cs[1] <=
'9' && __cs[2] <=
'9'
1089 && __cs[1] >=
'0' && __cs[2] >=
'0')))
1093 _CharT* __ws2 =
static_cast<_CharT*
>(__builtin_alloca(
sizeof(_CharT)
1097 if (__cs[0] ==
'-' || __cs[0] ==
'+')
1104 _M_group_float(__lc->_M_grouping, __lc->_M_grouping_size,
1105 __lc->_M_thousands_sep, __wp, __ws2 + __off,
1106 __ws + __off, __len);
1116 _CharT* __ws3 =
static_cast<_CharT*
>(__builtin_alloca(
sizeof(_CharT)
1118 _M_pad(__fill, __w, __io, __ws3, __ws, __len);
1125 return std::__write(__s, __ws, __len);
1128 template<
typename _CharT,
typename _OutIter>
1133 const ios_base::fmtflags __flags = __io.
flags();
1136 const long __l = __v;
1137 __s = _M_insert_int(__s, __io, __fill, __l);
1141 typedef __numpunct_cache<_CharT> __cache_type;
1142 __use_cache<__cache_type> __uc;
1144 const __cache_type* __lc = __uc(__loc);
1146 const _CharT* __name = __v ? __lc->_M_truename
1147 : __lc->_M_falsename;
1148 int __len = __v ? __lc->_M_truename_size
1149 : __lc->_M_falsename_size;
1156 =
static_cast<_CharT*
>(__builtin_alloca(
sizeof(_CharT)
1164 __s = std::__write(__s, __name, __len);
1165 __s = std::__write(__s, __ps, __plen);
1169 __s = std::__write(__s, __ps, __plen);
1170 __s = std::__write(__s, __name, __len);
1175 __s = std::__write(__s, __name, __len);
1180 template<
typename _CharT,
typename _OutIter>
1184 {
return _M_insert_float(__s, __io, __fill,
char(), __v); }
1186 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
1187 template<
typename _CharT,
typename _OutIter>
1190 __do_put(iter_type __s,
ios_base& __io, char_type __fill,
double __v)
const
1191 {
return _M_insert_float(__s, __io, __fill,
char(), __v); }
1194 template<
typename _CharT,
typename _OutIter>
1198 long double __v)
const
1199 {
return _M_insert_float(__s, __io, __fill,
'L', __v); }
1201 template<
typename _CharT,
typename _OutIter>
1205 const void* __v)
const
1207 const ios_base::fmtflags __flags = __io.
flags();
1212 #pragma GCC diagnostic push
1213 #pragma GCC diagnostic ignored "-Wlong-long"
1214 typedef __gnu_cxx::__conditional_type<(
sizeof(
const void*)
1215 <=
sizeof(
unsigned long)),
1216 unsigned long,
unsigned long long>::__type _UIntPtrType;
1217 #pragma GCC diagnostic pop
1219 __s = _M_insert_int(__s, __io, __fill,
1220 reinterpret_cast<_UIntPtrType
>(__v));
1221 __io.
flags(__flags);
1225 #if defined _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT \
1226 && defined __LONG_DOUBLE_IEEE128__
1227 template<
typename _CharT,
typename _OutIter>
1232 {
return _M_insert_float(__s, __io, __fill,
'L', __v); }
1234 _GLIBCXX_END_NAMESPACE_LDBL
1243 template<
typename _CharT,
typename _Traits>
1245 __pad<_CharT, _Traits>::_S_pad(ios_base& __io, _CharT __fill,
1246 _CharT* __news,
const _CharT* __olds,
1249 const size_t __plen =
static_cast<size_t>(__newlen - __oldlen);
1255 _Traits::copy(__news, __olds, __oldlen);
1256 _Traits::assign(__news + __oldlen, __plen, __fill);
1266 const locale& __loc = __io._M_getloc();
1267 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
1269 if (__ctype.widen(
'-') == __olds[0]
1270 || __ctype.widen(
'+') == __olds[0])
1272 __news[0] = __olds[0];
1276 else if (__ctype.widen(
'0') == __olds[0]
1278 && (__ctype.widen(
'x') == __olds[1]
1279 || __ctype.widen(
'X') == __olds[1]))
1281 __news[0] = __olds[0];
1282 __news[1] = __olds[1];
1288 _Traits::assign(__news, __plen, __fill);
1289 _Traits::copy(__news + __plen, __olds + __mod, __oldlen - __mod);
1292 template<
typename _CharT>
1294 __add_grouping(_CharT* __s, _CharT __sep,
1295 const char* __gbeg,
size_t __gsize,
1296 const _CharT* __first,
const _CharT* __last)
1301 while (__last - __first > __gbeg[__idx]
1302 &&
static_cast<signed char>(__gbeg[__idx]) > 0
1303 && __gbeg[__idx] != __gnu_cxx::__numeric_traits<char>::__max)
1305 __last -= __gbeg[__idx];
1306 __idx < __gsize - 1 ? ++__idx : ++__ctr;
1309 while (__first != __last)
1310 *__s++ = *__first++;
1315 for (
char __i = __gbeg[__idx]; __i > 0; --__i)
1316 *__s++ = *__first++;
1322 for (
char __i = __gbeg[__idx]; __i > 0; --__i)
1323 *__s++ = *__first++;
1331 #if _GLIBCXX_EXTERN_TEMPLATE
1332 extern template class _GLIBCXX_NAMESPACE_CXX11 numpunct<char>;
1333 extern template class _GLIBCXX_NAMESPACE_CXX11 numpunct_byname<char>;
1334 extern template class _GLIBCXX_NAMESPACE_LDBL num_get<char>;
1335 extern template class _GLIBCXX_NAMESPACE_LDBL num_put<char>;
1336 extern template class ctype_byname<char>;
1340 __try_use_facet<ctype<char> >(
const locale&) _GLIBCXX_NOTHROW;
1343 const numpunct<char>*
1344 __try_use_facet<numpunct<char> >(
const locale&) _GLIBCXX_NOTHROW;
1347 const num_put<char>*
1348 __try_use_facet<num_put<char> >(
const locale&) _GLIBCXX_NOTHROW;
1351 const num_get<char>*
1352 __try_use_facet<num_get<char> >(
const locale&) _GLIBCXX_NOTHROW;
1356 use_facet<ctype<char> >(
const locale&);
1359 const numpunct<char>&
1360 use_facet<numpunct<char> >(
const locale&);
1363 const num_put<char>&
1364 use_facet<num_put<char> >(
const locale&);
1367 const num_get<char>&
1368 use_facet<num_get<char> >(
const locale&);
1372 has_facet<ctype<char> >(
const locale&);
1376 has_facet<numpunct<char> >(
const locale&);
1380 has_facet<num_put<char> >(
const locale&);
1384 has_facet<num_get<char> >(
const locale&);
1386 #ifdef _GLIBCXX_USE_WCHAR_T
1387 extern template class _GLIBCXX_NAMESPACE_CXX11 numpunct<wchar_t>;
1388 extern template class _GLIBCXX_NAMESPACE_CXX11 numpunct_byname<wchar_t>;
1389 extern template class _GLIBCXX_NAMESPACE_LDBL num_get<wchar_t>;
1390 extern template class _GLIBCXX_NAMESPACE_LDBL num_put<wchar_t>;
1391 extern template class ctype_byname<wchar_t>;
1394 const ctype<wchar_t>*
1395 __try_use_facet<ctype<wchar_t> >(
const locale&) _GLIBCXX_NOTHROW;
1398 const numpunct<wchar_t>*
1399 __try_use_facet<numpunct<wchar_t> >(
const locale&) _GLIBCXX_NOTHROW;
1402 const num_put<wchar_t>*
1403 __try_use_facet<num_put<wchar_t> >(
const locale&) _GLIBCXX_NOTHROW;
1406 const num_get<wchar_t>*
1407 __try_use_facet<num_get<wchar_t> >(
const locale&) _GLIBCXX_NOTHROW;
1410 const ctype<wchar_t>&
1411 use_facet<ctype<wchar_t> >(
const locale&);
1414 const numpunct<wchar_t>&
1415 use_facet<numpunct<wchar_t> >(
const locale&);
1418 const num_put<wchar_t>&
1419 use_facet<num_put<wchar_t> >(
const locale&);
1422 const num_get<wchar_t>&
1423 use_facet<num_get<wchar_t> >(
const locale&);
1427 has_facet<ctype<wchar_t> >(
const locale&);
1431 has_facet<numpunct<wchar_t> >(
const locale&);
1435 has_facet<num_put<wchar_t> >(
const locale&);
1439 has_facet<num_get<wchar_t> >(
const locale&);
1443 _GLIBCXX_END_NAMESPACE_VERSION
1446 #pragma GCC diagnostic pop
ISO C++ entities toplevel namespace is std.
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
constexpr _Iterator __base(_Iterator __it)
Basis for explicit traits specializations.
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
void reserve(size_type __res_arg)
Attempt to preallocate enough memory for specified number of characters.
The base of the I/O class hierarchy.
_Ios_Fmtflags fmtflags
This is a bitmask type.
_Ios_Iostate iostate
This is a bitmask type.
static const fmtflags hex
Converts integer input or generates integer output in hexadecimal base.
static const fmtflags uppercase
Replaces certain lowercase letters with their uppercase equivalents in generated output.
static const fmtflags basefield
A mask of dec|oct|hex. Useful for the 2-arg form of setf.
const locale & _M_getloc() const
Locale access.
static const fmtflags showbase
Generates a prefix indicating the numeric base of generated integer output.
static const fmtflags internal
Adds fill characters at a designated internal point in certain generated output, or identical to righ...
static const fmtflags boolalpha
Insert/extract bool in alphabetic rather than numeric format.
fmtflags flags() const
Access to format flags.
static const iostate eofbit
Indicates that an input operation reached the end of an input sequence.
static const fmtflags floatfield
A mask of scientific|fixed. Useful for the 2-arg form of setf.
static const iostate goodbit
Indicates all is well.
streamsize width() const
Flags access.
static const fmtflags fixed
Generate floating-point output in fixed-point notation.
static const fmtflags oct
Converts integer input or generates integer output in octal base.
static const fmtflags left
Adds fill characters on the right (final positions) of certain generated output. (I....
static const fmtflags showpos
Generates a + sign in non-negative generated numeric output.
static const iostate failbit
Indicates that an input operation failed to read the expected characters, or that an output operation...
static const fmtflags adjustfield
A mask of left|right|internal. Useful for the 2-arg form of setf.
Container class for localization functionality.
static locale::id id
Numpunct facet id.
Primary class template num_get.
_InIter iter_type
Public typedefs.
_CharT char_type
Public typedefs.
virtual iter_type do_get(iter_type, iter_type, ios_base &, ios_base::iostate &, bool &) const
Numeric parsing.
Primary class template num_put.
virtual iter_type do_put(iter_type __s, ios_base &__io, char_type __fill, bool __v) const
Numeric formatting.
_CharT char_type
Public typedefs.
_OutIter iter_type
Public typedefs.