2 //===----------------------------------------------------------------------===//
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP___LOCALE
11 #define _LIBCPP___LOCALE
21 #if defined(_LIBCPP_MSVCRT_LIKE)
23 # include <support/win32/locale_win32.h>
25 # include <support/ibm/xlocale.h>
26 #elif defined(__ANDROID__)
27 # include <support/android/locale_bionic.h>
28 #elif defined(__sun__)
30 # include <support/solaris/xlocale.h>
31 #elif defined(_NEWLIB_VERSION)
32 # include <support/newlib/xlocale.h>
33 #elif (defined(__APPLE__) || defined(__FreeBSD__) \
34 || defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
36 #elif defined(__Fuchsia__)
37 # include <support/fuchsia/xlocale.h>
38 #elif defined(__wasi__)
39 // WASI libc uses musl's locales support.
40 # include <support/musl/xlocale.h>
41 #elif defined(_LIBCPP_HAS_MUSL_LIBC)
42 # include <support/musl/xlocale.h>
45 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
46 #pragma GCC system_header
49 _LIBCPP_BEGIN_NAMESPACE_STD
51 #if !defined(_LIBCPP_LOCALE__L_EXTENSIONS)
52 struct __libcpp_locale_guard {
53 _LIBCPP_INLINE_VISIBILITY
54 __libcpp_locale_guard(locale_t& __loc) : __old_loc_(uselocale(__loc)) {}
56 _LIBCPP_INLINE_VISIBILITY
57 ~__libcpp_locale_guard() {
59 uselocale(__old_loc_);
64 __libcpp_locale_guard(__libcpp_locale_guard const&);
65 __libcpp_locale_guard& operator=(__libcpp_locale_guard const&);
67 #elif defined(_LIBCPP_MSVCRT_LIKE)
68 struct __libcpp_locale_guard {
69 __libcpp_locale_guard(locale_t __l) :
70 __status(_configthreadlocale(_ENABLE_PER_THREAD_LOCALE)) {
71 // Setting the locale can be expensive even when the locale given is
72 // already the current locale, so do an explicit check to see if the
73 // current locale is already the one we want.
74 const char* __lc = __setlocale(nullptr);
75 // If every category is the same, the locale string will simply be the
76 // locale name, otherwise it will be a semicolon-separated string listing
77 // each category. In the second case, we know at least one category won't
78 // be what we want, so we only have to check the first case.
79 if (strcmp(__l.__get_locale(), __lc) != 0) {
80 __locale_all = _strdup(__lc);
81 if (__locale_all == nullptr)
83 __setlocale(__l.__get_locale());
86 ~__libcpp_locale_guard() {
87 // The CRT documentation doesn't explicitly say, but setlocale() does the
88 // right thing when given a semicolon-separated list of locale settings
89 // for the different categories in the same format as returned by
90 // setlocale(LC_ALL, nullptr).
91 if (__locale_all != nullptr) {
92 __setlocale(__locale_all);
95 _configthreadlocale(__status);
97 static const char* __setlocale(const char* __locale) {
98 const char* __new_locale = setlocale(LC_ALL, __locale);
99 if (__new_locale == nullptr)
104 char* __locale_all = nullptr;
109 class _LIBCPP_TYPE_VIS locale;
111 template <class _Facet>
112 _LIBCPP_INLINE_VISIBILITY
114 has_facet(const locale&) _NOEXCEPT;
116 template <class _Facet>
117 _LIBCPP_INLINE_VISIBILITY
119 use_facet(const locale&);
121 class _LIBCPP_TYPE_VIS locale
125 class _LIBCPP_TYPE_VIS facet;
126 class _LIBCPP_TYPE_VIS id;
128 typedef int category;
129 _LIBCPP_AVAILABILITY_LOCALE_CATEGORY
130 static const category // values assigned here are for exposition only
132 collate = LC_COLLATE_MASK,
133 ctype = LC_CTYPE_MASK,
134 monetary = LC_MONETARY_MASK,
135 numeric = LC_NUMERIC_MASK,
137 messages = LC_MESSAGES_MASK,
138 all = collate | ctype | monetary | numeric | time | messages;
140 // construct/copy/destroy:
142 locale(const locale&) _NOEXCEPT;
143 explicit locale(const char*);
144 explicit locale(const string&);
145 locale(const locale&, const char*, category);
146 locale(const locale&, const string&, category);
147 template <class _Facet>
148 _LIBCPP_INLINE_VISIBILITY locale(const locale&, _Facet*);
149 locale(const locale&, const locale&, category);
153 const locale& operator=(const locale&) _NOEXCEPT;
155 template <class _Facet>
156 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
157 locale combine(const locale&) const;
159 // locale operations:
161 bool operator==(const locale&) const;
162 bool operator!=(const locale& __y) const {return !(*this == __y);}
163 template <class _CharT, class _Traits, class _Allocator>
164 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
165 bool operator()(const basic_string<_CharT, _Traits, _Allocator>&,
166 const basic_string<_CharT, _Traits, _Allocator>&) const;
168 // global locale objects:
169 static locale global(const locale&);
170 static const locale& classic();
176 void __install_ctor(const locale&, facet*, long);
177 static locale& __global();
178 bool has_facet(id&) const;
179 const facet* use_facet(id&) const;
181 template <class _Facet> friend bool has_facet(const locale&) _NOEXCEPT;
182 template <class _Facet> friend const _Facet& use_facet(const locale&);
185 class _LIBCPP_TYPE_VIS locale::facet
186 : public __shared_count
189 _LIBCPP_INLINE_VISIBILITY
190 explicit facet(size_t __refs = 0)
191 : __shared_count(static_cast<long>(__refs)-1) {}
195 // facet(const facet&) = delete; // effectively done in __shared_count
196 // void operator=(const facet&) = delete;
198 virtual void __on_zero_shared() _NOEXCEPT;
201 class _LIBCPP_TYPE_VIS locale::id
206 static int32_t __next_id;
208 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR id() :__id_(0) {}
211 void operator=(const id&); // = delete;
212 id(const id&); // = delete;
213 public: // only needed for tests
217 friend class locale::__imp;
220 template <class _Facet>
221 inline _LIBCPP_INLINE_VISIBILITY
222 locale::locale(const locale& __other, _Facet* __f)
224 __install_ctor(__other, __f, __f ? __f->id.__get() : 0);
227 template <class _Facet>
229 locale::combine(const locale& __other) const
231 if (!_VSTD::has_facet<_Facet>(__other))
232 __throw_runtime_error("locale::combine: locale missing facet");
234 return locale(*this, &const_cast<_Facet&>(_VSTD::use_facet<_Facet>(__other)));
237 template <class _Facet>
238 inline _LIBCPP_INLINE_VISIBILITY
240 has_facet(const locale& __l) _NOEXCEPT
242 return __l.has_facet(_Facet::id);
245 template <class _Facet>
246 inline _LIBCPP_INLINE_VISIBILITY
248 use_facet(const locale& __l)
250 return static_cast<const _Facet&>(*__l.use_facet(_Facet::id));
253 // template <class _CharT> class collate;
255 template <class _CharT>
256 class _LIBCPP_TEMPLATE_VIS collate
257 : public locale::facet
260 typedef _CharT char_type;
261 typedef basic_string<char_type> string_type;
263 _LIBCPP_INLINE_VISIBILITY
264 explicit collate(size_t __refs = 0)
265 : locale::facet(__refs) {}
267 _LIBCPP_INLINE_VISIBILITY
268 int compare(const char_type* __lo1, const char_type* __hi1,
269 const char_type* __lo2, const char_type* __hi2) const
271 return do_compare(__lo1, __hi1, __lo2, __hi2);
274 // FIXME(EricWF): The _LIBCPP_ALWAYS_INLINE is needed on Windows to work
275 // around a dllimport bug that expects an external instantiation.
276 _LIBCPP_INLINE_VISIBILITY
277 _LIBCPP_ALWAYS_INLINE
278 string_type transform(const char_type* __lo, const char_type* __hi) const
280 return do_transform(__lo, __hi);
283 _LIBCPP_INLINE_VISIBILITY
284 long hash(const char_type* __lo, const char_type* __hi) const
286 return do_hash(__lo, __hi);
289 static locale::id id;
293 virtual int do_compare(const char_type* __lo1, const char_type* __hi1,
294 const char_type* __lo2, const char_type* __hi2) const;
295 virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const
296 {return string_type(__lo, __hi);}
297 virtual long do_hash(const char_type* __lo, const char_type* __hi) const;
300 template <class _CharT> locale::id collate<_CharT>::id;
302 template <class _CharT>
303 collate<_CharT>::~collate()
307 template <class _CharT>
309 collate<_CharT>::do_compare(const char_type* __lo1, const char_type* __hi1,
310 const char_type* __lo2, const char_type* __hi2) const
312 for (; __lo2 != __hi2; ++__lo1, ++__lo2)
314 if (__lo1 == __hi1 || *__lo1 < *__lo2)
319 return __lo1 != __hi1;
322 template <class _CharT>
324 collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const
327 const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8;
328 const size_t __mask = size_t(0xF) << (__sr + 4);
329 for(const char_type* __p = __lo; __p != __hi; ++__p)
331 __h = (__h << 4) + static_cast<size_t>(*__p);
332 size_t __g = __h & __mask;
333 __h ^= __g | (__g >> __sr);
335 return static_cast<long>(__h);
338 _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<char>)
339 _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<wchar_t>)
341 // template <class CharT> class collate_byname;
343 template <class _CharT> class _LIBCPP_TEMPLATE_VIS collate_byname;
346 class _LIBCPP_TYPE_VIS collate_byname<char>
347 : public collate<char>
351 typedef char char_type;
352 typedef basic_string<char_type> string_type;
354 explicit collate_byname(const char* __n, size_t __refs = 0);
355 explicit collate_byname(const string& __n, size_t __refs = 0);
359 virtual int do_compare(const char_type* __lo1, const char_type* __hi1,
360 const char_type* __lo2, const char_type* __hi2) const;
361 virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const;
365 class _LIBCPP_TYPE_VIS collate_byname<wchar_t>
366 : public collate<wchar_t>
370 typedef wchar_t char_type;
371 typedef basic_string<char_type> string_type;
373 explicit collate_byname(const char* __n, size_t __refs = 0);
374 explicit collate_byname(const string& __n, size_t __refs = 0);
379 virtual int do_compare(const char_type* __lo1, const char_type* __hi1,
380 const char_type* __lo2, const char_type* __hi2) const;
381 virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const;
384 template <class _CharT, class _Traits, class _Allocator>
386 locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
387 const basic_string<_CharT, _Traits, _Allocator>& __y) const
389 return _VSTD::use_facet<_VSTD::collate<_CharT> >(*this).compare(
390 __x.data(), __x.data() + __x.size(),
391 __y.data(), __y.data() + __y.size()) < 0;
394 // template <class charT> class ctype
396 class _LIBCPP_TYPE_VIS ctype_base
399 #if defined(__GLIBC__)
400 typedef unsigned short mask;
401 static const mask space = _ISspace;
402 static const mask print = _ISprint;
403 static const mask cntrl = _IScntrl;
404 static const mask upper = _ISupper;
405 static const mask lower = _ISlower;
406 static const mask alpha = _ISalpha;
407 static const mask digit = _ISdigit;
408 static const mask punct = _ISpunct;
409 static const mask xdigit = _ISxdigit;
410 static const mask blank = _ISblank;
411 #if defined(__mips__)
412 static const mask __regex_word = static_cast<mask>(_ISbit(15));
414 static const mask __regex_word = 0x80;
416 #elif defined(_LIBCPP_MSVCRT_LIKE)
417 typedef unsigned short mask;
418 static const mask space = _SPACE;
419 static const mask print = _BLANK|_PUNCT|_ALPHA|_DIGIT;
420 static const mask cntrl = _CONTROL;
421 static const mask upper = _UPPER;
422 static const mask lower = _LOWER;
423 static const mask alpha = _ALPHA;
424 static const mask digit = _DIGIT;
425 static const mask punct = _PUNCT;
426 static const mask xdigit = _HEX;
427 static const mask blank = _BLANK;
428 static const mask __regex_word = 0x80;
429 # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
430 #elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
432 typedef __uint32_t mask;
433 # elif defined(__FreeBSD__)
434 typedef unsigned long mask;
435 # elif defined(__EMSCRIPTEN__) || defined(__NetBSD__)
436 typedef unsigned short mask;
438 static const mask space = _CTYPE_S;
439 static const mask print = _CTYPE_R;
440 static const mask cntrl = _CTYPE_C;
441 static const mask upper = _CTYPE_U;
442 static const mask lower = _CTYPE_L;
443 static const mask alpha = _CTYPE_A;
444 static const mask digit = _CTYPE_D;
445 static const mask punct = _CTYPE_P;
446 static const mask xdigit = _CTYPE_X;
448 # if defined(__NetBSD__)
449 static const mask blank = _CTYPE_BL;
450 // NetBSD defines classes up to 0x2000
451 // see sys/ctype_bits.h, _CTYPE_Q
452 static const mask __regex_word = 0x8000;
454 static const mask blank = _CTYPE_B;
455 static const mask __regex_word = 0x80;
457 #elif defined(__sun__) || defined(_AIX)
458 typedef unsigned int mask;
459 static const mask space = _ISSPACE;
460 static const mask print = _ISPRINT;
461 static const mask cntrl = _ISCNTRL;
462 static const mask upper = _ISUPPER;
463 static const mask lower = _ISLOWER;
464 static const mask alpha = _ISALPHA;
465 static const mask digit = _ISDIGIT;
466 static const mask punct = _ISPUNCT;
467 static const mask xdigit = _ISXDIGIT;
468 static const mask blank = _ISBLANK;
469 static const mask __regex_word = 0x80;
470 #elif defined(_NEWLIB_VERSION)
471 // Same type as Newlib's _ctype_ array in newlib/libc/include/ctype.h.
473 static const mask space = _S;
474 static const mask print = _P | _U | _L | _N | _B;
475 static const mask cntrl = _C;
476 static const mask upper = _U;
477 static const mask lower = _L;
478 static const mask alpha = _U | _L;
479 static const mask digit = _N;
480 static const mask punct = _P;
481 static const mask xdigit = _X | _N;
482 static const mask blank = _B;
483 static const mask __regex_word = 0x80;
484 # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
485 # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
486 # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT
488 typedef unsigned long mask;
489 static const mask space = 1<<0;
490 static const mask print = 1<<1;
491 static const mask cntrl = 1<<2;
492 static const mask upper = 1<<3;
493 static const mask lower = 1<<4;
494 static const mask alpha = 1<<5;
495 static const mask digit = 1<<6;
496 static const mask punct = 1<<7;
497 static const mask xdigit = 1<<8;
498 static const mask blank = 1<<9;
499 static const mask __regex_word = 1<<10;
501 static const mask alnum = alpha | digit;
502 static const mask graph = alnum | punct;
504 _LIBCPP_INLINE_VISIBILITY ctype_base() {}
507 template <class _CharT> class _LIBCPP_TEMPLATE_VIS ctype;
510 class _LIBCPP_TYPE_VIS ctype<wchar_t>
511 : public locale::facet,
515 typedef wchar_t char_type;
517 _LIBCPP_INLINE_VISIBILITY
518 explicit ctype(size_t __refs = 0)
519 : locale::facet(__refs) {}
521 _LIBCPP_INLINE_VISIBILITY
522 bool is(mask __m, char_type __c) const
524 return do_is(__m, __c);
527 _LIBCPP_INLINE_VISIBILITY
528 const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
530 return do_is(__low, __high, __vec);
533 _LIBCPP_INLINE_VISIBILITY
534 const char_type* scan_is(mask __m, const char_type* __low, const char_type* __high) const
536 return do_scan_is(__m, __low, __high);
539 _LIBCPP_INLINE_VISIBILITY
540 const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
542 return do_scan_not(__m, __low, __high);
545 _LIBCPP_INLINE_VISIBILITY
546 char_type toupper(char_type __c) const
548 return do_toupper(__c);
551 _LIBCPP_INLINE_VISIBILITY
552 const char_type* toupper(char_type* __low, const char_type* __high) const
554 return do_toupper(__low, __high);
557 _LIBCPP_INLINE_VISIBILITY
558 char_type tolower(char_type __c) const
560 return do_tolower(__c);
563 _LIBCPP_INLINE_VISIBILITY
564 const char_type* tolower(char_type* __low, const char_type* __high) const
566 return do_tolower(__low, __high);
569 _LIBCPP_INLINE_VISIBILITY
570 char_type widen(char __c) const
572 return do_widen(__c);
575 _LIBCPP_INLINE_VISIBILITY
576 const char* widen(const char* __low, const char* __high, char_type* __to) const
578 return do_widen(__low, __high, __to);
581 _LIBCPP_INLINE_VISIBILITY
582 char narrow(char_type __c, char __dfault) const
584 return do_narrow(__c, __dfault);
587 _LIBCPP_INLINE_VISIBILITY
588 const char_type* narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const
590 return do_narrow(__low, __high, __dfault, __to);
593 static locale::id id;
597 virtual bool do_is(mask __m, char_type __c) const;
598 virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const;
599 virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const;
600 virtual const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const;
601 virtual char_type do_toupper(char_type) const;
602 virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
603 virtual char_type do_tolower(char_type) const;
604 virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
605 virtual char_type do_widen(char) const;
606 virtual const char* do_widen(const char* __low, const char* __high, char_type* __dest) const;
607 virtual char do_narrow(char_type, char __dfault) const;
608 virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const;
612 class _LIBCPP_TYPE_VIS ctype<char>
613 : public locale::facet, public ctype_base
618 typedef char char_type;
620 explicit ctype(const mask* __tab = 0, bool __del = false, size_t __refs = 0);
622 _LIBCPP_INLINE_VISIBILITY
623 bool is(mask __m, char_type __c) const
625 return isascii(__c) ? (__tab_[static_cast<int>(__c)] & __m) !=0 : false;
628 _LIBCPP_INLINE_VISIBILITY
629 const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
631 for (; __low != __high; ++__low, ++__vec)
632 *__vec = isascii(*__low) ? __tab_[static_cast<int>(*__low)] : 0;
636 _LIBCPP_INLINE_VISIBILITY
637 const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const
639 for (; __low != __high; ++__low)
640 if (isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))
645 _LIBCPP_INLINE_VISIBILITY
646 const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
648 for (; __low != __high; ++__low)
649 if (!(isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m)))
654 _LIBCPP_INLINE_VISIBILITY
655 char_type toupper(char_type __c) const
657 return do_toupper(__c);
660 _LIBCPP_INLINE_VISIBILITY
661 const char_type* toupper(char_type* __low, const char_type* __high) const
663 return do_toupper(__low, __high);
666 _LIBCPP_INLINE_VISIBILITY
667 char_type tolower(char_type __c) const
669 return do_tolower(__c);
672 _LIBCPP_INLINE_VISIBILITY
673 const char_type* tolower(char_type* __low, const char_type* __high) const
675 return do_tolower(__low, __high);
678 _LIBCPP_INLINE_VISIBILITY
679 char_type widen(char __c) const
681 return do_widen(__c);
684 _LIBCPP_INLINE_VISIBILITY
685 const char* widen(const char* __low, const char* __high, char_type* __to) const
687 return do_widen(__low, __high, __to);
690 _LIBCPP_INLINE_VISIBILITY
691 char narrow(char_type __c, char __dfault) const
693 return do_narrow(__c, __dfault);
696 _LIBCPP_INLINE_VISIBILITY
697 const char* narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const
699 return do_narrow(__low, __high, __dfault, __to);
702 static locale::id id;
705 static const size_t table_size = _CACHED_RUNES;
707 static const size_t table_size = 256; // FIXME: Don't hardcode this.
709 _LIBCPP_INLINE_VISIBILITY const mask* table() const _NOEXCEPT {return __tab_;}
710 static const mask* classic_table() _NOEXCEPT;
711 #if defined(__GLIBC__) || defined(__EMSCRIPTEN__)
712 static const int* __classic_upper_table() _NOEXCEPT;
713 static const int* __classic_lower_table() _NOEXCEPT;
715 #if defined(__NetBSD__)
716 static const short* __classic_upper_table() _NOEXCEPT;
717 static const short* __classic_lower_table() _NOEXCEPT;
722 virtual char_type do_toupper(char_type __c) const;
723 virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
724 virtual char_type do_tolower(char_type __c) const;
725 virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
726 virtual char_type do_widen(char __c) const;
727 virtual const char* do_widen(const char* __low, const char* __high, char_type* __to) const;
728 virtual char do_narrow(char_type __c, char __dfault) const;
729 virtual const char* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const;
732 // template <class CharT> class ctype_byname;
734 template <class _CharT> class _LIBCPP_TEMPLATE_VIS ctype_byname;
737 class _LIBCPP_TYPE_VIS ctype_byname<char>
743 explicit ctype_byname(const char*, size_t = 0);
744 explicit ctype_byname(const string&, size_t = 0);
748 virtual char_type do_toupper(char_type) const;
749 virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
750 virtual char_type do_tolower(char_type) const;
751 virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
755 class _LIBCPP_TYPE_VIS ctype_byname<wchar_t>
756 : public ctype<wchar_t>
761 explicit ctype_byname(const char*, size_t = 0);
762 explicit ctype_byname(const string&, size_t = 0);
766 virtual bool do_is(mask __m, char_type __c) const;
767 virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const;
768 virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const;
769 virtual const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const;
770 virtual char_type do_toupper(char_type) const;
771 virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
772 virtual char_type do_tolower(char_type) const;
773 virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
774 virtual char_type do_widen(char) const;
775 virtual const char* do_widen(const char* __low, const char* __high, char_type* __dest) const;
776 virtual char do_narrow(char_type, char __dfault) const;
777 virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const;
780 template <class _CharT>
781 inline _LIBCPP_INLINE_VISIBILITY
783 isspace(_CharT __c, const locale& __loc)
785 return use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c);
788 template <class _CharT>
789 inline _LIBCPP_INLINE_VISIBILITY
791 isprint(_CharT __c, const locale& __loc)
793 return use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c);
796 template <class _CharT>
797 inline _LIBCPP_INLINE_VISIBILITY
799 iscntrl(_CharT __c, const locale& __loc)
801 return use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c);
804 template <class _CharT>
805 inline _LIBCPP_INLINE_VISIBILITY
807 isupper(_CharT __c, const locale& __loc)
809 return use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c);
812 template <class _CharT>
813 inline _LIBCPP_INLINE_VISIBILITY
815 islower(_CharT __c, const locale& __loc)
817 return use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c);
820 template <class _CharT>
821 inline _LIBCPP_INLINE_VISIBILITY
823 isalpha(_CharT __c, const locale& __loc)
825 return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c);
828 template <class _CharT>
829 inline _LIBCPP_INLINE_VISIBILITY
831 isdigit(_CharT __c, const locale& __loc)
833 return use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c);
836 template <class _CharT>
837 inline _LIBCPP_INLINE_VISIBILITY
839 ispunct(_CharT __c, const locale& __loc)
841 return use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c);
844 template <class _CharT>
845 inline _LIBCPP_INLINE_VISIBILITY
847 isxdigit(_CharT __c, const locale& __loc)
849 return use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c);
852 template <class _CharT>
853 inline _LIBCPP_INLINE_VISIBILITY
855 isalnum(_CharT __c, const locale& __loc)
857 return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c);
860 template <class _CharT>
861 inline _LIBCPP_INLINE_VISIBILITY
863 isgraph(_CharT __c, const locale& __loc)
865 return use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c);
868 template <class _CharT>
869 inline _LIBCPP_INLINE_VISIBILITY
871 toupper(_CharT __c, const locale& __loc)
873 return use_facet<ctype<_CharT> >(__loc).toupper(__c);
876 template <class _CharT>
877 inline _LIBCPP_INLINE_VISIBILITY
879 tolower(_CharT __c, const locale& __loc)
881 return use_facet<ctype<_CharT> >(__loc).tolower(__c);
886 class _LIBCPP_TYPE_VIS codecvt_base
889 _LIBCPP_INLINE_VISIBILITY codecvt_base() {}
890 enum result {ok, partial, error, noconv};
893 // template <class internT, class externT, class stateT> class codecvt;
895 template <class _InternT, class _ExternT, class _StateT> class _LIBCPP_TEMPLATE_VIS codecvt;
897 // template <> class codecvt<char, char, mbstate_t>
900 class _LIBCPP_TYPE_VIS codecvt<char, char, mbstate_t>
901 : public locale::facet,
905 typedef char intern_type;
906 typedef char extern_type;
907 typedef mbstate_t state_type;
909 _LIBCPP_INLINE_VISIBILITY
910 explicit codecvt(size_t __refs = 0)
911 : locale::facet(__refs) {}
913 _LIBCPP_INLINE_VISIBILITY
914 result out(state_type& __st,
915 const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
916 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
918 return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
921 _LIBCPP_INLINE_VISIBILITY
922 result unshift(state_type& __st,
923 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
925 return do_unshift(__st, __to, __to_end, __to_nxt);
928 _LIBCPP_INLINE_VISIBILITY
929 result in(state_type& __st,
930 const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
931 intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
933 return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
936 _LIBCPP_INLINE_VISIBILITY
937 int encoding() const _NOEXCEPT
939 return do_encoding();
942 _LIBCPP_INLINE_VISIBILITY
943 bool always_noconv() const _NOEXCEPT
945 return do_always_noconv();
948 _LIBCPP_INLINE_VISIBILITY
949 int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
951 return do_length(__st, __frm, __end, __mx);
954 _LIBCPP_INLINE_VISIBILITY
955 int max_length() const _NOEXCEPT
957 return do_max_length();
960 static locale::id id;
963 _LIBCPP_INLINE_VISIBILITY
964 explicit codecvt(const char*, size_t __refs = 0)
965 : locale::facet(__refs) {}
969 virtual result do_out(state_type& __st,
970 const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
971 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
972 virtual result do_in(state_type& __st,
973 const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
974 intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
975 virtual result do_unshift(state_type& __st,
976 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
977 virtual int do_encoding() const _NOEXCEPT;
978 virtual bool do_always_noconv() const _NOEXCEPT;
979 virtual int do_length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
980 virtual int do_max_length() const _NOEXCEPT;
983 // template <> class codecvt<wchar_t, char, mbstate_t>
986 class _LIBCPP_TYPE_VIS codecvt<wchar_t, char, mbstate_t>
987 : public locale::facet,
992 typedef wchar_t intern_type;
993 typedef char extern_type;
994 typedef mbstate_t state_type;
996 explicit codecvt(size_t __refs = 0);
998 _LIBCPP_INLINE_VISIBILITY
999 result out(state_type& __st,
1000 const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
1001 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
1003 return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
1006 _LIBCPP_INLINE_VISIBILITY
1007 result unshift(state_type& __st,
1008 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
1010 return do_unshift(__st, __to, __to_end, __to_nxt);
1013 _LIBCPP_INLINE_VISIBILITY
1014 result in(state_type& __st,
1015 const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
1016 intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
1018 return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
1021 _LIBCPP_INLINE_VISIBILITY
1022 int encoding() const _NOEXCEPT
1024 return do_encoding();
1027 _LIBCPP_INLINE_VISIBILITY
1028 bool always_noconv() const _NOEXCEPT
1030 return do_always_noconv();
1033 _LIBCPP_INLINE_VISIBILITY
1034 int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
1036 return do_length(__st, __frm, __end, __mx);
1039 _LIBCPP_INLINE_VISIBILITY
1040 int max_length() const _NOEXCEPT
1042 return do_max_length();
1045 static locale::id id;
1048 explicit codecvt(const char*, size_t __refs = 0);
1052 virtual result do_out(state_type& __st,
1053 const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
1054 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
1055 virtual result do_in(state_type& __st,
1056 const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
1057 intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
1058 virtual result do_unshift(state_type& __st,
1059 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
1060 virtual int do_encoding() const _NOEXCEPT;
1061 virtual bool do_always_noconv() const _NOEXCEPT;
1062 virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
1063 virtual int do_max_length() const _NOEXCEPT;
1066 // template <> class codecvt<char16_t, char, mbstate_t>
1069 class _LIBCPP_TYPE_VIS codecvt<char16_t, char, mbstate_t>
1070 : public locale::facet,
1074 typedef char16_t intern_type;
1075 typedef char extern_type;
1076 typedef mbstate_t state_type;
1078 _LIBCPP_INLINE_VISIBILITY
1079 explicit codecvt(size_t __refs = 0)
1080 : locale::facet(__refs) {}
1082 _LIBCPP_INLINE_VISIBILITY
1083 result out(state_type& __st,
1084 const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
1085 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
1087 return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
1090 _LIBCPP_INLINE_VISIBILITY
1091 result unshift(state_type& __st,
1092 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
1094 return do_unshift(__st, __to, __to_end, __to_nxt);
1097 _LIBCPP_INLINE_VISIBILITY
1098 result in(state_type& __st,
1099 const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
1100 intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
1102 return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
1105 _LIBCPP_INLINE_VISIBILITY
1106 int encoding() const _NOEXCEPT
1108 return do_encoding();
1111 _LIBCPP_INLINE_VISIBILITY
1112 bool always_noconv() const _NOEXCEPT
1114 return do_always_noconv();
1117 _LIBCPP_INLINE_VISIBILITY
1118 int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
1120 return do_length(__st, __frm, __end, __mx);
1123 _LIBCPP_INLINE_VISIBILITY
1124 int max_length() const _NOEXCEPT
1126 return do_max_length();
1129 static locale::id id;
1132 _LIBCPP_INLINE_VISIBILITY
1133 explicit codecvt(const char*, size_t __refs = 0)
1134 : locale::facet(__refs) {}
1138 virtual result do_out(state_type& __st,
1139 const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
1140 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
1141 virtual result do_in(state_type& __st,
1142 const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
1143 intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
1144 virtual result do_unshift(state_type& __st,
1145 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
1146 virtual int do_encoding() const _NOEXCEPT;
1147 virtual bool do_always_noconv() const _NOEXCEPT;
1148 virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
1149 virtual int do_max_length() const _NOEXCEPT;
1152 // template <> class codecvt<char32_t, char, mbstate_t>
1155 class _LIBCPP_TYPE_VIS codecvt<char32_t, char, mbstate_t>
1156 : public locale::facet,
1160 typedef char32_t intern_type;
1161 typedef char extern_type;
1162 typedef mbstate_t state_type;
1164 _LIBCPP_INLINE_VISIBILITY
1165 explicit codecvt(size_t __refs = 0)
1166 : locale::facet(__refs) {}
1168 _LIBCPP_INLINE_VISIBILITY
1169 result out(state_type& __st,
1170 const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
1171 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
1173 return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
1176 _LIBCPP_INLINE_VISIBILITY
1177 result unshift(state_type& __st,
1178 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
1180 return do_unshift(__st, __to, __to_end, __to_nxt);
1183 _LIBCPP_INLINE_VISIBILITY
1184 result in(state_type& __st,
1185 const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
1186 intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
1188 return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
1191 _LIBCPP_INLINE_VISIBILITY
1192 int encoding() const _NOEXCEPT
1194 return do_encoding();
1197 _LIBCPP_INLINE_VISIBILITY
1198 bool always_noconv() const _NOEXCEPT
1200 return do_always_noconv();
1203 _LIBCPP_INLINE_VISIBILITY
1204 int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
1206 return do_length(__st, __frm, __end, __mx);
1209 _LIBCPP_INLINE_VISIBILITY
1210 int max_length() const _NOEXCEPT
1212 return do_max_length();
1215 static locale::id id;
1218 _LIBCPP_INLINE_VISIBILITY
1219 explicit codecvt(const char*, size_t __refs = 0)
1220 : locale::facet(__refs) {}
1224 virtual result do_out(state_type& __st,
1225 const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
1226 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
1227 virtual result do_in(state_type& __st,
1228 const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
1229 intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
1230 virtual result do_unshift(state_type& __st,
1231 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
1232 virtual int do_encoding() const _NOEXCEPT;
1233 virtual bool do_always_noconv() const _NOEXCEPT;
1234 virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
1235 virtual int do_max_length() const _NOEXCEPT;
1238 // template <class _InternT, class _ExternT, class _StateT> class codecvt_byname
1240 template <class _InternT, class _ExternT, class _StateT>
1241 class _LIBCPP_TEMPLATE_VIS codecvt_byname
1242 : public codecvt<_InternT, _ExternT, _StateT>
1245 _LIBCPP_INLINE_VISIBILITY
1246 explicit codecvt_byname(const char* __nm, size_t __refs = 0)
1247 : codecvt<_InternT, _ExternT, _StateT>(__nm, __refs) {}
1248 _LIBCPP_INLINE_VISIBILITY
1249 explicit codecvt_byname(const string& __nm, size_t __refs = 0)
1250 : codecvt<_InternT, _ExternT, _StateT>(__nm.c_str(), __refs) {}
1255 template <class _InternT, class _ExternT, class _StateT>
1256 codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname()
1260 _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char, char, mbstate_t>)
1261 _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<wchar_t, char, mbstate_t>)
1262 _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>)
1263 _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>)
1265 template <size_t _Np>
1266 struct __narrow_to_utf8
1268 template <class _OutputIterator, class _CharT>
1270 operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const;
1274 struct __narrow_to_utf8<8>
1276 template <class _OutputIterator, class _CharT>
1277 _LIBCPP_INLINE_VISIBILITY
1279 operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const
1281 for (; __wb < __we; ++__wb, ++__s)
1288 struct _LIBCPP_TEMPLATE_VIS __narrow_to_utf8<16>
1289 : public codecvt<char16_t, char, mbstate_t>
1291 _LIBCPP_INLINE_VISIBILITY
1292 __narrow_to_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
1294 _LIBCPP_EXPORTED_FROM_ABI ~__narrow_to_utf8();
1296 template <class _OutputIterator, class _CharT>
1297 _LIBCPP_INLINE_VISIBILITY
1299 operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const
1303 while (__wb < __we && __r != error)
1305 const int __sz = 32;
1308 const char16_t* __wn = (const char16_t*)__wb;
1309 __r = do_out(__mb, (const char16_t*)__wb, (const char16_t*)__we, __wn,
1310 __buf, __buf+__sz, __bn);
1311 if (__r == codecvt_base::error || __wn == (const char16_t*)__wb)
1312 __throw_runtime_error("locale not supported");
1313 for (const char* __p = __buf; __p < __bn; ++__p, ++__s)
1315 __wb = (const _CharT*)__wn;
1322 struct _LIBCPP_TEMPLATE_VIS __narrow_to_utf8<32>
1323 : public codecvt<char32_t, char, mbstate_t>
1325 _LIBCPP_INLINE_VISIBILITY
1326 __narrow_to_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
1328 _LIBCPP_EXPORTED_FROM_ABI ~__narrow_to_utf8();
1330 template <class _OutputIterator, class _CharT>
1331 _LIBCPP_INLINE_VISIBILITY
1333 operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const
1337 while (__wb < __we && __r != error)
1339 const int __sz = 32;
1342 const char32_t* __wn = (const char32_t*)__wb;
1343 __r = do_out(__mb, (const char32_t*)__wb, (const char32_t*)__we, __wn,
1344 __buf, __buf+__sz, __bn);
1345 if (__r == codecvt_base::error || __wn == (const char32_t*)__wb)
1346 __throw_runtime_error("locale not supported");
1347 for (const char* __p = __buf; __p < __bn; ++__p, ++__s)
1349 __wb = (const _CharT*)__wn;
1355 template <size_t _Np>
1356 struct __widen_from_utf8
1358 template <class _OutputIterator>
1360 operator()(_OutputIterator __s, const char* __nb, const char* __ne) const;
1364 struct __widen_from_utf8<8>
1366 template <class _OutputIterator>
1367 _LIBCPP_INLINE_VISIBILITY
1369 operator()(_OutputIterator __s, const char* __nb, const char* __ne) const
1371 for (; __nb < __ne; ++__nb, ++__s)
1378 struct _LIBCPP_TEMPLATE_VIS __widen_from_utf8<16>
1379 : public codecvt<char16_t, char, mbstate_t>
1381 _LIBCPP_INLINE_VISIBILITY
1382 __widen_from_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
1384 _LIBCPP_EXPORTED_FROM_ABI ~__widen_from_utf8();
1386 template <class _OutputIterator>
1387 _LIBCPP_INLINE_VISIBILITY
1389 operator()(_OutputIterator __s, const char* __nb, const char* __ne) const
1393 while (__nb < __ne && __r != error)
1395 const int __sz = 32;
1396 char16_t __buf[__sz];
1398 const char* __nn = __nb;
1399 __r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb+__sz : __ne, __nn,
1400 __buf, __buf+__sz, __bn);
1401 if (__r == codecvt_base::error || __nn == __nb)
1402 __throw_runtime_error("locale not supported");
1403 for (const char16_t* __p = __buf; __p < __bn; ++__p, ++__s)
1404 *__s = (wchar_t)*__p;
1412 struct _LIBCPP_TEMPLATE_VIS __widen_from_utf8<32>
1413 : public codecvt<char32_t, char, mbstate_t>
1415 _LIBCPP_INLINE_VISIBILITY
1416 __widen_from_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
1418 _LIBCPP_EXPORTED_FROM_ABI ~__widen_from_utf8();
1420 template <class _OutputIterator>
1421 _LIBCPP_INLINE_VISIBILITY
1423 operator()(_OutputIterator __s, const char* __nb, const char* __ne) const
1427 while (__nb < __ne && __r != error)
1429 const int __sz = 32;
1430 char32_t __buf[__sz];
1432 const char* __nn = __nb;
1433 __r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb+__sz : __ne, __nn,
1434 __buf, __buf+__sz, __bn);
1435 if (__r == codecvt_base::error || __nn == __nb)
1436 __throw_runtime_error("locale not supported");
1437 for (const char32_t* __p = __buf; __p < __bn; ++__p, ++__s)
1438 *__s = (wchar_t)*__p;
1445 // template <class charT> class numpunct
1447 template <class _CharT> class _LIBCPP_TEMPLATE_VIS numpunct;
1450 class _LIBCPP_TYPE_VIS numpunct<char>
1451 : public locale::facet
1454 typedef char char_type;
1455 typedef basic_string<char_type> string_type;
1457 explicit numpunct(size_t __refs = 0);
1459 _LIBCPP_INLINE_VISIBILITY char_type decimal_point() const {return do_decimal_point();}
1460 _LIBCPP_INLINE_VISIBILITY char_type thousands_sep() const {return do_thousands_sep();}
1461 _LIBCPP_INLINE_VISIBILITY string grouping() const {return do_grouping();}
1462 _LIBCPP_INLINE_VISIBILITY string_type truename() const {return do_truename();}
1463 _LIBCPP_INLINE_VISIBILITY string_type falsename() const {return do_falsename();}
1465 static locale::id id;
1469 virtual char_type do_decimal_point() const;
1470 virtual char_type do_thousands_sep() const;
1471 virtual string do_grouping() const;
1472 virtual string_type do_truename() const;
1473 virtual string_type do_falsename() const;
1475 char_type __decimal_point_;
1476 char_type __thousands_sep_;
1481 class _LIBCPP_TYPE_VIS numpunct<wchar_t>
1482 : public locale::facet
1485 typedef wchar_t char_type;
1486 typedef basic_string<char_type> string_type;
1488 explicit numpunct(size_t __refs = 0);
1490 _LIBCPP_INLINE_VISIBILITY char_type decimal_point() const {return do_decimal_point();}
1491 _LIBCPP_INLINE_VISIBILITY char_type thousands_sep() const {return do_thousands_sep();}
1492 _LIBCPP_INLINE_VISIBILITY string grouping() const {return do_grouping();}
1493 _LIBCPP_INLINE_VISIBILITY string_type truename() const {return do_truename();}
1494 _LIBCPP_INLINE_VISIBILITY string_type falsename() const {return do_falsename();}
1496 static locale::id id;
1500 virtual char_type do_decimal_point() const;
1501 virtual char_type do_thousands_sep() const;
1502 virtual string do_grouping() const;
1503 virtual string_type do_truename() const;
1504 virtual string_type do_falsename() const;
1506 char_type __decimal_point_;
1507 char_type __thousands_sep_;
1511 // template <class charT> class numpunct_byname
1513 template <class _CharT> class _LIBCPP_TEMPLATE_VIS numpunct_byname;
1516 class _LIBCPP_TYPE_VIS numpunct_byname<char>
1517 : public numpunct<char>
1520 typedef char char_type;
1521 typedef basic_string<char_type> string_type;
1523 explicit numpunct_byname(const char* __nm, size_t __refs = 0);
1524 explicit numpunct_byname(const string& __nm, size_t __refs = 0);
1530 void __init(const char*);
1534 class _LIBCPP_TYPE_VIS numpunct_byname<wchar_t>
1535 : public numpunct<wchar_t>
1538 typedef wchar_t char_type;
1539 typedef basic_string<char_type> string_type;
1541 explicit numpunct_byname(const char* __nm, size_t __refs = 0);
1542 explicit numpunct_byname(const string& __nm, size_t __refs = 0);
1548 void __init(const char*);
1551 _LIBCPP_END_NAMESPACE_STD
1553 #endif // _LIBCPP___LOCALE