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))
285 case money_base::none:
288 for (; __beg != __end
289 && __ctype.is(ctype_base::space, *__beg); ++__beg);
295 if (__sign_size > 1 && __testvalid)
297 const char_type* __sign = __negative ? __lc->_M_negative_sign
298 : __lc->_M_positive_sign;
300 for (; __beg != __end && __i < __sign_size
301 && *__beg == __sign[__i]; ++__beg, (void)++__i);
303 if (__i != __sign_size)
310 if (__res.size() > 1)
312 const size_type __first = __res.find_first_not_of(
'0');
315 __res.erase(0, __only_zeros ? __res.size() - 1 : __first);
319 if (__negative && __res[0] !=
'0')
320 __res.insert(__res.begin(),
'-');
323 if (__grouping_tmp.size())
326 __grouping_tmp +=
static_cast<char>(__testdecfound ? __last_pos
328 if (!std::__verify_grouping(__lc->_M_grouping,
329 __lc->_M_grouping_size,
335 if (__testdecfound && __n != __lc->_M_frac_digits)
351 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \ 352 && _GLIBCXX_USE_CXX11_ABI == 0 353 template<
typename _CharT,
typename _InIter>
355 money_get<_CharT, _InIter>::
356 __do_get(iter_type __beg, iter_type __end,
bool __intl, ios_base& __io,
360 __beg = __intl ? _M_extract<true>(__beg, __end, __io, __err, __str)
361 : _M_extract<false>(__beg, __end, __io, __err, __str);
362 std::__convert_to_v(__str.c_str(), __units, __err, _S_get_c_locale());
367 template<
typename _CharT,
typename _InIter>
371 ios_base::iostate& __err,
long double& __units)
const 374 __beg = __intl ? _M_extract<true>(__beg, __end, __io, __err, __str)
375 : _M_extract<false>(__beg, __end, __io, __err, __str);
376 std::__convert_to_v(__str.
c_str(), __units, __err, _S_get_c_locale());
380 template<
typename _CharT,
typename _InIter>
384 ios_base::iostate& __err,
string_type& __digits)
const 386 typedef typename string::size_type size_type;
389 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
392 __beg = __intl ? _M_extract<true>(__beg, __end, __io, __err, __str)
393 : _M_extract<false>(__beg, __end, __io, __err, __str);
394 const size_type __len = __str.size();
398 __ctype.
widen(__str.data(), __str.data() + __len, &__digits[0]);
403 template<
typename _CharT,
typename _OutIter>
410 typedef typename string_type::size_type size_type;
411 typedef money_base::part part;
412 typedef __moneypunct_cache<_CharT, _Intl> __cache_type;
415 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
417 __use_cache<__cache_type> __uc;
418 const __cache_type* __lc = __uc(__loc);
425 money_base::pattern __p;
427 size_type __sign_size;
428 if (!(*__beg == __lit[money_base::_S_minus]))
430 __p = __lc->_M_pos_format;
431 __sign = __lc->_M_positive_sign;
432 __sign_size = __lc->_M_positive_sign_size;
436 __p = __lc->_M_neg_format;
437 __sign = __lc->_M_negative_sign;
438 __sign_size = __lc->_M_negative_sign_size;
444 size_type __len = __ctype.
scan_not(ctype_base::digit, __beg,
445 __beg + __digits.
size()) - __beg;
456 long __paddec = __len - __lc->_M_frac_digits;
459 if (__lc->_M_frac_digits < 0)
461 if (__lc->_M_grouping_size)
465 std::__add_grouping(&__value[0], __lc->_M_thousands_sep,
467 __lc->_M_grouping_size,
468 __beg, __beg + __paddec);
469 __value.
erase(__vend - &__value[0]);
472 __value.
assign(__beg, __paddec);
476 if (__lc->_M_frac_digits > 0)
478 __value += __lc->_M_decimal_point;
480 __value.
append(__beg + __paddec, __lc->_M_frac_digits);
484 __value.
append(-__paddec, __lit[money_base::_S_zero]);
485 __value.
append(__beg, __len);
490 const ios_base::fmtflags __f = __io.
flags()
492 __len = __value.
size() + __sign_size;
494 ? __lc->_M_curr_symbol_size : 0);
499 const size_type __width =
static_cast<size_type
>(__io.
width());
503 for (
int __i = 0; __i < 4; ++__i)
505 const part __which =
static_cast<part
>(__p.field[__i]);
508 case money_base::symbol:
510 __res.
append(__lc->_M_curr_symbol,
511 __lc->_M_curr_symbol_size);
513 case money_base::sign:
520 case money_base::value:
523 case money_base::space:
528 __res.
append(__width - __len, __fill);
532 case money_base::none:
534 __res.
append(__width - __len, __fill);
541 __res.
append(__sign + 1, __sign_size - 1);
544 __len = __res.
size();
549 __res.
append(__width - __len, __fill);
552 __res.
insert(0, __width - __len, __fill);
557 __s = std::__write(__s, __res.
data(), __len);
563 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \ 564 && _GLIBCXX_USE_CXX11_ABI == 0 565 template<
typename _CharT,
typename _OutIter>
569 double __units)
const 570 {
return this->do_put(__s, __intl, __io, __fill, (
long double) __units); }
573 template<
typename _CharT,
typename _OutIter>
577 long double __units)
const 580 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
581 #if _GLIBCXX_USE_C99_STDIO 584 char* __cs =
static_cast<char*
>(__builtin_alloca(__cs_size));
587 int __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
588 "%.*Lf", 0, __units);
590 if (__len >= __cs_size)
592 __cs_size = __len + 1;
593 __cs =
static_cast<char*
>(__builtin_alloca(__cs_size));
594 __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
595 "%.*Lf", 0, __units);
599 const int __cs_size =
600 __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 3;
601 char* __cs =
static_cast<char*
>(__builtin_alloca(__cs_size));
602 int __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0,
"%.*Lf",
606 __ctype.
widen(__cs, __cs + __len, &__digits[0]);
607 return __intl ? _M_insert<true>(__s, __io, __fill, __digits)
608 : _M_insert<false>(__s, __io, __fill, __digits);
611 template<
typename _CharT,
typename _OutIter>
616 {
return __intl ? _M_insert<true>(__s, __io, __fill, __digits)
617 : _M_insert<false>(__s, __io, __fill, __digits); }
619 _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11
624 template<
typename _CharT,
typename _InIter>
627 {
return time_base::no_order; }
631 template<
typename _CharT,
typename _InIter>
635 ios_base::iostate& __err, tm* __tm,
636 const _CharT* __format)
const 639 const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
640 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
645 for (; __beg != __end && __i < __len && !__tmperr; ++__i)
647 if (__ctype.narrow(__format[__i], 0) ==
'%')
650 char __c = __ctype.narrow(__format[++__i], 0);
652 if (__c ==
'E' || __c ==
'O')
653 __c = __ctype.narrow(__format[++__i], 0);
661 __tp._M_days_abbreviated(__days1);
662 __beg = _M_extract_name(__beg, __end, __tm->tm_wday, __days1,
668 __tp._M_days(__days2);
669 __beg = _M_extract_name(__beg, __end, __tm->tm_wday, __days2,
676 __tp._M_months_abbreviated(__months1);
677 __beg = _M_extract_name(__beg, __end, __tm->tm_mon,
678 __months1, 12, __io, __tmperr);
683 __tp._M_months(__months2);
684 __beg = _M_extract_name(__beg, __end, __tm->tm_mon,
685 __months2, 12, __io, __tmperr);
690 __tp._M_date_time_formats(__dt);
691 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
696 __beg = _M_extract_num(__beg, __end, __tm->tm_mday, 1, 31, 2,
702 if (__ctype.is(ctype_base::space, *__beg))
703 __beg = _M_extract_num(++__beg, __end, __tm->tm_mday, 1, 9,
706 __beg = _M_extract_num(__beg, __end, __tm->tm_mday, 10, 31,
712 __ctype.widen(__cs, __cs + 9, __wcs);
713 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
718 __beg = _M_extract_num(__beg, __end, __tm->tm_hour, 0, 23, 2,
723 __beg = _M_extract_num(__beg, __end, __tm->tm_hour, 1, 12, 2,
728 __beg = _M_extract_num(__beg, __end, __mem, 1, 12, 2,
731 __tm->tm_mon = __mem - 1;
735 __beg = _M_extract_num(__beg, __end, __tm->tm_min, 0, 59, 2,
739 if (__ctype.narrow(*__beg, 0) ==
'\n')
747 __ctype.widen(__cs, __cs + 6, __wcs);
748 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
755 __beg = _M_extract_num(__beg, __end, __tm->tm_sec, 0, 60, 2,
757 __beg = _M_extract_num(__beg, __end, __tm->tm_sec, 0, 61, 2,
762 if (__ctype.narrow(*__beg, 0) ==
'\t')
770 __ctype.widen(__cs, __cs + 9, __wcs);
771 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
777 __tp._M_date_formats(__dates);
778 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
784 __tp._M_time_formats(__times);
785 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
796 __beg = _M_extract_num(__beg, __end, __mem, 0, 9999, 4,
799 __tm->tm_year = __mem < 0 ? __mem + 100 : __mem - 1900;
803 if (__ctype.is(ctype_base::upper, *__beg))
806 __beg = _M_extract_name(__beg, __end, __tmp,
807 __timepunct_cache<_CharT>::_S_timezones,
811 if (__beg != __end && !__tmperr && __tmp == 0
812 && (*__beg == __ctype.widen(
'-')
813 || *__beg == __ctype.widen(
'+')))
815 __beg = _M_extract_num(__beg, __end, __tmp, 0, 23, 2,
817 __beg = _M_extract_num(__beg, __end, __tmp, 0, 59, 2,
832 if (__format[__i] == *__beg)
839 if (__tmperr || __i != __len)
845 template<
typename _CharT,
typename _InIter>
849 int __min,
int __max,
size_t __len,
850 ios_base& __io, ios_base::iostate& __err)
const 853 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
856 int __mult = __len == 2 ? 10 : (__len == 4 ? 1000 : 1);
861 for (; __beg != __end && __i < __len; ++__beg, (void)++__i)
863 const char __c = __ctype.
narrow(*__beg,
'*');
864 if (__c >=
'0' && __c <=
'9')
866 __value = __value * 10 + (__c -
'0');
867 const int __valuec = __value * __mult;
868 if (__valuec > __max || __valuec + __mult < __min)
878 else if (__len == 4 && __i == 2)
879 __member = __value - 100;
888 template<
typename _CharT,
typename _InIter>
892 const _CharT** __names,
size_t __indexlen,
893 ios_base& __io, ios_base::iostate& __err)
const 897 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
899 int* __matches =
static_cast<int*
>(__builtin_alloca(
sizeof(
int)
901 size_t __nmatches = 0;
903 bool __testvalid =
true;
913 for (
size_t __i1 = 0; __i1 < __indexlen; ++__i1)
914 if (__c == __names[__i1][0]
915 || __c == __ctype.
toupper(__names[__i1][0]))
916 __matches[__nmatches++] = __i1;
919 while (__nmatches > 1)
922 size_t __minlen = __traits_type::length(__names[__matches[0]]);
923 for (
size_t __i2 = 1; __i2 < __nmatches; ++__i2)
925 __traits_type::length(__names[__matches[__i2]]));
928 if (__pos < __minlen && __beg != __end)
929 for (
size_t __i3 = 0; __i3 < __nmatches;)
931 __name = __names[__matches[__i3]];
932 if (!(__name[__pos] == *__beg))
933 __matches[__i3] = __matches[--__nmatches];
946 __name = __names[__matches[0]];
947 const size_t __len = __traits_type::length(__name);
948 while (__pos < __len && __beg != __end && __name[__pos] == *__beg)
949 ++__beg, (void)++__pos;
952 __member = __matches[0];
964 template<
typename _CharT,
typename _InIter>
968 const _CharT** __names,
size_t __indexlen,
969 ios_base& __io, ios_base::iostate& __err)
const 973 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
975 int* __matches =
static_cast<int*
>(__builtin_alloca(2 *
sizeof(
int)
977 size_t __nmatches = 0;
978 size_t* __matches_lengths = 0;
984 for (
size_t __i = 0; __i < 2 * __indexlen; ++__i)
985 if (__c == __names[__i][0]
986 || __c == __ctype.
toupper(__names[__i][0]))
987 __matches[__nmatches++] = __i;
996 =
static_cast<size_t*
>(__builtin_alloca(
sizeof(
size_t)
998 for (
size_t __i = 0; __i < __nmatches; ++__i)
999 __matches_lengths[__i]
1000 = __traits_type::length(__names[__matches[__i]]);
1003 for (; __beg != __end; ++__beg, (void)++__pos)
1005 size_t __nskipped = 0;
1007 for (
size_t __i = 0; __i < __nmatches;)
1009 const char_type* __name = __names[__matches[__i]];
1010 if (__pos >= __matches_lengths[__i])
1011 ++__nskipped, ++__i;
1012 else if (!(__name[__pos] == __c))
1015 __matches[__i] = __matches[__nmatches];
1016 __matches_lengths[__i] = __matches_lengths[__nmatches];
1021 if (__nskipped == __nmatches)
1025 if ((__nmatches == 1 && __matches_lengths[0] == __pos)
1026 || (__nmatches == 2 && (__matches_lengths[0] == __pos
1027 || __matches_lengths[1] == __pos)))
1028 __member = (__matches[0] >= __indexlen
1029 ? __matches[0] - __indexlen : __matches[0]);
1036 template<
typename _CharT,
typename _InIter>
1040 ios_base::iostate& __err, tm* __tm)
const 1043 const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
1045 __tp._M_time_formats(__times);
1046 __beg = _M_extract_via_format(__beg, __end, __io, __err,
1053 template<
typename _CharT,
typename _InIter>
1057 ios_base::iostate& __err, tm* __tm)
const 1060 const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
1062 __tp._M_date_formats(__dates);
1063 __beg = _M_extract_via_format(__beg, __end, __io, __err,
1070 template<
typename _CharT,
typename _InIter>
1074 ios_base::iostate& __err, tm* __tm)
const 1077 const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
1078 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
1080 __tp._M_days_abbreviated(__days);
1081 __tp._M_days(__days + 7);
1085 __beg = _M_extract_wday_or_month(__beg, __end, __tmpwday, __days, 7,
1088 __tm->tm_wday = __tmpwday;
1097 template<
typename _CharT,
typename _InIter>
1101 ios_base& __io, ios_base::iostate& __err, tm* __tm)
const 1104 const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
1105 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
1107 __tp._M_months_abbreviated(__months);
1108 __tp._M_months(__months + 12);
1112 __beg = _M_extract_wday_or_month(__beg, __end, __tmpmon, __months, 12,
1115 __tm->tm_mon = __tmpmon;
1124 template<
typename _CharT,
typename _InIter>
1128 ios_base::iostate& __err, tm* __tm)
const 1131 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
1135 __beg = _M_extract_num(__beg, __end, __tmpyear, 0, 9999, 4,
1138 __tm->tm_year = __tmpyear < 0 ? __tmpyear + 100 : __tmpyear - 1900;
1147 #if __cplusplus >= 201103L 1148 template<
typename _CharT,
typename _InIter>
1153 ios_base::iostate& __err, tm* __tm,
const char_type* __fmt,
1157 ctype<_CharT> const& __ctype = use_facet<ctype<_CharT> >(__loc);
1159 while (__fmt != __fmtend &&
1167 else if (__ctype.
narrow(*__fmt, 0) ==
'%')
1171 if (++__fmt == __fmtend)
1176 const char __c = __ctype.
narrow(*__fmt, 0);
1177 if (__c !=
'E' && __c !=
'O')
1179 else if (++__fmt != __fmtend)
1182 __format = __ctype.
narrow(*__fmt, 0);
1189 __s = this->do_get(__s, __end, __io, __err, __tm, __format,
1193 else if (__ctype.
is(ctype_base::space, *__fmt))
1196 while (__fmt != __fmtend &&
1197 __ctype.
is(ctype_base::space, *__fmt))
1200 while (__s != __end &&
1201 __ctype.
is(ctype_base::space, *__s))
1220 template<
typename _CharT,
typename _InIter>
1225 ios_base::iostate& __err, tm* __tm,
1226 char __format,
char __mod)
const 1229 ctype<_CharT> const& __ctype = use_facet<ctype<_CharT> >(__loc);
1233 __fmt[0] = __ctype.
widen(
'%');
1236 __fmt[1] = __format;
1242 __fmt[2] = __format;
1246 __beg = _M_extract_via_format(__beg, __end, __io, __err, __tm, __fmt);
1252 #endif // __cplusplus >= 201103L 1254 template<
typename _CharT,
typename _OutIter>
1258 const _CharT* __beg,
const _CharT* __end)
const 1261 ctype<_CharT> const& __ctype = use_facet<ctype<_CharT> >(__loc);
1262 for (; __beg != __end; ++__beg)
1263 if (__ctype.
narrow(*__beg, 0) !=
'%')
1268 else if (++__beg != __end)
1272 const char __c = __ctype.
narrow(*__beg, 0);
1273 if (__c !=
'E' && __c !=
'O')
1275 else if (++__beg != __end)
1278 __format = __ctype.
narrow(*__beg, 0);
1282 __s = this->do_put(__s, __io, __fill, __tm, __format, __mod);
1289 template<
typename _CharT,
typename _OutIter>
1293 char __format,
char __mod)
const 1296 ctype<_CharT> const& __ctype = use_facet<ctype<_CharT> >(__loc);
1297 __timepunct<_CharT>
const& __tp = use_facet<__timepunct<_CharT> >(__loc);
1301 const size_t __maxlen = 128;
1310 __fmt[0] = __ctype.
widen(
'%');
1313 __fmt[1] = __format;
1319 __fmt[2] = __format;
1323 __tp._M_put(__res, __maxlen, __fmt, __tm);
1332 #if _GLIBCXX_EXTERN_TEMPLATE 1337 extern template class _GLIBCXX_NAMESPACE_LDBL_OR_CXX11
money_get<char>;
1338 extern template class _GLIBCXX_NAMESPACE_LDBL_OR_CXX11
money_put<char>;
1339 extern template class __timepunct<char>;
1349 use_facet<moneypunct<char, true> >(
const locale&);
1353 use_facet<moneypunct<char, false> >(
const locale&);
1356 const money_put<char>&
1357 use_facet<money_put<char> >(
const locale&);
1360 const money_get<char>&
1361 use_facet<money_get<char> >(
const locale&);
1364 const __timepunct<char>&
1365 use_facet<__timepunct<char> >(
const locale&);
1369 use_facet<time_put<char> >(
const locale&);
1373 use_facet<time_get<char> >(
const locale&);
1377 use_facet<messages<char> >(
const locale&);
1381 has_facet<moneypunct<char> >(
const locale&);
1385 has_facet<money_put<char> >(
const locale&);
1389 has_facet<money_get<char> >(
const locale&);
1393 has_facet<__timepunct<char> >(
const locale&);
1397 has_facet<time_put<char> >(
const locale&);
1401 has_facet<time_get<char> >(
const locale&);
1405 has_facet<messages<char> >(
const locale&);
1407 #ifdef _GLIBCXX_USE_WCHAR_T 1414 extern template class __timepunct<wchar_t>;
1424 use_facet<moneypunct<wchar_t, true> >(
const locale&);
1427 const moneypunct<wchar_t, false>&
1428 use_facet<moneypunct<wchar_t, false> >(
const locale&);
1431 const money_put<wchar_t>&
1432 use_facet<money_put<wchar_t> >(
const locale&);
1435 const money_get<wchar_t>&
1436 use_facet<money_get<wchar_t> >(
const locale&);
1439 const __timepunct<wchar_t>&
1440 use_facet<__timepunct<wchar_t> >(
const locale&);
1444 use_facet<time_put<wchar_t> >(
const locale&);
1448 use_facet<time_get<wchar_t> >(
const locale&);
1452 use_facet<messages<wchar_t> >(
const locale&);
1456 has_facet<moneypunct<wchar_t> >(
const locale&);
1460 has_facet<money_put<wchar_t> >(
const locale&);
1464 has_facet<money_get<wchar_t> >(
const locale&);
1468 has_facet<__timepunct<wchar_t> >(
const locale&);
1472 has_facet<time_put<wchar_t> >(
const locale&);
1476 has_facet<time_get<wchar_t> >(
const locale&);
1480 has_facet<messages<wchar_t> >(
const locale&);
1484 _GLIBCXX_END_NAMESPACE_VERSION
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.
static const size_type npos
Value returned by various member functions when they fail.
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.
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.
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.
streamsize width() const
Flags access.
_CharT char_type
Public typedefs.
_CharT char_type
Public typedefs.
basic_string & assign(const basic_string &__str)
Set value to contents of another string.
The base of the I/O class hierarchy.This class defines everything that can be defined about I/O that ...
Primary class template time_put.This facet encapsulates the code to format and output dates and times...
Primary class template messages.This facet encapsulates the code to retrieve messages from message ca...
const _CharT * data() const noexcept
Return const pointer to contents.
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.
fmtflags flags() const
Access to format flags.
_OutIter iter_type
Public typedefs.
size_type size() const noexcept
Returns the number of characters in the string, not including any null-termination.
Primary class template money_get.This facet encapsulates the code to parse and return a monetary amou...
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 _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
class moneypunct_byname [22.2.6.4].
Primary class template ctype facet.This template class defines classification and conversion function...
bool is(mask __m, char_type __c) const
Test char_type classification.
virtual dateorder do_date_order() const
Return preferred order of month, day, and year.
_CharT char_type
Public typedefs.
class time_get_byname [22.2.5.2].
static const iostate eofbit
Indicates that an input operation reached the end of an input sequence.
static const iostate failbit
Indicates that an input operation failed to read the expected characters, or that an output operation...
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.
static const fmtflags adjustfield
A mask of left|right|internal. Useful for the 2-arg form of setf.
locale getloc() const
Locale access.
_InIter iter_type
Public typedefs.
void insert(iterator __p, size_type __n, _CharT __c)
Insert multiple characters.
iter_type do_get(iter_type __s, iter_type __end, ios_base &__f, ios_base::iostate &__err, tm *__tm, char __format, char __modifier) const
Parse input string according to format.
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.
basic_string & append(const basic_string &__str)
Append a string to this string.
void reserve(size_type __res_arg=0)
Attempt to preallocate enough memory for specified number of characters.
void resize(size_type __n, _CharT __c)
Resizes the string to the specified number of characters.
char narrow(char_type __c, char __dfault) const
Narrow char_type to char.
static const iostate goodbit
Indicates all is well.
class messages_byname [22.2.7.2].
_GLIBCXX14_CONSTEXPR const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
_InIter iter_type
Public typedefs.
char_type widen(char __c) const
Widen char to char_type.
_OutIter iter_type
Public typedefs.
Primary class template moneypunct.This facet encapsulates the punctuation, grouping and other formatt...
Container class for localization functionality.The locale class is first a class wrapper for C librar...
Basis for explicit traits specializations.
Primary class template time_get.This facet encapsulates the code to parse and return a date or time f...
_Ios_Iostate iostate
This is a bitmask type.
_CharT char_type
Public typedefs.
class time_put_byname [22.2.5.4].
basic_string & erase(size_type __pos=0, size_type __n=npos)
Remove characters.
char_type tolower(char_type __c) const
Convert to lowercase.
char_type toupper(char_type __c) const
Convert to uppercase.
iter_type get(iter_type __s, iter_type __end, ios_base &__io, ios_base::iostate &__err, tm *__tm, char __format, char __modifier=0) const
Parse input string according to format.
static const fmtflags showbase
Generates a prefix indicating the numeric base of generated integer output.
const locale & _M_getloc() const
Locale access.
ISO C++ entities toplevel namespace is std.
const char_type * scan_not(mask __m, const char_type *__lo, const char_type *__hi) const
Find char_type not matching a mask.
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.
static locale::id id
Numpunct facet id.
Primary class template money_put.This facet encapsulates the code to format and output a monetary amo...
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.
static const fmtflags internal
Adds fill characters at a designated internal point in certain generated output, or identical to righ...