1227825Stheraven// -*- C++ -*- 2227825Stheraven//===----------------------------------------------------------------------===// 3227825Stheraven// 4227825Stheraven// The LLVM Compiler Infrastructure 5227825Stheraven// 6227825Stheraven// This file is dual licensed under the MIT and the University of Illinois Open 7227825Stheraven// Source Licenses. See LICENSE.TXT for details. 8227825Stheraven// 9227825Stheraven//===----------------------------------------------------------------------===// 10227825Stheraven 11227825Stheraven#ifndef _LIBCPP___LOCALE 12227825Stheraven#define _LIBCPP___LOCALE 13227825Stheraven 14227825Stheraven#include <__config> 15227825Stheraven#include <string> 16227825Stheraven#include <memory> 17227825Stheraven#include <utility> 18227825Stheraven#include <mutex> 19227825Stheraven#include <cstdint> 20227825Stheraven#include <cctype> 21227825Stheraven#include <locale.h> 22262801Sdim#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) 23227825Stheraven# include <support/win32/locale_win32.h> 24262801Sdim#elif _AIX 25262801Sdim# include <support/ibm/xlocale.h> 26262801Sdim#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)) || defined(__EMSCRIPTEN__) || defined(__IBMCPP__) 27227825Stheraven# include <xlocale.h> 28262801Sdim#endif // _WIN32 || __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__ 29227825Stheraven 30227825Stheraven#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 31227825Stheraven#pragma GCC system_header 32227825Stheraven#endif 33227825Stheraven 34227825Stheraven_LIBCPP_BEGIN_NAMESPACE_STD 35227825Stheraven 36250514Sdimclass _LIBCPP_TYPE_VIS locale; 37227825Stheraven 38243376Sdimtemplate <class _Facet> 39243376Sdim_LIBCPP_INLINE_VISIBILITY 40243376Sdimbool 41243376Sdimhas_facet(const locale&) _NOEXCEPT; 42227825Stheraven 43243376Sdimtemplate <class _Facet> 44243376Sdim_LIBCPP_INLINE_VISIBILITY 45243376Sdimconst _Facet& 46243376Sdimuse_facet(const locale&); 47243376Sdim 48250514Sdimclass _LIBCPP_TYPE_VIS locale 49227825Stheraven{ 50227825Stheravenpublic: 51227825Stheraven // types: 52250514Sdim class _LIBCPP_TYPE_VIS facet; 53250514Sdim class _LIBCPP_TYPE_VIS id; 54227825Stheraven 55227825Stheraven typedef int category; 56227825Stheraven static const category // values assigned here are for exposition only 57227825Stheraven none = 0, 58227825Stheraven collate = LC_COLLATE_MASK, 59227825Stheraven ctype = LC_CTYPE_MASK, 60227825Stheraven monetary = LC_MONETARY_MASK, 61227825Stheraven numeric = LC_NUMERIC_MASK, 62227825Stheraven time = LC_TIME_MASK, 63227825Stheraven messages = LC_MESSAGES_MASK, 64227825Stheraven all = collate | ctype | monetary | numeric | time | messages; 65227825Stheraven 66227825Stheraven // construct/copy/destroy: 67227825Stheraven locale() _NOEXCEPT; 68227825Stheraven locale(const locale&) _NOEXCEPT; 69227825Stheraven explicit locale(const char*); 70227825Stheraven explicit locale(const string&); 71227825Stheraven locale(const locale&, const char*, category); 72227825Stheraven locale(const locale&, const string&, category); 73227825Stheraven template <class _Facet> 74227825Stheraven _LIBCPP_INLINE_VISIBILITY locale(const locale&, _Facet*); 75227825Stheraven locale(const locale&, const locale&, category); 76227825Stheraven 77227825Stheraven ~locale(); 78227825Stheraven 79227825Stheraven const locale& operator=(const locale&) _NOEXCEPT; 80227825Stheraven 81227825Stheraven template <class _Facet> locale combine(const locale&) const; 82227825Stheraven 83227825Stheraven // locale operations: 84227825Stheraven string name() const; 85227825Stheraven bool operator==(const locale&) const; 86227825Stheraven bool operator!=(const locale& __y) const {return !(*this == __y);} 87227825Stheraven template <class _CharT, class _Traits, class _Allocator> 88227825Stheraven bool operator()(const basic_string<_CharT, _Traits, _Allocator>&, 89227825Stheraven const basic_string<_CharT, _Traits, _Allocator>&) const; 90227825Stheraven 91227825Stheraven // global locale objects: 92227825Stheraven static locale global(const locale&); 93227825Stheraven static const locale& classic(); 94227825Stheraven 95227825Stheravenprivate: 96227825Stheraven class __imp; 97227825Stheraven __imp* __locale_; 98227825Stheraven 99227825Stheraven void __install_ctor(const locale&, facet*, long); 100227825Stheraven static locale& __global(); 101227825Stheraven bool has_facet(id&) const; 102227825Stheraven const facet* use_facet(id&) const; 103227825Stheraven 104227825Stheraven template <class _Facet> friend bool has_facet(const locale&) _NOEXCEPT; 105227825Stheraven template <class _Facet> friend const _Facet& use_facet(const locale&); 106227825Stheraven}; 107227825Stheraven 108250514Sdimclass _LIBCPP_TYPE_VIS locale::facet 109227825Stheraven : public __shared_count 110227825Stheraven{ 111227825Stheravenprotected: 112227825Stheraven _LIBCPP_INLINE_VISIBILITY 113227825Stheraven explicit facet(size_t __refs = 0) 114227825Stheraven : __shared_count(static_cast<long>(__refs)-1) {} 115227825Stheraven 116227825Stheraven virtual ~facet(); 117227825Stheraven 118227825Stheraven// facet(const facet&) = delete; // effectively done in __shared_count 119227825Stheraven// void operator=(const facet&) = delete; 120227825Stheravenprivate: 121227825Stheraven virtual void __on_zero_shared() _NOEXCEPT; 122227825Stheraven}; 123227825Stheraven 124250514Sdimclass _LIBCPP_TYPE_VIS locale::id 125227825Stheraven{ 126227825Stheraven once_flag __flag_; 127227825Stheraven int32_t __id_; 128227825Stheraven 129227825Stheraven static int32_t __next_id; 130227825Stheravenpublic: 131243376Sdim _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR id() :__id_(0) {} 132227825Stheravenprivate: 133227825Stheraven void __init(); 134227825Stheraven void operator=(const id&); // = delete; 135227825Stheraven id(const id&); // = delete; 136227825Stheravenpublic: // only needed for tests 137227825Stheraven long __get(); 138227825Stheraven 139227825Stheraven friend class locale; 140227825Stheraven friend class locale::__imp; 141227825Stheraven}; 142227825Stheraven 143227825Stheraventemplate <class _Facet> 144227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 145227825Stheravenlocale::locale(const locale& __other, _Facet* __f) 146227825Stheraven{ 147227825Stheraven __install_ctor(__other, __f, __f ? __f->id.__get() : 0); 148227825Stheraven} 149227825Stheraven 150227825Stheraventemplate <class _Facet> 151227825Stheravenlocale 152227825Stheravenlocale::combine(const locale& __other) const 153227825Stheraven{ 154227825Stheraven#ifndef _LIBCPP_NO_EXCEPTIONS 155227825Stheraven if (!_VSTD::has_facet<_Facet>(__other)) 156227825Stheraven throw runtime_error("locale::combine: locale missing facet"); 157227825Stheraven#endif // _LIBCPP_NO_EXCEPTIONS 158227825Stheraven return locale(*this, &const_cast<_Facet&>(_VSTD::use_facet<_Facet>(__other))); 159227825Stheraven} 160227825Stheraven 161227825Stheraventemplate <class _Facet> 162227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 163227825Stheravenbool 164227825Stheravenhas_facet(const locale& __l) _NOEXCEPT 165227825Stheraven{ 166227825Stheraven return __l.has_facet(_Facet::id); 167227825Stheraven} 168227825Stheraven 169227825Stheraventemplate <class _Facet> 170227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 171227825Stheravenconst _Facet& 172227825Stheravenuse_facet(const locale& __l) 173227825Stheraven{ 174227825Stheraven return static_cast<const _Facet&>(*__l.use_facet(_Facet::id)); 175227825Stheraven} 176227825Stheraven 177227825Stheraven// template <class _CharT> class collate; 178227825Stheraven 179227825Stheraventemplate <class _CharT> 180262801Sdimclass _LIBCPP_TYPE_VIS_ONLY collate 181227825Stheraven : public locale::facet 182227825Stheraven{ 183227825Stheravenpublic: 184227825Stheraven typedef _CharT char_type; 185227825Stheraven typedef basic_string<char_type> string_type; 186227825Stheraven 187227825Stheraven _LIBCPP_INLINE_VISIBILITY 188227825Stheraven explicit collate(size_t __refs = 0) 189227825Stheraven : locale::facet(__refs) {} 190227825Stheraven 191227825Stheraven _LIBCPP_INLINE_VISIBILITY 192227825Stheraven int compare(const char_type* __lo1, const char_type* __hi1, 193227825Stheraven const char_type* __lo2, const char_type* __hi2) const 194227825Stheraven { 195227825Stheraven return do_compare(__lo1, __hi1, __lo2, __hi2); 196227825Stheraven } 197227825Stheraven 198227825Stheraven _LIBCPP_INLINE_VISIBILITY 199227825Stheraven string_type transform(const char_type* __lo, const char_type* __hi) const 200227825Stheraven { 201227825Stheraven return do_transform(__lo, __hi); 202227825Stheraven } 203227825Stheraven 204227825Stheraven _LIBCPP_INLINE_VISIBILITY 205227825Stheraven long hash(const char_type* __lo, const char_type* __hi) const 206227825Stheraven { 207227825Stheraven return do_hash(__lo, __hi); 208227825Stheraven } 209227825Stheraven 210227825Stheraven static locale::id id; 211227825Stheraven 212227825Stheravenprotected: 213227825Stheraven ~collate(); 214227825Stheraven virtual int do_compare(const char_type* __lo1, const char_type* __hi1, 215227825Stheraven const char_type* __lo2, const char_type* __hi2) const; 216227825Stheraven virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const 217227825Stheraven {return string_type(__lo, __hi);} 218227825Stheraven virtual long do_hash(const char_type* __lo, const char_type* __hi) const; 219227825Stheraven}; 220227825Stheraven 221227825Stheraventemplate <class _CharT> locale::id collate<_CharT>::id; 222227825Stheraven 223227825Stheraventemplate <class _CharT> 224227825Stheravencollate<_CharT>::~collate() 225227825Stheraven{ 226227825Stheraven} 227227825Stheraven 228227825Stheraventemplate <class _CharT> 229227825Stheravenint 230227825Stheravencollate<_CharT>::do_compare(const char_type* __lo1, const char_type* __hi1, 231227825Stheraven const char_type* __lo2, const char_type* __hi2) const 232227825Stheraven{ 233227825Stheraven for (; __lo2 != __hi2; ++__lo1, ++__lo2) 234227825Stheraven { 235227825Stheraven if (__lo1 == __hi1 || *__lo1 < *__lo2) 236227825Stheraven return -1; 237227825Stheraven if (*__lo2 < *__lo1) 238227825Stheraven return 1; 239227825Stheraven } 240227825Stheraven return __lo1 != __hi1; 241227825Stheraven} 242227825Stheraven 243227825Stheraventemplate <class _CharT> 244227825Stheravenlong 245227825Stheravencollate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const 246227825Stheraven{ 247227825Stheraven size_t __h = 0; 248227825Stheraven const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8; 249227825Stheraven const size_t __mask = size_t(0xF) << (__sr + 4); 250227825Stheraven for(const char_type* __p = __lo; __p != __hi; ++__p) 251227825Stheraven { 252232950Stheraven __h = (__h << 4) + static_cast<size_t>(*__p); 253227825Stheraven size_t __g = __h & __mask; 254227825Stheraven __h ^= __g | (__g >> __sr); 255227825Stheraven } 256227825Stheraven return static_cast<long>(__h); 257227825Stheraven} 258227825Stheraven 259262801Sdim_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS collate<char>) 260262801Sdim_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS collate<wchar_t>) 261227825Stheraven 262227825Stheraven// template <class CharT> class collate_byname; 263227825Stheraven 264262801Sdimtemplate <class _CharT> class _LIBCPP_TYPE_VIS_ONLY collate_byname; 265227825Stheraven 266227825Stheraventemplate <> 267250514Sdimclass _LIBCPP_TYPE_VIS collate_byname<char> 268227825Stheraven : public collate<char> 269227825Stheraven{ 270227825Stheraven locale_t __l; 271227825Stheravenpublic: 272227825Stheraven typedef char char_type; 273227825Stheraven typedef basic_string<char_type> string_type; 274227825Stheraven 275227825Stheraven explicit collate_byname(const char* __n, size_t __refs = 0); 276227825Stheraven explicit collate_byname(const string& __n, size_t __refs = 0); 277227825Stheraven 278227825Stheravenprotected: 279227825Stheraven ~collate_byname(); 280227825Stheraven virtual int do_compare(const char_type* __lo1, const char_type* __hi1, 281227825Stheraven const char_type* __lo2, const char_type* __hi2) const; 282227825Stheraven virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const; 283227825Stheraven}; 284227825Stheraven 285227825Stheraventemplate <> 286250514Sdimclass _LIBCPP_TYPE_VIS collate_byname<wchar_t> 287227825Stheraven : public collate<wchar_t> 288227825Stheraven{ 289227825Stheraven locale_t __l; 290227825Stheravenpublic: 291227825Stheraven typedef wchar_t char_type; 292227825Stheraven typedef basic_string<char_type> string_type; 293227825Stheraven 294227825Stheraven explicit collate_byname(const char* __n, size_t __refs = 0); 295227825Stheraven explicit collate_byname(const string& __n, size_t __refs = 0); 296227825Stheraven 297227825Stheravenprotected: 298227825Stheraven ~collate_byname(); 299227825Stheraven 300227825Stheraven virtual int do_compare(const char_type* __lo1, const char_type* __hi1, 301227825Stheraven const char_type* __lo2, const char_type* __hi2) const; 302227825Stheraven virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const; 303227825Stheraven}; 304227825Stheraven 305227825Stheraventemplate <class _CharT, class _Traits, class _Allocator> 306227825Stheravenbool 307227825Stheravenlocale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x, 308227825Stheraven const basic_string<_CharT, _Traits, _Allocator>& __y) const 309227825Stheraven{ 310227825Stheraven return _VSTD::use_facet<_VSTD::collate<_CharT> >(*this).compare( 311227825Stheraven __x.data(), __x.data() + __x.size(), 312227825Stheraven __y.data(), __y.data() + __y.size()) < 0; 313227825Stheraven} 314227825Stheraven 315227825Stheraven// template <class charT> class ctype 316227825Stheraven 317250514Sdimclass _LIBCPP_TYPE_VIS ctype_base 318227825Stheraven{ 319227825Stheravenpublic: 320250514Sdim#ifdef __GLIBC__ 321227825Stheraven typedef unsigned short mask; 322227825Stheraven static const mask space = _ISspace; 323227825Stheraven static const mask print = _ISprint; 324227825Stheraven static const mask cntrl = _IScntrl; 325227825Stheraven static const mask upper = _ISupper; 326227825Stheraven static const mask lower = _ISlower; 327227825Stheraven static const mask alpha = _ISalpha; 328227825Stheraven static const mask digit = _ISdigit; 329227825Stheraven static const mask punct = _ISpunct; 330227825Stheraven static const mask xdigit = _ISxdigit; 331227825Stheraven static const mask blank = _ISblank; 332250514Sdim#elif defined(_WIN32) 333227825Stheraven typedef unsigned short mask; 334227825Stheraven static const mask space = _SPACE; 335227825Stheraven static const mask print = _BLANK|_PUNCT|_ALPHA|_DIGIT; 336227825Stheraven static const mask cntrl = _CONTROL; 337227825Stheraven static const mask upper = _UPPER; 338227825Stheraven static const mask lower = _LOWER; 339227825Stheraven static const mask alpha = _ALPHA; 340227825Stheraven static const mask digit = _DIGIT; 341227825Stheraven static const mask punct = _PUNCT; 342227825Stheraven static const mask xdigit = _HEX; 343227825Stheraven static const mask blank = _BLANK; 344262801Sdim#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__) 345250514Sdim#ifdef __APPLE__ 346227825Stheraven typedef __uint32_t mask; 347250514Sdim#elif defined(__FreeBSD__) 348227825Stheraven typedef unsigned long mask; 349262801Sdim#elif defined(__EMSCRIPTEN__) || defined(__NetBSD__) 350250514Sdim typedef unsigned short mask; 351227825Stheraven#endif 352227825Stheraven static const mask space = _CTYPE_S; 353227825Stheraven static const mask print = _CTYPE_R; 354227825Stheraven static const mask cntrl = _CTYPE_C; 355227825Stheraven static const mask upper = _CTYPE_U; 356227825Stheraven static const mask lower = _CTYPE_L; 357227825Stheraven static const mask alpha = _CTYPE_A; 358227825Stheraven static const mask digit = _CTYPE_D; 359227825Stheraven static const mask punct = _CTYPE_P; 360227825Stheraven static const mask xdigit = _CTYPE_X; 361253222Sdim# if defined(__NetBSD__) 362253222Sdim static const mask blank = _CTYPE_BL; 363253222Sdim# else 364227825Stheraven static const mask blank = _CTYPE_B; 365253222Sdim# endif 366262801Sdim#elif defined(__sun__) || defined(_AIX) 367232950Stheraven typedef unsigned int mask; 368232950Stheraven static const mask space = _ISSPACE; 369232950Stheraven static const mask print = _ISPRINT; 370232950Stheraven static const mask cntrl = _ISCNTRL; 371232950Stheraven static const mask upper = _ISUPPER; 372232950Stheraven static const mask lower = _ISLOWER; 373232950Stheraven static const mask alpha = _ISALPHA; 374232950Stheraven static const mask digit = _ISDIGIT; 375232950Stheraven static const mask punct = _ISPUNCT; 376232950Stheraven static const mask xdigit = _ISXDIGIT; 377232950Stheraven static const mask blank = _ISBLANK; 378262801Sdim#else // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__ || __EMSCRIPTEN__ || __sun__ 379227825Stheraven typedef unsigned long mask; 380227825Stheraven static const mask space = 1<<0; 381227825Stheraven static const mask print = 1<<1; 382227825Stheraven static const mask cntrl = 1<<2; 383227825Stheraven static const mask upper = 1<<3; 384227825Stheraven static const mask lower = 1<<4; 385227825Stheraven static const mask alpha = 1<<5; 386227825Stheraven static const mask digit = 1<<6; 387227825Stheraven static const mask punct = 1<<7; 388227825Stheraven static const mask xdigit = 1<<8; 389227825Stheraven static const mask blank = 1<<9; 390227825Stheraven#endif // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__ 391227825Stheraven static const mask alnum = alpha | digit; 392227825Stheraven static const mask graph = alnum | punct; 393227825Stheraven 394227825Stheraven _LIBCPP_ALWAYS_INLINE ctype_base() {} 395227825Stheraven}; 396227825Stheraven 397262801Sdimtemplate <class _CharT> class _LIBCPP_TYPE_VIS_ONLY ctype; 398227825Stheraven 399227825Stheraventemplate <> 400250514Sdimclass _LIBCPP_TYPE_VIS ctype<wchar_t> 401227825Stheraven : public locale::facet, 402227825Stheraven public ctype_base 403227825Stheraven{ 404227825Stheravenpublic: 405227825Stheraven typedef wchar_t char_type; 406227825Stheraven 407227825Stheraven _LIBCPP_ALWAYS_INLINE 408227825Stheraven explicit ctype(size_t __refs = 0) 409227825Stheraven : locale::facet(__refs) {} 410227825Stheraven 411227825Stheraven _LIBCPP_ALWAYS_INLINE 412227825Stheraven bool is(mask __m, char_type __c) const 413227825Stheraven { 414227825Stheraven return do_is(__m, __c); 415227825Stheraven } 416227825Stheraven 417227825Stheraven _LIBCPP_ALWAYS_INLINE 418227825Stheraven const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const 419227825Stheraven { 420227825Stheraven return do_is(__low, __high, __vec); 421227825Stheraven } 422227825Stheraven 423227825Stheraven _LIBCPP_ALWAYS_INLINE 424227825Stheraven const char_type* scan_is(mask __m, const char_type* __low, const char_type* __high) const 425227825Stheraven { 426227825Stheraven return do_scan_is(__m, __low, __high); 427227825Stheraven } 428227825Stheraven 429227825Stheraven _LIBCPP_ALWAYS_INLINE 430227825Stheraven const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const 431227825Stheraven { 432227825Stheraven return do_scan_not(__m, __low, __high); 433227825Stheraven } 434227825Stheraven 435227825Stheraven _LIBCPP_ALWAYS_INLINE 436227825Stheraven char_type toupper(char_type __c) const 437227825Stheraven { 438227825Stheraven return do_toupper(__c); 439227825Stheraven } 440227825Stheraven 441227825Stheraven _LIBCPP_ALWAYS_INLINE 442227825Stheraven const char_type* toupper(char_type* __low, const char_type* __high) const 443227825Stheraven { 444227825Stheraven return do_toupper(__low, __high); 445227825Stheraven } 446227825Stheraven 447227825Stheraven _LIBCPP_ALWAYS_INLINE 448227825Stheraven char_type tolower(char_type __c) const 449227825Stheraven { 450227825Stheraven return do_tolower(__c); 451227825Stheraven } 452227825Stheraven 453227825Stheraven _LIBCPP_ALWAYS_INLINE 454227825Stheraven const char_type* tolower(char_type* __low, const char_type* __high) const 455227825Stheraven { 456227825Stheraven return do_tolower(__low, __high); 457227825Stheraven } 458227825Stheraven 459227825Stheraven _LIBCPP_ALWAYS_INLINE 460227825Stheraven char_type widen(char __c) const 461227825Stheraven { 462227825Stheraven return do_widen(__c); 463227825Stheraven } 464227825Stheraven 465227825Stheraven _LIBCPP_ALWAYS_INLINE 466227825Stheraven const char* widen(const char* __low, const char* __high, char_type* __to) const 467227825Stheraven { 468227825Stheraven return do_widen(__low, __high, __to); 469227825Stheraven } 470227825Stheraven 471227825Stheraven _LIBCPP_ALWAYS_INLINE 472227825Stheraven char narrow(char_type __c, char __dfault) const 473227825Stheraven { 474227825Stheraven return do_narrow(__c, __dfault); 475227825Stheraven } 476227825Stheraven 477227825Stheraven _LIBCPP_ALWAYS_INLINE 478227825Stheraven const char_type* narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const 479227825Stheraven { 480227825Stheraven return do_narrow(__low, __high, __dfault, __to); 481227825Stheraven } 482227825Stheraven 483227825Stheraven static locale::id id; 484227825Stheraven 485227825Stheravenprotected: 486227825Stheraven ~ctype(); 487227825Stheraven virtual bool do_is(mask __m, char_type __c) const; 488227825Stheraven virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const; 489227825Stheraven virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const; 490227825Stheraven virtual const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const; 491227825Stheraven virtual char_type do_toupper(char_type) const; 492227825Stheraven virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; 493227825Stheraven virtual char_type do_tolower(char_type) const; 494227825Stheraven virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const; 495227825Stheraven virtual char_type do_widen(char) const; 496227825Stheraven virtual const char* do_widen(const char* __low, const char* __high, char_type* __dest) const; 497227825Stheraven virtual char do_narrow(char_type, char __dfault) const; 498227825Stheraven virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const; 499227825Stheraven}; 500227825Stheraven 501227825Stheraventemplate <> 502250514Sdimclass _LIBCPP_TYPE_VIS ctype<char> 503227825Stheraven : public locale::facet, public ctype_base 504227825Stheraven{ 505227825Stheraven const mask* __tab_; 506227825Stheraven bool __del_; 507227825Stheravenpublic: 508227825Stheraven typedef char char_type; 509227825Stheraven 510227825Stheraven explicit ctype(const mask* __tab = 0, bool __del = false, size_t __refs = 0); 511227825Stheraven 512227825Stheraven _LIBCPP_ALWAYS_INLINE 513227825Stheraven bool is(mask __m, char_type __c) const 514227825Stheraven { 515262801Sdim return isascii(__c) ? (__tab_[static_cast<int>(__c)] & __m) !=0 : false; 516227825Stheraven } 517227825Stheraven 518227825Stheraven _LIBCPP_ALWAYS_INLINE 519227825Stheraven const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const 520227825Stheraven { 521227825Stheraven for (; __low != __high; ++__low, ++__vec) 522232950Stheraven *__vec = isascii(*__low) ? __tab_[static_cast<int>(*__low)] : 0; 523227825Stheraven return __low; 524227825Stheraven } 525227825Stheraven 526227825Stheraven _LIBCPP_ALWAYS_INLINE 527227825Stheraven const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const 528227825Stheraven { 529227825Stheraven for (; __low != __high; ++__low) 530232950Stheraven if (isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m)) 531227825Stheraven break; 532227825Stheraven return __low; 533227825Stheraven } 534227825Stheraven 535227825Stheraven _LIBCPP_ALWAYS_INLINE 536227825Stheraven const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const 537227825Stheraven { 538227825Stheraven for (; __low != __high; ++__low) 539232950Stheraven if (!(isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))) 540227825Stheraven break; 541227825Stheraven return __low; 542227825Stheraven } 543227825Stheraven 544227825Stheraven _LIBCPP_ALWAYS_INLINE 545227825Stheraven char_type toupper(char_type __c) const 546227825Stheraven { 547227825Stheraven return do_toupper(__c); 548227825Stheraven } 549227825Stheraven 550227825Stheraven _LIBCPP_ALWAYS_INLINE 551227825Stheraven const char_type* toupper(char_type* __low, const char_type* __high) const 552227825Stheraven { 553227825Stheraven return do_toupper(__low, __high); 554227825Stheraven } 555227825Stheraven 556227825Stheraven _LIBCPP_ALWAYS_INLINE 557227825Stheraven char_type tolower(char_type __c) const 558227825Stheraven { 559227825Stheraven return do_tolower(__c); 560227825Stheraven } 561227825Stheraven 562227825Stheraven _LIBCPP_ALWAYS_INLINE 563227825Stheraven const char_type* tolower(char_type* __low, const char_type* __high) const 564227825Stheraven { 565227825Stheraven return do_tolower(__low, __high); 566227825Stheraven } 567227825Stheraven 568227825Stheraven _LIBCPP_ALWAYS_INLINE 569227825Stheraven char_type widen(char __c) const 570227825Stheraven { 571227825Stheraven return do_widen(__c); 572227825Stheraven } 573227825Stheraven 574227825Stheraven _LIBCPP_ALWAYS_INLINE 575227825Stheraven const char* widen(const char* __low, const char* __high, char_type* __to) const 576227825Stheraven { 577227825Stheraven return do_widen(__low, __high, __to); 578227825Stheraven } 579227825Stheraven 580227825Stheraven _LIBCPP_ALWAYS_INLINE 581227825Stheraven char narrow(char_type __c, char __dfault) const 582227825Stheraven { 583227825Stheraven return do_narrow(__c, __dfault); 584227825Stheraven } 585227825Stheraven 586227825Stheraven _LIBCPP_ALWAYS_INLINE 587227825Stheraven const char* narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const 588227825Stheraven { 589227825Stheraven return do_narrow(__low, __high, __dfault, __to); 590227825Stheraven } 591227825Stheraven 592227825Stheraven static locale::id id; 593227825Stheraven 594227825Stheraven#ifdef _CACHED_RUNES 595227825Stheraven static const size_t table_size = _CACHED_RUNES; 596227825Stheraven#else 597227825Stheraven static const size_t table_size = 256; // FIXME: Don't hardcode this. 598227825Stheraven#endif 599227825Stheraven _LIBCPP_ALWAYS_INLINE const mask* table() const _NOEXCEPT {return __tab_;} 600227825Stheraven static const mask* classic_table() _NOEXCEPT; 601262801Sdim#if defined(__GLIBC__) || defined(__EMSCRIPTEN__) 602227825Stheraven static const int* __classic_upper_table() _NOEXCEPT; 603227825Stheraven static const int* __classic_lower_table() _NOEXCEPT; 604227825Stheraven#endif 605253222Sdim#if defined(__NetBSD__) 606253222Sdim static const short* __classic_upper_table() _NOEXCEPT; 607253222Sdim static const short* __classic_lower_table() _NOEXCEPT; 608253222Sdim#endif 609227825Stheraven 610227825Stheravenprotected: 611227825Stheraven ~ctype(); 612227825Stheraven virtual char_type do_toupper(char_type __c) const; 613227825Stheraven virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; 614227825Stheraven virtual char_type do_tolower(char_type __c) const; 615227825Stheraven virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const; 616227825Stheraven virtual char_type do_widen(char __c) const; 617227825Stheraven virtual const char* do_widen(const char* __low, const char* __high, char_type* __to) const; 618227825Stheraven virtual char do_narrow(char_type __c, char __dfault) const; 619227825Stheraven virtual const char* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const; 620227825Stheraven}; 621227825Stheraven 622227825Stheraven// template <class CharT> class ctype_byname; 623227825Stheraven 624262801Sdimtemplate <class _CharT> class _LIBCPP_TYPE_VIS_ONLY ctype_byname; 625227825Stheraven 626227825Stheraventemplate <> 627250514Sdimclass _LIBCPP_TYPE_VIS ctype_byname<char> 628227825Stheraven : public ctype<char> 629227825Stheraven{ 630227825Stheraven locale_t __l; 631227825Stheraven 632227825Stheravenpublic: 633227825Stheraven explicit ctype_byname(const char*, size_t = 0); 634227825Stheraven explicit ctype_byname(const string&, size_t = 0); 635227825Stheraven 636227825Stheravenprotected: 637227825Stheraven ~ctype_byname(); 638227825Stheraven virtual char_type do_toupper(char_type) const; 639227825Stheraven virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; 640227825Stheraven virtual char_type do_tolower(char_type) const; 641227825Stheraven virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const; 642227825Stheraven}; 643227825Stheraven 644227825Stheraventemplate <> 645250514Sdimclass _LIBCPP_TYPE_VIS ctype_byname<wchar_t> 646227825Stheraven : public ctype<wchar_t> 647227825Stheraven{ 648227825Stheraven locale_t __l; 649227825Stheraven 650227825Stheravenpublic: 651227825Stheraven explicit ctype_byname(const char*, size_t = 0); 652227825Stheraven explicit ctype_byname(const string&, size_t = 0); 653227825Stheraven 654227825Stheravenprotected: 655227825Stheraven ~ctype_byname(); 656227825Stheraven virtual bool do_is(mask __m, char_type __c) const; 657227825Stheraven virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const; 658227825Stheraven virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const; 659227825Stheraven virtual const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const; 660227825Stheraven virtual char_type do_toupper(char_type) const; 661227825Stheraven virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; 662227825Stheraven virtual char_type do_tolower(char_type) const; 663227825Stheraven virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const; 664227825Stheraven virtual char_type do_widen(char) const; 665227825Stheraven virtual const char* do_widen(const char* __low, const char* __high, char_type* __dest) const; 666227825Stheraven virtual char do_narrow(char_type, char __dfault) const; 667227825Stheraven virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const; 668227825Stheraven}; 669227825Stheraven 670227825Stheraventemplate <class _CharT> 671227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 672227825Stheravenbool 673227825Stheravenisspace(_CharT __c, const locale& __loc) 674227825Stheraven{ 675227825Stheraven return use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c); 676227825Stheraven} 677227825Stheraven 678227825Stheraventemplate <class _CharT> 679227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 680227825Stheravenbool 681227825Stheravenisprint(_CharT __c, const locale& __loc) 682227825Stheraven{ 683227825Stheraven return use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c); 684227825Stheraven} 685227825Stheraven 686227825Stheraventemplate <class _CharT> 687227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 688227825Stheravenbool 689227825Stheraveniscntrl(_CharT __c, const locale& __loc) 690227825Stheraven{ 691227825Stheraven return use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c); 692227825Stheraven} 693227825Stheraven 694227825Stheraventemplate <class _CharT> 695227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 696227825Stheravenbool 697227825Stheravenisupper(_CharT __c, const locale& __loc) 698227825Stheraven{ 699227825Stheraven return use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c); 700227825Stheraven} 701227825Stheraven 702227825Stheraventemplate <class _CharT> 703227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 704227825Stheravenbool 705227825Stheravenislower(_CharT __c, const locale& __loc) 706227825Stheraven{ 707227825Stheraven return use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c); 708227825Stheraven} 709227825Stheraven 710227825Stheraventemplate <class _CharT> 711227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 712227825Stheravenbool 713227825Stheravenisalpha(_CharT __c, const locale& __loc) 714227825Stheraven{ 715227825Stheraven return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c); 716227825Stheraven} 717227825Stheraven 718227825Stheraventemplate <class _CharT> 719227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 720227825Stheravenbool 721227825Stheravenisdigit(_CharT __c, const locale& __loc) 722227825Stheraven{ 723227825Stheraven return use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c); 724227825Stheraven} 725227825Stheraven 726227825Stheraventemplate <class _CharT> 727227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 728227825Stheravenbool 729227825Stheravenispunct(_CharT __c, const locale& __loc) 730227825Stheraven{ 731227825Stheraven return use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c); 732227825Stheraven} 733227825Stheraven 734227825Stheraventemplate <class _CharT> 735227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 736227825Stheravenbool 737227825Stheravenisxdigit(_CharT __c, const locale& __loc) 738227825Stheraven{ 739227825Stheraven return use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c); 740227825Stheraven} 741227825Stheraven 742227825Stheraventemplate <class _CharT> 743227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 744227825Stheravenbool 745227825Stheravenisalnum(_CharT __c, const locale& __loc) 746227825Stheraven{ 747227825Stheraven return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c); 748227825Stheraven} 749227825Stheraven 750227825Stheraventemplate <class _CharT> 751227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 752227825Stheravenbool 753227825Stheravenisgraph(_CharT __c, const locale& __loc) 754227825Stheraven{ 755227825Stheraven return use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c); 756227825Stheraven} 757227825Stheraven 758227825Stheraventemplate <class _CharT> 759227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 760227825Stheraven_CharT 761227825Stheraventoupper(_CharT __c, const locale& __loc) 762227825Stheraven{ 763227825Stheraven return use_facet<ctype<_CharT> >(__loc).toupper(__c); 764227825Stheraven} 765227825Stheraven 766227825Stheraventemplate <class _CharT> 767227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 768227825Stheraven_CharT 769227825Stheraventolower(_CharT __c, const locale& __loc) 770227825Stheraven{ 771227825Stheraven return use_facet<ctype<_CharT> >(__loc).tolower(__c); 772227825Stheraven} 773227825Stheraven 774227825Stheraven// codecvt_base 775227825Stheraven 776250514Sdimclass _LIBCPP_TYPE_VIS codecvt_base 777227825Stheraven{ 778227825Stheravenpublic: 779227825Stheraven _LIBCPP_ALWAYS_INLINE codecvt_base() {} 780227825Stheraven enum result {ok, partial, error, noconv}; 781227825Stheraven}; 782227825Stheraven 783227825Stheraven// template <class internT, class externT, class stateT> class codecvt; 784227825Stheraven 785262801Sdimtemplate <class _InternT, class _ExternT, class _StateT> class _LIBCPP_TYPE_VIS_ONLY codecvt; 786227825Stheraven 787227825Stheraven// template <> class codecvt<char, char, mbstate_t> 788227825Stheraven 789227825Stheraventemplate <> 790250514Sdimclass _LIBCPP_TYPE_VIS codecvt<char, char, mbstate_t> 791227825Stheraven : public locale::facet, 792227825Stheraven public codecvt_base 793227825Stheraven{ 794227825Stheravenpublic: 795227825Stheraven typedef char intern_type; 796227825Stheraven typedef char extern_type; 797227825Stheraven typedef mbstate_t state_type; 798227825Stheraven 799227825Stheraven _LIBCPP_ALWAYS_INLINE 800227825Stheraven explicit codecvt(size_t __refs = 0) 801227825Stheraven : locale::facet(__refs) {} 802227825Stheraven 803227825Stheraven _LIBCPP_ALWAYS_INLINE 804227825Stheraven result out(state_type& __st, 805227825Stheraven const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 806227825Stheraven extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const 807227825Stheraven { 808227825Stheraven return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); 809227825Stheraven } 810227825Stheraven 811227825Stheraven _LIBCPP_ALWAYS_INLINE 812227825Stheraven result unshift(state_type& __st, 813227825Stheraven extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const 814227825Stheraven { 815227825Stheraven return do_unshift(__st, __to, __to_end, __to_nxt); 816227825Stheraven } 817227825Stheraven 818227825Stheraven _LIBCPP_ALWAYS_INLINE 819227825Stheraven result in(state_type& __st, 820227825Stheraven const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 821227825Stheraven intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const 822227825Stheraven { 823227825Stheraven return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); 824227825Stheraven } 825227825Stheraven 826227825Stheraven _LIBCPP_ALWAYS_INLINE 827227825Stheraven int encoding() const _NOEXCEPT 828227825Stheraven { 829227825Stheraven return do_encoding(); 830227825Stheraven } 831227825Stheraven 832227825Stheraven _LIBCPP_ALWAYS_INLINE 833227825Stheraven bool always_noconv() const _NOEXCEPT 834227825Stheraven { 835227825Stheraven return do_always_noconv(); 836227825Stheraven } 837227825Stheraven 838227825Stheraven _LIBCPP_ALWAYS_INLINE 839227825Stheraven int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const 840227825Stheraven { 841227825Stheraven return do_length(__st, __frm, __end, __mx); 842227825Stheraven } 843227825Stheraven 844227825Stheraven _LIBCPP_ALWAYS_INLINE 845227825Stheraven int max_length() const _NOEXCEPT 846227825Stheraven { 847227825Stheraven return do_max_length(); 848227825Stheraven } 849227825Stheraven 850227825Stheraven static locale::id id; 851227825Stheraven 852227825Stheravenprotected: 853227825Stheraven _LIBCPP_ALWAYS_INLINE 854227825Stheraven explicit codecvt(const char*, size_t __refs = 0) 855227825Stheraven : locale::facet(__refs) {} 856227825Stheraven 857227825Stheraven ~codecvt(); 858227825Stheraven 859227825Stheraven virtual result do_out(state_type& __st, 860227825Stheraven const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 861227825Stheraven extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 862227825Stheraven virtual result do_in(state_type& __st, 863227825Stheraven const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 864227825Stheraven intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; 865227825Stheraven virtual result do_unshift(state_type& __st, 866227825Stheraven extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 867227825Stheraven virtual int do_encoding() const _NOEXCEPT; 868227825Stheraven virtual bool do_always_noconv() const _NOEXCEPT; 869227825Stheraven virtual int do_length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const; 870227825Stheraven virtual int do_max_length() const _NOEXCEPT; 871227825Stheraven}; 872227825Stheraven 873227825Stheraven// template <> class codecvt<wchar_t, char, mbstate_t> 874227825Stheraven 875227825Stheraventemplate <> 876250514Sdimclass _LIBCPP_TYPE_VIS codecvt<wchar_t, char, mbstate_t> 877227825Stheraven : public locale::facet, 878227825Stheraven public codecvt_base 879227825Stheraven{ 880227825Stheraven locale_t __l; 881227825Stheravenpublic: 882227825Stheraven typedef wchar_t intern_type; 883227825Stheraven typedef char extern_type; 884227825Stheraven typedef mbstate_t state_type; 885227825Stheraven 886227825Stheraven explicit codecvt(size_t __refs = 0); 887227825Stheraven 888227825Stheraven _LIBCPP_ALWAYS_INLINE 889227825Stheraven result out(state_type& __st, 890227825Stheraven const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 891227825Stheraven extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const 892227825Stheraven { 893227825Stheraven return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); 894227825Stheraven } 895227825Stheraven 896227825Stheraven _LIBCPP_ALWAYS_INLINE 897227825Stheraven result unshift(state_type& __st, 898227825Stheraven extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const 899227825Stheraven { 900227825Stheraven return do_unshift(__st, __to, __to_end, __to_nxt); 901227825Stheraven } 902227825Stheraven 903227825Stheraven _LIBCPP_ALWAYS_INLINE 904227825Stheraven result in(state_type& __st, 905227825Stheraven const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 906227825Stheraven intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const 907227825Stheraven { 908227825Stheraven return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); 909227825Stheraven } 910227825Stheraven 911227825Stheraven _LIBCPP_ALWAYS_INLINE 912227825Stheraven int encoding() const _NOEXCEPT 913227825Stheraven { 914227825Stheraven return do_encoding(); 915227825Stheraven } 916227825Stheraven 917227825Stheraven _LIBCPP_ALWAYS_INLINE 918227825Stheraven bool always_noconv() const _NOEXCEPT 919227825Stheraven { 920227825Stheraven return do_always_noconv(); 921227825Stheraven } 922227825Stheraven 923227825Stheraven _LIBCPP_ALWAYS_INLINE 924227825Stheraven int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const 925227825Stheraven { 926227825Stheraven return do_length(__st, __frm, __end, __mx); 927227825Stheraven } 928227825Stheraven 929227825Stheraven _LIBCPP_ALWAYS_INLINE 930227825Stheraven int max_length() const _NOEXCEPT 931227825Stheraven { 932227825Stheraven return do_max_length(); 933227825Stheraven } 934227825Stheraven 935227825Stheraven static locale::id id; 936227825Stheraven 937227825Stheravenprotected: 938227825Stheraven explicit codecvt(const char*, size_t __refs = 0); 939227825Stheraven 940227825Stheraven ~codecvt(); 941227825Stheraven 942227825Stheraven virtual result do_out(state_type& __st, 943227825Stheraven const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 944227825Stheraven extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 945227825Stheraven virtual result do_in(state_type& __st, 946227825Stheraven const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 947227825Stheraven intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; 948227825Stheraven virtual result do_unshift(state_type& __st, 949227825Stheraven extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 950227825Stheraven virtual int do_encoding() const _NOEXCEPT; 951227825Stheraven virtual bool do_always_noconv() const _NOEXCEPT; 952227825Stheraven virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const; 953227825Stheraven virtual int do_max_length() const _NOEXCEPT; 954227825Stheraven}; 955227825Stheraven 956227825Stheraven// template <> class codecvt<char16_t, char, mbstate_t> 957227825Stheraven 958227825Stheraventemplate <> 959250514Sdimclass _LIBCPP_TYPE_VIS codecvt<char16_t, char, mbstate_t> 960227825Stheraven : public locale::facet, 961227825Stheraven public codecvt_base 962227825Stheraven{ 963227825Stheravenpublic: 964227825Stheraven typedef char16_t intern_type; 965227825Stheraven typedef char extern_type; 966227825Stheraven typedef mbstate_t state_type; 967227825Stheraven 968227825Stheraven _LIBCPP_ALWAYS_INLINE 969227825Stheraven explicit codecvt(size_t __refs = 0) 970227825Stheraven : locale::facet(__refs) {} 971227825Stheraven 972227825Stheraven _LIBCPP_ALWAYS_INLINE 973227825Stheraven result out(state_type& __st, 974227825Stheraven const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 975227825Stheraven extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const 976227825Stheraven { 977227825Stheraven return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); 978227825Stheraven } 979227825Stheraven 980227825Stheraven _LIBCPP_ALWAYS_INLINE 981227825Stheraven result unshift(state_type& __st, 982227825Stheraven extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const 983227825Stheraven { 984227825Stheraven return do_unshift(__st, __to, __to_end, __to_nxt); 985227825Stheraven } 986227825Stheraven 987227825Stheraven _LIBCPP_ALWAYS_INLINE 988227825Stheraven result in(state_type& __st, 989227825Stheraven const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 990227825Stheraven intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const 991227825Stheraven { 992227825Stheraven return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); 993227825Stheraven } 994227825Stheraven 995227825Stheraven _LIBCPP_ALWAYS_INLINE 996227825Stheraven int encoding() const _NOEXCEPT 997227825Stheraven { 998227825Stheraven return do_encoding(); 999227825Stheraven } 1000227825Stheraven 1001227825Stheraven _LIBCPP_ALWAYS_INLINE 1002227825Stheraven bool always_noconv() const _NOEXCEPT 1003227825Stheraven { 1004227825Stheraven return do_always_noconv(); 1005227825Stheraven } 1006227825Stheraven 1007227825Stheraven _LIBCPP_ALWAYS_INLINE 1008227825Stheraven int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const 1009227825Stheraven { 1010227825Stheraven return do_length(__st, __frm, __end, __mx); 1011227825Stheraven } 1012227825Stheraven 1013227825Stheraven _LIBCPP_ALWAYS_INLINE 1014227825Stheraven int max_length() const _NOEXCEPT 1015227825Stheraven { 1016227825Stheraven return do_max_length(); 1017227825Stheraven } 1018227825Stheraven 1019227825Stheraven static locale::id id; 1020227825Stheraven 1021227825Stheravenprotected: 1022227825Stheraven _LIBCPP_ALWAYS_INLINE 1023227825Stheraven explicit codecvt(const char*, size_t __refs = 0) 1024227825Stheraven : locale::facet(__refs) {} 1025227825Stheraven 1026227825Stheraven ~codecvt(); 1027227825Stheraven 1028227825Stheraven virtual result do_out(state_type& __st, 1029227825Stheraven const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 1030227825Stheraven extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 1031227825Stheraven virtual result do_in(state_type& __st, 1032227825Stheraven const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 1033227825Stheraven intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; 1034227825Stheraven virtual result do_unshift(state_type& __st, 1035227825Stheraven extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 1036227825Stheraven virtual int do_encoding() const _NOEXCEPT; 1037227825Stheraven virtual bool do_always_noconv() const _NOEXCEPT; 1038227825Stheraven virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const; 1039227825Stheraven virtual int do_max_length() const _NOEXCEPT; 1040227825Stheraven}; 1041227825Stheraven 1042227825Stheraven// template <> class codecvt<char32_t, char, mbstate_t> 1043227825Stheraven 1044227825Stheraventemplate <> 1045250514Sdimclass _LIBCPP_TYPE_VIS codecvt<char32_t, char, mbstate_t> 1046227825Stheraven : public locale::facet, 1047227825Stheraven public codecvt_base 1048227825Stheraven{ 1049227825Stheravenpublic: 1050227825Stheraven typedef char32_t intern_type; 1051227825Stheraven typedef char extern_type; 1052227825Stheraven typedef mbstate_t state_type; 1053227825Stheraven 1054227825Stheraven _LIBCPP_ALWAYS_INLINE 1055227825Stheraven explicit codecvt(size_t __refs = 0) 1056227825Stheraven : locale::facet(__refs) {} 1057227825Stheraven 1058227825Stheraven _LIBCPP_ALWAYS_INLINE 1059227825Stheraven result out(state_type& __st, 1060227825Stheraven const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 1061227825Stheraven extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const 1062227825Stheraven { 1063227825Stheraven return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); 1064227825Stheraven } 1065227825Stheraven 1066227825Stheraven _LIBCPP_ALWAYS_INLINE 1067227825Stheraven result unshift(state_type& __st, 1068227825Stheraven extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const 1069227825Stheraven { 1070227825Stheraven return do_unshift(__st, __to, __to_end, __to_nxt); 1071227825Stheraven } 1072227825Stheraven 1073227825Stheraven _LIBCPP_ALWAYS_INLINE 1074227825Stheraven result in(state_type& __st, 1075227825Stheraven const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 1076227825Stheraven intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const 1077227825Stheraven { 1078227825Stheraven return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); 1079227825Stheraven } 1080227825Stheraven 1081227825Stheraven _LIBCPP_ALWAYS_INLINE 1082227825Stheraven int encoding() const _NOEXCEPT 1083227825Stheraven { 1084227825Stheraven return do_encoding(); 1085227825Stheraven } 1086227825Stheraven 1087227825Stheraven _LIBCPP_ALWAYS_INLINE 1088227825Stheraven bool always_noconv() const _NOEXCEPT 1089227825Stheraven { 1090227825Stheraven return do_always_noconv(); 1091227825Stheraven } 1092227825Stheraven 1093227825Stheraven _LIBCPP_ALWAYS_INLINE 1094227825Stheraven int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const 1095227825Stheraven { 1096227825Stheraven return do_length(__st, __frm, __end, __mx); 1097227825Stheraven } 1098227825Stheraven 1099227825Stheraven _LIBCPP_ALWAYS_INLINE 1100227825Stheraven int max_length() const _NOEXCEPT 1101227825Stheraven { 1102227825Stheraven return do_max_length(); 1103227825Stheraven } 1104227825Stheraven 1105227825Stheraven static locale::id id; 1106227825Stheraven 1107227825Stheravenprotected: 1108227825Stheraven _LIBCPP_ALWAYS_INLINE 1109227825Stheraven explicit codecvt(const char*, size_t __refs = 0) 1110227825Stheraven : locale::facet(__refs) {} 1111227825Stheraven 1112227825Stheraven ~codecvt(); 1113227825Stheraven 1114227825Stheraven virtual result do_out(state_type& __st, 1115227825Stheraven const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 1116227825Stheraven extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 1117227825Stheraven virtual result do_in(state_type& __st, 1118227825Stheraven const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 1119227825Stheraven intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; 1120227825Stheraven virtual result do_unshift(state_type& __st, 1121227825Stheraven extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 1122227825Stheraven virtual int do_encoding() const _NOEXCEPT; 1123227825Stheraven virtual bool do_always_noconv() const _NOEXCEPT; 1124227825Stheraven virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const; 1125227825Stheraven virtual int do_max_length() const _NOEXCEPT; 1126227825Stheraven}; 1127227825Stheraven 1128227825Stheraven// template <class _InternT, class _ExternT, class _StateT> class codecvt_byname 1129227825Stheraven 1130227825Stheraventemplate <class _InternT, class _ExternT, class _StateT> 1131262801Sdimclass _LIBCPP_TYPE_VIS_ONLY codecvt_byname 1132227825Stheraven : public codecvt<_InternT, _ExternT, _StateT> 1133227825Stheraven{ 1134227825Stheravenpublic: 1135227825Stheraven _LIBCPP_ALWAYS_INLINE 1136227825Stheraven explicit codecvt_byname(const char* __nm, size_t __refs = 0) 1137227825Stheraven : codecvt<_InternT, _ExternT, _StateT>(__nm, __refs) {} 1138227825Stheraven _LIBCPP_ALWAYS_INLINE 1139227825Stheraven explicit codecvt_byname(const string& __nm, size_t __refs = 0) 1140227825Stheraven : codecvt<_InternT, _ExternT, _StateT>(__nm.c_str(), __refs) {} 1141227825Stheravenprotected: 1142227825Stheraven ~codecvt_byname(); 1143227825Stheraven}; 1144227825Stheraven 1145227825Stheraventemplate <class _InternT, class _ExternT, class _StateT> 1146227825Stheravencodecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname() 1147227825Stheraven{ 1148227825Stheraven} 1149227825Stheraven 1150262801Sdim_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<char, char, mbstate_t>) 1151262801Sdim_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<wchar_t, char, mbstate_t>) 1152262801Sdim_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>) 1153262801Sdim_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>) 1154227825Stheraven 1155250514Sdim_LIBCPP_FUNC_VIS void __throw_runtime_error(const char*); 1156227825Stheraven 1157232950Stheraventemplate <size_t _Np> 1158227825Stheravenstruct __narrow_to_utf8 1159227825Stheraven{ 1160227825Stheraven template <class _OutputIterator, class _CharT> 1161227825Stheraven _OutputIterator 1162227825Stheraven operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const; 1163227825Stheraven}; 1164227825Stheraven 1165227825Stheraventemplate <> 1166227825Stheravenstruct __narrow_to_utf8<8> 1167227825Stheraven{ 1168227825Stheraven template <class _OutputIterator, class _CharT> 1169227825Stheraven _LIBCPP_ALWAYS_INLINE 1170227825Stheraven _OutputIterator 1171227825Stheraven operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const 1172227825Stheraven { 1173227825Stheraven for (; __wb < __we; ++__wb, ++__s) 1174227825Stheraven *__s = *__wb; 1175227825Stheraven return __s; 1176227825Stheraven } 1177227825Stheraven}; 1178227825Stheraven 1179227825Stheraventemplate <> 1180227825Stheravenstruct __narrow_to_utf8<16> 1181227825Stheraven : public codecvt<char16_t, char, mbstate_t> 1182227825Stheraven{ 1183227825Stheraven _LIBCPP_ALWAYS_INLINE 1184227825Stheraven __narrow_to_utf8() : codecvt<char16_t, char, mbstate_t>(1) {} 1185227825Stheraven 1186227825Stheraven ~__narrow_to_utf8(); 1187227825Stheraven 1188227825Stheraven template <class _OutputIterator, class _CharT> 1189227825Stheraven _LIBCPP_ALWAYS_INLINE 1190227825Stheraven _OutputIterator 1191227825Stheraven operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const 1192227825Stheraven { 1193227825Stheraven result __r = ok; 1194227825Stheraven mbstate_t __mb; 1195227825Stheraven while (__wb < __we && __r != error) 1196227825Stheraven { 1197227825Stheraven const int __sz = 32; 1198227825Stheraven char __buf[__sz]; 1199227825Stheraven char* __bn; 1200227825Stheraven const char16_t* __wn = (const char16_t*)__wb; 1201227825Stheraven __r = do_out(__mb, (const char16_t*)__wb, (const char16_t*)__we, __wn, 1202227825Stheraven __buf, __buf+__sz, __bn); 1203227825Stheraven if (__r == codecvt_base::error || __wn == (const char16_t*)__wb) 1204227825Stheraven __throw_runtime_error("locale not supported"); 1205227825Stheraven for (const char* __p = __buf; __p < __bn; ++__p, ++__s) 1206227825Stheraven *__s = *__p; 1207227825Stheraven __wb = (const _CharT*)__wn; 1208227825Stheraven } 1209227825Stheraven return __s; 1210227825Stheraven } 1211227825Stheraven}; 1212227825Stheraven 1213227825Stheraventemplate <> 1214227825Stheravenstruct __narrow_to_utf8<32> 1215227825Stheraven : public codecvt<char32_t, char, mbstate_t> 1216227825Stheraven{ 1217227825Stheraven _LIBCPP_ALWAYS_INLINE 1218227825Stheraven __narrow_to_utf8() : codecvt<char32_t, char, mbstate_t>(1) {} 1219227825Stheraven 1220227825Stheraven ~__narrow_to_utf8(); 1221227825Stheraven 1222227825Stheraven template <class _OutputIterator, class _CharT> 1223227825Stheraven _LIBCPP_ALWAYS_INLINE 1224227825Stheraven _OutputIterator 1225227825Stheraven operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const 1226227825Stheraven { 1227227825Stheraven result __r = ok; 1228227825Stheraven mbstate_t __mb; 1229227825Stheraven while (__wb < __we && __r != error) 1230227825Stheraven { 1231227825Stheraven const int __sz = 32; 1232227825Stheraven char __buf[__sz]; 1233227825Stheraven char* __bn; 1234227825Stheraven const char32_t* __wn = (const char32_t*)__wb; 1235227825Stheraven __r = do_out(__mb, (const char32_t*)__wb, (const char32_t*)__we, __wn, 1236227825Stheraven __buf, __buf+__sz, __bn); 1237227825Stheraven if (__r == codecvt_base::error || __wn == (const char32_t*)__wb) 1238227825Stheraven __throw_runtime_error("locale not supported"); 1239227825Stheraven for (const char* __p = __buf; __p < __bn; ++__p, ++__s) 1240227825Stheraven *__s = *__p; 1241227825Stheraven __wb = (const _CharT*)__wn; 1242227825Stheraven } 1243227825Stheraven return __s; 1244227825Stheraven } 1245227825Stheraven}; 1246227825Stheraven 1247232950Stheraventemplate <size_t _Np> 1248227825Stheravenstruct __widen_from_utf8 1249227825Stheraven{ 1250227825Stheraven template <class _OutputIterator> 1251227825Stheraven _OutputIterator 1252227825Stheraven operator()(_OutputIterator __s, const char* __nb, const char* __ne) const; 1253227825Stheraven}; 1254227825Stheraven 1255227825Stheraventemplate <> 1256227825Stheravenstruct __widen_from_utf8<8> 1257227825Stheraven{ 1258227825Stheraven template <class _OutputIterator> 1259227825Stheraven _LIBCPP_ALWAYS_INLINE 1260227825Stheraven _OutputIterator 1261227825Stheraven operator()(_OutputIterator __s, const char* __nb, const char* __ne) const 1262227825Stheraven { 1263227825Stheraven for (; __nb < __ne; ++__nb, ++__s) 1264227825Stheraven *__s = *__nb; 1265227825Stheraven return __s; 1266227825Stheraven } 1267227825Stheraven}; 1268227825Stheraven 1269227825Stheraventemplate <> 1270227825Stheravenstruct __widen_from_utf8<16> 1271227825Stheraven : public codecvt<char16_t, char, mbstate_t> 1272227825Stheraven{ 1273227825Stheraven _LIBCPP_ALWAYS_INLINE 1274227825Stheraven __widen_from_utf8() : codecvt<char16_t, char, mbstate_t>(1) {} 1275227825Stheraven 1276227825Stheraven ~__widen_from_utf8(); 1277227825Stheraven 1278227825Stheraven template <class _OutputIterator> 1279227825Stheraven _LIBCPP_ALWAYS_INLINE 1280227825Stheraven _OutputIterator 1281227825Stheraven operator()(_OutputIterator __s, const char* __nb, const char* __ne) const 1282227825Stheraven { 1283227825Stheraven result __r = ok; 1284227825Stheraven mbstate_t __mb; 1285227825Stheraven while (__nb < __ne && __r != error) 1286227825Stheraven { 1287227825Stheraven const int __sz = 32; 1288227825Stheraven char16_t __buf[__sz]; 1289227825Stheraven char16_t* __bn; 1290227825Stheraven const char* __nn = __nb; 1291227825Stheraven __r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb+__sz : __ne, __nn, 1292227825Stheraven __buf, __buf+__sz, __bn); 1293227825Stheraven if (__r == codecvt_base::error || __nn == __nb) 1294227825Stheraven __throw_runtime_error("locale not supported"); 1295227825Stheraven for (const char16_t* __p = __buf; __p < __bn; ++__p, ++__s) 1296227825Stheraven *__s = (wchar_t)*__p; 1297227825Stheraven __nb = __nn; 1298227825Stheraven } 1299227825Stheraven return __s; 1300227825Stheraven } 1301227825Stheraven}; 1302227825Stheraven 1303227825Stheraventemplate <> 1304227825Stheravenstruct __widen_from_utf8<32> 1305227825Stheraven : public codecvt<char32_t, char, mbstate_t> 1306227825Stheraven{ 1307227825Stheraven _LIBCPP_ALWAYS_INLINE 1308227825Stheraven __widen_from_utf8() : codecvt<char32_t, char, mbstate_t>(1) {} 1309227825Stheraven 1310227825Stheraven ~__widen_from_utf8(); 1311227825Stheraven 1312227825Stheraven template <class _OutputIterator> 1313227825Stheraven _LIBCPP_ALWAYS_INLINE 1314227825Stheraven _OutputIterator 1315227825Stheraven operator()(_OutputIterator __s, const char* __nb, const char* __ne) const 1316227825Stheraven { 1317227825Stheraven result __r = ok; 1318227825Stheraven mbstate_t __mb; 1319227825Stheraven while (__nb < __ne && __r != error) 1320227825Stheraven { 1321227825Stheraven const int __sz = 32; 1322227825Stheraven char32_t __buf[__sz]; 1323227825Stheraven char32_t* __bn; 1324227825Stheraven const char* __nn = __nb; 1325227825Stheraven __r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb+__sz : __ne, __nn, 1326227825Stheraven __buf, __buf+__sz, __bn); 1327227825Stheraven if (__r == codecvt_base::error || __nn == __nb) 1328227825Stheraven __throw_runtime_error("locale not supported"); 1329227825Stheraven for (const char32_t* __p = __buf; __p < __bn; ++__p, ++__s) 1330227825Stheraven *__s = (wchar_t)*__p; 1331227825Stheraven __nb = __nn; 1332227825Stheraven } 1333227825Stheraven return __s; 1334227825Stheraven } 1335227825Stheraven}; 1336227825Stheraven 1337227825Stheraven// template <class charT> class numpunct 1338227825Stheraven 1339262801Sdimtemplate <class _CharT> class _LIBCPP_TYPE_VIS_ONLY numpunct; 1340227825Stheraven 1341227825Stheraventemplate <> 1342250514Sdimclass _LIBCPP_TYPE_VIS numpunct<char> 1343227825Stheraven : public locale::facet 1344227825Stheraven{ 1345227825Stheravenpublic: 1346227825Stheraven typedef char char_type; 1347227825Stheraven typedef basic_string<char_type> string_type; 1348227825Stheraven 1349227825Stheraven explicit numpunct(size_t __refs = 0); 1350227825Stheraven 1351227825Stheraven _LIBCPP_ALWAYS_INLINE char_type decimal_point() const {return do_decimal_point();} 1352227825Stheraven _LIBCPP_ALWAYS_INLINE char_type thousands_sep() const {return do_thousands_sep();} 1353227825Stheraven _LIBCPP_ALWAYS_INLINE string grouping() const {return do_grouping();} 1354227825Stheraven _LIBCPP_ALWAYS_INLINE string_type truename() const {return do_truename();} 1355227825Stheraven _LIBCPP_ALWAYS_INLINE string_type falsename() const {return do_falsename();} 1356227825Stheraven 1357227825Stheraven static locale::id id; 1358227825Stheraven 1359227825Stheravenprotected: 1360227825Stheraven ~numpunct(); 1361227825Stheraven virtual char_type do_decimal_point() const; 1362227825Stheraven virtual char_type do_thousands_sep() const; 1363227825Stheraven virtual string do_grouping() const; 1364227825Stheraven virtual string_type do_truename() const; 1365227825Stheraven virtual string_type do_falsename() const; 1366227825Stheraven 1367227825Stheraven char_type __decimal_point_; 1368227825Stheraven char_type __thousands_sep_; 1369227825Stheraven string __grouping_; 1370227825Stheraven}; 1371227825Stheraven 1372227825Stheraventemplate <> 1373250514Sdimclass _LIBCPP_TYPE_VIS numpunct<wchar_t> 1374227825Stheraven : public locale::facet 1375227825Stheraven{ 1376227825Stheravenpublic: 1377227825Stheraven typedef wchar_t char_type; 1378227825Stheraven typedef basic_string<char_type> string_type; 1379227825Stheraven 1380227825Stheraven explicit numpunct(size_t __refs = 0); 1381227825Stheraven 1382227825Stheraven _LIBCPP_ALWAYS_INLINE char_type decimal_point() const {return do_decimal_point();} 1383227825Stheraven _LIBCPP_ALWAYS_INLINE char_type thousands_sep() const {return do_thousands_sep();} 1384227825Stheraven _LIBCPP_ALWAYS_INLINE string grouping() const {return do_grouping();} 1385227825Stheraven _LIBCPP_ALWAYS_INLINE string_type truename() const {return do_truename();} 1386227825Stheraven _LIBCPP_ALWAYS_INLINE string_type falsename() const {return do_falsename();} 1387227825Stheraven 1388227825Stheraven static locale::id id; 1389227825Stheraven 1390227825Stheravenprotected: 1391227825Stheraven ~numpunct(); 1392227825Stheraven virtual char_type do_decimal_point() const; 1393227825Stheraven virtual char_type do_thousands_sep() const; 1394227825Stheraven virtual string do_grouping() const; 1395227825Stheraven virtual string_type do_truename() const; 1396227825Stheraven virtual string_type do_falsename() const; 1397227825Stheraven 1398227825Stheraven char_type __decimal_point_; 1399227825Stheraven char_type __thousands_sep_; 1400227825Stheraven string __grouping_; 1401227825Stheraven}; 1402227825Stheraven 1403227825Stheraven// template <class charT> class numpunct_byname 1404227825Stheraven 1405262801Sdimtemplate <class charT> class _LIBCPP_TYPE_VIS_ONLY numpunct_byname; 1406227825Stheraven 1407227825Stheraventemplate <> 1408250514Sdimclass _LIBCPP_TYPE_VIS numpunct_byname<char> 1409227825Stheraven: public numpunct<char> 1410227825Stheraven{ 1411227825Stheravenpublic: 1412227825Stheraven typedef char char_type; 1413227825Stheraven typedef basic_string<char_type> string_type; 1414227825Stheraven 1415227825Stheraven explicit numpunct_byname(const char* __nm, size_t __refs = 0); 1416227825Stheraven explicit numpunct_byname(const string& __nm, size_t __refs = 0); 1417227825Stheraven 1418227825Stheravenprotected: 1419227825Stheraven ~numpunct_byname(); 1420227825Stheraven 1421227825Stheravenprivate: 1422227825Stheraven void __init(const char*); 1423227825Stheraven}; 1424227825Stheraven 1425227825Stheraventemplate <> 1426250514Sdimclass _LIBCPP_TYPE_VIS numpunct_byname<wchar_t> 1427227825Stheraven: public numpunct<wchar_t> 1428227825Stheraven{ 1429227825Stheravenpublic: 1430227825Stheraven typedef wchar_t char_type; 1431227825Stheraven typedef basic_string<char_type> string_type; 1432227825Stheraven 1433227825Stheraven explicit numpunct_byname(const char* __nm, size_t __refs = 0); 1434227825Stheraven explicit numpunct_byname(const string& __nm, size_t __refs = 0); 1435227825Stheraven 1436227825Stheravenprotected: 1437227825Stheraven ~numpunct_byname(); 1438227825Stheraven 1439227825Stheravenprivate: 1440227825Stheraven void __init(const char*); 1441227825Stheraven}; 1442227825Stheraven 1443227825Stheraven_LIBCPP_END_NAMESPACE_STD 1444227825Stheraven 1445227825Stheraven#endif // _LIBCPP___LOCALE 1446