1 // Locale support -*- C++ -*-
3 // Copyright (C) 2007-2024 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // Under Section 7 of GPL version 3, you are granted additional
17 // permissions described in the GCC Runtime Library Exception, version
18 // 3.1, as published by the Free Software Foundation.
20 // You should have received a copy of the GNU General Public License and
21 // a copy of the GCC Runtime Library Exception along with this program;
22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 // <http://www.gnu.org/licenses/>.
25 /** @file bits/locale_facets_nonio.tcc
26 * This is an internal header file, included by other library headers.
27 * Do not attempt to use it directly. @headername{locale}
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)
71 const moneypunct<_CharT, _Intl>& __mp =
72 use_facet<moneypunct<_CharT, _Intl> >(__loc);
80 _Scoped_str(const basic_string<_CharT>& __str)
81 : _M_len(__str.size()), _M_str(new _CharT[_M_len])
82 { __str.copy(_M_str, _M_len); }
84 ~_Scoped_str() { delete[] _M_str; }
87 _M_release(const _CharT*& __p, size_t& __n)
95 _Scoped_str __curr_symbol(__mp.curr_symbol());
96 _Scoped_str __positive_sign(__mp.positive_sign());
97 _Scoped_str __negative_sign(__mp.negative_sign());
99 const string& __g = __mp.grouping();
100 const size_t __g_size = __g.size();
101 char* const __grouping = new char[__g_size];
102 __g.copy(__grouping, __g_size);
104 // All allocations succeeded without throwing, OK to modify *this now.
106 _M_grouping = __grouping;
107 _M_grouping_size = __g_size;
108 _M_use_grouping = (__g_size
109 && static_cast<signed char>(__grouping[0]) > 0
111 != __gnu_cxx::__numeric_traits<char>::__max));
113 _M_decimal_point = __mp.decimal_point();
114 _M_thousands_sep = __mp.thousands_sep();
116 __curr_symbol._M_release(_M_curr_symbol, _M_curr_symbol_size);
117 __positive_sign._M_release(_M_positive_sign, _M_positive_sign_size);
118 __negative_sign._M_release(_M_negative_sign, _M_negative_sign_size);
120 _M_frac_digits = __mp.frac_digits();
121 _M_pos_format = __mp.pos_format();
122 _M_neg_format = __mp.neg_format();
124 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__loc);
125 __ct.widen(money_base::_S_atoms,
126 money_base::_S_atoms + money_base::_S_end, _M_atoms);
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,
138 ios_base::iostate& __err, string& __units) const
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;
156 // True if sign is mandatory.
157 const bool __mandatory_sign = (__lc->_M_positive_sign_size
158 && __lc->_M_negative_sign_size);
159 // String of grouping info from thousands_sep plucked from __units.
160 string __grouping_tmp;
161 if (__lc->_M_use_grouping)
162 __grouping_tmp.reserve(32);
163 // Last position before the decimal point.
165 // Separator positions, then, possibly, fractional digits.
167 // If input iterator is in a valid state.
168 bool __testvalid = true;
169 // Flag marking when a decimal point is found.
170 bool __testdecfound = false;
172 // The tentative returned string is stored here.
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:
184 // According to 22.2.6.1.2, p2, symbol is required
185 // if (__io.flags() & ios_base::showbase), otherwise
186 // is optional and consumed only if other characters
187 // are needed to complete the format.
188 if (__io.flags() & ios_base::showbase || __sign_size > 1
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);
207 && (__j || __io.flags() & ios_base::showbase))
211 case money_base::sign:
212 // Sign might not exist, or be more than one character long.
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)
228 // "... if no sign is detected, the result is given the sign
229 // that corresponds to the source of the empty string"
231 else if (__mandatory_sign)
234 case money_base::value:
235 // Extract digits, remove and stash away the
236 // grouping of found thousands separators.
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
263 // Mark position for later analysis.
264 __grouping_tmp += static_cast<char>(__n);
279 case money_base::space:
280 // At least one space is required.
281 if (__beg != __end && __ctype.is(ctype_base::space, *__beg))
286 case money_base::none:
287 // Only if not at the end of the pattern.
289 for (; __beg != __end
290 && __ctype.is(ctype_base::space, *__beg); ++__beg);
295 // Need to get the rest of the sign characters, if they exist.
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)
310 // Strip leading zeros.
311 if (__res.size() > 1)
313 const size_type __first = __res.find_first_not_of('0');
314 const bool __only_zeros = __first == string::npos;
316 __res.erase(0, __only_zeros ? __res.size() - 1 : __first);
320 if (__negative && __res[0] != '0')
321 __res.insert(__res.begin(), '-');
323 // Test for grouping fidelity.
324 if (__grouping_tmp.size())
326 // Add the ending grouping.
327 __grouping_tmp += static_cast<char>(__testdecfound ? __last_pos
329 if (!std::__verify_grouping(__lc->_M_grouping,
330 __lc->_M_grouping_size,
332 __err |= ios_base::failbit;
335 // Iff not enough digits were supplied after the decimal-point.
336 if (__testdecfound && __n != __lc->_M_frac_digits)
340 // Iff valid sequence is not recognized.
342 __err |= ios_base::failbit;
346 // Iff no more characters are available.
348 __err |= ios_base::eofbit;
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,
358 ios_base::iostate& __err, double& __units) const
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>
370 money_get<_CharT, _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>
383 money_get<_CharT, _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;
389 const locale& __loc = __io._M_getloc();
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();
398 __digits.resize(__len);
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>
408 money_get<_CharT, _InIter>::
409 __do_get(iter_type __beg, iter_type __end, bool __intl, ios_base& __io,
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;
438 // Determine if negative or positive formats are to be used, and
439 // discard leading negative_sign if it is present.
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;
460 // Look for valid numbers in the ctype facet within input digits.
461 size_type __len = __ctype.scan_not(ctype_base::digit, __beg,
462 __beg + __digits.size()) - __beg;
465 // Assume valid input, and attempt to format.
466 // Break down input numbers into base components, as follows:
467 // final_value = grouped units + (decimal point) + (digits)
469 __value.reserve(2 * __len);
471 // Add thousands separators to non-decimal digits, per
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);
492 // Deal with decimal point, decimal digits.
493 if (__lc->_M_frac_digits > 0)
495 __value += __lc->_M_decimal_point;
497 __value.append(__beg + __paddec, __lc->_M_frac_digits);
500 // Have to pad zeros in the decimal position.
501 __value.append(-__paddec, __lit[money_base::_S_zero]);
502 __value.append(__beg, __len);
506 // Calculate length of resulting string.
507 const ios_base::fmtflags __f = __io.flags()
508 & ios_base::adjustfield;
509 __len = __value.size() + __sign_size;
510 __len += ((__io.flags() & ios_base::showbase)
511 ? __lc->_M_curr_symbol_size : 0);
514 __res.reserve(2 * __len);
516 const size_type __width = static_cast<size_type>(__io.width());
517 const bool __testipad = (__f == ios_base::internal
519 // Fit formatted digits into the required pattern.
520 for (int __i = 0; __i < 4; ++__i)
522 const part __which = static_cast<part>(__p.field[__i]);
525 case money_base::symbol:
526 if (__io.flags() & ios_base::showbase)
527 __res.append(__lc->_M_curr_symbol,
528 __lc->_M_curr_symbol_size);
530 case money_base::sign:
531 // Sign might not exist, or be more than one
532 // character long. In that case, add in the rest
537 case money_base::value:
540 case money_base::space:
541 // At least one space is required, but if internal
542 // formatting is required, an arbitrary number of
543 // fill spaces will be necessary.
545 __res.append(__width - __len, __fill);
549 case money_base::none:
551 __res.append(__width - __len, __fill);
556 // Special case of multi-part sign parts.
558 __res.append(__sign + 1, __sign_size - 1);
560 // Pad, if still necessary.
561 __len = __res.size();
564 if (__f == ios_base::left)
566 __res.append(__width - __len, __fill);
569 __res.insert(0, __width - __len, __fill);
573 // Write resulting, fully-formatted string to output iterator.
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>
592 money_put<_CharT, _OutIter>::
593 do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,
594 long double __units) const
596 const locale __loc = __io.getloc();
597 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
598 #if _GLIBCXX_USE_C99_STDIO
599 // First try a buffer perhaps big enough.
601 char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
602 // _GLIBCXX_RESOLVE_LIB_DEFECTS
603 // 328. Bad sprintf format modifier in money_put<>::do_put()
604 int __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
605 "%.*Lf", 0, __units);
606 // If the buffer was not large enough, try again with the correct size.
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);
615 // max_exponent10 + 1 for the integer part, + 2 for sign and '\0'.
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",
622 string_type __digits(__len, char_type());
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>
630 money_put<_CharT, _OutIter>::
631 do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,
632 const string_type& __digits) const
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__
639 __typeof__(__builtin_snprintf) __glibcxx_snprintfibm128 __asm__("snprintf");
641 template<typename _CharT, typename _OutIter>
643 money_put<_CharT, _OutIter>::
644 __do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,
645 __ibm128 __units) const
647 const locale __loc = __io.getloc();
648 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
649 // First try a buffer perhaps big enough.
651 char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
652 const __c_locale __old = __gnu_cxx::__uselocale(_S_get_c_locale());
654 // _GLIBCXX_RESOLVE_LIB_DEFECTS
655 // 328. Bad sprintf format modifier in money_put<>::do_put()
656 int __len = __glibcxx_snprintfibm128(__cs, __cs_size, "%.*Lf", 0,
658 // If the buffer was not large enough, try again with the correct size.
659 if (__len >= __cs_size)
661 __cs_size = __len + 1;
662 __cs = static_cast<char*>(__builtin_alloca(__cs_size));
663 __len = __glibcxx_snprintfibm128(__cs, __cs_size, "%.*Lf", 0,
666 __gnu_cxx::__uselocale(__old);
667 string_type __digits(__len, char_type());
668 __ctype.widen(__cs, __cs + __len, &__digits[0]);
669 return __intl ? _M_insert<true>(__s, __io, __fill, __digits)
670 : _M_insert<false>(__s, __io, __fill, __digits);
674 _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11
676 // NB: Not especially useful. Without an ios_base object or some
677 // kind of locale reference, we are left clawing at the air where
678 // the side of the mountain used to be...
679 template<typename _CharT, typename _InIter>
681 time_get<_CharT, _InIter>::do_date_order() const
682 { return time_base::no_order; }
684 // Expand a strptime format string and parse it. E.g., do_get_date() may
685 // pass %m/%d/%Y => extracted characters.
686 template<typename _CharT, typename _InIter>
688 time_get<_CharT, _InIter>::
689 _M_extract_via_format(iter_type __beg, iter_type __end, ios_base& __io,
690 ios_base::iostate& __err, tm* __tm,
691 const _CharT* __format,
692 __time_get_state &__state) const
694 const locale& __loc = __io._M_getloc();
695 const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
696 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
697 const size_t __len = char_traits<_CharT>::length(__format);
699 ios_base::iostate __tmperr = ios_base::goodbit;
701 for (; __beg != __end && __i < __len && !__tmperr; ++__i)
703 if (__ctype.narrow(__format[__i], 0) == '%')
705 // Verify valid formatting code, attempt to extract.
706 char __c = __ctype.narrow(__format[++__i], 0);
708 if (__c == 'E' || __c == 'O')
709 __c = __ctype.narrow(__format[++__i], 0);
716 // Weekday name (possibly abbreviated) [tm_wday]
717 const char_type* __days[14];
718 __tp._M_days(&__days[0]);
719 __tp._M_days_abbreviated(&__days[7]);
720 __beg = _M_extract_name(__beg, __end, __mem, __days,
724 __tm->tm_wday = __mem % 7;
725 __state._M_have_wday = 1;
731 // Month name (possibly abbreviated) [tm_mon]
732 const char_type* __months[24];
733 __tp._M_months(&__months[0]);
734 __tp._M_months_abbreviated(&__months[12]);
735 __beg = _M_extract_name(__beg, __end, __mem,
736 __months, 24, __io, __tmperr);
739 __tm->tm_mon = __mem % 12;
740 __state._M_have_mon = 1;
741 __state._M_want_xday = 1;
745 // Default time and date representation.
746 const char_type* __dt[2];
747 __tp._M_date_time_formats(__dt);
748 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
749 __tm, __dt[0], __state);
751 __state._M_want_xday = 1;
755 __beg = _M_extract_num(__beg, __end, __mem, 0, 99, 2,
759 __state._M_century = __mem;
760 __state._M_have_century = 1;
761 __state._M_want_xday = 1;
766 // Day [1, 31]. [tm_mday]
767 if (__ctype.is(ctype_base::space, *__beg))
769 __beg = _M_extract_num(__beg, __end, __mem, 1, 31, 2,
773 __tm->tm_mday = __mem;
774 __state._M_have_mday = 1;
775 __state._M_want_xday = 1;
779 // Equivalent to %m/%d/%y.[tm_mon, tm_mday, tm_year]
781 __ctype.widen(__cs, __cs + 9, __wcs);
782 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
783 __tm, __wcs, __state);
785 __state._M_want_xday = 1;
788 // Hour [00, 23]. [tm_hour]
789 __beg = _M_extract_num(__beg, __end, __mem, 0, 23, 2,
793 __tm->tm_hour = __mem;
794 __state._M_have_I = 0;
798 // Hour [01, 12]. [tm_hour]
799 __beg = _M_extract_num(__beg, __end, __mem, 1, 12, 2,
803 __tm->tm_hour = __mem % 12;
804 __state._M_have_I = 1;
808 // Day number of year.
809 __beg = _M_extract_num(__beg, __end, __mem, 1, 366, 3,
813 __tm->tm_yday = __mem - 1;
814 __state._M_have_yday = 1;
818 // Month [01, 12]. [tm_mon]
819 __beg = _M_extract_num(__beg, __end, __mem, 1, 12, 2,
823 __tm->tm_mon = __mem - 1;
824 __state._M_have_mon = 1;
828 // Minute [00, 59]. [tm_min]
829 __beg = _M_extract_num(__beg, __end, __mem, 0, 59, 2,
832 __tm->tm_min = __mem;
836 while (__beg != __end
837 && __ctype.is(ctype_base::space, *__beg))
841 // Locale's a.m. or p.m.
842 const char_type* __ampm[2];
843 __tp._M_am_pm(&__ampm[0]);
844 if (!__ampm[0][0] || !__ampm[1][0])
846 __beg = _M_extract_name(__beg, __end, __mem, __ampm,
848 if (!__tmperr && __mem)
849 __state._M_is_pm = 1;
852 // Locale's 12-hour clock time format (in C %I:%M:%S %p).
853 const char_type* __ampm_format;
854 __tp._M_am_pm_format(&__ampm_format);
855 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
856 __tm, __ampm_format, __state);
859 // Equivalent to (%H:%M).
861 __ctype.widen(__cs, __cs + 6, __wcs);
862 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
863 __tm, __wcs, __state);
867 // [00, 60] in C99 (one leap-second), [00, 61] in C89.
869 __beg = _M_extract_num(__beg, __end, __mem, 0, 60, 2,
871 __beg = _M_extract_num(__beg, __end, __mem, 0, 61, 2,
875 __tm->tm_sec = __mem;
878 // Equivalent to (%H:%M:%S).
880 __ctype.widen(__cs, __cs + 9, __wcs);
881 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
882 __tm, __wcs, __state);
885 // Week number of the year (Sunday as first day of week).
886 __beg = _M_extract_num(__beg, __end, __mem, 0, 53, 2,
890 __state._M_week_no = __mem;
891 __state._M_have_uweek = 1;
896 __beg = _M_extract_num(__beg, __end, __mem, 0, 6, 1,
900 __tm->tm_wday = __mem;
901 __state._M_have_wday = 1;
905 // Week number of the year (Monday as first day of week).
906 __beg = _M_extract_num(__beg, __end, __mem, 0, 53, 2,
910 __state._M_week_no = __mem;
911 __state._M_have_wweek = 1;
916 const char_type* __dates[2];
917 __tp._M_date_formats(__dates);
918 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
919 __tm, __dates[0], __state);
923 const char_type* __times[2];
924 __tp._M_time_formats(__times);
925 __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
926 __tm, __times[0], __state);
929 // The last 2 digits of year.
930 __beg = _M_extract_num(__beg, __end, __mem, 0, 99, 2,
934 __state._M_want_century = 1;
935 __state._M_want_xday = 1;
936 // As an extension, if the 2 digits are followed by
937 // 1-2 further digits, treat it like %Y.
940 __c = __ctype.narrow(*__beg, '*');
941 if (__c >= '0' && __c <= '9')
944 __mem = __mem * 10 + (__c - '0');
947 __c = __ctype.narrow(*__beg, '*');
948 if (__c >= '0' && __c <= '9')
951 __mem = __mem * 10 + (__c - '0');
955 __state._M_want_century = 0;
957 // Otherwise, as per POSIX 2008, 00-68 is 2000-2068,
958 // while 69-99 is 1969-1999.
961 __tm->tm_year = __mem;
966 __beg = _M_extract_num(__beg, __end, __mem, 0, 9999, 4,
970 __tm->tm_year = __mem - 1900;
971 __state._M_want_century = 0;
972 __state._M_want_xday = 1;
977 if (__ctype.is(ctype_base::upper, *__beg))
980 __beg = _M_extract_name(__beg, __end, __tmp,
981 __timepunct_cache<_CharT>::_S_timezones,
984 // GMT requires special effort.
985 if (__beg != __end && !__tmperr && __tmp == 0
986 && (*__beg == __ctype.widen('-')
987 || *__beg == __ctype.widen('+')))
989 __beg = _M_extract_num(__beg, __end, __tmp, 0, 23, 2,
991 __beg = _M_extract_num(__beg, __end, __tmp, 0, 59, 2,
996 __tmperr |= ios_base::failbit;
999 if (*__beg == __ctype.widen('%'))
1002 __tmperr |= ios_base::failbit;
1006 __tmperr |= ios_base::failbit;
1009 else if (__ctype.is(ctype_base::space, __format[__i]))
1011 // Skip any whitespace.
1012 while (__beg != __end
1013 && __ctype.is(ctype_base::space, *__beg))
1018 // Verify format and input match, extract and discard.
1019 // TODO real case-insensitive comparison
1020 if (__ctype.tolower(__format[__i]) == __ctype.tolower(*__beg)
1021 || __ctype.toupper(__format[__i]) == __ctype.toupper(*__beg))
1024 __tmperr |= ios_base::failbit;
1028 if (__tmperr || __i != __len)
1029 __err |= ios_base::failbit;
1034 template<typename _CharT, typename _InIter>
1036 time_get<_CharT, _InIter>::
1037 _M_extract_via_format(iter_type __beg, iter_type __end, ios_base& __io,
1038 ios_base::iostate& __err, tm* __tm,
1039 const _CharT* __format) const
1041 __time_get_state __state = __time_get_state();
1042 return _M_extract_via_format(__beg, __end, __io, __err, __tm,
1046 template<typename _CharT, typename _InIter>
1048 time_get<_CharT, _InIter>::
1049 _M_extract_num(iter_type __beg, iter_type __end, int& __member,
1050 int __min, int __max, size_t __len,
1051 ios_base& __io, ios_base::iostate& __err) const
1053 const locale& __loc = __io._M_getloc();
1054 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
1058 for (; __beg != __end && __i < __len; ++__beg, (void)++__i)
1060 const char __c = __ctype.narrow(*__beg, '*');
1061 if (__c >= '0' && __c <= '9')
1063 __value = __value * 10 + (__c - '0');
1064 if (__value > __max)
1070 if (__i && __value >= __min && __value <= __max)
1073 __err |= ios_base::failbit;
1079 // All elements in __names are unique, except if __indexlen is
1080 // even __names in the first half could be the same as corresponding
1081 // __names in the second half (May is abbreviated as May). Some __names
1082 // elements could be prefixes of other __names elements.
1083 template<typename _CharT, typename _InIter>
1085 time_get<_CharT, _InIter>::
1086 _M_extract_name(iter_type __beg, iter_type __end, int& __member,
1087 const _CharT** __names, size_t __indexlen,
1088 ios_base& __io, ios_base::iostate& __err) const
1090 typedef char_traits<_CharT> __traits_type;
1091 const locale& __loc = __io._M_getloc();
1092 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
1095 = static_cast<size_t*>(__builtin_alloca(2 * sizeof(size_t)
1097 size_t* __lengths = __matches + __indexlen;
1098 size_t __nmatches = 0;
1100 bool __testvalid = true;
1101 const char_type* __name;
1102 bool __begupdated = false;
1104 // Look for initial matches.
1107 const char_type __c = *__beg;
1108 // TODO real case-insensitive comparison
1109 const char_type __cl = __ctype.tolower(__c);
1110 const char_type __cu = __ctype.toupper(__c);
1111 for (size_t __i1 = 0; __i1 < __indexlen; ++__i1)
1112 if (__cl == __ctype.tolower(__names[__i1][0])
1113 || __cu == __ctype.toupper(__names[__i1][0]))
1115 __lengths[__nmatches]
1116 = __traits_type::length(__names[__i1]);
1117 __matches[__nmatches++] = __i1;
1121 while (__nmatches > 1)
1123 // Find smallest matching string.
1124 size_t __minlen = __lengths[0];
1125 for (size_t __i2 = 1; __i2 < __nmatches; ++__i2)
1126 __minlen = std::min(__minlen, __lengths[__i2]);
1129 if (__pos == __minlen)
1131 // If some match has remaining length of 0,
1132 // need to decide if any match with remaining
1133 // length non-zero matches the next character.
1134 // If so, remove all matches with remaining length
1135 // 0 from consideration, otherwise keep only matches
1136 // with remaining length 0.
1137 bool __match_longer = false;
1141 // TODO real case-insensitive comparison
1142 const char_type __cl = __ctype.tolower(*__beg);
1143 const char_type __cu = __ctype.toupper(*__beg);
1144 for (size_t __i3 = 0; __i3 < __nmatches; ++__i3)
1146 __name = __names[__matches[__i3]];
1147 if (__lengths[__i3] > __pos
1148 && (__ctype.tolower(__name[__pos]) == __cl
1149 || __ctype.toupper(__name[__pos]) == __cu))
1151 __match_longer = true;
1156 for (size_t __i4 = 0; __i4 < __nmatches;)
1157 if (__match_longer == (__lengths[__i4] == __pos))
1159 __matches[__i4] = __matches[--__nmatches];
1160 __lengths[__i4] = __lengths[__nmatches];
1166 __minlen = __lengths[0];
1167 for (size_t __i5 = 1; __i5 < __nmatches; ++__i5)
1168 __minlen = std::min(__minlen, __lengths[__i5]);
1172 // Deal with May being full as well as abbreviated month
1173 // name. Pick the smaller index.
1174 if (__nmatches == 2 && (__indexlen & 1) == 0)
1176 if (__matches[0] < __indexlen / 2)
1178 if (__matches[1] == __matches[0] + __indexlen / 2)
1181 else if (__matches[1] == __matches[0] - __indexlen / 2)
1183 __matches[0] = __matches[1];
1184 __lengths[0] = __lengths[1];
1188 __begupdated = true;
1192 if (__pos < __minlen && __beg != __end)
1194 // TODO real case-insensitive comparison
1195 const char_type __cl = __ctype.tolower(*__beg);
1196 const char_type __cu = __ctype.toupper(*__beg);
1197 for (size_t __i6 = 0; __i6 < __nmatches;)
1199 __name = __names[__matches[__i6]];
1200 if (__ctype.tolower(__name[__pos]) != __cl
1201 && __ctype.toupper(__name[__pos]) != __cu)
1203 __matches[__i6] = __matches[--__nmatches];
1204 __lengths[__i6] = __lengths[__nmatches];
1214 if (__nmatches == 1)
1216 // Make sure found name is completely extracted.
1222 __name = __names[__matches[0]];
1223 const size_t __len = __lengths[0];
1224 while (__pos < __len
1226 // TODO real case-insensitive comparison
1227 && (__ctype.tolower(__name[__pos]) == __ctype.tolower(*__beg)
1228 || (__ctype.toupper(__name[__pos])
1229 == __ctype.toupper(*__beg))))
1230 ++__beg, (void)++__pos;
1233 __member = __matches[0];
1235 __testvalid = false;
1238 __testvalid = false;
1240 __err |= ios_base::failbit;
1245 template<typename _CharT, typename _InIter>
1247 time_get<_CharT, _InIter>::
1248 _M_extract_wday_or_month(iter_type __beg, iter_type __end, int& __member,
1249 const _CharT** __names, size_t __indexlen,
1250 ios_base& __io, ios_base::iostate& __err) const
1252 typedef char_traits<_CharT> __traits_type;
1253 const locale& __loc = __io._M_getloc();
1254 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
1256 int* __matches = static_cast<int*>(__builtin_alloca(2 * sizeof(int)
1258 size_t __nmatches = 0;
1259 size_t* __matches_lengths = 0;
1264 const char_type __c = *__beg;
1265 for (size_t __i = 0; __i < 2 * __indexlen; ++__i)
1266 if (__c == __names[__i][0]
1267 || __c == __ctype.toupper(__names[__i][0]))
1268 __matches[__nmatches++] = __i;
1277 = static_cast<size_t*>(__builtin_alloca(sizeof(size_t)
1279 for (size_t __i = 0; __i < __nmatches; ++__i)
1280 __matches_lengths[__i]
1281 = __traits_type::length(__names[__matches[__i]]);
1284 for (; __beg != __end; ++__beg, (void)++__pos)
1286 size_t __nskipped = 0;
1287 const char_type __c = *__beg;
1288 for (size_t __i = 0; __i < __nmatches;)
1290 const char_type* __name = __names[__matches[__i]];
1291 if (__pos >= __matches_lengths[__i])
1292 ++__nskipped, ++__i;
1293 else if (!(__name[__pos] == __c))
1296 __matches[__i] = __matches[__nmatches];
1297 __matches_lengths[__i] = __matches_lengths[__nmatches];
1302 if (__nskipped == __nmatches)
1306 if ((__nmatches == 1 && __matches_lengths[0] == __pos)
1307 || (__nmatches == 2 && (__matches_lengths[0] == __pos
1308 || __matches_lengths[1] == __pos)))
1309 __member = (__matches[0] >= (int)__indexlen
1310 ? __matches[0] - (int)__indexlen : __matches[0]);
1312 __err |= ios_base::failbit;
1317 template<typename _CharT, typename _InIter>
1319 time_get<_CharT, _InIter>::
1320 do_get_time(iter_type __beg, iter_type __end, ios_base& __io,
1321 ios_base::iostate& __err, tm* __tm) const
1323 const locale& __loc = __io._M_getloc();
1324 const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
1325 const char_type* __times[2];
1326 __tp._M_time_formats(__times);
1327 __time_get_state __state = __time_get_state();
1328 __beg = _M_extract_via_format(__beg, __end, __io, __err,
1329 __tm, __times[0], __state);
1330 __state._M_finalize_state(__tm);
1332 __err |= ios_base::eofbit;
1336 template<typename _CharT, typename _InIter>
1338 time_get<_CharT, _InIter>::
1339 do_get_date(iter_type __beg, iter_type __end, ios_base& __io,
1340 ios_base::iostate& __err, tm* __tm) const
1342 const locale& __loc = __io._M_getloc();
1343 const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
1344 const char_type* __dates[2];
1345 __tp._M_date_formats(__dates);
1346 __time_get_state __state = __time_get_state();
1347 __beg = _M_extract_via_format(__beg, __end, __io, __err,
1348 __tm, __dates[0], __state);
1349 __state._M_finalize_state(__tm);
1351 __err |= ios_base::eofbit;
1355 template<typename _CharT, typename _InIter>
1357 time_get<_CharT, _InIter>::
1358 do_get_weekday(iter_type __beg, iter_type __end, ios_base& __io,
1359 ios_base::iostate& __err, tm* __tm) const
1361 const locale& __loc = __io._M_getloc();
1362 const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
1363 const char_type* __days[14];
1364 __tp._M_days_abbreviated(__days);
1365 __tp._M_days(__days + 7);
1367 ios_base::iostate __tmperr = ios_base::goodbit;
1369 __beg = _M_extract_wday_or_month(__beg, __end, __tmpwday, __days, 7,
1372 __tm->tm_wday = __tmpwday;
1374 __err |= ios_base::failbit;
1377 __err |= ios_base::eofbit;
1381 template<typename _CharT, typename _InIter>
1383 time_get<_CharT, _InIter>::
1384 do_get_monthname(iter_type __beg, iter_type __end,
1385 ios_base& __io, ios_base::iostate& __err, tm* __tm) const
1387 const locale& __loc = __io._M_getloc();
1388 const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
1389 const char_type* __months[24];
1390 __tp._M_months_abbreviated(__months);
1391 __tp._M_months(__months + 12);
1393 ios_base::iostate __tmperr = ios_base::goodbit;
1395 __beg = _M_extract_wday_or_month(__beg, __end, __tmpmon, __months, 12,
1398 __tm->tm_mon = __tmpmon;
1400 __err |= ios_base::failbit;
1403 __err |= ios_base::eofbit;
1407 template<typename _CharT, typename _InIter>
1409 time_get<_CharT, _InIter>::
1410 do_get_year(iter_type __beg, iter_type __end, ios_base& __io,
1411 ios_base::iostate& __err, tm* __tm) const
1414 ios_base::iostate __tmperr = ios_base::goodbit;
1415 const locale& __loc = __io._M_getloc();
1416 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
1418 __beg = _M_extract_num(__beg, __end, __tmpyear, 0, 99, 2,
1424 __c = __ctype.narrow(*__beg, '*');
1425 // For 1-2 digit year, assume 69-99 is 1969-1999, 0-68 is 2000-2068.
1426 // For 3-4 digit year, use it as year.
1427 // __tm->tm_year needs year - 1900 though.
1428 if (__c >= '0' && __c <= '9')
1431 __tmpyear = __tmpyear * 10 + (__c - '0');
1434 __c = __ctype.narrow(*__beg, '*');
1435 if (__c >= '0' && __c <= '9')
1438 __tmpyear = __tmpyear * 10 + (__c - '0');
1443 else if (__tmpyear < 69)
1445 __tm->tm_year = __tmpyear;
1448 __err |= ios_base::failbit;
1451 __err |= ios_base::eofbit;
1455 #if __cplusplus >= 201103L
1456 template<typename _CharT, typename _InIter>
1459 time_get<_CharT, _InIter>::
1460 get(iter_type __s, iter_type __end, ios_base& __io,
1461 ios_base::iostate& __err, tm* __tm, const char_type* __fmt,
1462 const char_type* __fmtend) const
1464 const locale& __loc = __io._M_getloc();
1465 ctype<_CharT> const& __ctype = use_facet<ctype<_CharT> >(__loc);
1466 __err = ios_base::goodbit;
1467 bool __use_state = false;
1468 #if __GNUC__ >= 5 && !defined(_GLIBCXX_CLANG)
1469 #pragma GCC diagnostic push
1470 #pragma GCC diagnostic ignored "-Wpmf-conversions"
1471 // Nasty hack. The C++ standard mandates that get invokes the do_get
1472 // virtual method, but unfortunately at least without an ABI change
1473 // for the facets we can't keep state across the different do_get
1474 // calls. So e.g. if __fmt is "%p %I:%M:%S", we can't handle it
1475 // properly, because we first handle the %p am/pm specifier and only
1476 // later the 12-hour format specifier.
1477 if ((void*)(this->*(&time_get::do_get)) == (void*)(&time_get::do_get))
1479 #pragma GCC diagnostic pop
1481 __time_get_state __state = __time_get_state();
1482 while (__fmt != __fmtend &&
1483 __err == ios_base::goodbit)
1487 __err = ios_base::eofbit | ios_base::failbit;
1490 else if (__ctype.narrow(*__fmt, 0) == '%')
1492 const char_type* __fmt_start = __fmt;
1495 if (++__fmt == __fmtend)
1497 __err = ios_base::failbit;
1500 const char __c = __ctype.narrow(*__fmt, 0);
1501 if (__c != 'E' && __c != 'O')
1503 else if (++__fmt != __fmtend)
1506 __format = __ctype.narrow(*__fmt, 0);
1510 __err = ios_base::failbit;
1515 char_type __new_fmt[4];
1516 __new_fmt[0] = __fmt_start[0];
1517 __new_fmt[1] = __fmt_start[1];
1520 __new_fmt[2] = __fmt_start[2];
1521 __new_fmt[3] = char_type();
1524 __new_fmt[2] = char_type();
1525 __s = _M_extract_via_format(__s, __end, __io, __err, __tm,
1526 __new_fmt, __state);
1528 __err |= ios_base::eofbit;
1531 __s = this->do_get(__s, __end, __io, __err, __tm, __format,
1535 else if (__ctype.is(ctype_base::space, *__fmt))
1538 while (__fmt != __fmtend &&
1539 __ctype.is(ctype_base::space, *__fmt))
1542 while (__s != __end &&
1543 __ctype.is(ctype_base::space, *__s))
1546 // TODO real case-insensitive comparison
1547 else if (__ctype.tolower(*__s) == __ctype.tolower(*__fmt) ||
1548 __ctype.toupper(*__s) == __ctype.toupper(*__fmt))
1555 __err = ios_base::failbit;
1560 __state._M_finalize_state(__tm);
1564 template<typename _CharT, typename _InIter>
1567 time_get<_CharT, _InIter>::
1568 do_get(iter_type __beg, iter_type __end, ios_base& __io,
1569 ios_base::iostate& __err, tm* __tm,
1570 char __format, char __mod) const
1572 const locale& __loc = __io._M_getloc();
1573 ctype<_CharT> const& __ctype = use_facet<ctype<_CharT> >(__loc);
1574 __err = ios_base::goodbit;
1577 __fmt[0] = __ctype.widen('%');
1580 __fmt[1] = __format;
1581 __fmt[2] = char_type();
1586 __fmt[2] = __format;
1587 __fmt[3] = char_type();
1590 __time_get_state __state = __time_get_state();
1591 __beg = _M_extract_via_format(__beg, __end, __io, __err, __tm, __fmt,
1593 __state._M_finalize_state(__tm);
1595 __err |= ios_base::eofbit;
1599 #endif // __cplusplus >= 201103L
1601 template<typename _CharT, typename _OutIter>
1603 time_put<_CharT, _OutIter>::
1604 put(iter_type __s, ios_base& __io, char_type __fill, const tm* __tm,
1605 const _CharT* __beg, const _CharT* __end) const
1607 const locale& __loc = __io._M_getloc();
1608 ctype<_CharT> const& __ctype = use_facet<ctype<_CharT> >(__loc);
1609 for (; __beg != __end; ++__beg)
1610 if (__ctype.narrow(*__beg, 0) != '%')
1615 else if (++__beg != __end)
1619 const char __c = __ctype.narrow(*__beg, 0);
1620 if (__c != 'E' && __c != 'O')
1622 else if (++__beg != __end)
1625 __format = __ctype.narrow(*__beg, 0);
1629 __s = this->do_put(__s, __io, __fill, __tm, __format, __mod);
1636 template<typename _CharT, typename _OutIter>
1638 time_put<_CharT, _OutIter>::
1639 do_put(iter_type __s, ios_base& __io, char_type, const tm* __tm,
1640 char __format, char __mod) const
1642 const locale& __loc = __io._M_getloc();
1643 ctype<_CharT> const& __ctype = use_facet<ctype<_CharT> >(__loc);
1644 __timepunct<_CharT> const& __tp = use_facet<__timepunct<_CharT> >(__loc);
1646 // NB: This size is arbitrary. Should this be a data member,
1647 // initialized at construction?
1648 const size_t __maxlen = 128;
1649 char_type __res[__maxlen];
1651 // NB: In IEE 1003.1-200x, and perhaps other locale models, it
1652 // is possible that the format character will be longer than one
1653 // character. Possibilities include 'E' or 'O' followed by a
1654 // format character: if __mod is not the default argument, assume
1655 // it's a valid modifier.
1657 __fmt[0] = __ctype.widen('%');
1660 __fmt[1] = __format;
1661 __fmt[2] = char_type();
1666 __fmt[2] = __format;
1667 __fmt[3] = char_type();
1670 __tp._M_put(__res, __maxlen, __fmt, __tm);
1672 // Write resulting, fully-formatted string to output iterator.
1673 return std::__write(__s, __res, char_traits<char_type>::length(__res));
1677 // Inhibit implicit instantiations for required instantiations,
1678 // which are defined via explicit instantiations elsewhere.
1679 #if _GLIBCXX_EXTERN_TEMPLATE
1680 extern template class moneypunct<char, false>;
1681 extern template class moneypunct<char, true>;
1682 extern template class moneypunct_byname<char, false>;
1683 extern template class moneypunct_byname<char, true>;
1684 extern template class _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 money_get<char>;
1685 extern template class _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 money_put<char>;
1686 extern template class __timepunct<char>;
1687 extern template class time_put<char>;
1688 extern template class time_put_byname<char>;
1689 extern template class time_get<char>;
1690 extern template class time_get_byname<char>;
1691 extern template class messages<char>;
1692 extern template class messages_byname<char>;
1695 const moneypunct<char, true>*
1696 __try_use_facet<moneypunct<char, true> >(const locale&) _GLIBCXX_NOTHROW;
1699 const moneypunct<char, false>*
1700 __try_use_facet<moneypunct<char, false> >(const locale&) _GLIBCXX_NOTHROW;
1703 const money_put<char>*
1704 __try_use_facet<money_put<char> >(const locale&) _GLIBCXX_NOTHROW;
1707 const money_get<char>*
1708 __try_use_facet<money_get<char> >(const locale&) _GLIBCXX_NOTHROW;
1711 const __timepunct<char>*
1712 __try_use_facet<__timepunct<char> >(const locale&) _GLIBCXX_NOTHROW;
1715 const time_put<char>*
1716 __try_use_facet<time_put<char> >(const locale&) _GLIBCXX_NOTHROW;
1719 const time_get<char>*
1720 __try_use_facet<time_get<char> >(const locale&) _GLIBCXX_NOTHROW;
1723 const messages<char>*
1724 __try_use_facet<messages<char> >(const locale&) _GLIBCXX_NOTHROW;
1727 const moneypunct<char, true>&
1728 use_facet<moneypunct<char, true> >(const locale&);
1731 const moneypunct<char, false>&
1732 use_facet<moneypunct<char, false> >(const locale&);
1735 const money_put<char>&
1736 use_facet<money_put<char> >(const locale&);
1739 const money_get<char>&
1740 use_facet<money_get<char> >(const locale&);
1743 const __timepunct<char>&
1744 use_facet<__timepunct<char> >(const locale&);
1747 const time_put<char>&
1748 use_facet<time_put<char> >(const locale&);
1751 const time_get<char>&
1752 use_facet<time_get<char> >(const locale&);
1755 const messages<char>&
1756 use_facet<messages<char> >(const locale&);
1760 has_facet<moneypunct<char> >(const locale&);
1764 has_facet<money_put<char> >(const locale&);
1768 has_facet<money_get<char> >(const locale&);
1772 has_facet<__timepunct<char> >(const locale&);
1776 has_facet<time_put<char> >(const locale&);
1780 has_facet<time_get<char> >(const locale&);
1784 has_facet<messages<char> >(const locale&);
1786 #ifdef _GLIBCXX_USE_WCHAR_T
1787 extern template class moneypunct<wchar_t, false>;
1788 extern template class moneypunct<wchar_t, true>;
1789 extern template class moneypunct_byname<wchar_t, false>;
1790 extern template class moneypunct_byname<wchar_t, true>;
1791 extern template class _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 money_get<wchar_t>;
1792 extern template class _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 money_put<wchar_t>;
1793 extern template class __timepunct<wchar_t>;
1794 extern template class time_put<wchar_t>;
1795 extern template class time_put_byname<wchar_t>;
1796 extern template class time_get<wchar_t>;
1797 extern template class time_get_byname<wchar_t>;
1798 extern template class messages<wchar_t>;
1799 extern template class messages_byname<wchar_t>;
1802 const moneypunct<wchar_t, true>*
1803 __try_use_facet<moneypunct<wchar_t, true> >(const locale&) _GLIBCXX_NOTHROW;
1806 const moneypunct<wchar_t, false>*
1807 __try_use_facet<moneypunct<wchar_t, false> >(const locale&) _GLIBCXX_NOTHROW;
1810 const money_put<wchar_t>*
1811 __try_use_facet<money_put<wchar_t> >(const locale&) _GLIBCXX_NOTHROW;
1814 const money_get<wchar_t>*
1815 __try_use_facet<money_get<wchar_t> >(const locale&) _GLIBCXX_NOTHROW;
1818 const __timepunct<wchar_t>*
1819 __try_use_facet<__timepunct<wchar_t> >(const locale&) _GLIBCXX_NOTHROW;
1822 const time_put<wchar_t>*
1823 __try_use_facet<time_put<wchar_t> >(const locale&) _GLIBCXX_NOTHROW;
1826 const time_get<wchar_t>*
1827 __try_use_facet<time_get<wchar_t> >(const locale&) _GLIBCXX_NOTHROW;
1830 const messages<wchar_t>*
1831 __try_use_facet<messages<wchar_t> >(const locale&) _GLIBCXX_NOTHROW;
1834 const moneypunct<wchar_t, true>&
1835 use_facet<moneypunct<wchar_t, true> >(const locale&);
1838 const moneypunct<wchar_t, false>&
1839 use_facet<moneypunct<wchar_t, false> >(const locale&);
1842 const money_put<wchar_t>&
1843 use_facet<money_put<wchar_t> >(const locale&);
1846 const money_get<wchar_t>&
1847 use_facet<money_get<wchar_t> >(const locale&);
1850 const __timepunct<wchar_t>&
1851 use_facet<__timepunct<wchar_t> >(const locale&);
1854 const time_put<wchar_t>&
1855 use_facet<time_put<wchar_t> >(const locale&);
1858 const time_get<wchar_t>&
1859 use_facet<time_get<wchar_t> >(const locale&);
1862 const messages<wchar_t>&
1863 use_facet<messages<wchar_t> >(const locale&);
1867 has_facet<moneypunct<wchar_t> >(const locale&);
1871 has_facet<money_put<wchar_t> >(const locale&);
1875 has_facet<money_get<wchar_t> >(const locale&);
1879 has_facet<__timepunct<wchar_t> >(const locale&);
1883 has_facet<time_put<wchar_t> >(const locale&);
1887 has_facet<time_get<wchar_t> >(const locale&);
1891 has_facet<messages<wchar_t> >(const locale&);
1895 _GLIBCXX_END_NAMESPACE_VERSION