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
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)
71 const moneypunct<_CharT, _Intl>& __mp =
72 use_facet<moneypunct<_CharT, _Intl> >(__loc);
74 _M_decimal_point = __mp.decimal_point();
75 _M_thousands_sep = __mp.thousands_sep();
76 _M_frac_digits = __mp.frac_digits();
79 _CharT* __curr_symbol = 0;
80 _CharT* __positive_sign = 0;
81 _CharT* __negative_sign = 0;
85 const string& __g = __mp.grouping();
86 __sz = _M_grouping_size = __g.size();
87 __grouping =
new char[__sz];
88 __g.copy(__grouping, __sz);
89 _M_use_grouping = (_M_grouping_size
90 &&
static_cast<signed char>(__grouping[0]) > 0
92 != __gnu_cxx::__numeric_traits<char>::__max));
94 const basic_string<_CharT>& __cs = __mp.curr_symbol();
95 __sz = _M_curr_symbol_size = __cs.size();
96 __curr_symbol =
new _CharT[__sz];
97 __cs.copy(__curr_symbol, __sz);
99 const basic_string<_CharT>& __ps = __mp.positive_sign();
100 __sz = _M_positive_sign_size = __ps.size();
101 __positive_sign =
new _CharT[__sz];
102 __ps.copy(__positive_sign, __sz);
104 const basic_string<_CharT>& __ns = __mp.negative_sign();
105 __sz = _M_negative_sign_size = __ns.size();
106 __negative_sign =
new _CharT[__sz];
107 __ns.copy(__negative_sign, __sz);
109 _M_pos_format = __mp.pos_format();
110 _M_neg_format = __mp.neg_format();
112 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__loc);
113 __ct.widen(money_base::_S_atoms,
114 money_base::_S_atoms + money_base::_S_end, _M_atoms);
116 _M_grouping = __grouping;
117 _M_curr_symbol = __curr_symbol;
118 _M_positive_sign = __positive_sign;
119 _M_negative_sign = __negative_sign;
124 delete [] __grouping;
125 delete [] __curr_symbol;
126 delete [] __positive_sign;
127 delete [] __negative_sign;
128 __throw_exception_again;
132 _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11
134 template<
typename _CharT,
typename _InIter>
137 money_get<_CharT, _InIter>::
138 _M_extract(iter_type __beg, iter_type __end, ios_base& __io,
141 typedef char_traits<_CharT> __traits_type;
142 typedef typename string_type::size_type size_type;
143 typedef money_base::part part;
144 typedef __moneypunct_cache<_CharT, _Intl> __cache_type;
146 const locale& __loc = __io._M_getloc();
147 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
149 __use_cache<__cache_type> __uc;
150 const __cache_type* __lc = __uc(__loc);
151 const char_type* __lit = __lc->_M_atoms;
154 bool __negative =
false;
156 size_type __sign_size = 0;
158 const bool __mandatory_sign = (__lc->_M_positive_sign_size
159 && __lc->_M_negative_sign_size);
161 string __grouping_tmp;
162 if (__lc->_M_use_grouping)
163 __grouping_tmp.reserve(32);
169 bool __testvalid =
true;
171 bool __testdecfound =
false;
177 const char_type* __lit_zero = __lit + money_base::_S_zero;
178 const money_base::pattern __p = __lc->_M_neg_format;
179 for (
int __i = 0; __i < 4 && __testvalid; ++__i)
181 const part __which =
static_cast<part
>(__p.field[__i]);
184 case money_base::symbol:
191 || (__i == 1 && (__mandatory_sign
192 || (
static_cast<part
>(__p.field[0])
194 || (
static_cast<part
>(__p.field[2])
195 == money_base::space)))
196 || (__i == 2 && ((
static_cast<part
>(__p.field[3])
197 == money_base::value)
199 && (
static_cast<part
>(__p.field[3])
200 == money_base::sign)))))
202 const size_type __len = __lc->_M_curr_symbol_size;
204 for (; __beg != __end && __j < __len
205 && *__beg == __lc->_M_curr_symbol[__j];
206 ++__beg, (void)++__j);
212 case money_base::sign:
214 if (__lc->_M_positive_sign_size && __beg != __end
215 && *__beg == __lc->_M_positive_sign[0])
217 __sign_size = __lc->_M_positive_sign_size;
220 else if (__lc->_M_negative_sign_size && __beg != __end
221 && *__beg == __lc->_M_negative_sign[0])
224 __sign_size = __lc->_M_negative_sign_size;
227 else if (__lc->_M_positive_sign_size
228 && !__lc->_M_negative_sign_size)
232 else if (__mandatory_sign)
235 case money_base::value:
238 for (; __beg != __end; ++__beg)
240 const char_type __c = *__beg;
241 const char_type* __q = __traits_type::find(__lit_zero,
245 __res += money_base::_S_atoms[__q - __lit];
248 else if (__c == __lc->_M_decimal_point
251 if (__lc->_M_frac_digits <= 0)
256 __testdecfound =
true;
258 else if (__lc->_M_use_grouping
259 && __c == __lc->_M_thousands_sep
265 __grouping_tmp +=
static_cast<char>(__n);
280 case money_base::space:
282 if (__beg != __end && __ctype.is(ctype_base::space, *__beg))
287 case money_base::none:
290 for (; __beg != __end
291 && __ctype.is(ctype_base::space, *__beg); ++__beg);
297 if (__sign_size > 1 && __testvalid)
299 const char_type* __sign = __negative ? __lc->_M_negative_sign
300 : __lc->_M_positive_sign;
302 for (; __beg != __end && __i < __sign_size
303 && *__beg == __sign[__i]; ++__beg, (void)++__i);
305 if (__i != __sign_size)
312 if (__res.size() > 1)
314 const size_type __first = __res.find_first_not_of(
'0');
317 __res.erase(0, __only_zeros ? __res.size() - 1 : __first);
321 if (__negative && __res[0] !=
'0')
322 __res.insert(__res.begin(),
'-');
325 if (__grouping_tmp.size())
328 __grouping_tmp +=
static_cast<char>(__testdecfound ? __last_pos
330 if (!std::__verify_grouping(__lc->_M_grouping,
331 __lc->_M_grouping_size,
337 if (__testdecfound && __n != __lc->_M_frac_digits)
353 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \
354 && (_GLIBCXX_USE_CXX11_ABI == 0 || defined __LONG_DOUBLE_IEEE128__)
355 template<
typename _CharT,
typename _InIter>
357 money_get<_CharT, _InIter>::
358 __do_get(iter_type __beg, iter_type __end,
bool __intl, ios_base& __io,
362 __beg = __intl ? _M_extract<true>(__beg, __end, __io, __err, __str)
363 : _M_extract<false>(__beg, __end, __io, __err, __str);
364 std::__convert_to_v(__str.c_str(), __units, __err, _S_get_c_locale());
369 template<
typename _CharT,
typename _InIter>
373 ios_base::iostate& __err,
long double& __units)
const
376 __beg = __intl ? _M_extract<true>(__beg, __end, __io, __err, __str)
377 : _M_extract<false>(__beg, __end, __io, __err, __str);
378 std::__convert_to_v(__str.
c_str(), __units, __err, _S_get_c_locale());
382 template<
typename _CharT,
typename _InIter>
386 ios_base::iostate& __err,
string_type& __digits)
const
388 typedef typename string::size_type size_type;
391 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
394 __beg = __intl ? _M_extract<true>(__beg, __end, __io, __err, __str)
395 : _M_extract<false>(__beg, __end, __io, __err, __str);
396 const size_type __len = __str.size();
400 __ctype.
widen(__str.data(), __str.data() + __len, &__digits[0]);
405 #if defined _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT \
406 && defined __LONG_DOUBLE_IEEE128__
407 template<
typename _CharT,
typename _InIter>
411 ios_base::iostate& __err, __ibm128& __units)
const
414 __beg = __intl ? _M_extract<true>(__beg, __end, __io, __err, __str)
415 : _M_extract<false>(__beg, __end, __io, __err, __str);
416 std::__convert_to_v(__str.
c_str(), __units, __err, _S_get_c_locale());
421 template<
typename _CharT,
typename _OutIter>
424 money_put<_CharT, _OutIter>::
425 _M_insert(iter_type __s, ios_base& __io, char_type __fill,
426 const string_type& __digits)
const
428 typedef typename string_type::size_type size_type;
429 typedef money_base::part part;
430 typedef __moneypunct_cache<_CharT, _Intl> __cache_type;
432 const locale& __loc = __io._M_getloc();
433 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
435 __use_cache<__cache_type> __uc;
436 const __cache_type* __lc = __uc(__loc);
437 const char_type* __lit = __lc->_M_atoms;
441 const char_type* __beg = __digits.data();
443 money_base::pattern __p;
444 const char_type* __sign;
445 size_type __sign_size;
446 if (!(*__beg == __lit[money_base::_S_minus]))
448 __p = __lc->_M_pos_format;
449 __sign = __lc->_M_positive_sign;
450 __sign_size = __lc->_M_positive_sign_size;
454 __p = __lc->_M_neg_format;
455 __sign = __lc->_M_negative_sign;
456 __sign_size = __lc->_M_negative_sign_size;
462 size_type __len = __ctype.scan_not(ctype_base::digit, __beg,
463 __beg + __digits.size()) - __beg;
470 __value.reserve(2 * __len);
474 long __paddec = __len - __lc->_M_frac_digits;
477 if (__lc->_M_frac_digits < 0)
479 if (__lc->_M_grouping_size)
481 __value.assign(2 * __paddec, char_type());
483 std::__add_grouping(&__value[0], __lc->_M_thousands_sep,
485 __lc->_M_grouping_size,
486 __beg, __beg + __paddec);
487 __value.erase(__vend - &__value[0]);
490 __value.assign(__beg, __paddec);
494 if (__lc->_M_frac_digits > 0)
496 __value += __lc->_M_decimal_point;
498 __value.append(__beg + __paddec, __lc->_M_frac_digits);
502 __value.append(-__paddec, __lit[money_base::_S_zero]);
503 __value.append(__beg, __len);
510 __len = __value.size() + __sign_size;
512 ? __lc->_M_curr_symbol_size : 0);
515 __res.reserve(2 * __len);
517 const size_type __width =
static_cast<size_type
>(__io.width());
521 for (
int __i = 0; __i < 4; ++__i)
523 const part __which =
static_cast<part
>(__p.field[__i]);
526 case money_base::symbol:
528 __res.append(__lc->_M_curr_symbol,
529 __lc->_M_curr_symbol_size);
531 case money_base::sign:
538 case money_base::value:
541 case money_base::space:
546 __res.append(__width - __len, __fill);
550 case money_base::none:
552 __res.append(__width - __len, __fill);
559 __res.append(__sign + 1, __sign_size - 1);
562 __len = __res.size();
567 __res.append(__width - __len, __fill);
570 __res.insert(0, __width - __len, __fill);
575 __s = std::__write(__s, __res.data(), __len);
581 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \
582 && (_GLIBCXX_USE_CXX11_ABI == 0 || defined __LONG_DOUBLE_IEEE128__)
583 template<
typename _CharT,
typename _OutIter>
585 money_put<_CharT, _OutIter>::
586 __do_put(iter_type __s,
bool __intl, ios_base& __io, char_type __fill,
587 double __units)
const
588 {
return this->do_put(__s, __intl, __io, __fill, (
long double) __units); }
591 template<
typename _CharT,
typename _OutIter>
595 long double __units)
const
598 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
599 #if _GLIBCXX_USE_C99_STDIO
602 char* __cs =
static_cast<char*
>(__builtin_alloca(__cs_size));
605 int __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
606 "%.*Lf", 0, __units);
608 if (__len >= __cs_size)
610 __cs_size = __len + 1;
611 __cs =
static_cast<char*
>(__builtin_alloca(__cs_size));
612 __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
613 "%.*Lf", 0, __units);
617 const int __cs_size =
618 __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 3;
619 char* __cs =
static_cast<char*
>(__builtin_alloca(__cs_size));
620 int __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0,
"%.*Lf",
624 __ctype.
widen(__cs, __cs + __len, &__digits[0]);
625 return __intl ? _M_insert<true>(__s, __io, __fill, __digits)
626 : _M_insert<false>(__s, __io, __fill, __digits);
629 template<
typename _CharT,
typename _OutIter>
634 {
return __intl ? _M_insert<true>(__s, __io, __fill, __digits)
635 : _M_insert<false>(__s, __io, __fill, __digits); }
637 #if defined _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT \
638 && defined __LONG_DOUBLE_IEEE128__
639 template<
typename _CharT,
typename _OutIter>
643 __ibm128 __units)
const
646 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
647 #if _GLIBCXX_USE_C99_STDIO
650 char* __cs =
static_cast<char*
>(__builtin_alloca(__cs_size));
653 int __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
654 "%.*Lf", 0, __units);
656 if (__len >= __cs_size)
658 __cs_size = __len + 1;
659 __cs =
static_cast<char*
>(__builtin_alloca(__cs_size));
660 __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
661 "%.*Lf", 0, __units);
665 const int __cs_size =
666 __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 3;
667 char* __cs =
static_cast<char*
>(__builtin_alloca(__cs_size));
668 int __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0,
"%.*Lf",
671 string_type __digits(__len, char_type());
672 __ctype.
widen(__cs, __cs + __len, &__digits[0]);
673 return __intl ? _M_insert<true>(__s, __io, __fill, __digits)
674 : _M_insert<false>(__s, __io, __fill, __digits);
678 _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11
683 template<
typename _CharT,
typename _InIter>
686 {
return time_base::no_order; }
690 template<
typename _CharT,
typename _InIter>
694 ios_base::iostate& __err, tm* __tm,
695 const _CharT* __format)
const
698 const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
699 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
704 for (; __beg != __end && __i < __len && !__tmperr; ++__i)
706 if (__ctype.narrow(__format[__i], 0) ==
'%')
709 char __c = __ctype.narrow(__format[++__i], 0);
711 if (__c ==
'E' || __c ==
'O')
712 __c = __ctype.narrow(__format[++__i], 0);
719 const char_type* __days1[7];
720 __tp._M_days_abbreviated(__days1);
721 __beg = _M_extract_name(__beg, __end, __mem, __days1,
724 __tm->tm_wday = __mem;
728 const char_type* __days2[7];
729 __tp._M_days(__days2);
730 __beg = _M_extract_name(__beg, __end, __mem, __days2,
733 __tm->tm_wday = __mem;
738 const char_type* __months1[12];
739 __tp._M_months_abbreviated(__months1);
740 __beg = _M_extract_name(__beg, __end, __mem,
741 __months1, 12, __io, __tmperr);
743 __tm->tm_mon = __mem;
747 const char_type* __months2[12];
748 __tp._M_months(__months2);
749 __beg = _M_extract_name(__beg, __end, __mem,
750 __months2, 12, __io, __tmperr);
752 __tm->tm_mon = __mem;
756 const char_type* __dt[2];
757 __tp._M_date_time_formats(__dt);
758 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
763 __beg = _M_extract_num(__beg, __end, __mem, 1, 31, 2,
766 __tm->tm_mday = __mem;
771 if (__ctype.is(ctype_base::space, *__beg))
772 __beg = _M_extract_num(++__beg, __end, __mem, 1, 9,
775 __beg = _M_extract_num(__beg, __end, __mem, 10, 31,
778 __tm->tm_mday = __mem;
783 __ctype.widen(__cs, __cs + 9, __wcs);
784 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
789 __beg = _M_extract_num(__beg, __end, __mem, 0, 23, 2,
792 __tm->tm_hour = __mem;
796 __beg = _M_extract_num(__beg, __end, __mem, 1, 12, 2,
799 __tm->tm_hour = __mem;
803 __beg = _M_extract_num(__beg, __end, __mem, 1, 12, 2,
806 __tm->tm_mon = __mem - 1;
810 __beg = _M_extract_num(__beg, __end, __mem, 0, 59, 2,
813 __tm->tm_min = __mem;
816 if (__ctype.narrow(*__beg, 0) ==
'\n')
824 __ctype.widen(__cs, __cs + 6, __wcs);
825 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
832 __beg = _M_extract_num(__beg, __end, __mem, 0, 60, 2,
834 __beg = _M_extract_num(__beg, __end, __mem, 0, 61, 2,
838 __tm->tm_sec = __mem;
841 if (__ctype.narrow(*__beg, 0) ==
'\t')
849 __ctype.widen(__cs, __cs + 9, __wcs);
850 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
855 const char_type* __dates[2];
856 __tp._M_date_formats(__dates);
857 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
862 const char_type* __times[2];
863 __tp._M_time_formats(__times);
864 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
875 __beg = _M_extract_num(__beg, __end, __mem, 0, 9999, 4,
878 __tm->tm_year = __mem < 0 ? __mem + 100 : __mem - 1900;
882 if (__ctype.is(ctype_base::upper, *__beg))
885 __beg = _M_extract_name(__beg, __end, __tmp,
886 __timepunct_cache<_CharT>::_S_timezones,
890 if (__beg != __end && !__tmperr && __tmp == 0
891 && (*__beg == __ctype.widen(
'-')
892 || *__beg == __ctype.widen(
'+')))
894 __beg = _M_extract_num(__beg, __end, __tmp, 0, 23, 2,
896 __beg = _M_extract_num(__beg, __end, __tmp, 0, 59, 2,
911 if (__format[__i] == *__beg)
918 if (__tmperr || __i != __len)
924 template<
typename _CharT,
typename _InIter>
926 time_get<_CharT, _InIter>::
927 _M_extract_num(iter_type __beg, iter_type __end,
int& __member,
928 int __min,
int __max,
size_t __len,
931 const locale& __loc = __io._M_getloc();
932 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
935 int __mult = __len == 2 ? 10 : (__len == 4 ? 1000 : 1);
940 for (; __beg != __end && __i < __len; ++__beg, (void)++__i)
942 const char __c = __ctype.narrow(*__beg,
'*');
943 if (__c >=
'0' && __c <=
'9')
945 __value = __value * 10 + (__c -
'0');
946 const int __valuec = __value * __mult;
947 if (__valuec > __max || __valuec + __mult < __min)
957 else if (__len == 4 && __i == 2)
958 __member = __value - 100;
967 template<
typename _CharT,
typename _InIter>
969 time_get<_CharT, _InIter>::
970 _M_extract_name(iter_type __beg, iter_type __end,
int& __member,
971 const _CharT** __names,
size_t __indexlen,
974 typedef char_traits<_CharT> __traits_type;
975 const locale& __loc = __io._M_getloc();
976 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
978 int* __matches =
static_cast<int*
>(__builtin_alloca(
sizeof(
int)
980 size_t __nmatches = 0;
982 bool __testvalid =
true;
983 const char_type* __name;
991 const char_type __c = *__beg;
992 for (
size_t __i1 = 0; __i1 < __indexlen; ++__i1)
993 if (__c == __names[__i1][0]
994 || __c == __ctype.toupper(__names[__i1][0]))
995 __matches[__nmatches++] = __i1;
998 while (__nmatches > 1)
1001 size_t __minlen = __traits_type::length(__names[__matches[0]]);
1002 for (
size_t __i2 = 1; __i2 < __nmatches; ++__i2)
1004 __traits_type::length(__names[__matches[__i2]]));
1007 if (__pos < __minlen && __beg != __end)
1008 for (
size_t __i3 = 0; __i3 < __nmatches;)
1010 __name = __names[__matches[__i3]];
1011 if (!(__name[__pos] == *__beg))
1012 __matches[__i3] = __matches[--__nmatches];
1020 if (__nmatches == 1)
1025 __name = __names[__matches[0]];
1026 const size_t __len = __traits_type::length(__name);
1027 while (__pos < __len && __beg != __end && __name[__pos] == *__beg)
1028 ++__beg, (void)++__pos;
1031 __member = __matches[0];
1033 __testvalid =
false;
1036 __testvalid =
false;
1043 template<
typename _CharT,
typename _InIter>
1045 time_get<_CharT, _InIter>::
1046 _M_extract_wday_or_month(iter_type __beg, iter_type __end,
int& __member,
1047 const _CharT** __names,
size_t __indexlen,
1050 typedef char_traits<_CharT> __traits_type;
1051 const locale& __loc = __io._M_getloc();
1052 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
1054 int* __matches =
static_cast<int*
>(__builtin_alloca(2 *
sizeof(
int)
1056 size_t __nmatches = 0;
1057 size_t* __matches_lengths = 0;
1062 const char_type __c = *__beg;
1063 for (
size_t __i = 0; __i < 2 * __indexlen; ++__i)
1064 if (__c == __names[__i][0]
1065 || __c == __ctype.toupper(__names[__i][0]))
1066 __matches[__nmatches++] = __i;
1075 =
static_cast<size_t*
>(__builtin_alloca(
sizeof(
size_t)
1077 for (
size_t __i = 0; __i < __nmatches; ++__i)
1078 __matches_lengths[__i]
1079 = __traits_type::length(__names[__matches[__i]]);
1082 for (; __beg != __end; ++__beg, (void)++__pos)
1084 size_t __nskipped = 0;
1085 const char_type __c = *__beg;
1086 for (
size_t __i = 0; __i < __nmatches;)
1088 const char_type* __name = __names[__matches[__i]];
1089 if (__pos >= __matches_lengths[__i])
1090 ++__nskipped, ++__i;
1091 else if (!(__name[__pos] == __c))
1094 __matches[__i] = __matches[__nmatches];
1095 __matches_lengths[__i] = __matches_lengths[__nmatches];
1100 if (__nskipped == __nmatches)
1104 if ((__nmatches == 1 && __matches_lengths[0] == __pos)
1105 || (__nmatches == 2 && (__matches_lengths[0] == __pos
1106 || __matches_lengths[1] == __pos)))
1107 __member = (__matches[0] >= (
int)__indexlen
1108 ? __matches[0] - (int)__indexlen : __matches[0]);
1115 template<
typename _CharT,
typename _InIter>
1119 ios_base::iostate& __err, tm* __tm)
const
1122 const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
1124 __tp._M_time_formats(__times);
1125 __beg = _M_extract_via_format(__beg, __end, __io, __err,
1132 template<
typename _CharT,
typename _InIter>
1136 ios_base::iostate& __err, tm* __tm)
const
1139 const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
1141 __tp._M_date_formats(__dates);
1142 __beg = _M_extract_via_format(__beg, __end, __io, __err,
1149 template<
typename _CharT,
typename _InIter>
1153 ios_base::iostate& __err, tm* __tm)
const
1156 const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
1158 __tp._M_days_abbreviated(__days);
1159 __tp._M_days(__days + 7);
1163 __beg = _M_extract_wday_or_month(__beg, __end, __tmpwday, __days, 7,
1166 __tm->tm_wday = __tmpwday;
1175 template<
typename _CharT,
typename _InIter>
1179 ios_base& __io, ios_base::iostate& __err, tm* __tm)
const
1182 const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
1184 __tp._M_months_abbreviated(__months);
1185 __tp._M_months(__months + 12);
1189 __beg = _M_extract_wday_or_month(__beg, __end, __tmpmon, __months, 12,
1192 __tm->tm_mon = __tmpmon;
1201 template<
typename _CharT,
typename _InIter>
1205 ios_base::iostate& __err, tm* __tm)
const
1210 __beg = _M_extract_num(__beg, __end, __tmpyear, 0, 9999, 4,
1213 __tm->tm_year = __tmpyear < 0 ? __tmpyear + 100 : __tmpyear - 1900;
1222 #if __cplusplus >= 201103L
1223 template<
typename _CharT,
typename _InIter>
1228 ios_base::iostate& __err, tm* __tm,
const char_type* __fmt,
1232 ctype<_CharT> const& __ctype = use_facet<ctype<_CharT> >(__loc);
1234 while (__fmt != __fmtend &&
1242 else if (__ctype.
narrow(*__fmt, 0) ==
'%')
1246 if (++__fmt == __fmtend)
1251 const char __c = __ctype.
narrow(*__fmt, 0);
1252 if (__c !=
'E' && __c !=
'O')
1254 else if (++__fmt != __fmtend)
1257 __format = __ctype.
narrow(*__fmt, 0);
1264 __s = this->do_get(__s, __end, __io, __err, __tm, __format,
1268 else if (__ctype.
is(ctype_base::space, *__fmt))
1271 while (__fmt != __fmtend &&
1272 __ctype.
is(ctype_base::space, *__fmt))
1275 while (__s != __end &&
1276 __ctype.
is(ctype_base::space, *__s))
1295 template<
typename _CharT,
typename _InIter>
1300 ios_base::iostate& __err, tm* __tm,
1301 char __format,
char __mod)
const
1304 ctype<_CharT> const& __ctype = use_facet<ctype<_CharT> >(__loc);
1308 __fmt[0] = __ctype.
widen(
'%');
1311 __fmt[1] = __format;
1317 __fmt[2] = __format;
1321 __beg = _M_extract_via_format(__beg, __end, __io, __err, __tm, __fmt);
1327 #endif // __cplusplus >= 201103L
1329 template<
typename _CharT,
typename _OutIter>
1333 const _CharT* __beg,
const _CharT* __end)
const
1336 ctype<_CharT> const& __ctype = use_facet<ctype<_CharT> >(__loc);
1337 for (; __beg != __end; ++__beg)
1338 if (__ctype.
narrow(*__beg, 0) !=
'%')
1343 else if (++__beg != __end)
1347 const char __c = __ctype.
narrow(*__beg, 0);
1348 if (__c !=
'E' && __c !=
'O')
1350 else if (++__beg != __end)
1353 __format = __ctype.
narrow(*__beg, 0);
1357 __s = this->do_put(__s, __io, __fill, __tm, __format, __mod);
1364 template<
typename _CharT,
typename _OutIter>
1368 char __format,
char __mod)
const
1371 ctype<_CharT> const& __ctype = use_facet<ctype<_CharT> >(__loc);
1372 __timepunct<_CharT>
const& __tp = use_facet<__timepunct<_CharT> >(__loc);
1376 const size_t __maxlen = 128;
1385 __fmt[0] = __ctype.
widen(
'%');
1388 __fmt[1] = __format;
1394 __fmt[2] = __format;
1398 __tp._M_put(__res, __maxlen, __fmt, __tm);
1407 #if _GLIBCXX_EXTERN_TEMPLATE
1412 extern template class _GLIBCXX_NAMESPACE_LDBL_OR_CXX11
money_get<char>;
1413 extern template class _GLIBCXX_NAMESPACE_LDBL_OR_CXX11
money_put<char>;
1414 extern template class __timepunct<char>;
1424 use_facet<moneypunct<char, true> >(
const locale&);
1428 use_facet<moneypunct<char, false> >(
const locale&);
1432 use_facet<money_put<char> >(
const locale&);
1436 use_facet<money_get<char> >(
const locale&);
1439 const __timepunct<char>&
1440 use_facet<__timepunct<char> >(
const locale&);
1444 use_facet<time_put<char> >(
const locale&);
1448 use_facet<time_get<char> >(
const locale&);
1452 use_facet<messages<char> >(
const locale&);
1456 has_facet<moneypunct<char> >(
const locale&);
1460 has_facet<money_put<char> >(
const locale&);
1464 has_facet<money_get<char> >(
const locale&);
1468 has_facet<__timepunct<char> >(
const locale&);
1472 has_facet<time_put<char> >(
const locale&);
1476 has_facet<time_get<char> >(
const locale&);
1480 has_facet<messages<char> >(
const locale&);
1482 #ifdef _GLIBCXX_USE_WCHAR_T
1489 extern template class __timepunct<wchar_t>;
1499 use_facet<moneypunct<wchar_t, true> >(
const locale&);
1503 use_facet<moneypunct<wchar_t, false> >(
const locale&);
1507 use_facet<money_put<wchar_t> >(
const locale&);
1511 use_facet<money_get<wchar_t> >(
const locale&);
1514 const __timepunct<wchar_t>&
1515 use_facet<__timepunct<wchar_t> >(
const locale&);
1519 use_facet<time_put<wchar_t> >(
const locale&);
1523 use_facet<time_get<wchar_t> >(
const locale&);
1527 use_facet<messages<wchar_t> >(
const locale&);
1531 has_facet<moneypunct<wchar_t> >(
const locale&);
1535 has_facet<money_put<wchar_t> >(
const locale&);
1539 has_facet<money_get<wchar_t> >(
const locale&);
1543 has_facet<__timepunct<wchar_t> >(
const locale&);
1547 has_facet<time_put<wchar_t> >(
const locale&);
1551 has_facet<time_get<wchar_t> >(
const locale&);
1555 has_facet<messages<wchar_t> >(
const locale&);
1559 _GLIBCXX_END_NAMESPACE_VERSION