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