14684ddb6SLionel Sambuc// -*- C++ -*- 24684ddb6SLionel Sambuc//===----------------------------------------------------------------------===// 34684ddb6SLionel Sambuc// 44684ddb6SLionel Sambuc// The LLVM Compiler Infrastructure 54684ddb6SLionel Sambuc// 64684ddb6SLionel Sambuc// This file is dual licensed under the MIT and the University of Illinois Open 74684ddb6SLionel Sambuc// Source Licenses. See LICENSE.TXT for details. 84684ddb6SLionel Sambuc// 94684ddb6SLionel Sambuc//===----------------------------------------------------------------------===// 104684ddb6SLionel Sambuc 114684ddb6SLionel Sambuc#ifndef _LIBCPP___LOCALE 124684ddb6SLionel Sambuc#define _LIBCPP___LOCALE 134684ddb6SLionel Sambuc 144684ddb6SLionel Sambuc#include <__config> 154684ddb6SLionel Sambuc#include <string> 164684ddb6SLionel Sambuc#include <memory> 174684ddb6SLionel Sambuc#include <utility> 184684ddb6SLionel Sambuc#include <mutex> 194684ddb6SLionel Sambuc#include <cstdint> 204684ddb6SLionel Sambuc#include <cctype> 214684ddb6SLionel Sambuc#include <locale.h> 224684ddb6SLionel Sambuc#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) 234684ddb6SLionel Sambuc# include <support/win32/locale_win32.h> 24*0a6a1f1dSLionel Sambuc#elif defined(_AIX) 254684ddb6SLionel Sambuc# include <support/ibm/xlocale.h> 26*0a6a1f1dSLionel Sambuc#elif defined(__ANDROID__) 27*0a6a1f1dSLionel Sambuc// Android gained the locale aware functions in L (API level 21) 28*0a6a1f1dSLionel Sambuc# include <android/api-level.h> 29*0a6a1f1dSLionel Sambuc# if __ANDROID_API__ <= 20 30*0a6a1f1dSLionel Sambuc# include <support/android/locale_bionic.h> 31*0a6a1f1dSLionel Sambuc# endif 32*0a6a1f1dSLionel Sambuc#elif defined(__sun__) 334684ddb6SLionel Sambuc# include <xlocale.h> 34*0a6a1f1dSLionel Sambuc# include <support/solaris/xlocale.h> 35*0a6a1f1dSLionel Sambuc#elif defined(_NEWLIB_VERSION) 36*0a6a1f1dSLionel Sambuc# include <support/newlib/xlocale.h> 37*0a6a1f1dSLionel Sambuc#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) \ 38*0a6a1f1dSLionel Sambuc || defined(__EMSCRIPTEN__) || defined(__IBMCPP__)) 39*0a6a1f1dSLionel Sambuc# include <xlocale.h> 40*0a6a1f1dSLionel Sambuc#endif // __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__ 414684ddb6SLionel Sambuc 424684ddb6SLionel Sambuc#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 434684ddb6SLionel Sambuc#pragma GCC system_header 444684ddb6SLionel Sambuc#endif 454684ddb6SLionel Sambuc 464684ddb6SLionel Sambuc_LIBCPP_BEGIN_NAMESPACE_STD 474684ddb6SLionel Sambuc 484684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS locale; 494684ddb6SLionel Sambuc 504684ddb6SLionel Sambuctemplate <class _Facet> 514684ddb6SLionel Sambuc_LIBCPP_INLINE_VISIBILITY 524684ddb6SLionel Sambucbool 534684ddb6SLionel Sambuchas_facet(const locale&) _NOEXCEPT; 544684ddb6SLionel Sambuc 554684ddb6SLionel Sambuctemplate <class _Facet> 564684ddb6SLionel Sambuc_LIBCPP_INLINE_VISIBILITY 574684ddb6SLionel Sambucconst _Facet& 584684ddb6SLionel Sambucuse_facet(const locale&); 594684ddb6SLionel Sambuc 604684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS locale 614684ddb6SLionel Sambuc{ 624684ddb6SLionel Sambucpublic: 634684ddb6SLionel Sambuc // types: 644684ddb6SLionel Sambuc class _LIBCPP_TYPE_VIS facet; 654684ddb6SLionel Sambuc class _LIBCPP_TYPE_VIS id; 664684ddb6SLionel Sambuc 674684ddb6SLionel Sambuc typedef int category; 684684ddb6SLionel Sambuc static const category // values assigned here are for exposition only 694684ddb6SLionel Sambuc none = 0, 704684ddb6SLionel Sambuc collate = LC_COLLATE_MASK, 714684ddb6SLionel Sambuc ctype = LC_CTYPE_MASK, 724684ddb6SLionel Sambuc monetary = LC_MONETARY_MASK, 734684ddb6SLionel Sambuc numeric = LC_NUMERIC_MASK, 744684ddb6SLionel Sambuc time = LC_TIME_MASK, 754684ddb6SLionel Sambuc messages = LC_MESSAGES_MASK, 764684ddb6SLionel Sambuc all = collate | ctype | monetary | numeric | time | messages; 774684ddb6SLionel Sambuc 784684ddb6SLionel Sambuc // construct/copy/destroy: 794684ddb6SLionel Sambuc locale() _NOEXCEPT; 804684ddb6SLionel Sambuc locale(const locale&) _NOEXCEPT; 814684ddb6SLionel Sambuc explicit locale(const char*); 824684ddb6SLionel Sambuc explicit locale(const string&); 834684ddb6SLionel Sambuc locale(const locale&, const char*, category); 844684ddb6SLionel Sambuc locale(const locale&, const string&, category); 854684ddb6SLionel Sambuc template <class _Facet> 864684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY locale(const locale&, _Facet*); 874684ddb6SLionel Sambuc locale(const locale&, const locale&, category); 884684ddb6SLionel Sambuc 894684ddb6SLionel Sambuc ~locale(); 904684ddb6SLionel Sambuc 914684ddb6SLionel Sambuc const locale& operator=(const locale&) _NOEXCEPT; 924684ddb6SLionel Sambuc 934684ddb6SLionel Sambuc template <class _Facet> locale combine(const locale&) const; 944684ddb6SLionel Sambuc 954684ddb6SLionel Sambuc // locale operations: 964684ddb6SLionel Sambuc string name() const; 974684ddb6SLionel Sambuc bool operator==(const locale&) const; 984684ddb6SLionel Sambuc bool operator!=(const locale& __y) const {return !(*this == __y);} 994684ddb6SLionel Sambuc template <class _CharT, class _Traits, class _Allocator> 1004684ddb6SLionel Sambuc bool operator()(const basic_string<_CharT, _Traits, _Allocator>&, 1014684ddb6SLionel Sambuc const basic_string<_CharT, _Traits, _Allocator>&) const; 1024684ddb6SLionel Sambuc 1034684ddb6SLionel Sambuc // global locale objects: 1044684ddb6SLionel Sambuc static locale global(const locale&); 1054684ddb6SLionel Sambuc static const locale& classic(); 1064684ddb6SLionel Sambuc 1074684ddb6SLionel Sambucprivate: 1084684ddb6SLionel Sambuc class __imp; 1094684ddb6SLionel Sambuc __imp* __locale_; 1104684ddb6SLionel Sambuc 1114684ddb6SLionel Sambuc void __install_ctor(const locale&, facet*, long); 1124684ddb6SLionel Sambuc static locale& __global(); 1134684ddb6SLionel Sambuc bool has_facet(id&) const; 1144684ddb6SLionel Sambuc const facet* use_facet(id&) const; 1154684ddb6SLionel Sambuc 1164684ddb6SLionel Sambuc template <class _Facet> friend bool has_facet(const locale&) _NOEXCEPT; 1174684ddb6SLionel Sambuc template <class _Facet> friend const _Facet& use_facet(const locale&); 1184684ddb6SLionel Sambuc}; 1194684ddb6SLionel Sambuc 1204684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS locale::facet 1214684ddb6SLionel Sambuc : public __shared_count 1224684ddb6SLionel Sambuc{ 1234684ddb6SLionel Sambucprotected: 1244684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY 1254684ddb6SLionel Sambuc explicit facet(size_t __refs = 0) 1264684ddb6SLionel Sambuc : __shared_count(static_cast<long>(__refs)-1) {} 1274684ddb6SLionel Sambuc 1284684ddb6SLionel Sambuc virtual ~facet(); 1294684ddb6SLionel Sambuc 1304684ddb6SLionel Sambuc// facet(const facet&) = delete; // effectively done in __shared_count 1314684ddb6SLionel Sambuc// void operator=(const facet&) = delete; 1324684ddb6SLionel Sambucprivate: 1334684ddb6SLionel Sambuc virtual void __on_zero_shared() _NOEXCEPT; 1344684ddb6SLionel Sambuc}; 1354684ddb6SLionel Sambuc 1364684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS locale::id 1374684ddb6SLionel Sambuc{ 1384684ddb6SLionel Sambuc once_flag __flag_; 1394684ddb6SLionel Sambuc int32_t __id_; 1404684ddb6SLionel Sambuc 1414684ddb6SLionel Sambuc static int32_t __next_id; 1424684ddb6SLionel Sambucpublic: 1434684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR id() :__id_(0) {} 1444684ddb6SLionel Sambucprivate: 1454684ddb6SLionel Sambuc void __init(); 1464684ddb6SLionel Sambuc void operator=(const id&); // = delete; 1474684ddb6SLionel Sambuc id(const id&); // = delete; 1484684ddb6SLionel Sambucpublic: // only needed for tests 1494684ddb6SLionel Sambuc long __get(); 1504684ddb6SLionel Sambuc 1514684ddb6SLionel Sambuc friend class locale; 1524684ddb6SLionel Sambuc friend class locale::__imp; 1534684ddb6SLionel Sambuc}; 1544684ddb6SLionel Sambuc 1554684ddb6SLionel Sambuctemplate <class _Facet> 1564684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 1574684ddb6SLionel Sambuclocale::locale(const locale& __other, _Facet* __f) 1584684ddb6SLionel Sambuc{ 1594684ddb6SLionel Sambuc __install_ctor(__other, __f, __f ? __f->id.__get() : 0); 1604684ddb6SLionel Sambuc} 1614684ddb6SLionel Sambuc 1624684ddb6SLionel Sambuctemplate <class _Facet> 1634684ddb6SLionel Sambuclocale 1644684ddb6SLionel Sambuclocale::combine(const locale& __other) const 1654684ddb6SLionel Sambuc{ 1664684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 1674684ddb6SLionel Sambuc if (!_VSTD::has_facet<_Facet>(__other)) 1684684ddb6SLionel Sambuc throw runtime_error("locale::combine: locale missing facet"); 1694684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 1704684ddb6SLionel Sambuc return locale(*this, &const_cast<_Facet&>(_VSTD::use_facet<_Facet>(__other))); 1714684ddb6SLionel Sambuc} 1724684ddb6SLionel Sambuc 1734684ddb6SLionel Sambuctemplate <class _Facet> 1744684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 1754684ddb6SLionel Sambucbool 1764684ddb6SLionel Sambuchas_facet(const locale& __l) _NOEXCEPT 1774684ddb6SLionel Sambuc{ 1784684ddb6SLionel Sambuc return __l.has_facet(_Facet::id); 1794684ddb6SLionel Sambuc} 1804684ddb6SLionel Sambuc 1814684ddb6SLionel Sambuctemplate <class _Facet> 1824684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 1834684ddb6SLionel Sambucconst _Facet& 1844684ddb6SLionel Sambucuse_facet(const locale& __l) 1854684ddb6SLionel Sambuc{ 1864684ddb6SLionel Sambuc return static_cast<const _Facet&>(*__l.use_facet(_Facet::id)); 1874684ddb6SLionel Sambuc} 1884684ddb6SLionel Sambuc 1894684ddb6SLionel Sambuc// template <class _CharT> class collate; 1904684ddb6SLionel Sambuc 1914684ddb6SLionel Sambuctemplate <class _CharT> 1924684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY collate 1934684ddb6SLionel Sambuc : public locale::facet 1944684ddb6SLionel Sambuc{ 1954684ddb6SLionel Sambucpublic: 1964684ddb6SLionel Sambuc typedef _CharT char_type; 1974684ddb6SLionel Sambuc typedef basic_string<char_type> string_type; 1984684ddb6SLionel Sambuc 1994684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY 2004684ddb6SLionel Sambuc explicit collate(size_t __refs = 0) 2014684ddb6SLionel Sambuc : locale::facet(__refs) {} 2024684ddb6SLionel Sambuc 2034684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY 2044684ddb6SLionel Sambuc int compare(const char_type* __lo1, const char_type* __hi1, 2054684ddb6SLionel Sambuc const char_type* __lo2, const char_type* __hi2) const 2064684ddb6SLionel Sambuc { 2074684ddb6SLionel Sambuc return do_compare(__lo1, __hi1, __lo2, __hi2); 2084684ddb6SLionel Sambuc } 2094684ddb6SLionel Sambuc 2104684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY 2114684ddb6SLionel Sambuc string_type transform(const char_type* __lo, const char_type* __hi) const 2124684ddb6SLionel Sambuc { 2134684ddb6SLionel Sambuc return do_transform(__lo, __hi); 2144684ddb6SLionel Sambuc } 2154684ddb6SLionel Sambuc 2164684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY 2174684ddb6SLionel Sambuc long hash(const char_type* __lo, const char_type* __hi) const 2184684ddb6SLionel Sambuc { 2194684ddb6SLionel Sambuc return do_hash(__lo, __hi); 2204684ddb6SLionel Sambuc } 2214684ddb6SLionel Sambuc 2224684ddb6SLionel Sambuc static locale::id id; 2234684ddb6SLionel Sambuc 2244684ddb6SLionel Sambucprotected: 2254684ddb6SLionel Sambuc ~collate(); 2264684ddb6SLionel Sambuc virtual int do_compare(const char_type* __lo1, const char_type* __hi1, 2274684ddb6SLionel Sambuc const char_type* __lo2, const char_type* __hi2) const; 2284684ddb6SLionel Sambuc virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const 2294684ddb6SLionel Sambuc {return string_type(__lo, __hi);} 2304684ddb6SLionel Sambuc virtual long do_hash(const char_type* __lo, const char_type* __hi) const; 2314684ddb6SLionel Sambuc}; 2324684ddb6SLionel Sambuc 2334684ddb6SLionel Sambuctemplate <class _CharT> locale::id collate<_CharT>::id; 2344684ddb6SLionel Sambuc 2354684ddb6SLionel Sambuctemplate <class _CharT> 2364684ddb6SLionel Sambuccollate<_CharT>::~collate() 2374684ddb6SLionel Sambuc{ 2384684ddb6SLionel Sambuc} 2394684ddb6SLionel Sambuc 2404684ddb6SLionel Sambuctemplate <class _CharT> 2414684ddb6SLionel Sambucint 2424684ddb6SLionel Sambuccollate<_CharT>::do_compare(const char_type* __lo1, const char_type* __hi1, 2434684ddb6SLionel Sambuc const char_type* __lo2, const char_type* __hi2) const 2444684ddb6SLionel Sambuc{ 2454684ddb6SLionel Sambuc for (; __lo2 != __hi2; ++__lo1, ++__lo2) 2464684ddb6SLionel Sambuc { 2474684ddb6SLionel Sambuc if (__lo1 == __hi1 || *__lo1 < *__lo2) 2484684ddb6SLionel Sambuc return -1; 2494684ddb6SLionel Sambuc if (*__lo2 < *__lo1) 2504684ddb6SLionel Sambuc return 1; 2514684ddb6SLionel Sambuc } 2524684ddb6SLionel Sambuc return __lo1 != __hi1; 2534684ddb6SLionel Sambuc} 2544684ddb6SLionel Sambuc 2554684ddb6SLionel Sambuctemplate <class _CharT> 2564684ddb6SLionel Sambuclong 2574684ddb6SLionel Sambuccollate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const 2584684ddb6SLionel Sambuc{ 2594684ddb6SLionel Sambuc size_t __h = 0; 2604684ddb6SLionel Sambuc const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8; 2614684ddb6SLionel Sambuc const size_t __mask = size_t(0xF) << (__sr + 4); 2624684ddb6SLionel Sambuc for(const char_type* __p = __lo; __p != __hi; ++__p) 2634684ddb6SLionel Sambuc { 2644684ddb6SLionel Sambuc __h = (__h << 4) + static_cast<size_t>(*__p); 2654684ddb6SLionel Sambuc size_t __g = __h & __mask; 2664684ddb6SLionel Sambuc __h ^= __g | (__g >> __sr); 2674684ddb6SLionel Sambuc } 2684684ddb6SLionel Sambuc return static_cast<long>(__h); 2694684ddb6SLionel Sambuc} 2704684ddb6SLionel Sambuc 2714684ddb6SLionel Sambuc_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS collate<char>) 2724684ddb6SLionel Sambuc_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS collate<wchar_t>) 2734684ddb6SLionel Sambuc 2744684ddb6SLionel Sambuc// template <class CharT> class collate_byname; 2754684ddb6SLionel Sambuc 2764684ddb6SLionel Sambuctemplate <class _CharT> class _LIBCPP_TYPE_VIS_ONLY collate_byname; 2774684ddb6SLionel Sambuc 2784684ddb6SLionel Sambuctemplate <> 2794684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS collate_byname<char> 2804684ddb6SLionel Sambuc : public collate<char> 2814684ddb6SLionel Sambuc{ 2824684ddb6SLionel Sambuc locale_t __l; 2834684ddb6SLionel Sambucpublic: 2844684ddb6SLionel Sambuc typedef char char_type; 2854684ddb6SLionel Sambuc typedef basic_string<char_type> string_type; 2864684ddb6SLionel Sambuc 2874684ddb6SLionel Sambuc explicit collate_byname(const char* __n, size_t __refs = 0); 2884684ddb6SLionel Sambuc explicit collate_byname(const string& __n, size_t __refs = 0); 2894684ddb6SLionel Sambuc 2904684ddb6SLionel Sambucprotected: 2914684ddb6SLionel Sambuc ~collate_byname(); 2924684ddb6SLionel Sambuc virtual int do_compare(const char_type* __lo1, const char_type* __hi1, 2934684ddb6SLionel Sambuc const char_type* __lo2, const char_type* __hi2) const; 2944684ddb6SLionel Sambuc virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const; 2954684ddb6SLionel Sambuc}; 2964684ddb6SLionel Sambuc 2974684ddb6SLionel Sambuctemplate <> 2984684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS collate_byname<wchar_t> 2994684ddb6SLionel Sambuc : public collate<wchar_t> 3004684ddb6SLionel Sambuc{ 3014684ddb6SLionel Sambuc locale_t __l; 3024684ddb6SLionel Sambucpublic: 3034684ddb6SLionel Sambuc typedef wchar_t char_type; 3044684ddb6SLionel Sambuc typedef basic_string<char_type> string_type; 3054684ddb6SLionel Sambuc 3064684ddb6SLionel Sambuc explicit collate_byname(const char* __n, size_t __refs = 0); 3074684ddb6SLionel Sambuc explicit collate_byname(const string& __n, size_t __refs = 0); 3084684ddb6SLionel Sambuc 3094684ddb6SLionel Sambucprotected: 3104684ddb6SLionel Sambuc ~collate_byname(); 3114684ddb6SLionel Sambuc 3124684ddb6SLionel Sambuc virtual int do_compare(const char_type* __lo1, const char_type* __hi1, 3134684ddb6SLionel Sambuc const char_type* __lo2, const char_type* __hi2) const; 3144684ddb6SLionel Sambuc virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const; 3154684ddb6SLionel Sambuc}; 3164684ddb6SLionel Sambuc 3174684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 3184684ddb6SLionel Sambucbool 3194684ddb6SLionel Sambuclocale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x, 3204684ddb6SLionel Sambuc const basic_string<_CharT, _Traits, _Allocator>& __y) const 3214684ddb6SLionel Sambuc{ 3224684ddb6SLionel Sambuc return _VSTD::use_facet<_VSTD::collate<_CharT> >(*this).compare( 3234684ddb6SLionel Sambuc __x.data(), __x.data() + __x.size(), 3244684ddb6SLionel Sambuc __y.data(), __y.data() + __y.size()) < 0; 3254684ddb6SLionel Sambuc} 3264684ddb6SLionel Sambuc 3274684ddb6SLionel Sambuc// template <class charT> class ctype 3284684ddb6SLionel Sambuc 3294684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS ctype_base 3304684ddb6SLionel Sambuc{ 3314684ddb6SLionel Sambucpublic: 3324684ddb6SLionel Sambuc#ifdef __GLIBC__ 3334684ddb6SLionel Sambuc typedef unsigned short mask; 3344684ddb6SLionel Sambuc static const mask space = _ISspace; 3354684ddb6SLionel Sambuc static const mask print = _ISprint; 3364684ddb6SLionel Sambuc static const mask cntrl = _IScntrl; 3374684ddb6SLionel Sambuc static const mask upper = _ISupper; 3384684ddb6SLionel Sambuc static const mask lower = _ISlower; 3394684ddb6SLionel Sambuc static const mask alpha = _ISalpha; 3404684ddb6SLionel Sambuc static const mask digit = _ISdigit; 3414684ddb6SLionel Sambuc static const mask punct = _ISpunct; 3424684ddb6SLionel Sambuc static const mask xdigit = _ISxdigit; 3434684ddb6SLionel Sambuc static const mask blank = _ISblank; 3444684ddb6SLionel Sambuc#elif defined(_WIN32) 3454684ddb6SLionel Sambuc typedef unsigned short mask; 3464684ddb6SLionel Sambuc static const mask space = _SPACE; 3474684ddb6SLionel Sambuc static const mask print = _BLANK|_PUNCT|_ALPHA|_DIGIT; 3484684ddb6SLionel Sambuc static const mask cntrl = _CONTROL; 3494684ddb6SLionel Sambuc static const mask upper = _UPPER; 3504684ddb6SLionel Sambuc static const mask lower = _LOWER; 3514684ddb6SLionel Sambuc static const mask alpha = _ALPHA; 3524684ddb6SLionel Sambuc static const mask digit = _DIGIT; 3534684ddb6SLionel Sambuc static const mask punct = _PUNCT; 3544684ddb6SLionel Sambuc static const mask xdigit = _HEX; 3554684ddb6SLionel Sambuc static const mask blank = _BLANK; 356*0a6a1f1dSLionel Sambuc# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT 3574684ddb6SLionel Sambuc#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__) || defined(__minix) 3584684ddb6SLionel Sambuc# ifdef __APPLE__ 3594684ddb6SLionel Sambuc typedef __uint32_t mask; 3604684ddb6SLionel Sambuc# elif defined(__FreeBSD__) 3614684ddb6SLionel Sambuc typedef unsigned long mask; 3624684ddb6SLionel Sambuc# elif defined(__EMSCRIPTEN__) || defined(__NetBSD__) || defined(__minix) 3634684ddb6SLionel Sambuc typedef unsigned short mask; 3644684ddb6SLionel Sambuc# endif 3654684ddb6SLionel Sambuc static const mask space = _CTYPE_S; 3664684ddb6SLionel Sambuc static const mask print = _CTYPE_R; 3674684ddb6SLionel Sambuc static const mask cntrl = _CTYPE_C; 3684684ddb6SLionel Sambuc static const mask upper = _CTYPE_U; 3694684ddb6SLionel Sambuc static const mask lower = _CTYPE_L; 3704684ddb6SLionel Sambuc static const mask alpha = _CTYPE_A; 3714684ddb6SLionel Sambuc static const mask digit = _CTYPE_D; 3724684ddb6SLionel Sambuc static const mask punct = _CTYPE_P; 3734684ddb6SLionel Sambuc static const mask xdigit = _CTYPE_X; 374*0a6a1f1dSLionel Sambuc 3754684ddb6SLionel Sambuc# if defined(__NetBSD__) || defined(__minix) 3764684ddb6SLionel Sambuc static const mask blank = _CTYPE_BL; 3774684ddb6SLionel Sambuc# else 3784684ddb6SLionel Sambuc static const mask blank = _CTYPE_B; 3794684ddb6SLionel Sambuc# endif 3804684ddb6SLionel Sambuc#elif defined(__sun__) || defined(_AIX) 3814684ddb6SLionel Sambuc typedef unsigned int mask; 3824684ddb6SLionel Sambuc static const mask space = _ISSPACE; 3834684ddb6SLionel Sambuc static const mask print = _ISPRINT; 3844684ddb6SLionel Sambuc static const mask cntrl = _ISCNTRL; 3854684ddb6SLionel Sambuc static const mask upper = _ISUPPER; 3864684ddb6SLionel Sambuc static const mask lower = _ISLOWER; 3874684ddb6SLionel Sambuc static const mask alpha = _ISALPHA; 3884684ddb6SLionel Sambuc static const mask digit = _ISDIGIT; 3894684ddb6SLionel Sambuc static const mask punct = _ISPUNCT; 3904684ddb6SLionel Sambuc static const mask xdigit = _ISXDIGIT; 3914684ddb6SLionel Sambuc static const mask blank = _ISBLANK; 392*0a6a1f1dSLionel Sambuc#elif defined(_NEWLIB_VERSION) 393*0a6a1f1dSLionel Sambuc // Same type as Newlib's _ctype_ array in newlib/libc/include/ctype.h. 394*0a6a1f1dSLionel Sambuc typedef char mask; 395*0a6a1f1dSLionel Sambuc static const mask space = _S; 396*0a6a1f1dSLionel Sambuc static const mask print = _P | _U | _L | _N | _B; 397*0a6a1f1dSLionel Sambuc static const mask cntrl = _C; 398*0a6a1f1dSLionel Sambuc static const mask upper = _U; 399*0a6a1f1dSLionel Sambuc static const mask lower = _L; 400*0a6a1f1dSLionel Sambuc static const mask alpha = _U | _L; 401*0a6a1f1dSLionel Sambuc static const mask digit = _N; 402*0a6a1f1dSLionel Sambuc static const mask punct = _P; 403*0a6a1f1dSLionel Sambuc static const mask xdigit = _X | _N; 404*0a6a1f1dSLionel Sambuc static const mask blank = _B; 405*0a6a1f1dSLionel Sambuc# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT 406*0a6a1f1dSLionel Sambuc# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA 407*0a6a1f1dSLionel Sambuc# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT 408*0a6a1f1dSLionel Sambuc#else 4094684ddb6SLionel Sambuc typedef unsigned long mask; 4104684ddb6SLionel Sambuc static const mask space = 1<<0; 4114684ddb6SLionel Sambuc static const mask print = 1<<1; 4124684ddb6SLionel Sambuc static const mask cntrl = 1<<2; 4134684ddb6SLionel Sambuc static const mask upper = 1<<3; 4144684ddb6SLionel Sambuc static const mask lower = 1<<4; 4154684ddb6SLionel Sambuc static const mask alpha = 1<<5; 4164684ddb6SLionel Sambuc static const mask digit = 1<<6; 4174684ddb6SLionel Sambuc static const mask punct = 1<<7; 4184684ddb6SLionel Sambuc static const mask xdigit = 1<<8; 4194684ddb6SLionel Sambuc static const mask blank = 1<<9; 420*0a6a1f1dSLionel Sambuc#endif 4214684ddb6SLionel Sambuc static const mask alnum = alpha | digit; 4224684ddb6SLionel Sambuc static const mask graph = alnum | punct; 4234684ddb6SLionel Sambuc 4244684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE ctype_base() {} 4254684ddb6SLionel Sambuc}; 4264684ddb6SLionel Sambuc 4274684ddb6SLionel Sambuctemplate <class _CharT> class _LIBCPP_TYPE_VIS_ONLY ctype; 4284684ddb6SLionel Sambuc 4294684ddb6SLionel Sambuctemplate <> 4304684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS ctype<wchar_t> 4314684ddb6SLionel Sambuc : public locale::facet, 4324684ddb6SLionel Sambuc public ctype_base 4334684ddb6SLionel Sambuc{ 4344684ddb6SLionel Sambucpublic: 4354684ddb6SLionel Sambuc typedef wchar_t char_type; 4364684ddb6SLionel Sambuc 4374684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 4384684ddb6SLionel Sambuc explicit ctype(size_t __refs = 0) 4394684ddb6SLionel Sambuc : locale::facet(__refs) {} 4404684ddb6SLionel Sambuc 4414684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 4424684ddb6SLionel Sambuc bool is(mask __m, char_type __c) const 4434684ddb6SLionel Sambuc { 4444684ddb6SLionel Sambuc return do_is(__m, __c); 4454684ddb6SLionel Sambuc } 4464684ddb6SLionel Sambuc 4474684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 4484684ddb6SLionel Sambuc const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const 4494684ddb6SLionel Sambuc { 4504684ddb6SLionel Sambuc return do_is(__low, __high, __vec); 4514684ddb6SLionel Sambuc } 4524684ddb6SLionel Sambuc 4534684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 4544684ddb6SLionel Sambuc const char_type* scan_is(mask __m, const char_type* __low, const char_type* __high) const 4554684ddb6SLionel Sambuc { 4564684ddb6SLionel Sambuc return do_scan_is(__m, __low, __high); 4574684ddb6SLionel Sambuc } 4584684ddb6SLionel Sambuc 4594684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 4604684ddb6SLionel Sambuc const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const 4614684ddb6SLionel Sambuc { 4624684ddb6SLionel Sambuc return do_scan_not(__m, __low, __high); 4634684ddb6SLionel Sambuc } 4644684ddb6SLionel Sambuc 4654684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 4664684ddb6SLionel Sambuc char_type toupper(char_type __c) const 4674684ddb6SLionel Sambuc { 4684684ddb6SLionel Sambuc return do_toupper(__c); 4694684ddb6SLionel Sambuc } 4704684ddb6SLionel Sambuc 4714684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 4724684ddb6SLionel Sambuc const char_type* toupper(char_type* __low, const char_type* __high) const 4734684ddb6SLionel Sambuc { 4744684ddb6SLionel Sambuc return do_toupper(__low, __high); 4754684ddb6SLionel Sambuc } 4764684ddb6SLionel Sambuc 4774684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 4784684ddb6SLionel Sambuc char_type tolower(char_type __c) const 4794684ddb6SLionel Sambuc { 4804684ddb6SLionel Sambuc return do_tolower(__c); 4814684ddb6SLionel Sambuc } 4824684ddb6SLionel Sambuc 4834684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 4844684ddb6SLionel Sambuc const char_type* tolower(char_type* __low, const char_type* __high) const 4854684ddb6SLionel Sambuc { 4864684ddb6SLionel Sambuc return do_tolower(__low, __high); 4874684ddb6SLionel Sambuc } 4884684ddb6SLionel Sambuc 4894684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 4904684ddb6SLionel Sambuc char_type widen(char __c) const 4914684ddb6SLionel Sambuc { 4924684ddb6SLionel Sambuc return do_widen(__c); 4934684ddb6SLionel Sambuc } 4944684ddb6SLionel Sambuc 4954684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 4964684ddb6SLionel Sambuc const char* widen(const char* __low, const char* __high, char_type* __to) const 4974684ddb6SLionel Sambuc { 4984684ddb6SLionel Sambuc return do_widen(__low, __high, __to); 4994684ddb6SLionel Sambuc } 5004684ddb6SLionel Sambuc 5014684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 5024684ddb6SLionel Sambuc char narrow(char_type __c, char __dfault) const 5034684ddb6SLionel Sambuc { 5044684ddb6SLionel Sambuc return do_narrow(__c, __dfault); 5054684ddb6SLionel Sambuc } 5064684ddb6SLionel Sambuc 5074684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 5084684ddb6SLionel Sambuc const char_type* narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const 5094684ddb6SLionel Sambuc { 5104684ddb6SLionel Sambuc return do_narrow(__low, __high, __dfault, __to); 5114684ddb6SLionel Sambuc } 5124684ddb6SLionel Sambuc 5134684ddb6SLionel Sambuc static locale::id id; 5144684ddb6SLionel Sambuc 5154684ddb6SLionel Sambucprotected: 5164684ddb6SLionel Sambuc ~ctype(); 5174684ddb6SLionel Sambuc virtual bool do_is(mask __m, char_type __c) const; 5184684ddb6SLionel Sambuc virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const; 5194684ddb6SLionel Sambuc virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const; 5204684ddb6SLionel Sambuc virtual const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const; 5214684ddb6SLionel Sambuc virtual char_type do_toupper(char_type) const; 5224684ddb6SLionel Sambuc virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; 5234684ddb6SLionel Sambuc virtual char_type do_tolower(char_type) const; 5244684ddb6SLionel Sambuc virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const; 5254684ddb6SLionel Sambuc virtual char_type do_widen(char) const; 5264684ddb6SLionel Sambuc virtual const char* do_widen(const char* __low, const char* __high, char_type* __dest) const; 5274684ddb6SLionel Sambuc virtual char do_narrow(char_type, char __dfault) const; 5284684ddb6SLionel Sambuc virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const; 5294684ddb6SLionel Sambuc}; 5304684ddb6SLionel Sambuc 5314684ddb6SLionel Sambuctemplate <> 5324684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS ctype<char> 5334684ddb6SLionel Sambuc : public locale::facet, public ctype_base 5344684ddb6SLionel Sambuc{ 5354684ddb6SLionel Sambuc const mask* __tab_; 5364684ddb6SLionel Sambuc bool __del_; 5374684ddb6SLionel Sambucpublic: 5384684ddb6SLionel Sambuc typedef char char_type; 5394684ddb6SLionel Sambuc 5404684ddb6SLionel Sambuc explicit ctype(const mask* __tab = 0, bool __del = false, size_t __refs = 0); 5414684ddb6SLionel Sambuc 5424684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 5434684ddb6SLionel Sambuc bool is(mask __m, char_type __c) const 5444684ddb6SLionel Sambuc { 5454684ddb6SLionel Sambuc return isascii(__c) ? (__tab_[static_cast<int>(__c)] & __m) !=0 : false; 5464684ddb6SLionel Sambuc } 5474684ddb6SLionel Sambuc 5484684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 5494684ddb6SLionel Sambuc const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const 5504684ddb6SLionel Sambuc { 5514684ddb6SLionel Sambuc for (; __low != __high; ++__low, ++__vec) 5524684ddb6SLionel Sambuc *__vec = isascii(*__low) ? __tab_[static_cast<int>(*__low)] : 0; 5534684ddb6SLionel Sambuc return __low; 5544684ddb6SLionel Sambuc } 5554684ddb6SLionel Sambuc 5564684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 5574684ddb6SLionel Sambuc const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const 5584684ddb6SLionel Sambuc { 5594684ddb6SLionel Sambuc for (; __low != __high; ++__low) 5604684ddb6SLionel Sambuc if (isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m)) 5614684ddb6SLionel Sambuc break; 5624684ddb6SLionel Sambuc return __low; 5634684ddb6SLionel Sambuc } 5644684ddb6SLionel Sambuc 5654684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 5664684ddb6SLionel Sambuc const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const 5674684ddb6SLionel Sambuc { 5684684ddb6SLionel Sambuc for (; __low != __high; ++__low) 5694684ddb6SLionel Sambuc if (!(isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))) 5704684ddb6SLionel Sambuc break; 5714684ddb6SLionel Sambuc return __low; 5724684ddb6SLionel Sambuc } 5734684ddb6SLionel Sambuc 5744684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 5754684ddb6SLionel Sambuc char_type toupper(char_type __c) const 5764684ddb6SLionel Sambuc { 5774684ddb6SLionel Sambuc return do_toupper(__c); 5784684ddb6SLionel Sambuc } 5794684ddb6SLionel Sambuc 5804684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 5814684ddb6SLionel Sambuc const char_type* toupper(char_type* __low, const char_type* __high) const 5824684ddb6SLionel Sambuc { 5834684ddb6SLionel Sambuc return do_toupper(__low, __high); 5844684ddb6SLionel Sambuc } 5854684ddb6SLionel Sambuc 5864684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 5874684ddb6SLionel Sambuc char_type tolower(char_type __c) const 5884684ddb6SLionel Sambuc { 5894684ddb6SLionel Sambuc return do_tolower(__c); 5904684ddb6SLionel Sambuc } 5914684ddb6SLionel Sambuc 5924684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 5934684ddb6SLionel Sambuc const char_type* tolower(char_type* __low, const char_type* __high) const 5944684ddb6SLionel Sambuc { 5954684ddb6SLionel Sambuc return do_tolower(__low, __high); 5964684ddb6SLionel Sambuc } 5974684ddb6SLionel Sambuc 5984684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 5994684ddb6SLionel Sambuc char_type widen(char __c) const 6004684ddb6SLionel Sambuc { 6014684ddb6SLionel Sambuc return do_widen(__c); 6024684ddb6SLionel Sambuc } 6034684ddb6SLionel Sambuc 6044684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 6054684ddb6SLionel Sambuc const char* widen(const char* __low, const char* __high, char_type* __to) const 6064684ddb6SLionel Sambuc { 6074684ddb6SLionel Sambuc return do_widen(__low, __high, __to); 6084684ddb6SLionel Sambuc } 6094684ddb6SLionel Sambuc 6104684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 6114684ddb6SLionel Sambuc char narrow(char_type __c, char __dfault) const 6124684ddb6SLionel Sambuc { 6134684ddb6SLionel Sambuc return do_narrow(__c, __dfault); 6144684ddb6SLionel Sambuc } 6154684ddb6SLionel Sambuc 6164684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 6174684ddb6SLionel Sambuc const char* narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const 6184684ddb6SLionel Sambuc { 6194684ddb6SLionel Sambuc return do_narrow(__low, __high, __dfault, __to); 6204684ddb6SLionel Sambuc } 6214684ddb6SLionel Sambuc 6224684ddb6SLionel Sambuc static locale::id id; 6234684ddb6SLionel Sambuc 6244684ddb6SLionel Sambuc#ifdef _CACHED_RUNES 6254684ddb6SLionel Sambuc static const size_t table_size = _CACHED_RUNES; 6264684ddb6SLionel Sambuc#else 6274684ddb6SLionel Sambuc static const size_t table_size = 256; // FIXME: Don't hardcode this. 6284684ddb6SLionel Sambuc#endif 6294684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE const mask* table() const _NOEXCEPT {return __tab_;} 6304684ddb6SLionel Sambuc static const mask* classic_table() _NOEXCEPT; 6314684ddb6SLionel Sambuc#if defined(__GLIBC__) || defined(__EMSCRIPTEN__) 6324684ddb6SLionel Sambuc static const int* __classic_upper_table() _NOEXCEPT; 6334684ddb6SLionel Sambuc static const int* __classic_lower_table() _NOEXCEPT; 6344684ddb6SLionel Sambuc#endif 6354684ddb6SLionel Sambuc#if defined(__NetBSD__) || defined(__minix) 6364684ddb6SLionel Sambuc static const short* __classic_upper_table() _NOEXCEPT; 6374684ddb6SLionel Sambuc static const short* __classic_lower_table() _NOEXCEPT; 6384684ddb6SLionel Sambuc#endif 6394684ddb6SLionel Sambuc 6404684ddb6SLionel Sambucprotected: 6414684ddb6SLionel Sambuc ~ctype(); 6424684ddb6SLionel Sambuc virtual char_type do_toupper(char_type __c) const; 6434684ddb6SLionel Sambuc virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; 6444684ddb6SLionel Sambuc virtual char_type do_tolower(char_type __c) const; 6454684ddb6SLionel Sambuc virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const; 6464684ddb6SLionel Sambuc virtual char_type do_widen(char __c) const; 6474684ddb6SLionel Sambuc virtual const char* do_widen(const char* __low, const char* __high, char_type* __to) const; 6484684ddb6SLionel Sambuc virtual char do_narrow(char_type __c, char __dfault) const; 6494684ddb6SLionel Sambuc virtual const char* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const; 6504684ddb6SLionel Sambuc}; 6514684ddb6SLionel Sambuc 6524684ddb6SLionel Sambuc// template <class CharT> class ctype_byname; 6534684ddb6SLionel Sambuc 6544684ddb6SLionel Sambuctemplate <class _CharT> class _LIBCPP_TYPE_VIS_ONLY ctype_byname; 6554684ddb6SLionel Sambuc 6564684ddb6SLionel Sambuctemplate <> 6574684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS ctype_byname<char> 6584684ddb6SLionel Sambuc : public ctype<char> 6594684ddb6SLionel Sambuc{ 6604684ddb6SLionel Sambuc locale_t __l; 6614684ddb6SLionel Sambuc 6624684ddb6SLionel Sambucpublic: 6634684ddb6SLionel Sambuc explicit ctype_byname(const char*, size_t = 0); 6644684ddb6SLionel Sambuc explicit ctype_byname(const string&, size_t = 0); 6654684ddb6SLionel Sambuc 6664684ddb6SLionel Sambucprotected: 6674684ddb6SLionel Sambuc ~ctype_byname(); 6684684ddb6SLionel Sambuc virtual char_type do_toupper(char_type) const; 6694684ddb6SLionel Sambuc virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; 6704684ddb6SLionel Sambuc virtual char_type do_tolower(char_type) const; 6714684ddb6SLionel Sambuc virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const; 6724684ddb6SLionel Sambuc}; 6734684ddb6SLionel Sambuc 6744684ddb6SLionel Sambuctemplate <> 6754684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS ctype_byname<wchar_t> 6764684ddb6SLionel Sambuc : public ctype<wchar_t> 6774684ddb6SLionel Sambuc{ 6784684ddb6SLionel Sambuc locale_t __l; 6794684ddb6SLionel Sambuc 6804684ddb6SLionel Sambucpublic: 6814684ddb6SLionel Sambuc explicit ctype_byname(const char*, size_t = 0); 6824684ddb6SLionel Sambuc explicit ctype_byname(const string&, size_t = 0); 6834684ddb6SLionel Sambuc 6844684ddb6SLionel Sambucprotected: 6854684ddb6SLionel Sambuc ~ctype_byname(); 6864684ddb6SLionel Sambuc virtual bool do_is(mask __m, char_type __c) const; 6874684ddb6SLionel Sambuc virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const; 6884684ddb6SLionel Sambuc virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const; 6894684ddb6SLionel Sambuc virtual const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const; 6904684ddb6SLionel Sambuc virtual char_type do_toupper(char_type) const; 6914684ddb6SLionel Sambuc virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; 6924684ddb6SLionel Sambuc virtual char_type do_tolower(char_type) const; 6934684ddb6SLionel Sambuc virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const; 6944684ddb6SLionel Sambuc virtual char_type do_widen(char) const; 6954684ddb6SLionel Sambuc virtual const char* do_widen(const char* __low, const char* __high, char_type* __dest) const; 6964684ddb6SLionel Sambuc virtual char do_narrow(char_type, char __dfault) const; 6974684ddb6SLionel Sambuc virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const; 6984684ddb6SLionel Sambuc}; 6994684ddb6SLionel Sambuc 7004684ddb6SLionel Sambuctemplate <class _CharT> 7014684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 7024684ddb6SLionel Sambucbool 7034684ddb6SLionel Sambucisspace(_CharT __c, const locale& __loc) 7044684ddb6SLionel Sambuc{ 7054684ddb6SLionel Sambuc return use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c); 7064684ddb6SLionel Sambuc} 7074684ddb6SLionel Sambuc 7084684ddb6SLionel Sambuctemplate <class _CharT> 7094684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 7104684ddb6SLionel Sambucbool 7114684ddb6SLionel Sambucisprint(_CharT __c, const locale& __loc) 7124684ddb6SLionel Sambuc{ 7134684ddb6SLionel Sambuc return use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c); 7144684ddb6SLionel Sambuc} 7154684ddb6SLionel Sambuc 7164684ddb6SLionel Sambuctemplate <class _CharT> 7174684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 7184684ddb6SLionel Sambucbool 7194684ddb6SLionel Sambuciscntrl(_CharT __c, const locale& __loc) 7204684ddb6SLionel Sambuc{ 7214684ddb6SLionel Sambuc return use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c); 7224684ddb6SLionel Sambuc} 7234684ddb6SLionel Sambuc 7244684ddb6SLionel Sambuctemplate <class _CharT> 7254684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 7264684ddb6SLionel Sambucbool 7274684ddb6SLionel Sambucisupper(_CharT __c, const locale& __loc) 7284684ddb6SLionel Sambuc{ 7294684ddb6SLionel Sambuc return use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c); 7304684ddb6SLionel Sambuc} 7314684ddb6SLionel Sambuc 7324684ddb6SLionel Sambuctemplate <class _CharT> 7334684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 7344684ddb6SLionel Sambucbool 7354684ddb6SLionel Sambucislower(_CharT __c, const locale& __loc) 7364684ddb6SLionel Sambuc{ 7374684ddb6SLionel Sambuc return use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c); 7384684ddb6SLionel Sambuc} 7394684ddb6SLionel Sambuc 7404684ddb6SLionel Sambuctemplate <class _CharT> 7414684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 7424684ddb6SLionel Sambucbool 7434684ddb6SLionel Sambucisalpha(_CharT __c, const locale& __loc) 7444684ddb6SLionel Sambuc{ 7454684ddb6SLionel Sambuc return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c); 7464684ddb6SLionel Sambuc} 7474684ddb6SLionel Sambuc 7484684ddb6SLionel Sambuctemplate <class _CharT> 7494684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 7504684ddb6SLionel Sambucbool 7514684ddb6SLionel Sambucisdigit(_CharT __c, const locale& __loc) 7524684ddb6SLionel Sambuc{ 7534684ddb6SLionel Sambuc return use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c); 7544684ddb6SLionel Sambuc} 7554684ddb6SLionel Sambuc 7564684ddb6SLionel Sambuctemplate <class _CharT> 7574684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 7584684ddb6SLionel Sambucbool 7594684ddb6SLionel Sambucispunct(_CharT __c, const locale& __loc) 7604684ddb6SLionel Sambuc{ 7614684ddb6SLionel Sambuc return use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c); 7624684ddb6SLionel Sambuc} 7634684ddb6SLionel Sambuc 7644684ddb6SLionel Sambuctemplate <class _CharT> 7654684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 7664684ddb6SLionel Sambucbool 7674684ddb6SLionel Sambucisxdigit(_CharT __c, const locale& __loc) 7684684ddb6SLionel Sambuc{ 7694684ddb6SLionel Sambuc return use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c); 7704684ddb6SLionel Sambuc} 7714684ddb6SLionel Sambuc 7724684ddb6SLionel Sambuctemplate <class _CharT> 7734684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 7744684ddb6SLionel Sambucbool 7754684ddb6SLionel Sambucisalnum(_CharT __c, const locale& __loc) 7764684ddb6SLionel Sambuc{ 7774684ddb6SLionel Sambuc return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c); 7784684ddb6SLionel Sambuc} 7794684ddb6SLionel Sambuc 7804684ddb6SLionel Sambuctemplate <class _CharT> 7814684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 7824684ddb6SLionel Sambucbool 7834684ddb6SLionel Sambucisgraph(_CharT __c, const locale& __loc) 7844684ddb6SLionel Sambuc{ 7854684ddb6SLionel Sambuc return use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c); 7864684ddb6SLionel Sambuc} 7874684ddb6SLionel Sambuc 7884684ddb6SLionel Sambuctemplate <class _CharT> 7894684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 7904684ddb6SLionel Sambuc_CharT 7914684ddb6SLionel Sambuctoupper(_CharT __c, const locale& __loc) 7924684ddb6SLionel Sambuc{ 7934684ddb6SLionel Sambuc return use_facet<ctype<_CharT> >(__loc).toupper(__c); 7944684ddb6SLionel Sambuc} 7954684ddb6SLionel Sambuc 7964684ddb6SLionel Sambuctemplate <class _CharT> 7974684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 7984684ddb6SLionel Sambuc_CharT 7994684ddb6SLionel Sambuctolower(_CharT __c, const locale& __loc) 8004684ddb6SLionel Sambuc{ 8014684ddb6SLionel Sambuc return use_facet<ctype<_CharT> >(__loc).tolower(__c); 8024684ddb6SLionel Sambuc} 8034684ddb6SLionel Sambuc 8044684ddb6SLionel Sambuc// codecvt_base 8054684ddb6SLionel Sambuc 8064684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS codecvt_base 8074684ddb6SLionel Sambuc{ 8084684ddb6SLionel Sambucpublic: 8094684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE codecvt_base() {} 8104684ddb6SLionel Sambuc enum result {ok, partial, error, noconv}; 8114684ddb6SLionel Sambuc}; 8124684ddb6SLionel Sambuc 8134684ddb6SLionel Sambuc// template <class internT, class externT, class stateT> class codecvt; 8144684ddb6SLionel Sambuc 8154684ddb6SLionel Sambuctemplate <class _InternT, class _ExternT, class _StateT> class _LIBCPP_TYPE_VIS_ONLY codecvt; 8164684ddb6SLionel Sambuc 8174684ddb6SLionel Sambuc// template <> class codecvt<char, char, mbstate_t> 8184684ddb6SLionel Sambuc 8194684ddb6SLionel Sambuctemplate <> 8204684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS codecvt<char, char, mbstate_t> 8214684ddb6SLionel Sambuc : public locale::facet, 8224684ddb6SLionel Sambuc public codecvt_base 8234684ddb6SLionel Sambuc{ 8244684ddb6SLionel Sambucpublic: 8254684ddb6SLionel Sambuc typedef char intern_type; 8264684ddb6SLionel Sambuc typedef char extern_type; 8274684ddb6SLionel Sambuc typedef mbstate_t state_type; 8284684ddb6SLionel Sambuc 8294684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 8304684ddb6SLionel Sambuc explicit codecvt(size_t __refs = 0) 8314684ddb6SLionel Sambuc : locale::facet(__refs) {} 8324684ddb6SLionel Sambuc 8334684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 8344684ddb6SLionel Sambuc result out(state_type& __st, 8354684ddb6SLionel Sambuc const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 8364684ddb6SLionel Sambuc extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const 8374684ddb6SLionel Sambuc { 8384684ddb6SLionel Sambuc return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); 8394684ddb6SLionel Sambuc } 8404684ddb6SLionel Sambuc 8414684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 8424684ddb6SLionel Sambuc result unshift(state_type& __st, 8434684ddb6SLionel Sambuc extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const 8444684ddb6SLionel Sambuc { 8454684ddb6SLionel Sambuc return do_unshift(__st, __to, __to_end, __to_nxt); 8464684ddb6SLionel Sambuc } 8474684ddb6SLionel Sambuc 8484684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 8494684ddb6SLionel Sambuc result in(state_type& __st, 8504684ddb6SLionel Sambuc const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 8514684ddb6SLionel Sambuc intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const 8524684ddb6SLionel Sambuc { 8534684ddb6SLionel Sambuc return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); 8544684ddb6SLionel Sambuc } 8554684ddb6SLionel Sambuc 8564684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 8574684ddb6SLionel Sambuc int encoding() const _NOEXCEPT 8584684ddb6SLionel Sambuc { 8594684ddb6SLionel Sambuc return do_encoding(); 8604684ddb6SLionel Sambuc } 8614684ddb6SLionel Sambuc 8624684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 8634684ddb6SLionel Sambuc bool always_noconv() const _NOEXCEPT 8644684ddb6SLionel Sambuc { 8654684ddb6SLionel Sambuc return do_always_noconv(); 8664684ddb6SLionel Sambuc } 8674684ddb6SLionel Sambuc 8684684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 8694684ddb6SLionel Sambuc int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const 8704684ddb6SLionel Sambuc { 8714684ddb6SLionel Sambuc return do_length(__st, __frm, __end, __mx); 8724684ddb6SLionel Sambuc } 8734684ddb6SLionel Sambuc 8744684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 8754684ddb6SLionel Sambuc int max_length() const _NOEXCEPT 8764684ddb6SLionel Sambuc { 8774684ddb6SLionel Sambuc return do_max_length(); 8784684ddb6SLionel Sambuc } 8794684ddb6SLionel Sambuc 8804684ddb6SLionel Sambuc static locale::id id; 8814684ddb6SLionel Sambuc 8824684ddb6SLionel Sambucprotected: 8834684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 8844684ddb6SLionel Sambuc explicit codecvt(const char*, size_t __refs = 0) 8854684ddb6SLionel Sambuc : locale::facet(__refs) {} 8864684ddb6SLionel Sambuc 8874684ddb6SLionel Sambuc ~codecvt(); 8884684ddb6SLionel Sambuc 8894684ddb6SLionel Sambuc virtual result do_out(state_type& __st, 8904684ddb6SLionel Sambuc const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 8914684ddb6SLionel Sambuc extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 8924684ddb6SLionel Sambuc virtual result do_in(state_type& __st, 8934684ddb6SLionel Sambuc const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 8944684ddb6SLionel Sambuc intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; 8954684ddb6SLionel Sambuc virtual result do_unshift(state_type& __st, 8964684ddb6SLionel Sambuc extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 8974684ddb6SLionel Sambuc virtual int do_encoding() const _NOEXCEPT; 8984684ddb6SLionel Sambuc virtual bool do_always_noconv() const _NOEXCEPT; 8994684ddb6SLionel Sambuc virtual int do_length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const; 9004684ddb6SLionel Sambuc virtual int do_max_length() const _NOEXCEPT; 9014684ddb6SLionel Sambuc}; 9024684ddb6SLionel Sambuc 9034684ddb6SLionel Sambuc// template <> class codecvt<wchar_t, char, mbstate_t> 9044684ddb6SLionel Sambuc 9054684ddb6SLionel Sambuctemplate <> 9064684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS codecvt<wchar_t, char, mbstate_t> 9074684ddb6SLionel Sambuc : public locale::facet, 9084684ddb6SLionel Sambuc public codecvt_base 9094684ddb6SLionel Sambuc{ 9104684ddb6SLionel Sambuc locale_t __l; 9114684ddb6SLionel Sambucpublic: 9124684ddb6SLionel Sambuc typedef wchar_t intern_type; 9134684ddb6SLionel Sambuc typedef char extern_type; 9144684ddb6SLionel Sambuc typedef mbstate_t state_type; 9154684ddb6SLionel Sambuc 9164684ddb6SLionel Sambuc explicit codecvt(size_t __refs = 0); 9174684ddb6SLionel Sambuc 9184684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 9194684ddb6SLionel Sambuc result out(state_type& __st, 9204684ddb6SLionel Sambuc const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 9214684ddb6SLionel Sambuc extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const 9224684ddb6SLionel Sambuc { 9234684ddb6SLionel Sambuc return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); 9244684ddb6SLionel Sambuc } 9254684ddb6SLionel Sambuc 9264684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 9274684ddb6SLionel Sambuc result unshift(state_type& __st, 9284684ddb6SLionel Sambuc extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const 9294684ddb6SLionel Sambuc { 9304684ddb6SLionel Sambuc return do_unshift(__st, __to, __to_end, __to_nxt); 9314684ddb6SLionel Sambuc } 9324684ddb6SLionel Sambuc 9334684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 9344684ddb6SLionel Sambuc result in(state_type& __st, 9354684ddb6SLionel Sambuc const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 9364684ddb6SLionel Sambuc intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const 9374684ddb6SLionel Sambuc { 9384684ddb6SLionel Sambuc return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); 9394684ddb6SLionel Sambuc } 9404684ddb6SLionel Sambuc 9414684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 9424684ddb6SLionel Sambuc int encoding() const _NOEXCEPT 9434684ddb6SLionel Sambuc { 9444684ddb6SLionel Sambuc return do_encoding(); 9454684ddb6SLionel Sambuc } 9464684ddb6SLionel Sambuc 9474684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 9484684ddb6SLionel Sambuc bool always_noconv() const _NOEXCEPT 9494684ddb6SLionel Sambuc { 9504684ddb6SLionel Sambuc return do_always_noconv(); 9514684ddb6SLionel Sambuc } 9524684ddb6SLionel Sambuc 9534684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 9544684ddb6SLionel Sambuc int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const 9554684ddb6SLionel Sambuc { 9564684ddb6SLionel Sambuc return do_length(__st, __frm, __end, __mx); 9574684ddb6SLionel Sambuc } 9584684ddb6SLionel Sambuc 9594684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 9604684ddb6SLionel Sambuc int max_length() const _NOEXCEPT 9614684ddb6SLionel Sambuc { 9624684ddb6SLionel Sambuc return do_max_length(); 9634684ddb6SLionel Sambuc } 9644684ddb6SLionel Sambuc 9654684ddb6SLionel Sambuc static locale::id id; 9664684ddb6SLionel Sambuc 9674684ddb6SLionel Sambucprotected: 9684684ddb6SLionel Sambuc explicit codecvt(const char*, size_t __refs = 0); 9694684ddb6SLionel Sambuc 9704684ddb6SLionel Sambuc ~codecvt(); 9714684ddb6SLionel Sambuc 9724684ddb6SLionel Sambuc virtual result do_out(state_type& __st, 9734684ddb6SLionel Sambuc const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 9744684ddb6SLionel Sambuc extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 9754684ddb6SLionel Sambuc virtual result do_in(state_type& __st, 9764684ddb6SLionel Sambuc const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 9774684ddb6SLionel Sambuc intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; 9784684ddb6SLionel Sambuc virtual result do_unshift(state_type& __st, 9794684ddb6SLionel Sambuc extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 9804684ddb6SLionel Sambuc virtual int do_encoding() const _NOEXCEPT; 9814684ddb6SLionel Sambuc virtual bool do_always_noconv() const _NOEXCEPT; 9824684ddb6SLionel Sambuc virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const; 9834684ddb6SLionel Sambuc virtual int do_max_length() const _NOEXCEPT; 9844684ddb6SLionel Sambuc}; 9854684ddb6SLionel Sambuc 9864684ddb6SLionel Sambuc// template <> class codecvt<char16_t, char, mbstate_t> 9874684ddb6SLionel Sambuc 9884684ddb6SLionel Sambuctemplate <> 9894684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS codecvt<char16_t, char, mbstate_t> 9904684ddb6SLionel Sambuc : public locale::facet, 9914684ddb6SLionel Sambuc public codecvt_base 9924684ddb6SLionel Sambuc{ 9934684ddb6SLionel Sambucpublic: 9944684ddb6SLionel Sambuc typedef char16_t intern_type; 9954684ddb6SLionel Sambuc typedef char extern_type; 9964684ddb6SLionel Sambuc typedef mbstate_t state_type; 9974684ddb6SLionel Sambuc 9984684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 9994684ddb6SLionel Sambuc explicit codecvt(size_t __refs = 0) 10004684ddb6SLionel Sambuc : locale::facet(__refs) {} 10014684ddb6SLionel Sambuc 10024684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 10034684ddb6SLionel Sambuc result out(state_type& __st, 10044684ddb6SLionel Sambuc const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 10054684ddb6SLionel Sambuc extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const 10064684ddb6SLionel Sambuc { 10074684ddb6SLionel Sambuc return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); 10084684ddb6SLionel Sambuc } 10094684ddb6SLionel Sambuc 10104684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 10114684ddb6SLionel Sambuc result unshift(state_type& __st, 10124684ddb6SLionel Sambuc extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const 10134684ddb6SLionel Sambuc { 10144684ddb6SLionel Sambuc return do_unshift(__st, __to, __to_end, __to_nxt); 10154684ddb6SLionel Sambuc } 10164684ddb6SLionel Sambuc 10174684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 10184684ddb6SLionel Sambuc result in(state_type& __st, 10194684ddb6SLionel Sambuc const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 10204684ddb6SLionel Sambuc intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const 10214684ddb6SLionel Sambuc { 10224684ddb6SLionel Sambuc return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); 10234684ddb6SLionel Sambuc } 10244684ddb6SLionel Sambuc 10254684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 10264684ddb6SLionel Sambuc int encoding() const _NOEXCEPT 10274684ddb6SLionel Sambuc { 10284684ddb6SLionel Sambuc return do_encoding(); 10294684ddb6SLionel Sambuc } 10304684ddb6SLionel Sambuc 10314684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 10324684ddb6SLionel Sambuc bool always_noconv() const _NOEXCEPT 10334684ddb6SLionel Sambuc { 10344684ddb6SLionel Sambuc return do_always_noconv(); 10354684ddb6SLionel Sambuc } 10364684ddb6SLionel Sambuc 10374684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 10384684ddb6SLionel Sambuc int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const 10394684ddb6SLionel Sambuc { 10404684ddb6SLionel Sambuc return do_length(__st, __frm, __end, __mx); 10414684ddb6SLionel Sambuc } 10424684ddb6SLionel Sambuc 10434684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 10444684ddb6SLionel Sambuc int max_length() const _NOEXCEPT 10454684ddb6SLionel Sambuc { 10464684ddb6SLionel Sambuc return do_max_length(); 10474684ddb6SLionel Sambuc } 10484684ddb6SLionel Sambuc 10494684ddb6SLionel Sambuc static locale::id id; 10504684ddb6SLionel Sambuc 10514684ddb6SLionel Sambucprotected: 10524684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 10534684ddb6SLionel Sambuc explicit codecvt(const char*, size_t __refs = 0) 10544684ddb6SLionel Sambuc : locale::facet(__refs) {} 10554684ddb6SLionel Sambuc 10564684ddb6SLionel Sambuc ~codecvt(); 10574684ddb6SLionel Sambuc 10584684ddb6SLionel Sambuc virtual result do_out(state_type& __st, 10594684ddb6SLionel Sambuc const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 10604684ddb6SLionel Sambuc extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 10614684ddb6SLionel Sambuc virtual result do_in(state_type& __st, 10624684ddb6SLionel Sambuc const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 10634684ddb6SLionel Sambuc intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; 10644684ddb6SLionel Sambuc virtual result do_unshift(state_type& __st, 10654684ddb6SLionel Sambuc extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 10664684ddb6SLionel Sambuc virtual int do_encoding() const _NOEXCEPT; 10674684ddb6SLionel Sambuc virtual bool do_always_noconv() const _NOEXCEPT; 10684684ddb6SLionel Sambuc virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const; 10694684ddb6SLionel Sambuc virtual int do_max_length() const _NOEXCEPT; 10704684ddb6SLionel Sambuc}; 10714684ddb6SLionel Sambuc 10724684ddb6SLionel Sambuc// template <> class codecvt<char32_t, char, mbstate_t> 10734684ddb6SLionel Sambuc 10744684ddb6SLionel Sambuctemplate <> 10754684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS codecvt<char32_t, char, mbstate_t> 10764684ddb6SLionel Sambuc : public locale::facet, 10774684ddb6SLionel Sambuc public codecvt_base 10784684ddb6SLionel Sambuc{ 10794684ddb6SLionel Sambucpublic: 10804684ddb6SLionel Sambuc typedef char32_t intern_type; 10814684ddb6SLionel Sambuc typedef char extern_type; 10824684ddb6SLionel Sambuc typedef mbstate_t state_type; 10834684ddb6SLionel Sambuc 10844684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 10854684ddb6SLionel Sambuc explicit codecvt(size_t __refs = 0) 10864684ddb6SLionel Sambuc : locale::facet(__refs) {} 10874684ddb6SLionel Sambuc 10884684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 10894684ddb6SLionel Sambuc result out(state_type& __st, 10904684ddb6SLionel Sambuc const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 10914684ddb6SLionel Sambuc extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const 10924684ddb6SLionel Sambuc { 10934684ddb6SLionel Sambuc return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); 10944684ddb6SLionel Sambuc } 10954684ddb6SLionel Sambuc 10964684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 10974684ddb6SLionel Sambuc result unshift(state_type& __st, 10984684ddb6SLionel Sambuc extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const 10994684ddb6SLionel Sambuc { 11004684ddb6SLionel Sambuc return do_unshift(__st, __to, __to_end, __to_nxt); 11014684ddb6SLionel Sambuc } 11024684ddb6SLionel Sambuc 11034684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 11044684ddb6SLionel Sambuc result in(state_type& __st, 11054684ddb6SLionel Sambuc const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 11064684ddb6SLionel Sambuc intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const 11074684ddb6SLionel Sambuc { 11084684ddb6SLionel Sambuc return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); 11094684ddb6SLionel Sambuc } 11104684ddb6SLionel Sambuc 11114684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 11124684ddb6SLionel Sambuc int encoding() const _NOEXCEPT 11134684ddb6SLionel Sambuc { 11144684ddb6SLionel Sambuc return do_encoding(); 11154684ddb6SLionel Sambuc } 11164684ddb6SLionel Sambuc 11174684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 11184684ddb6SLionel Sambuc bool always_noconv() const _NOEXCEPT 11194684ddb6SLionel Sambuc { 11204684ddb6SLionel Sambuc return do_always_noconv(); 11214684ddb6SLionel Sambuc } 11224684ddb6SLionel Sambuc 11234684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 11244684ddb6SLionel Sambuc int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const 11254684ddb6SLionel Sambuc { 11264684ddb6SLionel Sambuc return do_length(__st, __frm, __end, __mx); 11274684ddb6SLionel Sambuc } 11284684ddb6SLionel Sambuc 11294684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 11304684ddb6SLionel Sambuc int max_length() const _NOEXCEPT 11314684ddb6SLionel Sambuc { 11324684ddb6SLionel Sambuc return do_max_length(); 11334684ddb6SLionel Sambuc } 11344684ddb6SLionel Sambuc 11354684ddb6SLionel Sambuc static locale::id id; 11364684ddb6SLionel Sambuc 11374684ddb6SLionel Sambucprotected: 11384684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 11394684ddb6SLionel Sambuc explicit codecvt(const char*, size_t __refs = 0) 11404684ddb6SLionel Sambuc : locale::facet(__refs) {} 11414684ddb6SLionel Sambuc 11424684ddb6SLionel Sambuc ~codecvt(); 11434684ddb6SLionel Sambuc 11444684ddb6SLionel Sambuc virtual result do_out(state_type& __st, 11454684ddb6SLionel Sambuc const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 11464684ddb6SLionel Sambuc extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 11474684ddb6SLionel Sambuc virtual result do_in(state_type& __st, 11484684ddb6SLionel Sambuc const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 11494684ddb6SLionel Sambuc intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; 11504684ddb6SLionel Sambuc virtual result do_unshift(state_type& __st, 11514684ddb6SLionel Sambuc extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 11524684ddb6SLionel Sambuc virtual int do_encoding() const _NOEXCEPT; 11534684ddb6SLionel Sambuc virtual bool do_always_noconv() const _NOEXCEPT; 11544684ddb6SLionel Sambuc virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const; 11554684ddb6SLionel Sambuc virtual int do_max_length() const _NOEXCEPT; 11564684ddb6SLionel Sambuc}; 11574684ddb6SLionel Sambuc 11584684ddb6SLionel Sambuc// template <class _InternT, class _ExternT, class _StateT> class codecvt_byname 11594684ddb6SLionel Sambuc 11604684ddb6SLionel Sambuctemplate <class _InternT, class _ExternT, class _StateT> 11614684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY codecvt_byname 11624684ddb6SLionel Sambuc : public codecvt<_InternT, _ExternT, _StateT> 11634684ddb6SLionel Sambuc{ 11644684ddb6SLionel Sambucpublic: 11654684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 11664684ddb6SLionel Sambuc explicit codecvt_byname(const char* __nm, size_t __refs = 0) 11674684ddb6SLionel Sambuc : codecvt<_InternT, _ExternT, _StateT>(__nm, __refs) {} 11684684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 11694684ddb6SLionel Sambuc explicit codecvt_byname(const string& __nm, size_t __refs = 0) 11704684ddb6SLionel Sambuc : codecvt<_InternT, _ExternT, _StateT>(__nm.c_str(), __refs) {} 11714684ddb6SLionel Sambucprotected: 11724684ddb6SLionel Sambuc ~codecvt_byname(); 11734684ddb6SLionel Sambuc}; 11744684ddb6SLionel Sambuc 11754684ddb6SLionel Sambuctemplate <class _InternT, class _ExternT, class _StateT> 11764684ddb6SLionel Sambuccodecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname() 11774684ddb6SLionel Sambuc{ 11784684ddb6SLionel Sambuc} 11794684ddb6SLionel Sambuc 11804684ddb6SLionel Sambuc_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<char, char, mbstate_t>) 11814684ddb6SLionel Sambuc_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<wchar_t, char, mbstate_t>) 11824684ddb6SLionel Sambuc_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>) 11834684ddb6SLionel Sambuc_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>) 11844684ddb6SLionel Sambuc 11854684ddb6SLionel Sambuc_LIBCPP_FUNC_VIS void __throw_runtime_error(const char*); 11864684ddb6SLionel Sambuc 11874684ddb6SLionel Sambuctemplate <size_t _Np> 11884684ddb6SLionel Sambucstruct __narrow_to_utf8 11894684ddb6SLionel Sambuc{ 11904684ddb6SLionel Sambuc template <class _OutputIterator, class _CharT> 11914684ddb6SLionel Sambuc _OutputIterator 11924684ddb6SLionel Sambuc operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const; 11934684ddb6SLionel Sambuc}; 11944684ddb6SLionel Sambuc 11954684ddb6SLionel Sambuctemplate <> 11964684ddb6SLionel Sambucstruct __narrow_to_utf8<8> 11974684ddb6SLionel Sambuc{ 11984684ddb6SLionel Sambuc template <class _OutputIterator, class _CharT> 11994684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 12004684ddb6SLionel Sambuc _OutputIterator 12014684ddb6SLionel Sambuc operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const 12024684ddb6SLionel Sambuc { 12034684ddb6SLionel Sambuc for (; __wb < __we; ++__wb, ++__s) 12044684ddb6SLionel Sambuc *__s = *__wb; 12054684ddb6SLionel Sambuc return __s; 12064684ddb6SLionel Sambuc } 12074684ddb6SLionel Sambuc}; 12084684ddb6SLionel Sambuc 12094684ddb6SLionel Sambuctemplate <> 12104684ddb6SLionel Sambucstruct __narrow_to_utf8<16> 12114684ddb6SLionel Sambuc : public codecvt<char16_t, char, mbstate_t> 12124684ddb6SLionel Sambuc{ 12134684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 12144684ddb6SLionel Sambuc __narrow_to_utf8() : codecvt<char16_t, char, mbstate_t>(1) {} 12154684ddb6SLionel Sambuc 12164684ddb6SLionel Sambuc ~__narrow_to_utf8(); 12174684ddb6SLionel Sambuc 12184684ddb6SLionel Sambuc template <class _OutputIterator, class _CharT> 12194684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 12204684ddb6SLionel Sambuc _OutputIterator 12214684ddb6SLionel Sambuc operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const 12224684ddb6SLionel Sambuc { 12234684ddb6SLionel Sambuc result __r = ok; 12244684ddb6SLionel Sambuc mbstate_t __mb; 12254684ddb6SLionel Sambuc while (__wb < __we && __r != error) 12264684ddb6SLionel Sambuc { 12274684ddb6SLionel Sambuc const int __sz = 32; 12284684ddb6SLionel Sambuc char __buf[__sz]; 12294684ddb6SLionel Sambuc char* __bn; 12304684ddb6SLionel Sambuc const char16_t* __wn = (const char16_t*)__wb; 12314684ddb6SLionel Sambuc __r = do_out(__mb, (const char16_t*)__wb, (const char16_t*)__we, __wn, 12324684ddb6SLionel Sambuc __buf, __buf+__sz, __bn); 12334684ddb6SLionel Sambuc if (__r == codecvt_base::error || __wn == (const char16_t*)__wb) 12344684ddb6SLionel Sambuc __throw_runtime_error("locale not supported"); 12354684ddb6SLionel Sambuc for (const char* __p = __buf; __p < __bn; ++__p, ++__s) 12364684ddb6SLionel Sambuc *__s = *__p; 12374684ddb6SLionel Sambuc __wb = (const _CharT*)__wn; 12384684ddb6SLionel Sambuc } 12394684ddb6SLionel Sambuc return __s; 12404684ddb6SLionel Sambuc } 12414684ddb6SLionel Sambuc}; 12424684ddb6SLionel Sambuc 12434684ddb6SLionel Sambuctemplate <> 12444684ddb6SLionel Sambucstruct __narrow_to_utf8<32> 12454684ddb6SLionel Sambuc : public codecvt<char32_t, char, mbstate_t> 12464684ddb6SLionel Sambuc{ 12474684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 12484684ddb6SLionel Sambuc __narrow_to_utf8() : codecvt<char32_t, char, mbstate_t>(1) {} 12494684ddb6SLionel Sambuc 12504684ddb6SLionel Sambuc ~__narrow_to_utf8(); 12514684ddb6SLionel Sambuc 12524684ddb6SLionel Sambuc template <class _OutputIterator, class _CharT> 12534684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 12544684ddb6SLionel Sambuc _OutputIterator 12554684ddb6SLionel Sambuc operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const 12564684ddb6SLionel Sambuc { 12574684ddb6SLionel Sambuc result __r = ok; 12584684ddb6SLionel Sambuc mbstate_t __mb; 12594684ddb6SLionel Sambuc while (__wb < __we && __r != error) 12604684ddb6SLionel Sambuc { 12614684ddb6SLionel Sambuc const int __sz = 32; 12624684ddb6SLionel Sambuc char __buf[__sz]; 12634684ddb6SLionel Sambuc char* __bn; 12644684ddb6SLionel Sambuc const char32_t* __wn = (const char32_t*)__wb; 12654684ddb6SLionel Sambuc __r = do_out(__mb, (const char32_t*)__wb, (const char32_t*)__we, __wn, 12664684ddb6SLionel Sambuc __buf, __buf+__sz, __bn); 12674684ddb6SLionel Sambuc if (__r == codecvt_base::error || __wn == (const char32_t*)__wb) 12684684ddb6SLionel Sambuc __throw_runtime_error("locale not supported"); 12694684ddb6SLionel Sambuc for (const char* __p = __buf; __p < __bn; ++__p, ++__s) 12704684ddb6SLionel Sambuc *__s = *__p; 12714684ddb6SLionel Sambuc __wb = (const _CharT*)__wn; 12724684ddb6SLionel Sambuc } 12734684ddb6SLionel Sambuc return __s; 12744684ddb6SLionel Sambuc } 12754684ddb6SLionel Sambuc}; 12764684ddb6SLionel Sambuc 12774684ddb6SLionel Sambuctemplate <size_t _Np> 12784684ddb6SLionel Sambucstruct __widen_from_utf8 12794684ddb6SLionel Sambuc{ 12804684ddb6SLionel Sambuc template <class _OutputIterator> 12814684ddb6SLionel Sambuc _OutputIterator 12824684ddb6SLionel Sambuc operator()(_OutputIterator __s, const char* __nb, const char* __ne) const; 12834684ddb6SLionel Sambuc}; 12844684ddb6SLionel Sambuc 12854684ddb6SLionel Sambuctemplate <> 12864684ddb6SLionel Sambucstruct __widen_from_utf8<8> 12874684ddb6SLionel Sambuc{ 12884684ddb6SLionel Sambuc template <class _OutputIterator> 12894684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 12904684ddb6SLionel Sambuc _OutputIterator 12914684ddb6SLionel Sambuc operator()(_OutputIterator __s, const char* __nb, const char* __ne) const 12924684ddb6SLionel Sambuc { 12934684ddb6SLionel Sambuc for (; __nb < __ne; ++__nb, ++__s) 12944684ddb6SLionel Sambuc *__s = *__nb; 12954684ddb6SLionel Sambuc return __s; 12964684ddb6SLionel Sambuc } 12974684ddb6SLionel Sambuc}; 12984684ddb6SLionel Sambuc 12994684ddb6SLionel Sambuctemplate <> 13004684ddb6SLionel Sambucstruct __widen_from_utf8<16> 13014684ddb6SLionel Sambuc : public codecvt<char16_t, char, mbstate_t> 13024684ddb6SLionel Sambuc{ 13034684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 13044684ddb6SLionel Sambuc __widen_from_utf8() : codecvt<char16_t, char, mbstate_t>(1) {} 13054684ddb6SLionel Sambuc 13064684ddb6SLionel Sambuc ~__widen_from_utf8(); 13074684ddb6SLionel Sambuc 13084684ddb6SLionel Sambuc template <class _OutputIterator> 13094684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 13104684ddb6SLionel Sambuc _OutputIterator 13114684ddb6SLionel Sambuc operator()(_OutputIterator __s, const char* __nb, const char* __ne) const 13124684ddb6SLionel Sambuc { 13134684ddb6SLionel Sambuc result __r = ok; 13144684ddb6SLionel Sambuc mbstate_t __mb; 13154684ddb6SLionel Sambuc while (__nb < __ne && __r != error) 13164684ddb6SLionel Sambuc { 13174684ddb6SLionel Sambuc const int __sz = 32; 13184684ddb6SLionel Sambuc char16_t __buf[__sz]; 13194684ddb6SLionel Sambuc char16_t* __bn; 13204684ddb6SLionel Sambuc const char* __nn = __nb; 13214684ddb6SLionel Sambuc __r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb+__sz : __ne, __nn, 13224684ddb6SLionel Sambuc __buf, __buf+__sz, __bn); 13234684ddb6SLionel Sambuc if (__r == codecvt_base::error || __nn == __nb) 13244684ddb6SLionel Sambuc __throw_runtime_error("locale not supported"); 13254684ddb6SLionel Sambuc for (const char16_t* __p = __buf; __p < __bn; ++__p, ++__s) 13264684ddb6SLionel Sambuc *__s = (wchar_t)*__p; 13274684ddb6SLionel Sambuc __nb = __nn; 13284684ddb6SLionel Sambuc } 13294684ddb6SLionel Sambuc return __s; 13304684ddb6SLionel Sambuc } 13314684ddb6SLionel Sambuc}; 13324684ddb6SLionel Sambuc 13334684ddb6SLionel Sambuctemplate <> 13344684ddb6SLionel Sambucstruct __widen_from_utf8<32> 13354684ddb6SLionel Sambuc : public codecvt<char32_t, char, mbstate_t> 13364684ddb6SLionel Sambuc{ 13374684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 13384684ddb6SLionel Sambuc __widen_from_utf8() : codecvt<char32_t, char, mbstate_t>(1) {} 13394684ddb6SLionel Sambuc 13404684ddb6SLionel Sambuc ~__widen_from_utf8(); 13414684ddb6SLionel Sambuc 13424684ddb6SLionel Sambuc template <class _OutputIterator> 13434684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 13444684ddb6SLionel Sambuc _OutputIterator 13454684ddb6SLionel Sambuc operator()(_OutputIterator __s, const char* __nb, const char* __ne) const 13464684ddb6SLionel Sambuc { 13474684ddb6SLionel Sambuc result __r = ok; 13484684ddb6SLionel Sambuc mbstate_t __mb; 13494684ddb6SLionel Sambuc while (__nb < __ne && __r != error) 13504684ddb6SLionel Sambuc { 13514684ddb6SLionel Sambuc const int __sz = 32; 13524684ddb6SLionel Sambuc char32_t __buf[__sz]; 13534684ddb6SLionel Sambuc char32_t* __bn; 13544684ddb6SLionel Sambuc const char* __nn = __nb; 13554684ddb6SLionel Sambuc __r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb+__sz : __ne, __nn, 13564684ddb6SLionel Sambuc __buf, __buf+__sz, __bn); 13574684ddb6SLionel Sambuc if (__r == codecvt_base::error || __nn == __nb) 13584684ddb6SLionel Sambuc __throw_runtime_error("locale not supported"); 13594684ddb6SLionel Sambuc for (const char32_t* __p = __buf; __p < __bn; ++__p, ++__s) 13604684ddb6SLionel Sambuc *__s = (wchar_t)*__p; 13614684ddb6SLionel Sambuc __nb = __nn; 13624684ddb6SLionel Sambuc } 13634684ddb6SLionel Sambuc return __s; 13644684ddb6SLionel Sambuc } 13654684ddb6SLionel Sambuc}; 13664684ddb6SLionel Sambuc 13674684ddb6SLionel Sambuc// template <class charT> class numpunct 13684684ddb6SLionel Sambuc 13694684ddb6SLionel Sambuctemplate <class _CharT> class _LIBCPP_TYPE_VIS_ONLY numpunct; 13704684ddb6SLionel Sambuc 13714684ddb6SLionel Sambuctemplate <> 13724684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS numpunct<char> 13734684ddb6SLionel Sambuc : public locale::facet 13744684ddb6SLionel Sambuc{ 13754684ddb6SLionel Sambucpublic: 13764684ddb6SLionel Sambuc typedef char char_type; 13774684ddb6SLionel Sambuc typedef basic_string<char_type> string_type; 13784684ddb6SLionel Sambuc 13794684ddb6SLionel Sambuc explicit numpunct(size_t __refs = 0); 13804684ddb6SLionel Sambuc 13814684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE char_type decimal_point() const {return do_decimal_point();} 13824684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE char_type thousands_sep() const {return do_thousands_sep();} 13834684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE string grouping() const {return do_grouping();} 13844684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE string_type truename() const {return do_truename();} 13854684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE string_type falsename() const {return do_falsename();} 13864684ddb6SLionel Sambuc 13874684ddb6SLionel Sambuc static locale::id id; 13884684ddb6SLionel Sambuc 13894684ddb6SLionel Sambucprotected: 13904684ddb6SLionel Sambuc ~numpunct(); 13914684ddb6SLionel Sambuc virtual char_type do_decimal_point() const; 13924684ddb6SLionel Sambuc virtual char_type do_thousands_sep() const; 13934684ddb6SLionel Sambuc virtual string do_grouping() const; 13944684ddb6SLionel Sambuc virtual string_type do_truename() const; 13954684ddb6SLionel Sambuc virtual string_type do_falsename() const; 13964684ddb6SLionel Sambuc 13974684ddb6SLionel Sambuc char_type __decimal_point_; 13984684ddb6SLionel Sambuc char_type __thousands_sep_; 13994684ddb6SLionel Sambuc string __grouping_; 14004684ddb6SLionel Sambuc}; 14014684ddb6SLionel Sambuc 14024684ddb6SLionel Sambuctemplate <> 14034684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS numpunct<wchar_t> 14044684ddb6SLionel Sambuc : public locale::facet 14054684ddb6SLionel Sambuc{ 14064684ddb6SLionel Sambucpublic: 14074684ddb6SLionel Sambuc typedef wchar_t char_type; 14084684ddb6SLionel Sambuc typedef basic_string<char_type> string_type; 14094684ddb6SLionel Sambuc 14104684ddb6SLionel Sambuc explicit numpunct(size_t __refs = 0); 14114684ddb6SLionel Sambuc 14124684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE char_type decimal_point() const {return do_decimal_point();} 14134684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE char_type thousands_sep() const {return do_thousands_sep();} 14144684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE string grouping() const {return do_grouping();} 14154684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE string_type truename() const {return do_truename();} 14164684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE string_type falsename() const {return do_falsename();} 14174684ddb6SLionel Sambuc 14184684ddb6SLionel Sambuc static locale::id id; 14194684ddb6SLionel Sambuc 14204684ddb6SLionel Sambucprotected: 14214684ddb6SLionel Sambuc ~numpunct(); 14224684ddb6SLionel Sambuc virtual char_type do_decimal_point() const; 14234684ddb6SLionel Sambuc virtual char_type do_thousands_sep() const; 14244684ddb6SLionel Sambuc virtual string do_grouping() const; 14254684ddb6SLionel Sambuc virtual string_type do_truename() const; 14264684ddb6SLionel Sambuc virtual string_type do_falsename() const; 14274684ddb6SLionel Sambuc 14284684ddb6SLionel Sambuc char_type __decimal_point_; 14294684ddb6SLionel Sambuc char_type __thousands_sep_; 14304684ddb6SLionel Sambuc string __grouping_; 14314684ddb6SLionel Sambuc}; 14324684ddb6SLionel Sambuc 14334684ddb6SLionel Sambuc// template <class charT> class numpunct_byname 14344684ddb6SLionel Sambuc 1435*0a6a1f1dSLionel Sambuctemplate <class _CharT> class _LIBCPP_TYPE_VIS_ONLY numpunct_byname; 14364684ddb6SLionel Sambuc 14374684ddb6SLionel Sambuctemplate <> 14384684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS numpunct_byname<char> 14394684ddb6SLionel Sambuc: public numpunct<char> 14404684ddb6SLionel Sambuc{ 14414684ddb6SLionel Sambucpublic: 14424684ddb6SLionel Sambuc typedef char char_type; 14434684ddb6SLionel Sambuc typedef basic_string<char_type> string_type; 14444684ddb6SLionel Sambuc 14454684ddb6SLionel Sambuc explicit numpunct_byname(const char* __nm, size_t __refs = 0); 14464684ddb6SLionel Sambuc explicit numpunct_byname(const string& __nm, size_t __refs = 0); 14474684ddb6SLionel Sambuc 14484684ddb6SLionel Sambucprotected: 14494684ddb6SLionel Sambuc ~numpunct_byname(); 14504684ddb6SLionel Sambuc 14514684ddb6SLionel Sambucprivate: 14524684ddb6SLionel Sambuc void __init(const char*); 14534684ddb6SLionel Sambuc}; 14544684ddb6SLionel Sambuc 14554684ddb6SLionel Sambuctemplate <> 14564684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS numpunct_byname<wchar_t> 14574684ddb6SLionel Sambuc: public numpunct<wchar_t> 14584684ddb6SLionel Sambuc{ 14594684ddb6SLionel Sambucpublic: 14604684ddb6SLionel Sambuc typedef wchar_t char_type; 14614684ddb6SLionel Sambuc typedef basic_string<char_type> string_type; 14624684ddb6SLionel Sambuc 14634684ddb6SLionel Sambuc explicit numpunct_byname(const char* __nm, size_t __refs = 0); 14644684ddb6SLionel Sambuc explicit numpunct_byname(const string& __nm, size_t __refs = 0); 14654684ddb6SLionel Sambuc 14664684ddb6SLionel Sambucprotected: 14674684ddb6SLionel Sambuc ~numpunct_byname(); 14684684ddb6SLionel Sambuc 14694684ddb6SLionel Sambucprivate: 14704684ddb6SLionel Sambuc void __init(const char*); 14714684ddb6SLionel Sambuc}; 14724684ddb6SLionel Sambuc 14734684ddb6SLionel Sambuc_LIBCPP_END_NAMESPACE_STD 14744684ddb6SLionel Sambuc 14754684ddb6SLionel Sambuc#endif // _LIBCPP___LOCALE 1476