30 #ifndef _LOCALE_FACETS_NONIO_TCC
31 #define _LOCALE_FACETS_NONIO_TCC 1
33 #pragma GCC system_header
35 namespace std _GLIBCXX_VISIBILITY(default)
37 _GLIBCXX_BEGIN_NAMESPACE_VERSION
39 template<
typename _CharT,
bool _Intl>
40 struct __use_cache<__moneypunct_cache<_CharT, _Intl> >
42 const __moneypunct_cache<_CharT, _Intl>*
43 operator() (
const locale& __loc)
const
45 const size_t __i = moneypunct<_CharT, _Intl>::id._M_id();
46 const locale::facet** __caches = __loc._M_impl->_M_caches;
49 __moneypunct_cache<_CharT, _Intl>* __tmp = 0;
52 __tmp =
new __moneypunct_cache<_CharT, _Intl>;
53 __tmp->_M_cache(__loc);
58 __throw_exception_again;
60 __loc._M_impl->_M_install_cache(__tmp, __i);
63 const __moneypunct_cache<_CharT, _Intl>*
>(__caches[__i]);
67 template<
typename _CharT,
bool _Intl>
69 __moneypunct_cache<_CharT, _Intl>::_M_cache(
const locale& __loc)
73 const moneypunct<_CharT, _Intl>& __mp =
74 use_facet<moneypunct<_CharT, _Intl> >(__loc);
76 _M_decimal_point = __mp.decimal_point();
77 _M_thousands_sep = __mp.thousands_sep();
78 _M_frac_digits = __mp.frac_digits();
81 _CharT* __curr_symbol = 0;
82 _CharT* __positive_sign = 0;
83 _CharT* __negative_sign = 0;
86 _M_grouping_size = __mp.grouping().size();
87 __grouping =
new char[_M_grouping_size];
88 __mp.grouping().copy(__grouping, _M_grouping_size);
89 _M_grouping = __grouping;
90 _M_use_grouping = (_M_grouping_size
91 &&
static_cast<signed char>(_M_grouping[0]) > 0
93 != __gnu_cxx::__numeric_traits<char>::__max));
95 _M_curr_symbol_size = __mp.curr_symbol().size();
96 __curr_symbol =
new _CharT[_M_curr_symbol_size];
97 __mp.curr_symbol().copy(__curr_symbol, _M_curr_symbol_size);
98 _M_curr_symbol = __curr_symbol;
100 _M_positive_sign_size = __mp.positive_sign().size();
101 __positive_sign =
new _CharT[_M_positive_sign_size];
102 __mp.positive_sign().copy(__positive_sign, _M_positive_sign_size);
103 _M_positive_sign = __positive_sign;
105 _M_negative_sign_size = __mp.negative_sign().size();
106 __negative_sign =
new _CharT[_M_negative_sign_size];
107 __mp.negative_sign().copy(__negative_sign, _M_negative_sign_size);
108 _M_negative_sign = __negative_sign;
110 _M_pos_format = __mp.pos_format();
111 _M_neg_format = __mp.neg_format();
113 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__loc);
114 __ct.widen(money_base::_S_atoms,
115 money_base::_S_atoms + money_base::_S_end, _M_atoms);
119 delete [] __grouping;
120 delete [] __curr_symbol;
121 delete [] __positive_sign;
122 delete [] __negative_sign;
123 __throw_exception_again;
127 _GLIBCXX_BEGIN_NAMESPACE_LDBL
129 template<
typename _CharT,
typename _InIter>
132 money_get<_CharT, _InIter>::
133 _M_extract(iter_type __beg, iter_type __end, ios_base& __io,
136 typedef char_traits<_CharT> __traits_type;
137 typedef typename string_type::size_type size_type;
138 typedef money_base::part part;
139 typedef __moneypunct_cache<_CharT, _Intl> __cache_type;
141 const locale& __loc = __io._M_getloc();
142 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
144 __use_cache<__cache_type> __uc;
145 const __cache_type* __lc = __uc(__loc);
146 const char_type* __lit = __lc->_M_atoms;
149 bool __negative =
false;
151 size_type __sign_size = 0;
153 const bool __mandatory_sign = (__lc->_M_positive_sign_size
154 && __lc->_M_negative_sign_size);
156 string __grouping_tmp;
157 if (__lc->_M_use_grouping)
158 __grouping_tmp.reserve(32);
164 bool __testvalid =
true;
166 bool __testdecfound =
false;
172 const char_type* __lit_zero = __lit + money_base::_S_zero;
173 const money_base::pattern __p = __lc->_M_neg_format;
174 for (
int __i = 0; __i < 4 && __testvalid; ++__i)
176 const part __which =
static_cast<part
>(__p.field[__i]);
179 case money_base::symbol:
186 || (__i == 1 && (__mandatory_sign
187 || (
static_cast<part
>(__p.field[0])
189 || (
static_cast<part
>(__p.field[2])
190 == money_base::space)))
191 || (__i == 2 && ((
static_cast<part
>(__p.field[3])
192 == money_base::value)
194 && (
static_cast<part
>(__p.field[3])
195 == money_base::sign)))))
197 const size_type __len = __lc->_M_curr_symbol_size;
199 for (; __beg != __end && __j < __len
200 && *__beg == __lc->_M_curr_symbol[__j];
207 case money_base::sign:
209 if (__lc->_M_positive_sign_size && __beg != __end
210 && *__beg == __lc->_M_positive_sign[0])
212 __sign_size = __lc->_M_positive_sign_size;
215 else if (__lc->_M_negative_sign_size && __beg != __end
216 && *__beg == __lc->_M_negative_sign[0])
219 __sign_size = __lc->_M_negative_sign_size;
222 else if (__lc->_M_positive_sign_size
223 && !__lc->_M_negative_sign_size)
227 else if (__mandatory_sign)
230 case money_base::value:
233 for (; __beg != __end; ++__beg)
235 const char_type __c = *__beg;
236 const char_type* __q = __traits_type::find(__lit_zero,
240 __res += money_base::_S_atoms[__q - __lit];
243 else if (__c == __lc->_M_decimal_point
246 if (__lc->_M_frac_digits <= 0)
251 __testdecfound =
true;
253 else if (__lc->_M_use_grouping
254 && __c == __lc->_M_thousands_sep
260 __grouping_tmp +=
static_cast<char>(__n);
275 case money_base::space:
277 if (__beg != __end && __ctype.is(ctype_base::space, *__beg))
281 case money_base::none:
284 for (; __beg != __end
285 && __ctype.is(ctype_base::space, *__beg); ++__beg);
291 if (__sign_size > 1 && __testvalid)
293 const char_type* __sign = __negative ? __lc->_M_negative_sign
294 : __lc->_M_positive_sign;
296 for (; __beg != __end && __i < __sign_size
297 && *__beg == __sign[__i]; ++__beg, ++__i);
299 if (__i != __sign_size)
306 if (__res.size() > 1)
308 const size_type __first = __res.find_first_not_of(
'0');
311 __res.erase(0, __only_zeros ? __res.size() - 1 : __first);
315 if (__negative && __res[0] !=
'0')
316 __res.insert(__res.begin(),
'-');
319 if (__grouping_tmp.size())
322 __grouping_tmp +=
static_cast<char>(__testdecfound ? __last_pos
324 if (!std::__verify_grouping(__lc->_M_grouping,
325 __lc->_M_grouping_size,
331 if (__testdecfound && __n != __lc->_M_frac_digits)
347 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
348 template<
typename _CharT,
typename _InIter>
350 money_get<_CharT, _InIter>::
351 __do_get(iter_type __beg, iter_type __end,
bool __intl, ios_base& __io,
355 __beg = __intl ? _M_extract<true>(__beg, __end, __io, __err, __str)
356 : _M_extract<false>(__beg, __end, __io, __err, __str);
357 std::__convert_to_v(__str.c_str(), __units, __err, _S_get_c_locale());
362 template<
typename _CharT,
typename _InIter>
366 ios_base::iostate& __err,
long double& __units)
const
369 __beg = __intl ? _M_extract<true>(__beg, __end, __io, __err, __str)
370 : _M_extract<false>(__beg, __end, __io, __err, __str);
371 std::__convert_to_v(__str.
c_str(), __units, __err, _S_get_c_locale());
375 template<
typename _CharT,
typename _InIter>
379 ios_base::iostate& __err,
string_type& __digits)
const
381 typedef typename string::size_type size_type;
384 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
387 __beg = __intl ? _M_extract<true>(__beg, __end, __io, __err, __str)
388 : _M_extract<false>(__beg, __end, __io, __err, __str);
389 const size_type __len = __str.size();
393 __ctype.
widen(__str.data(), __str.data() + __len, &__digits[0]);
398 template<
typename _CharT,
typename _OutIter>
403 const string_type& __digits)
const
405 typedef typename string_type::size_type size_type;
406 typedef money_base::part part;
407 typedef __moneypunct_cache<_CharT, _Intl> __cache_type;
410 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
412 __use_cache<__cache_type> __uc;
413 const __cache_type* __lc = __uc(__loc);
414 const char_type* __lit = __lc->_M_atoms;
418 const char_type* __beg = __digits.data();
420 money_base::pattern __p;
421 const char_type* __sign;
422 size_type __sign_size;
423 if (!(*__beg == __lit[money_base::_S_minus]))
425 __p = __lc->_M_pos_format;
426 __sign = __lc->_M_positive_sign;
427 __sign_size = __lc->_M_positive_sign_size;
431 __p = __lc->_M_neg_format;
432 __sign = __lc->_M_negative_sign;
433 __sign_size = __lc->_M_negative_sign_size;
439 size_type __len = __ctype.
scan_not(ctype_base::digit, __beg,
440 __beg + __digits.size()) - __beg;
447 __value.reserve(2 * __len);
451 long __paddec = __len - __lc->_M_frac_digits;
454 if (__lc->_M_frac_digits < 0)
456 if (__lc->_M_grouping_size)
458 __value.assign(2 * __paddec, char_type());
460 std::__add_grouping(&__value[0], __lc->_M_thousands_sep,
462 __lc->_M_grouping_size,
463 __beg, __beg + __paddec);
464 __value.erase(__vend - &__value[0]);
467 __value.assign(__beg, __paddec);
471 if (__lc->_M_frac_digits > 0)
473 __value += __lc->_M_decimal_point;
475 __value.append(__beg + __paddec, __lc->_M_frac_digits);
479 __value.append(-__paddec, __lit[money_base::_S_zero]);
480 __value.append(__beg, __len);
487 __len = __value.size() + __sign_size;
489 ? __lc->_M_curr_symbol_size : 0);
492 __res.reserve(2 * __len);
494 const size_type __width =
static_cast<size_type
>(__io.
width());
498 for (
int __i = 0; __i < 4; ++__i)
500 const part __which =
static_cast<part
>(__p.field[__i]);
503 case money_base::symbol:
505 __res.append(__lc->_M_curr_symbol,
506 __lc->_M_curr_symbol_size);
508 case money_base::sign:
515 case money_base::value:
518 case money_base::space:
523 __res.append(__width - __len, __fill);
527 case money_base::none:
529 __res.append(__width - __len, __fill);
536 __res.append(__sign + 1, __sign_size - 1);
539 __len = __res.size();
544 __res.append(__width - __len, __fill);
547 __res.insert(0, __width - __len, __fill);
552 __s = std::__write(__s, __res.data(), __len);
558 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
559 template<
typename _CharT,
typename _OutIter>
561 money_put<_CharT, _OutIter>::
562 __do_put(iter_type __s,
bool __intl, ios_base& __io, char_type __fill,
563 double __units)
const
564 {
return this->do_put(__s, __intl, __io, __fill, (
long double) __units); }
567 template<
typename _CharT,
typename _OutIter>
571 long double __units)
const
574 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
575 #ifdef _GLIBCXX_USE_C99
578 char* __cs =
static_cast<char*
>(__builtin_alloca(__cs_size));
581 int __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
582 "%.*Lf", 0, __units);
584 if (__len >= __cs_size)
586 __cs_size = __len + 1;
587 __cs =
static_cast<char*
>(__builtin_alloca(__cs_size));
588 __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
589 "%.*Lf", 0, __units);
593 const int __cs_size =
594 __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 3;
595 char* __cs =
static_cast<char*
>(__builtin_alloca(__cs_size));
596 int __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0,
"%.*Lf",
600 __ctype.
widen(__cs, __cs + __len, &__digits[0]);
601 return __intl ? _M_insert<true>(__s, __io, __fill, __digits)
602 : _M_insert<false>(__s, __io, __fill, __digits);
605 template<
typename _CharT,
typename _OutIter>
610 {
return __intl ? _M_insert<true>(__s, __io, __fill, __digits)
611 : _M_insert<false>(__s, __io, __fill, __digits); }
613 _GLIBCXX_END_NAMESPACE_LDBL
618 template<
typename _CharT,
typename _InIter>
621 {
return time_base::no_order; }
625 template<
typename _CharT,
typename _InIter>
629 ios_base::iostate& __err, tm* __tm,
630 const _CharT* __format)
const
633 const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
634 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
639 for (; __beg != __end && __i < __len && !__tmperr; ++__i)
641 if (__ctype.narrow(__format[__i], 0) ==
'%')
644 char __c = __ctype.narrow(__format[++__i], 0);
646 if (__c ==
'E' || __c ==
'O')
647 __c = __ctype.narrow(__format[++__i], 0);
654 const char_type* __days1[7];
655 __tp._M_days_abbreviated(__days1);
656 __beg = _M_extract_name(__beg, __end, __tm->tm_wday, __days1,
661 const char_type* __days2[7];
662 __tp._M_days(__days2);
663 __beg = _M_extract_name(__beg, __end, __tm->tm_wday, __days2,
669 const char_type* __months1[12];
670 __tp._M_months_abbreviated(__months1);
671 __beg = _M_extract_name(__beg, __end, __tm->tm_mon,
672 __months1, 12, __io, __tmperr);
676 const char_type* __months2[12];
677 __tp._M_months(__months2);
678 __beg = _M_extract_name(__beg, __end, __tm->tm_mon,
679 __months2, 12, __io, __tmperr);
683 const char_type* __dt[2];
684 __tp._M_date_time_formats(__dt);
685 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
690 __beg = _M_extract_num(__beg, __end, __tm->tm_mday, 1, 31, 2,
696 if (__ctype.is(ctype_base::space, *__beg))
697 __beg = _M_extract_num(++__beg, __end, __tm->tm_mday, 1, 9,
700 __beg = _M_extract_num(__beg, __end, __tm->tm_mday, 10, 31,
706 __ctype.widen(__cs, __cs + 9, __wcs);
707 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
712 __beg = _M_extract_num(__beg, __end, __tm->tm_hour, 0, 23, 2,
717 __beg = _M_extract_num(__beg, __end, __tm->tm_hour, 1, 12, 2,
722 __beg = _M_extract_num(__beg, __end, __mem, 1, 12, 2,
725 __tm->tm_mon = __mem - 1;
729 __beg = _M_extract_num(__beg, __end, __tm->tm_min, 0, 59, 2,
733 if (__ctype.narrow(*__beg, 0) ==
'\n')
741 __ctype.widen(__cs, __cs + 6, __wcs);
742 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
748 #ifdef _GLIBCXX_USE_C99
749 __beg = _M_extract_num(__beg, __end, __tm->tm_sec, 0, 60, 2,
751 __beg = _M_extract_num(__beg, __end, __tm->tm_sec, 0, 61, 2,
756 if (__ctype.narrow(*__beg, 0) ==
'\t')
764 __ctype.widen(__cs, __cs + 9, __wcs);
765 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
770 const char_type* __dates[2];
771 __tp._M_date_formats(__dates);
772 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
777 const char_type* __times[2];
778 __tp._M_time_formats(__times);
779 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
790 __beg = _M_extract_num(__beg, __end, __mem, 0, 9999, 4,
793 __tm->tm_year = __mem < 0 ? __mem + 100 : __mem - 1900;
797 if (__ctype.is(ctype_base::upper, *__beg))
800 __beg = _M_extract_name(__beg, __end, __tmp,
801 __timepunct_cache<_CharT>::_S_timezones,
805 if (__beg != __end && !__tmperr && __tmp == 0
806 && (*__beg == __ctype.widen(
'-')
807 || *__beg == __ctype.widen(
'+')))
809 __beg = _M_extract_num(__beg, __end, __tmp, 0, 23, 2,
811 __beg = _M_extract_num(__beg, __end, __tmp, 0, 59, 2,
826 if (__format[__i] == *__beg)
833 if (__tmperr || __i != __len)
839 template<
typename _CharT,
typename _InIter>
841 time_get<_CharT, _InIter>::
842 _M_extract_num(iter_type __beg, iter_type __end,
int& __member,
843 int __min,
int __max,
size_t __len,
846 const locale& __loc = __io._M_getloc();
847 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
850 int __mult = __len == 2 ? 10 : (__len == 4 ? 1000 : 1);
855 for (; __beg != __end && __i < __len; ++__beg, ++__i)
857 const char __c = __ctype.narrow(*__beg,
'*');
858 if (__c >=
'0' && __c <=
'9')
860 __value = __value * 10 + (__c -
'0');
861 const int __valuec = __value * __mult;
862 if (__valuec > __max || __valuec + __mult < __min)
872 else if (__len == 4 && __i == 2)
873 __member = __value - 100;
882 template<
typename _CharT,
typename _InIter>
884 time_get<_CharT, _InIter>::
885 _M_extract_name(iter_type __beg, iter_type __end,
int& __member,
886 const _CharT** __names,
size_t __indexlen,
889 typedef char_traits<_CharT> __traits_type;
890 const locale& __loc = __io._M_getloc();
891 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
893 int* __matches =
static_cast<int*
>(__builtin_alloca(
sizeof(
int)
895 size_t __nmatches = 0;
897 bool __testvalid =
true;
898 const char_type* __name;
906 const char_type __c = *__beg;
907 for (
size_t __i1 = 0; __i1 < __indexlen; ++__i1)
908 if (__c == __names[__i1][0]
909 || __c == __ctype.toupper(__names[__i1][0]))
910 __matches[__nmatches++] = __i1;
913 while (__nmatches > 1)
916 size_t __minlen = __traits_type::length(__names[__matches[0]]);
917 for (
size_t __i2 = 1; __i2 < __nmatches; ++__i2)
919 __traits_type::length(__names[__matches[__i2]]));
921 if (__pos < __minlen && __beg != __end)
922 for (
size_t __i3 = 0; __i3 < __nmatches;)
924 __name = __names[__matches[__i3]];
925 if (!(__name[__pos] == *__beg))
926 __matches[__i3] = __matches[--__nmatches];
938 __name = __names[__matches[0]];
939 const size_t __len = __traits_type::length(__name);
940 while (__pos < __len && __beg != __end && __name[__pos] == *__beg)
944 __member = __matches[0];
956 template<
typename _CharT,
typename _InIter>
958 time_get<_CharT, _InIter>::
959 _M_extract_wday_or_month(iter_type __beg, iter_type __end,
int& __member,
960 const _CharT** __names,
size_t __indexlen,
963 typedef char_traits<_CharT> __traits_type;
964 const locale& __loc = __io._M_getloc();
965 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
967 int* __matches =
static_cast<int*
>(__builtin_alloca(2 *
sizeof(
int)
969 size_t __nmatches = 0;
970 size_t* __matches_lengths = 0;
975 const char_type __c = *__beg;
976 for (
size_t __i = 0; __i < 2 * __indexlen; ++__i)
977 if (__c == __names[__i][0]
978 || __c == __ctype.toupper(__names[__i][0]))
979 __matches[__nmatches++] = __i;
987 =
static_cast<size_t*
>(__builtin_alloca(
sizeof(
size_t)
989 for (
size_t __i = 0; __i < __nmatches; ++__i)
990 __matches_lengths[__i]
991 = __traits_type::length(__names[__matches[__i]]);
994 for (; __beg != __end; ++__beg, ++__pos)
996 size_t __nskipped = 0;
997 const char_type __c = *__beg;
998 for (
size_t __i = 0; __i < __nmatches;)
1000 const char_type* __name = __names[__matches[__i]];
1001 if (__pos >= __matches_lengths[__i])
1002 ++__nskipped, ++__i;
1003 else if (!(__name[__pos] == __c))
1006 __matches[__i] = __matches[__nmatches];
1007 __matches_lengths[__i] = __matches_lengths[__nmatches];
1012 if (__nskipped == __nmatches)
1016 if ((__nmatches == 1 && __matches_lengths[0] == __pos)
1017 || (__nmatches == 2 && (__matches_lengths[0] == __pos
1018 || __matches_lengths[1] == __pos)))
1019 __member = (__matches[0] >= __indexlen
1020 ? __matches[0] - __indexlen : __matches[0]);
1027 template<
typename _CharT,
typename _InIter>
1031 ios_base::iostate& __err, tm* __tm)
const
1034 const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
1036 __tp._M_time_formats(__times);
1037 __beg = _M_extract_via_format(__beg, __end, __io, __err,
1044 template<
typename _CharT,
typename _InIter>
1048 ios_base::iostate& __err, tm* __tm)
const
1051 const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
1053 __tp._M_date_formats(__dates);
1054 __beg = _M_extract_via_format(__beg, __end, __io, __err,
1061 template<
typename _CharT,
typename _InIter>
1065 ios_base::iostate& __err, tm* __tm)
const
1069 const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
1070 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
1072 __tp._M_days_abbreviated(__days);
1073 __tp._M_days(__days + 7);
1077 __beg = _M_extract_wday_or_month(__beg, __end, __tmpwday, __days, 7,
1080 __tm->tm_wday = __tmpwday;
1089 template<
typename _CharT,
typename _InIter>
1093 ios_base& __io, ios_base::iostate& __err, tm* __tm)
const
1097 const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
1098 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
1100 __tp._M_months_abbreviated(__months);
1101 __tp._M_months(__months + 12);
1105 __beg = _M_extract_wday_or_month(__beg, __end, __tmpmon, __months, 12,
1108 __tm->tm_mon = __tmpmon;
1117 template<
typename _CharT,
typename _InIter>
1121 ios_base::iostate& __err, tm* __tm)
const
1124 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
1128 __beg = _M_extract_num(__beg, __end, __tmpyear, 0, 9999, 4,
1131 __tm->tm_year = __tmpyear < 0 ? __tmpyear + 100 : __tmpyear - 1900;
1140 template<
typename _CharT,
typename _OutIter>
1144 const _CharT* __beg,
const _CharT* __end)
const
1147 ctype<_CharT> const& __ctype = use_facet<ctype<_CharT> >(__loc);
1148 for (; __beg != __end; ++__beg)
1149 if (__ctype.
narrow(*__beg, 0) !=
'%')
1154 else if (++__beg != __end)
1158 const char __c = __ctype.
narrow(*__beg, 0);
1159 if (__c !=
'E' && __c !=
'O')
1161 else if (++__beg != __end)
1164 __format = __ctype.
narrow(*__beg, 0);
1168 __s = this->do_put(__s, __io, __fill, __tm, __format, __mod);
1175 template<
typename _CharT,
typename _OutIter>
1179 char __format,
char __mod)
const
1182 ctype<_CharT> const& __ctype = use_facet<ctype<_CharT> >(__loc);
1183 __timepunct<_CharT>
const& __tp = use_facet<__timepunct<_CharT> >(__loc);
1187 const size_t __maxlen = 128;
1196 __fmt[0] = __ctype.
widen(
'%');
1199 __fmt[1] = __format;
1205 __fmt[2] = __format;
1209 __tp._M_put(__res, __maxlen, __fmt, __tm);
1218 #if _GLIBCXX_EXTERN_TEMPLATE
1225 extern template class __timepunct<char>;
1235 use_facet<moneypunct<char, true> >(
const locale&);
1239 use_facet<moneypunct<char, false> >(
const locale&);
1243 use_facet<money_put<char> >(
const locale&);
1247 use_facet<money_get<char> >(
const locale&);
1250 const __timepunct<char>&
1251 use_facet<__timepunct<char> >(
const locale&);
1255 use_facet<time_put<char> >(
const locale&);
1259 use_facet<time_get<char> >(
const locale&);
1263 use_facet<messages<char> >(
const locale&);
1267 has_facet<moneypunct<char> >(
const locale&);
1271 has_facet<money_put<char> >(
const locale&);
1275 has_facet<money_get<char> >(
const locale&);
1279 has_facet<__timepunct<char> >(
const locale&);
1283 has_facet<time_put<char> >(
const locale&);
1287 has_facet<time_get<char> >(
const locale&);
1291 has_facet<messages<char> >(
const locale&);
1293 #ifdef _GLIBCXX_USE_WCHAR_T
1300 extern template class __timepunct<wchar_t>;
1310 use_facet<moneypunct<wchar_t, true> >(
const locale&);
1314 use_facet<moneypunct<wchar_t, false> >(
const locale&);
1318 use_facet<money_put<wchar_t> >(
const locale&);
1322 use_facet<money_get<wchar_t> >(
const locale&);
1325 const __timepunct<wchar_t>&
1326 use_facet<__timepunct<wchar_t> >(
const locale&);
1330 use_facet<time_put<wchar_t> >(
const locale&);
1334 use_facet<time_get<wchar_t> >(
const locale&);
1338 use_facet<messages<wchar_t> >(
const locale&);
1342 has_facet<moneypunct<wchar_t> >(
const locale&);
1346 has_facet<money_put<wchar_t> >(
const locale&);
1350 has_facet<money_get<wchar_t> >(
const locale&);
1354 has_facet<__timepunct<wchar_t> >(
const locale&);
1358 has_facet<time_put<wchar_t> >(
const locale&);
1362 has_facet<time_get<wchar_t> >(
const locale&);
1366 has_facet<messages<wchar_t> >(
const locale&);
1370 _GLIBCXX_END_NAMESPACE_VERSION
void resize(size_type __n, _CharT __c)
Resizes the string to the specified number of characters.
_InIter iter_type
Public typedefs.
_Ios_Iostate iostate
This is a bitmask type.
Primary class template money_put.This facet encapsulates the code to format and output a monetary amo...
Primary class template ctype facet.This template class defines classification and conversion function...
static const iostate failbit
Indicates that an input operation failed to read the expected characters, or that an output operation...
Primary class template time_put.This facet encapsulates the code to format and output dates and times...
_CharT char_type
Public typedefs.
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
_Ios_Fmtflags fmtflags
This is a bitmask type.
const char_type * scan_not(mask __m, const char_type *__lo, const char_type *__hi) const
Find char_type not matching a mask.
static const fmtflags adjustfield
A mask of left|right|internal. Useful for the 2-arg form of setf.
virtual iter_type do_put(iter_type __s, ios_base &__io, char_type __fill, const tm *__tm, char __format, char __mod) const
Format and output a time or date.
The base of the I/O class hierarchy.This class defines everything that can be defined about I/O that ...
virtual iter_type do_get_weekday(iter_type __beg, iter_type __end, ios_base &, ios_base::iostate &__err, tm *__tm) const
Parse input weekday string.
class moneypunct_byname [22.2.6.4].
static const iostate goodbit
Indicates all is well.
locale getloc() const
Locale access.
char_type widen(char __c) const
Widen char to char_type.
_OutIter iter_type
Public typedefs.
_OutIter iter_type
Public typedefs.
Primary class template money_get.This facet encapsulates the code to parse and return a monetary amou...
virtual dateorder do_date_order() const
Return preferred order of month, day, and year.
static const size_type npos
Value returned by various member functions when they fail.
class time_get_byname [22.2.5.2].
static const fmtflags showbase
Generates a prefix indicating the numeric base of generated integer output.
_CharT char_type
Public typedefs.
Container class for localization functionality.The locale class is first a class wrapper for C librar...
class messages_byname [22.2.7.2].
const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
virtual iter_type do_get_date(iter_type __beg, iter_type __end, ios_base &__io, ios_base::iostate &__err, tm *__tm) const
Parse input date string.
Primary class template messages.This facet encapsulates the code to retrieve messages from message ca...
virtual iter_type do_get_monthname(iter_type __beg, iter_type __end, ios_base &, ios_base::iostate &__err, tm *__tm) const
Parse input month string.
Primary class template time_get.This facet encapsulates the code to parse and return a date or time f...
iter_type put(iter_type __s, ios_base &__io, char_type __fill, const tm *__tm, const _CharT *__beg, const _CharT *__end) const
Format and output a time or date.
Primary class template moneypunct.This facet encapsulates the punctuation, grouping and other formatt...
Basis for explicit traits specializations.
virtual iter_type do_get_year(iter_type __beg, iter_type __end, ios_base &__io, ios_base::iostate &__err, tm *__tm) const
Parse input year string.
_CharT char_type
Public typedefs.
static const iostate eofbit
Indicates that an input operation reached the end of an input sequence.
fmtflags flags() const
Access to format flags.
virtual iter_type do_put(iter_type __s, bool __intl, ios_base &__io, char_type __fill, long double __units) const
Format and output a monetary value.
_InIter iter_type
Public typedefs.
streamsize width() const
Flags access.
static const fmtflags internal
Adds fill characters at a designated internal point in certain generated output, or identical to righ...
virtual iter_type do_get(iter_type __s, iter_type __end, bool __intl, ios_base &__io, ios_base::iostate &__err, long double &__units) const
Read and parse a monetary value.
class time_put_byname [22.2.5.4].
char narrow(char_type __c, char __dfault) const
Narrow char_type to char.
static const fmtflags left
Adds fill characters on the right (final positions) of certain generated output. (I.e., the thing you print is flush left.)
const locale & _M_getloc() const
Locale access.
virtual iter_type do_get_time(iter_type __beg, iter_type __end, ios_base &__io, ios_base::iostate &__err, tm *__tm) const
Parse input time string.