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;
84 const string& __g = __mp.grouping();
85 _M_grouping_size = __g.size();
86 __grouping =
new char[_M_grouping_size];
87 __g.copy(__grouping, _M_grouping_size);
88 _M_use_grouping = (_M_grouping_size
89 &&
static_cast<signed char>(__grouping[0]) > 0
91 != __gnu_cxx::__numeric_traits<char>::__max));
93 const basic_string<_CharT>& __cs = __mp.curr_symbol();
94 _M_curr_symbol_size = __cs.size();
95 __curr_symbol =
new _CharT[_M_curr_symbol_size];
96 __cs.copy(__curr_symbol, _M_curr_symbol_size);
98 const basic_string<_CharT>& __ps = __mp.positive_sign();
99 _M_positive_sign_size = __ps.size();
100 __positive_sign =
new _CharT[_M_positive_sign_size];
101 __ps.copy(__positive_sign, _M_positive_sign_size);
103 const basic_string<_CharT>& __ns = __mp.negative_sign();
104 _M_negative_sign_size = __ns.size();
105 __negative_sign =
new _CharT[_M_negative_sign_size];
106 __ns.copy(__negative_sign, _M_negative_sign_size);
108 _M_pos_format = __mp.pos_format();
109 _M_neg_format = __mp.neg_format();
111 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__loc);
112 __ct.widen(money_base::_S_atoms,
113 money_base::_S_atoms + money_base::_S_end, _M_atoms);
115 _M_grouping = __grouping;
116 _M_curr_symbol = __curr_symbol;
117 _M_positive_sign = __positive_sign;
118 _M_negative_sign = __negative_sign;
123 delete [] __grouping;
124 delete [] __curr_symbol;
125 delete [] __positive_sign;
126 delete [] __negative_sign;
127 __throw_exception_again;
131 _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11
133 template<
typename _CharT,
typename _InIter>
136 money_get<_CharT, _InIter>::
137 _M_extract(iter_type __beg, iter_type __end, ios_base& __io,
140 typedef char_traits<_CharT> __traits_type;
141 typedef typename string_type::size_type size_type;
142 typedef money_base::part part;
143 typedef __moneypunct_cache<_CharT, _Intl> __cache_type;
145 const locale& __loc = __io._M_getloc();
146 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
148 __use_cache<__cache_type> __uc;
149 const __cache_type* __lc = __uc(__loc);
150 const char_type* __lit = __lc->_M_atoms;
153 bool __negative =
false;
155 size_type __sign_size = 0;
157 const bool __mandatory_sign = (__lc->_M_positive_sign_size
158 && __lc->_M_negative_sign_size);
160 string __grouping_tmp;
161 if (__lc->_M_use_grouping)
162 __grouping_tmp.reserve(32);
168 bool __testvalid =
true;
170 bool __testdecfound =
false;
176 const char_type* __lit_zero = __lit + money_base::_S_zero;
177 const money_base::pattern __p = __lc->_M_neg_format;
178 for (
int __i = 0; __i < 4 && __testvalid; ++__i)
180 const part __which =
static_cast<part
>(__p.field[__i]);
183 case money_base::symbol:
190 || (__i == 1 && (__mandatory_sign
191 || (
static_cast<part
>(__p.field[0])
193 || (
static_cast<part
>(__p.field[2])
194 == money_base::space)))
195 || (__i == 2 && ((
static_cast<part
>(__p.field[3])
196 == money_base::value)
198 && (
static_cast<part
>(__p.field[3])
199 == money_base::sign)))))
201 const size_type __len = __lc->_M_curr_symbol_size;
203 for (; __beg != __end && __j < __len
204 && *__beg == __lc->_M_curr_symbol[__j];
205 ++__beg, (void)++__j);
211 case money_base::sign:
213 if (__lc->_M_positive_sign_size && __beg != __end
214 && *__beg == __lc->_M_positive_sign[0])
216 __sign_size = __lc->_M_positive_sign_size;
219 else if (__lc->_M_negative_sign_size && __beg != __end
220 && *__beg == __lc->_M_negative_sign[0])
223 __sign_size = __lc->_M_negative_sign_size;
226 else if (__lc->_M_positive_sign_size
227 && !__lc->_M_negative_sign_size)
231 else if (__mandatory_sign)
234 case money_base::value:
237 for (; __beg != __end; ++__beg)
239 const char_type __c = *__beg;
240 const char_type* __q = __traits_type::find(__lit_zero,
244 __res += money_base::_S_atoms[__q - __lit];
247 else if (__c == __lc->_M_decimal_point
250 if (__lc->_M_frac_digits <= 0)
255 __testdecfound =
true;
257 else if (__lc->_M_use_grouping
258 && __c == __lc->_M_thousands_sep
264 __grouping_tmp +=
static_cast<char>(__n);
279 case money_base::space:
281 if (__beg != __end && __ctype.is(ctype_base::space, *__beg))
286 case money_base::none:
289 for (; __beg != __end
290 && __ctype.is(ctype_base::space, *__beg); ++__beg);
296 if (__sign_size > 1 && __testvalid)
298 const char_type* __sign = __negative ? __lc->_M_negative_sign
299 : __lc->_M_positive_sign;
301 for (; __beg != __end && __i < __sign_size
302 && *__beg == __sign[__i]; ++__beg, (void)++__i);
304 if (__i != __sign_size)
311 if (__res.size() > 1)
313 const size_type __first = __res.find_first_not_of(
'0');
316 __res.erase(0, __only_zeros ? __res.size() - 1 : __first);
320 if (__negative && __res[0] !=
'0')
321 __res.insert(__res.begin(),
'-');
324 if (__grouping_tmp.size())
327 __grouping_tmp +=
static_cast<char>(__testdecfound ? __last_pos
329 if (!std::__verify_grouping(__lc->_M_grouping,
330 __lc->_M_grouping_size,
336 if (__testdecfound && __n != __lc->_M_frac_digits)
352 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \
353 && (_GLIBCXX_USE_CXX11_ABI == 0 || defined __LONG_DOUBLE_IEEE128__)
354 template<
typename _CharT,
typename _InIter>
356 money_get<_CharT, _InIter>::
357 __do_get(iter_type __beg, iter_type __end,
bool __intl, ios_base& __io,
361 __beg = __intl ? _M_extract<true>(__beg, __end, __io, __err, __str)
362 : _M_extract<false>(__beg, __end, __io, __err, __str);
363 std::__convert_to_v(__str.c_str(), __units, __err, _S_get_c_locale());
368 template<
typename _CharT,
typename _InIter>
371 do_get(iter_type __beg, iter_type __end,
bool __intl,
ios_base& __io,
372 ios_base::iostate& __err,
long double& __units)
const
375 __beg = __intl ? _M_extract<true>(__beg, __end, __io, __err, __str)
376 : _M_extract<false>(__beg, __end, __io, __err, __str);
377 std::__convert_to_v(__str.
c_str(), __units, __err, _S_get_c_locale());
381 template<
typename _CharT,
typename _InIter>
384 do_get(iter_type __beg, iter_type __end,
bool __intl,
ios_base& __io,
385 ios_base::iostate& __err,
string_type& __digits)
const
387 typedef typename string::size_type size_type;
390 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
393 __beg = __intl ? _M_extract<true>(__beg, __end, __io, __err, __str)
394 : _M_extract<false>(__beg, __end, __io, __err, __str);
395 const size_type __len = __str.size();
399 __ctype.
widen(__str.data(), __str.data() + __len, &__digits[0]);
404 #if defined _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT \
405 && defined __LONG_DOUBLE_IEEE128__
406 template<
typename _CharT,
typename _InIter>
410 ios_base::iostate& __err, __ibm128& __units)
const
413 __beg = __intl ? _M_extract<true>(__beg, __end, __io, __err, __str)
414 : _M_extract<false>(__beg, __end, __io, __err, __str);
415 std::__convert_to_v(__str.
c_str(), __units, __err, _S_get_c_locale());
420 template<
typename _CharT,
typename _OutIter>
423 money_put<_CharT, _OutIter>::
424 _M_insert(iter_type __s, ios_base& __io, char_type __fill,
425 const string_type& __digits)
const
427 typedef typename string_type::size_type size_type;
428 typedef money_base::part part;
429 typedef __moneypunct_cache<_CharT, _Intl> __cache_type;
431 const locale& __loc = __io._M_getloc();
432 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
434 __use_cache<__cache_type> __uc;
435 const __cache_type* __lc = __uc(__loc);
436 const char_type* __lit = __lc->_M_atoms;
440 const char_type* __beg = __digits.data();
442 money_base::pattern __p;
443 const char_type* __sign;
444 size_type __sign_size;
445 if (!(*__beg == __lit[money_base::_S_minus]))
447 __p = __lc->_M_pos_format;
448 __sign = __lc->_M_positive_sign;
449 __sign_size = __lc->_M_positive_sign_size;
453 __p = __lc->_M_neg_format;
454 __sign = __lc->_M_negative_sign;
455 __sign_size = __lc->_M_negative_sign_size;
461 size_type __len = __ctype.scan_not(ctype_base::digit, __beg,
462 __beg + __digits.size()) - __beg;
469 __value.reserve(2 * __len);
473 long __paddec = __len - __lc->_M_frac_digits;
476 if (__lc->_M_frac_digits < 0)
478 if (__lc->_M_grouping_size)
480 __value.assign(2 * __paddec, char_type());
482 std::__add_grouping(&__value[0], __lc->_M_thousands_sep,
484 __lc->_M_grouping_size,
485 __beg, __beg + __paddec);
486 __value.erase(__vend - &__value[0]);
489 __value.assign(__beg, __paddec);
493 if (__lc->_M_frac_digits > 0)
495 __value += __lc->_M_decimal_point;
497 __value.append(__beg + __paddec, __lc->_M_frac_digits);
501 __value.append(-__paddec, __lit[money_base::_S_zero]);
502 __value.append(__beg, __len);
509 __len = __value.size() + __sign_size;
511 ? __lc->_M_curr_symbol_size : 0);
514 __res.reserve(2 * __len);
516 const size_type __width =
static_cast<size_type
>(__io.width());
520 for (
int __i = 0; __i < 4; ++__i)
522 const part __which =
static_cast<part
>(__p.field[__i]);
525 case money_base::symbol:
527 __res.append(__lc->_M_curr_symbol,
528 __lc->_M_curr_symbol_size);
530 case money_base::sign:
537 case money_base::value:
540 case money_base::space:
545 __res.append(__width - __len, __fill);
549 case money_base::none:
551 __res.append(__width - __len, __fill);
558 __res.append(__sign + 1, __sign_size - 1);
561 __len = __res.size();
566 __res.append(__width - __len, __fill);
569 __res.insert(0, __width - __len, __fill);
574 __s = std::__write(__s, __res.data(), __len);
580 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \
581 && (_GLIBCXX_USE_CXX11_ABI == 0 || defined __LONG_DOUBLE_IEEE128__)
582 template<
typename _CharT,
typename _OutIter>
584 money_put<_CharT, _OutIter>::
585 __do_put(iter_type __s,
bool __intl, ios_base& __io, char_type __fill,
586 double __units)
const
587 {
return this->do_put(__s, __intl, __io, __fill, (
long double) __units); }
590 template<
typename _CharT,
typename _OutIter>
594 long double __units)
const
597 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
598 #if _GLIBCXX_USE_C99_STDIO
601 char* __cs =
static_cast<char*
>(__builtin_alloca(__cs_size));
604 int __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
605 "%.*Lf", 0, __units);
607 if (__len >= __cs_size)
609 __cs_size = __len + 1;
610 __cs =
static_cast<char*
>(__builtin_alloca(__cs_size));
611 __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
612 "%.*Lf", 0, __units);
616 const int __cs_size =
617 __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 3;
618 char* __cs =
static_cast<char*
>(__builtin_alloca(__cs_size));
619 int __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0,
"%.*Lf",
623 __ctype.
widen(__cs, __cs + __len, &__digits[0]);
624 return __intl ? _M_insert<true>(__s, __io, __fill, __digits)
625 : _M_insert<false>(__s, __io, __fill, __digits);
628 template<
typename _CharT,
typename _OutIter>
633 {
return __intl ? _M_insert<true>(__s, __io, __fill, __digits)
634 : _M_insert<false>(__s, __io, __fill, __digits); }
636 #if defined _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT \
637 && defined __LONG_DOUBLE_IEEE128__
638 template<
typename _CharT,
typename _OutIter>
642 __ibm128 __units)
const
645 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
646 #if _GLIBCXX_USE_C99_STDIO
649 char* __cs =
static_cast<char*
>(__builtin_alloca(__cs_size));
652 int __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
653 "%.*Lf", 0, __units);
655 if (__len >= __cs_size)
657 __cs_size = __len + 1;
658 __cs =
static_cast<char*
>(__builtin_alloca(__cs_size));
659 __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
660 "%.*Lf", 0, __units);
664 const int __cs_size =
665 __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 3;
666 char* __cs =
static_cast<char*
>(__builtin_alloca(__cs_size));
667 int __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0,
"%.*Lf",
670 string_type __digits(__len, char_type());
671 __ctype.
widen(__cs, __cs + __len, &__digits[0]);
672 return __intl ? _M_insert<true>(__s, __io, __fill, __digits)
673 : _M_insert<false>(__s, __io, __fill, __digits);
677 _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11
682 template<
typename _CharT,
typename _InIter>
685 {
return time_base::no_order; }
689 template<
typename _CharT,
typename _InIter>
693 ios_base::iostate& __err, tm* __tm,
694 const _CharT* __format)
const
697 const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
698 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
703 for (; __beg != __end && __i < __len && !__tmperr; ++__i)
705 if (__ctype.narrow(__format[__i], 0) ==
'%')
708 char __c = __ctype.narrow(__format[++__i], 0);
710 if (__c ==
'E' || __c ==
'O')
711 __c = __ctype.narrow(__format[++__i], 0);
718 const char_type* __days1[7];
719 __tp._M_days_abbreviated(__days1);
720 __beg = _M_extract_name(__beg, __end, __mem, __days1,
723 __tm->tm_wday = __mem;
727 const char_type* __days2[7];
728 __tp._M_days(__days2);
729 __beg = _M_extract_name(__beg, __end, __mem, __days2,
732 __tm->tm_wday = __mem;
737 const char_type* __months1[12];
738 __tp._M_months_abbreviated(__months1);
739 __beg = _M_extract_name(__beg, __end, __mem,
740 __months1, 12, __io, __tmperr);
742 __tm->tm_mon = __mem;
746 const char_type* __months2[12];
747 __tp._M_months(__months2);
748 __beg = _M_extract_name(__beg, __end, __mem,
749 __months2, 12, __io, __tmperr);
751 __tm->tm_mon = __mem;
755 const char_type* __dt[2];
756 __tp._M_date_time_formats(__dt);
757 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
762 __beg = _M_extract_num(__beg, __end, __mem, 1, 31, 2,
765 __tm->tm_mday = __mem;
770 if (__ctype.is(ctype_base::space, *__beg))
771 __beg = _M_extract_num(++__beg, __end, __mem, 1, 9,
774 __beg = _M_extract_num(__beg, __end, __mem, 10, 31,
777 __tm->tm_mday = __mem;
782 __ctype.widen(__cs, __cs + 9, __wcs);
783 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
788 __beg = _M_extract_num(__beg, __end, __mem, 0, 23, 2,
791 __tm->tm_hour = __mem;
795 __beg = _M_extract_num(__beg, __end, __mem, 1, 12, 2,
798 __tm->tm_hour = __mem;
802 __beg = _M_extract_num(__beg, __end, __mem, 1, 12, 2,
805 __tm->tm_mon = __mem - 1;
809 __beg = _M_extract_num(__beg, __end, __mem, 0, 59, 2,
812 __tm->tm_min = __mem;
815 if (__ctype.narrow(*__beg, 0) ==
'\n')
823 __ctype.widen(__cs, __cs + 6, __wcs);
824 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
831 __beg = _M_extract_num(__beg, __end, __mem, 0, 60, 2,
833 __beg = _M_extract_num(__beg, __end, __mem, 0, 61, 2,
837 __tm->tm_sec = __mem;
840 if (__ctype.narrow(*__beg, 0) ==
'\t')
848 __ctype.widen(__cs, __cs + 9, __wcs);
849 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
854 const char_type* __dates[2];
855 __tp._M_date_formats(__dates);
856 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
861 const char_type* __times[2];
862 __tp._M_time_formats(__times);
863 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
874 __beg = _M_extract_num(__beg, __end, __mem, 0, 9999, 4,
877 __tm->tm_year = __mem < 0 ? __mem + 100 : __mem - 1900;
881 if (__ctype.is(ctype_base::upper, *__beg))
884 __beg = _M_extract_name(__beg, __end, __tmp,
885 __timepunct_cache<_CharT>::_S_timezones,
889 if (__beg != __end && !__tmperr && __tmp == 0
890 && (*__beg == __ctype.widen(
'-')
891 || *__beg == __ctype.widen(
'+')))
893 __beg = _M_extract_num(__beg, __end, __tmp, 0, 23, 2,
895 __beg = _M_extract_num(__beg, __end, __tmp, 0, 59, 2,
910 if (__format[__i] == *__beg)
917 if (__tmperr || __i != __len)
923 template<
typename _CharT,
typename _InIter>
925 time_get<_CharT, _InIter>::
926 _M_extract_num(iter_type __beg, iter_type __end,
int& __member,
927 int __min,
int __max,
size_t __len,
930 const locale& __loc = __io._M_getloc();
931 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
934 int __mult = __len == 2 ? 10 : (__len == 4 ? 1000 : 1);
939 for (; __beg != __end && __i < __len; ++__beg, (void)++__i)
941 const char __c = __ctype.narrow(*__beg,
'*');
942 if (__c >=
'0' && __c <=
'9')
944 __value = __value * 10 + (__c -
'0');
945 const int __valuec = __value * __mult;
946 if (__valuec > __max || __valuec + __mult < __min)
956 else if (__len == 4 && __i == 2)
957 __member = __value - 100;
966 template<
typename _CharT,
typename _InIter>
968 time_get<_CharT, _InIter>::
969 _M_extract_name(iter_type __beg, iter_type __end,
int& __member,
970 const _CharT** __names,
size_t __indexlen,
973 typedef char_traits<_CharT> __traits_type;
974 const locale& __loc = __io._M_getloc();
975 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
977 int* __matches =
static_cast<int*
>(__builtin_alloca(
sizeof(
int)
979 size_t __nmatches = 0;
981 bool __testvalid =
true;
982 const char_type* __name;
990 const char_type __c = *__beg;
991 for (
size_t __i1 = 0; __i1 < __indexlen; ++__i1)
992 if (__c == __names[__i1][0]
993 || __c == __ctype.toupper(__names[__i1][0]))
994 __matches[__nmatches++] = __i1;
997 while (__nmatches > 1)
1000 size_t __minlen = __traits_type::length(__names[__matches[0]]);
1001 for (
size_t __i2 = 1; __i2 < __nmatches; ++__i2)
1003 __traits_type::length(__names[__matches[__i2]]));
1006 if (__pos < __minlen && __beg != __end)
1007 for (
size_t __i3 = 0; __i3 < __nmatches;)
1009 __name = __names[__matches[__i3]];
1010 if (!(__name[__pos] == *__beg))
1011 __matches[__i3] = __matches[--__nmatches];
1019 if (__nmatches == 1)
1024 __name = __names[__matches[0]];
1025 const size_t __len = __traits_type::length(__name);
1026 while (__pos < __len && __beg != __end && __name[__pos] == *__beg)
1027 ++__beg, (void)++__pos;
1030 __member = __matches[0];
1032 __testvalid =
false;
1035 __testvalid =
false;
1042 template<
typename _CharT,
typename _InIter>
1044 time_get<_CharT, _InIter>::
1045 _M_extract_wday_or_month(iter_type __beg, iter_type __end,
int& __member,
1046 const _CharT** __names,
size_t __indexlen,
1049 typedef char_traits<_CharT> __traits_type;
1050 const locale& __loc = __io._M_getloc();
1051 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
1053 int* __matches =
static_cast<int*
>(__builtin_alloca(2 *
sizeof(
int)
1055 size_t __nmatches = 0;
1056 size_t* __matches_lengths = 0;
1061 const char_type __c = *__beg;
1062 for (
size_t __i = 0; __i < 2 * __indexlen; ++__i)
1063 if (__c == __names[__i][0]
1064 || __c == __ctype.toupper(__names[__i][0]))
1065 __matches[__nmatches++] = __i;
1074 =
static_cast<size_t*
>(__builtin_alloca(
sizeof(
size_t)
1076 for (
size_t __i = 0; __i < __nmatches; ++__i)
1077 __matches_lengths[__i]
1078 = __traits_type::length(__names[__matches[__i]]);
1081 for (; __beg != __end; ++__beg, (void)++__pos)
1083 size_t __nskipped = 0;
1084 const char_type __c = *__beg;
1085 for (
size_t __i = 0; __i < __nmatches;)
1087 const char_type* __name = __names[__matches[__i]];
1088 if (__pos >= __matches_lengths[__i])
1089 ++__nskipped, ++__i;
1090 else if (!(__name[__pos] == __c))
1093 __matches[__i] = __matches[__nmatches];
1094 __matches_lengths[__i] = __matches_lengths[__nmatches];
1099 if (__nskipped == __nmatches)
1103 if ((__nmatches == 1 && __matches_lengths[0] == __pos)
1104 || (__nmatches == 2 && (__matches_lengths[0] == __pos
1105 || __matches_lengths[1] == __pos)))
1106 __member = (__matches[0] >= (
int)__indexlen
1107 ? __matches[0] - (int)__indexlen : __matches[0]);
1114 template<
typename _CharT,
typename _InIter>
1118 ios_base::iostate& __err, tm* __tm)
const
1121 const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
1123 __tp._M_time_formats(__times);
1124 __beg = _M_extract_via_format(__beg, __end, __io, __err,
1131 template<
typename _CharT,
typename _InIter>
1135 ios_base::iostate& __err, tm* __tm)
const
1138 const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
1140 __tp._M_date_formats(__dates);
1141 __beg = _M_extract_via_format(__beg, __end, __io, __err,
1148 template<
typename _CharT,
typename _InIter>
1152 ios_base::iostate& __err, tm* __tm)
const
1155 const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
1157 __tp._M_days_abbreviated(__days);
1158 __tp._M_days(__days + 7);
1162 __beg = _M_extract_wday_or_month(__beg, __end, __tmpwday, __days, 7,
1165 __tm->tm_wday = __tmpwday;
1174 template<
typename _CharT,
typename _InIter>
1178 ios_base& __io, ios_base::iostate& __err, tm* __tm)
const
1181 const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
1183 __tp._M_months_abbreviated(__months);
1184 __tp._M_months(__months + 12);
1188 __beg = _M_extract_wday_or_month(__beg, __end, __tmpmon, __months, 12,
1191 __tm->tm_mon = __tmpmon;
1200 template<
typename _CharT,
typename _InIter>
1204 ios_base::iostate& __err, tm* __tm)
const
1209 __beg = _M_extract_num(__beg, __end, __tmpyear, 0, 9999, 4,
1212 __tm->tm_year = __tmpyear < 0 ? __tmpyear + 100 : __tmpyear - 1900;
1221 #if __cplusplus >= 201103L
1222 template<
typename _CharT,
typename _InIter>
1226 get(iter_type __s, iter_type __end,
ios_base& __io,
1227 ios_base::iostate& __err, tm* __tm,
const char_type* __fmt,
1231 ctype<_CharT> const& __ctype = use_facet<ctype<_CharT> >(__loc);
1233 while (__fmt != __fmtend &&
1241 else if (__ctype.
narrow(*__fmt, 0) ==
'%')
1245 if (++__fmt == __fmtend)
1250 const char __c = __ctype.
narrow(*__fmt, 0);
1251 if (__c !=
'E' && __c !=
'O')
1253 else if (++__fmt != __fmtend)
1256 __format = __ctype.
narrow(*__fmt, 0);
1263 __s = this->do_get(__s, __end, __io, __err, __tm, __format,
1267 else if (__ctype.
is(ctype_base::space, *__fmt))
1270 while (__fmt != __fmtend &&
1271 __ctype.
is(ctype_base::space, *__fmt))
1274 while (__s != __end &&
1275 __ctype.
is(ctype_base::space, *__s))
1294 template<
typename _CharT,
typename _InIter>
1299 ios_base::iostate& __err, tm* __tm,
1300 char __format,
char __mod)
const
1303 ctype<_CharT> const& __ctype = use_facet<ctype<_CharT> >(__loc);
1307 __fmt[0] = __ctype.
widen(
'%');
1310 __fmt[1] = __format;
1316 __fmt[2] = __format;
1320 __beg = _M_extract_via_format(__beg, __end, __io, __err, __tm, __fmt);
1326 #endif // __cplusplus >= 201103L
1328 template<
typename _CharT,
typename _OutIter>
1332 const _CharT* __beg,
const _CharT* __end)
const
1335 ctype<_CharT> const& __ctype = use_facet<ctype<_CharT> >(__loc);
1336 for (; __beg != __end; ++__beg)
1337 if (__ctype.
narrow(*__beg, 0) !=
'%')
1342 else if (++__beg != __end)
1346 const char __c = __ctype.
narrow(*__beg, 0);
1347 if (__c !=
'E' && __c !=
'O')
1349 else if (++__beg != __end)
1352 __format = __ctype.
narrow(*__beg, 0);
1356 __s = this->do_put(__s, __io, __fill, __tm, __format, __mod);
1363 template<
typename _CharT,
typename _OutIter>
1367 char __format,
char __mod)
const
1370 ctype<_CharT> const& __ctype = use_facet<ctype<_CharT> >(__loc);
1371 __timepunct<_CharT>
const& __tp = use_facet<__timepunct<_CharT> >(__loc);
1375 const size_t __maxlen = 128;
1384 __fmt[0] = __ctype.
widen(
'%');
1387 __fmt[1] = __format;
1393 __fmt[2] = __format;
1397 __tp._M_put(__res, __maxlen, __fmt, __tm);
1406 #if _GLIBCXX_EXTERN_TEMPLATE
1411 extern template class _GLIBCXX_NAMESPACE_LDBL_OR_CXX11
money_get<char>;
1412 extern template class _GLIBCXX_NAMESPACE_LDBL_OR_CXX11
money_put<char>;
1413 extern template class __timepunct<char>;
1423 use_facet<moneypunct<char, true> >(
const locale&);
1427 use_facet<moneypunct<char, false> >(
const locale&);
1431 use_facet<money_put<char> >(
const locale&);
1435 use_facet<money_get<char> >(
const locale&);
1438 const __timepunct<char>&
1439 use_facet<__timepunct<char> >(
const locale&);
1443 use_facet<time_put<char> >(
const locale&);
1447 use_facet<time_get<char> >(
const locale&);
1451 use_facet<messages<char> >(
const locale&);
1455 has_facet<moneypunct<char> >(
const locale&);
1459 has_facet<money_put<char> >(
const locale&);
1463 has_facet<money_get<char> >(
const locale&);
1467 has_facet<__timepunct<char> >(
const locale&);
1471 has_facet<time_put<char> >(
const locale&);
1475 has_facet<time_get<char> >(
const locale&);
1479 has_facet<messages<char> >(
const locale&);
1481 #ifdef _GLIBCXX_USE_WCHAR_T
1488 extern template class __timepunct<wchar_t>;
1498 use_facet<moneypunct<wchar_t, true> >(
const locale&);
1502 use_facet<moneypunct<wchar_t, false> >(
const locale&);
1506 use_facet<money_put<wchar_t> >(
const locale&);
1510 use_facet<money_get<wchar_t> >(
const locale&);
1513 const __timepunct<wchar_t>&
1514 use_facet<__timepunct<wchar_t> >(
const locale&);
1518 use_facet<time_put<wchar_t> >(
const locale&);
1522 use_facet<time_get<wchar_t> >(
const locale&);
1526 use_facet<messages<wchar_t> >(
const locale&);
1530 has_facet<moneypunct<wchar_t> >(
const locale&);
1534 has_facet<money_put<wchar_t> >(
const locale&);
1538 has_facet<money_get<wchar_t> >(
const locale&);
1542 has_facet<__timepunct<wchar_t> >(
const locale&);
1546 has_facet<time_put<wchar_t> >(
const locale&);
1550 has_facet<time_get<wchar_t> >(
const locale&);
1554 has_facet<messages<wchar_t> >(
const locale&);
1558 _GLIBCXX_END_NAMESPACE_VERSION