xref: /netbsd-src/external/apache2/llvm/dist/libcxx/include/__locale (revision 4d6fc14bc9b0c5bf3e30be318c143ee82cadd108)
1*4d6fc14bSjoerg// -*- C++ -*-
2*4d6fc14bSjoerg//===----------------------------------------------------------------------===//
3*4d6fc14bSjoerg//
4*4d6fc14bSjoerg// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5*4d6fc14bSjoerg// See https://llvm.org/LICENSE.txt for license information.
6*4d6fc14bSjoerg// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7*4d6fc14bSjoerg//
8*4d6fc14bSjoerg//===----------------------------------------------------------------------===//
9*4d6fc14bSjoerg
10*4d6fc14bSjoerg#ifndef _LIBCPP___LOCALE
11*4d6fc14bSjoerg#define _LIBCPP___LOCALE
12*4d6fc14bSjoerg
13*4d6fc14bSjoerg#include <__config>
14*4d6fc14bSjoerg#include <__availability>
15*4d6fc14bSjoerg#include <string>
16*4d6fc14bSjoerg#include <memory>
17*4d6fc14bSjoerg#include <utility>
18*4d6fc14bSjoerg#include <mutex>
19*4d6fc14bSjoerg#include <cstdint>
20*4d6fc14bSjoerg#include <cctype>
21*4d6fc14bSjoerg#include <locale.h>
22*4d6fc14bSjoerg#if defined(_LIBCPP_MSVCRT_LIKE)
23*4d6fc14bSjoerg# include <cstring>
24*4d6fc14bSjoerg# include <__support/win32/locale_win32.h>
25*4d6fc14bSjoerg#elif defined(__NuttX__)
26*4d6fc14bSjoerg# include <__support/nuttx/xlocale.h>
27*4d6fc14bSjoerg#elif defined(_AIX) || defined(__MVS__)
28*4d6fc14bSjoerg# include <__support/ibm/xlocale.h>
29*4d6fc14bSjoerg#elif defined(__ANDROID__)
30*4d6fc14bSjoerg# include <__support/android/locale_bionic.h>
31*4d6fc14bSjoerg#elif defined(__sun__)
32*4d6fc14bSjoerg# include <xlocale.h>
33*4d6fc14bSjoerg# include <__support/solaris/xlocale.h>
34*4d6fc14bSjoerg#elif defined(_NEWLIB_VERSION)
35*4d6fc14bSjoerg# include <__support/newlib/xlocale.h>
36*4d6fc14bSjoerg#elif defined(__OpenBSD__)
37*4d6fc14bSjoerg# include <__support/openbsd/xlocale.h>
38*4d6fc14bSjoerg#elif (defined(__APPLE__)      || defined(__FreeBSD__) \
39*4d6fc14bSjoerg    || defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
40*4d6fc14bSjoerg# include <xlocale.h>
41*4d6fc14bSjoerg#elif defined(__Fuchsia__)
42*4d6fc14bSjoerg# include <__support/fuchsia/xlocale.h>
43*4d6fc14bSjoerg#elif defined(__wasi__)
44*4d6fc14bSjoerg// WASI libc uses musl's locales support.
45*4d6fc14bSjoerg# include <__support/musl/xlocale.h>
46*4d6fc14bSjoerg#elif defined(_LIBCPP_HAS_MUSL_LIBC)
47*4d6fc14bSjoerg# include <__support/musl/xlocale.h>
48*4d6fc14bSjoerg#endif
49*4d6fc14bSjoerg
50*4d6fc14bSjoerg#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
51*4d6fc14bSjoerg#pragma GCC system_header
52*4d6fc14bSjoerg#endif
53*4d6fc14bSjoerg
54*4d6fc14bSjoerg_LIBCPP_BEGIN_NAMESPACE_STD
55*4d6fc14bSjoerg
56*4d6fc14bSjoerg#if !defined(_LIBCPP_LOCALE__L_EXTENSIONS)
57*4d6fc14bSjoergstruct __libcpp_locale_guard {
58*4d6fc14bSjoerg  _LIBCPP_INLINE_VISIBILITY
59*4d6fc14bSjoerg  __libcpp_locale_guard(locale_t& __loc) : __old_loc_(uselocale(__loc)) {}
60*4d6fc14bSjoerg
61*4d6fc14bSjoerg  _LIBCPP_INLINE_VISIBILITY
62*4d6fc14bSjoerg  ~__libcpp_locale_guard() {
63*4d6fc14bSjoerg    if (__old_loc_)
64*4d6fc14bSjoerg      uselocale(__old_loc_);
65*4d6fc14bSjoerg  }
66*4d6fc14bSjoerg
67*4d6fc14bSjoerg  locale_t __old_loc_;
68*4d6fc14bSjoergprivate:
69*4d6fc14bSjoerg  __libcpp_locale_guard(__libcpp_locale_guard const&);
70*4d6fc14bSjoerg  __libcpp_locale_guard& operator=(__libcpp_locale_guard const&);
71*4d6fc14bSjoerg};
72*4d6fc14bSjoerg#elif defined(_LIBCPP_MSVCRT_LIKE)
73*4d6fc14bSjoergstruct __libcpp_locale_guard {
74*4d6fc14bSjoerg    __libcpp_locale_guard(locale_t __l) :
75*4d6fc14bSjoerg        __status(_configthreadlocale(_ENABLE_PER_THREAD_LOCALE)) {
76*4d6fc14bSjoerg      // Setting the locale can be expensive even when the locale given is
77*4d6fc14bSjoerg      // already the current locale, so do an explicit check to see if the
78*4d6fc14bSjoerg      // current locale is already the one we want.
79*4d6fc14bSjoerg      const char* __lc = __setlocale(nullptr);
80*4d6fc14bSjoerg      // If every category is the same, the locale string will simply be the
81*4d6fc14bSjoerg      // locale name, otherwise it will be a semicolon-separated string listing
82*4d6fc14bSjoerg      // each category.  In the second case, we know at least one category won't
83*4d6fc14bSjoerg      // be what we want, so we only have to check the first case.
84*4d6fc14bSjoerg      if (_VSTD::strcmp(__l.__get_locale(), __lc) != 0) {
85*4d6fc14bSjoerg        __locale_all = _strdup(__lc);
86*4d6fc14bSjoerg        if (__locale_all == nullptr)
87*4d6fc14bSjoerg          __throw_bad_alloc();
88*4d6fc14bSjoerg        __setlocale(__l.__get_locale());
89*4d6fc14bSjoerg      }
90*4d6fc14bSjoerg    }
91*4d6fc14bSjoerg    ~__libcpp_locale_guard() {
92*4d6fc14bSjoerg      // The CRT documentation doesn't explicitly say, but setlocale() does the
93*4d6fc14bSjoerg      // right thing when given a semicolon-separated list of locale settings
94*4d6fc14bSjoerg      // for the different categories in the same format as returned by
95*4d6fc14bSjoerg      // setlocale(LC_ALL, nullptr).
96*4d6fc14bSjoerg      if (__locale_all != nullptr) {
97*4d6fc14bSjoerg        __setlocale(__locale_all);
98*4d6fc14bSjoerg        free(__locale_all);
99*4d6fc14bSjoerg      }
100*4d6fc14bSjoerg      _configthreadlocale(__status);
101*4d6fc14bSjoerg    }
102*4d6fc14bSjoerg    static const char* __setlocale(const char* __locale) {
103*4d6fc14bSjoerg      const char* __new_locale = setlocale(LC_ALL, __locale);
104*4d6fc14bSjoerg      if (__new_locale == nullptr)
105*4d6fc14bSjoerg        __throw_bad_alloc();
106*4d6fc14bSjoerg      return __new_locale;
107*4d6fc14bSjoerg    }
108*4d6fc14bSjoerg    int __status;
109*4d6fc14bSjoerg    char* __locale_all = nullptr;
110*4d6fc14bSjoerg};
111*4d6fc14bSjoerg#endif
112*4d6fc14bSjoerg
113*4d6fc14bSjoergclass _LIBCPP_TYPE_VIS locale;
114*4d6fc14bSjoerg
115*4d6fc14bSjoergtemplate <class _Facet>
116*4d6fc14bSjoerg_LIBCPP_INLINE_VISIBILITY
117*4d6fc14bSjoergbool
118*4d6fc14bSjoerghas_facet(const locale&) _NOEXCEPT;
119*4d6fc14bSjoerg
120*4d6fc14bSjoergtemplate <class _Facet>
121*4d6fc14bSjoerg_LIBCPP_INLINE_VISIBILITY
122*4d6fc14bSjoergconst _Facet&
123*4d6fc14bSjoerguse_facet(const locale&);
124*4d6fc14bSjoerg
125*4d6fc14bSjoergclass _LIBCPP_TYPE_VIS locale
126*4d6fc14bSjoerg{
127*4d6fc14bSjoergpublic:
128*4d6fc14bSjoerg    // types:
129*4d6fc14bSjoerg    class _LIBCPP_TYPE_VIS facet;
130*4d6fc14bSjoerg    class _LIBCPP_TYPE_VIS id;
131*4d6fc14bSjoerg
132*4d6fc14bSjoerg    typedef int category;
133*4d6fc14bSjoerg    _LIBCPP_AVAILABILITY_LOCALE_CATEGORY
134*4d6fc14bSjoerg    static const category // values assigned here are for exposition only
135*4d6fc14bSjoerg        none     = 0,
136*4d6fc14bSjoerg        collate  = LC_COLLATE_MASK,
137*4d6fc14bSjoerg        ctype    = LC_CTYPE_MASK,
138*4d6fc14bSjoerg        monetary = LC_MONETARY_MASK,
139*4d6fc14bSjoerg        numeric  = LC_NUMERIC_MASK,
140*4d6fc14bSjoerg        time     = LC_TIME_MASK,
141*4d6fc14bSjoerg        messages = LC_MESSAGES_MASK,
142*4d6fc14bSjoerg        all = collate | ctype | monetary | numeric | time | messages;
143*4d6fc14bSjoerg
144*4d6fc14bSjoerg    // construct/copy/destroy:
145*4d6fc14bSjoerg    locale()  _NOEXCEPT;
146*4d6fc14bSjoerg    locale(const locale&)  _NOEXCEPT;
147*4d6fc14bSjoerg    explicit locale(const char*);
148*4d6fc14bSjoerg    explicit locale(const string&);
149*4d6fc14bSjoerg    locale(const locale&, const char*, category);
150*4d6fc14bSjoerg    locale(const locale&, const string&, category);
151*4d6fc14bSjoerg    template <class _Facet>
152*4d6fc14bSjoerg        _LIBCPP_INLINE_VISIBILITY locale(const locale&, _Facet*);
153*4d6fc14bSjoerg    locale(const locale&, const locale&, category);
154*4d6fc14bSjoerg
155*4d6fc14bSjoerg    ~locale();
156*4d6fc14bSjoerg
157*4d6fc14bSjoerg    const locale& operator=(const locale&)  _NOEXCEPT;
158*4d6fc14bSjoerg
159*4d6fc14bSjoerg    template <class _Facet>
160*4d6fc14bSjoerg      _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
161*4d6fc14bSjoerg      locale combine(const locale&) const;
162*4d6fc14bSjoerg
163*4d6fc14bSjoerg    // locale operations:
164*4d6fc14bSjoerg    string name() const;
165*4d6fc14bSjoerg    bool operator==(const locale&) const;
166*4d6fc14bSjoerg    bool operator!=(const locale& __y) const {return !(*this == __y);}
167*4d6fc14bSjoerg    template <class _CharT, class _Traits, class _Allocator>
168*4d6fc14bSjoerg      _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
169*4d6fc14bSjoerg      bool operator()(const basic_string<_CharT, _Traits, _Allocator>&,
170*4d6fc14bSjoerg                      const basic_string<_CharT, _Traits, _Allocator>&) const;
171*4d6fc14bSjoerg
172*4d6fc14bSjoerg    // global locale objects:
173*4d6fc14bSjoerg    static locale global(const locale&);
174*4d6fc14bSjoerg    static const locale& classic();
175*4d6fc14bSjoerg
176*4d6fc14bSjoergprivate:
177*4d6fc14bSjoerg    class __imp;
178*4d6fc14bSjoerg    __imp* __locale_;
179*4d6fc14bSjoerg
180*4d6fc14bSjoerg    void __install_ctor(const locale&, facet*, long);
181*4d6fc14bSjoerg    static locale& __global();
182*4d6fc14bSjoerg    bool has_facet(id&) const;
183*4d6fc14bSjoerg    const facet* use_facet(id&) const;
184*4d6fc14bSjoerg
185*4d6fc14bSjoerg    template <class _Facet> friend bool has_facet(const locale&)  _NOEXCEPT;
186*4d6fc14bSjoerg    template <class _Facet> friend const _Facet& use_facet(const locale&);
187*4d6fc14bSjoerg};
188*4d6fc14bSjoerg
189*4d6fc14bSjoergclass _LIBCPP_TYPE_VIS locale::facet
190*4d6fc14bSjoerg    : public __shared_count
191*4d6fc14bSjoerg{
192*4d6fc14bSjoergprotected:
193*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
194*4d6fc14bSjoerg    explicit facet(size_t __refs = 0)
195*4d6fc14bSjoerg        : __shared_count(static_cast<long>(__refs)-1) {}
196*4d6fc14bSjoerg
197*4d6fc14bSjoerg    virtual ~facet();
198*4d6fc14bSjoerg
199*4d6fc14bSjoerg//    facet(const facet&) = delete;     // effectively done in __shared_count
200*4d6fc14bSjoerg//    void operator=(const facet&) = delete;
201*4d6fc14bSjoergprivate:
202*4d6fc14bSjoerg    virtual void __on_zero_shared() _NOEXCEPT;
203*4d6fc14bSjoerg};
204*4d6fc14bSjoerg
205*4d6fc14bSjoergclass _LIBCPP_TYPE_VIS locale::id
206*4d6fc14bSjoerg{
207*4d6fc14bSjoerg    once_flag      __flag_;
208*4d6fc14bSjoerg    int32_t        __id_;
209*4d6fc14bSjoerg
210*4d6fc14bSjoerg    static int32_t __next_id;
211*4d6fc14bSjoergpublic:
212*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR id() :__id_(0) {}
213*4d6fc14bSjoergprivate:
214*4d6fc14bSjoerg    void __init();
215*4d6fc14bSjoerg    void operator=(const id&); // = delete;
216*4d6fc14bSjoerg    id(const id&); // = delete;
217*4d6fc14bSjoergpublic:  // only needed for tests
218*4d6fc14bSjoerg    long __get();
219*4d6fc14bSjoerg
220*4d6fc14bSjoerg    friend class locale;
221*4d6fc14bSjoerg    friend class locale::__imp;
222*4d6fc14bSjoerg};
223*4d6fc14bSjoerg
224*4d6fc14bSjoergtemplate <class _Facet>
225*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY
226*4d6fc14bSjoerglocale::locale(const locale& __other, _Facet* __f)
227*4d6fc14bSjoerg{
228*4d6fc14bSjoerg    __install_ctor(__other, __f, __f ? __f->id.__get() : 0);
229*4d6fc14bSjoerg}
230*4d6fc14bSjoerg
231*4d6fc14bSjoergtemplate <class _Facet>
232*4d6fc14bSjoerglocale
233*4d6fc14bSjoerglocale::combine(const locale& __other) const
234*4d6fc14bSjoerg{
235*4d6fc14bSjoerg    if (!_VSTD::has_facet<_Facet>(__other))
236*4d6fc14bSjoerg        __throw_runtime_error("locale::combine: locale missing facet");
237*4d6fc14bSjoerg
238*4d6fc14bSjoerg    return locale(*this, &const_cast<_Facet&>(_VSTD::use_facet<_Facet>(__other)));
239*4d6fc14bSjoerg}
240*4d6fc14bSjoerg
241*4d6fc14bSjoergtemplate <class _Facet>
242*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY
243*4d6fc14bSjoergbool
244*4d6fc14bSjoerghas_facet(const locale& __l)  _NOEXCEPT
245*4d6fc14bSjoerg{
246*4d6fc14bSjoerg    return __l.has_facet(_Facet::id);
247*4d6fc14bSjoerg}
248*4d6fc14bSjoerg
249*4d6fc14bSjoergtemplate <class _Facet>
250*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY
251*4d6fc14bSjoergconst _Facet&
252*4d6fc14bSjoerguse_facet(const locale& __l)
253*4d6fc14bSjoerg{
254*4d6fc14bSjoerg    return static_cast<const _Facet&>(*__l.use_facet(_Facet::id));
255*4d6fc14bSjoerg}
256*4d6fc14bSjoerg
257*4d6fc14bSjoerg// template <class _CharT> class collate;
258*4d6fc14bSjoerg
259*4d6fc14bSjoergtemplate <class _CharT>
260*4d6fc14bSjoergclass _LIBCPP_TEMPLATE_VIS collate
261*4d6fc14bSjoerg    : public locale::facet
262*4d6fc14bSjoerg{
263*4d6fc14bSjoergpublic:
264*4d6fc14bSjoerg    typedef _CharT char_type;
265*4d6fc14bSjoerg    typedef basic_string<char_type> string_type;
266*4d6fc14bSjoerg
267*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
268*4d6fc14bSjoerg    explicit collate(size_t __refs = 0)
269*4d6fc14bSjoerg        : locale::facet(__refs) {}
270*4d6fc14bSjoerg
271*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
272*4d6fc14bSjoerg    int compare(const char_type* __lo1, const char_type* __hi1,
273*4d6fc14bSjoerg                const char_type* __lo2, const char_type* __hi2) const
274*4d6fc14bSjoerg    {
275*4d6fc14bSjoerg        return do_compare(__lo1, __hi1, __lo2, __hi2);
276*4d6fc14bSjoerg    }
277*4d6fc14bSjoerg
278*4d6fc14bSjoerg    // FIXME(EricWF): The _LIBCPP_ALWAYS_INLINE is needed on Windows to work
279*4d6fc14bSjoerg    // around a dllimport bug that expects an external instantiation.
280*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
281*4d6fc14bSjoerg    _LIBCPP_ALWAYS_INLINE
282*4d6fc14bSjoerg    string_type transform(const char_type* __lo, const char_type* __hi) const
283*4d6fc14bSjoerg    {
284*4d6fc14bSjoerg        return do_transform(__lo, __hi);
285*4d6fc14bSjoerg    }
286*4d6fc14bSjoerg
287*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
288*4d6fc14bSjoerg    long hash(const char_type* __lo, const char_type* __hi) const
289*4d6fc14bSjoerg    {
290*4d6fc14bSjoerg        return do_hash(__lo, __hi);
291*4d6fc14bSjoerg    }
292*4d6fc14bSjoerg
293*4d6fc14bSjoerg    static locale::id id;
294*4d6fc14bSjoerg
295*4d6fc14bSjoergprotected:
296*4d6fc14bSjoerg    ~collate();
297*4d6fc14bSjoerg    virtual int do_compare(const char_type* __lo1, const char_type* __hi1,
298*4d6fc14bSjoerg                           const char_type* __lo2, const char_type* __hi2) const;
299*4d6fc14bSjoerg    virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const
300*4d6fc14bSjoerg        {return string_type(__lo, __hi);}
301*4d6fc14bSjoerg    virtual long do_hash(const char_type* __lo, const char_type* __hi) const;
302*4d6fc14bSjoerg};
303*4d6fc14bSjoerg
304*4d6fc14bSjoergtemplate <class _CharT> locale::id collate<_CharT>::id;
305*4d6fc14bSjoerg
306*4d6fc14bSjoergtemplate <class _CharT>
307*4d6fc14bSjoergcollate<_CharT>::~collate()
308*4d6fc14bSjoerg{
309*4d6fc14bSjoerg}
310*4d6fc14bSjoerg
311*4d6fc14bSjoergtemplate <class _CharT>
312*4d6fc14bSjoergint
313*4d6fc14bSjoergcollate<_CharT>::do_compare(const char_type* __lo1, const char_type* __hi1,
314*4d6fc14bSjoerg                            const char_type* __lo2, const char_type* __hi2) const
315*4d6fc14bSjoerg{
316*4d6fc14bSjoerg    for (; __lo2 != __hi2; ++__lo1, ++__lo2)
317*4d6fc14bSjoerg    {
318*4d6fc14bSjoerg        if (__lo1 == __hi1 || *__lo1 < *__lo2)
319*4d6fc14bSjoerg            return -1;
320*4d6fc14bSjoerg        if (*__lo2 < *__lo1)
321*4d6fc14bSjoerg            return 1;
322*4d6fc14bSjoerg    }
323*4d6fc14bSjoerg    return __lo1 != __hi1;
324*4d6fc14bSjoerg}
325*4d6fc14bSjoerg
326*4d6fc14bSjoergtemplate <class _CharT>
327*4d6fc14bSjoerglong
328*4d6fc14bSjoergcollate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const
329*4d6fc14bSjoerg{
330*4d6fc14bSjoerg    size_t __h = 0;
331*4d6fc14bSjoerg    const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8;
332*4d6fc14bSjoerg    const size_t __mask = size_t(0xF) << (__sr + 4);
333*4d6fc14bSjoerg    for(const char_type* __p = __lo; __p != __hi; ++__p)
334*4d6fc14bSjoerg    {
335*4d6fc14bSjoerg        __h = (__h << 4) + static_cast<size_t>(*__p);
336*4d6fc14bSjoerg        size_t __g = __h & __mask;
337*4d6fc14bSjoerg        __h ^= __g | (__g >> __sr);
338*4d6fc14bSjoerg    }
339*4d6fc14bSjoerg    return static_cast<long>(__h);
340*4d6fc14bSjoerg}
341*4d6fc14bSjoerg
342*4d6fc14bSjoerg_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<char>)
343*4d6fc14bSjoerg_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<wchar_t>)
344*4d6fc14bSjoerg
345*4d6fc14bSjoerg// template <class CharT> class collate_byname;
346*4d6fc14bSjoerg
347*4d6fc14bSjoergtemplate <class _CharT> class _LIBCPP_TEMPLATE_VIS collate_byname;
348*4d6fc14bSjoerg
349*4d6fc14bSjoergtemplate <>
350*4d6fc14bSjoergclass _LIBCPP_TYPE_VIS collate_byname<char>
351*4d6fc14bSjoerg    : public collate<char>
352*4d6fc14bSjoerg{
353*4d6fc14bSjoerg    locale_t __l;
354*4d6fc14bSjoergpublic:
355*4d6fc14bSjoerg    typedef char char_type;
356*4d6fc14bSjoerg    typedef basic_string<char_type> string_type;
357*4d6fc14bSjoerg
358*4d6fc14bSjoerg    explicit collate_byname(const char* __n, size_t __refs = 0);
359*4d6fc14bSjoerg    explicit collate_byname(const string& __n, size_t __refs = 0);
360*4d6fc14bSjoerg
361*4d6fc14bSjoergprotected:
362*4d6fc14bSjoerg    ~collate_byname();
363*4d6fc14bSjoerg    virtual int do_compare(const char_type* __lo1, const char_type* __hi1,
364*4d6fc14bSjoerg                           const char_type* __lo2, const char_type* __hi2) const;
365*4d6fc14bSjoerg    virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const;
366*4d6fc14bSjoerg};
367*4d6fc14bSjoerg
368*4d6fc14bSjoergtemplate <>
369*4d6fc14bSjoergclass _LIBCPP_TYPE_VIS collate_byname<wchar_t>
370*4d6fc14bSjoerg    : public collate<wchar_t>
371*4d6fc14bSjoerg{
372*4d6fc14bSjoerg    locale_t __l;
373*4d6fc14bSjoergpublic:
374*4d6fc14bSjoerg    typedef wchar_t char_type;
375*4d6fc14bSjoerg    typedef basic_string<char_type> string_type;
376*4d6fc14bSjoerg
377*4d6fc14bSjoerg    explicit collate_byname(const char* __n, size_t __refs = 0);
378*4d6fc14bSjoerg    explicit collate_byname(const string& __n, size_t __refs = 0);
379*4d6fc14bSjoerg
380*4d6fc14bSjoergprotected:
381*4d6fc14bSjoerg    ~collate_byname();
382*4d6fc14bSjoerg
383*4d6fc14bSjoerg    virtual int do_compare(const char_type* __lo1, const char_type* __hi1,
384*4d6fc14bSjoerg                           const char_type* __lo2, const char_type* __hi2) const;
385*4d6fc14bSjoerg    virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const;
386*4d6fc14bSjoerg};
387*4d6fc14bSjoerg
388*4d6fc14bSjoergtemplate <class _CharT, class _Traits, class _Allocator>
389*4d6fc14bSjoergbool
390*4d6fc14bSjoerglocale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
391*4d6fc14bSjoerg                   const basic_string<_CharT, _Traits, _Allocator>& __y) const
392*4d6fc14bSjoerg{
393*4d6fc14bSjoerg    return _VSTD::use_facet<_VSTD::collate<_CharT> >(*this).compare(
394*4d6fc14bSjoerg                                       __x.data(), __x.data() + __x.size(),
395*4d6fc14bSjoerg                                       __y.data(), __y.data() + __y.size()) < 0;
396*4d6fc14bSjoerg}
397*4d6fc14bSjoerg
398*4d6fc14bSjoerg// template <class charT> class ctype
399*4d6fc14bSjoerg
400*4d6fc14bSjoergclass _LIBCPP_TYPE_VIS ctype_base
401*4d6fc14bSjoerg{
402*4d6fc14bSjoergpublic:
403*4d6fc14bSjoerg#if defined(_LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE)
404*4d6fc14bSjoerg    typedef unsigned long mask;
405*4d6fc14bSjoerg    static const mask space  = 1<<0;
406*4d6fc14bSjoerg    static const mask print  = 1<<1;
407*4d6fc14bSjoerg    static const mask cntrl  = 1<<2;
408*4d6fc14bSjoerg    static const mask upper  = 1<<3;
409*4d6fc14bSjoerg    static const mask lower  = 1<<4;
410*4d6fc14bSjoerg    static const mask alpha  = 1<<5;
411*4d6fc14bSjoerg    static const mask digit  = 1<<6;
412*4d6fc14bSjoerg    static const mask punct  = 1<<7;
413*4d6fc14bSjoerg    static const mask xdigit = 1<<8;
414*4d6fc14bSjoerg    static const mask blank  = 1<<9;
415*4d6fc14bSjoerg#if defined(__BIONIC__)
416*4d6fc14bSjoerg    // Historically this was a part of regex_traits rather than ctype_base. The
417*4d6fc14bSjoerg    // historical value of the constant is preserved for ABI compatibility.
418*4d6fc14bSjoerg    static const mask __regex_word = 0x8000;
419*4d6fc14bSjoerg#else
420*4d6fc14bSjoerg    static const mask __regex_word = 1<<10;
421*4d6fc14bSjoerg#endif // defined(__BIONIC__)
422*4d6fc14bSjoerg#elif defined(__GLIBC__)
423*4d6fc14bSjoerg    typedef unsigned short mask;
424*4d6fc14bSjoerg    static const mask space  = _ISspace;
425*4d6fc14bSjoerg    static const mask print  = _ISprint;
426*4d6fc14bSjoerg    static const mask cntrl  = _IScntrl;
427*4d6fc14bSjoerg    static const mask upper  = _ISupper;
428*4d6fc14bSjoerg    static const mask lower  = _ISlower;
429*4d6fc14bSjoerg    static const mask alpha  = _ISalpha;
430*4d6fc14bSjoerg    static const mask digit  = _ISdigit;
431*4d6fc14bSjoerg    static const mask punct  = _ISpunct;
432*4d6fc14bSjoerg    static const mask xdigit = _ISxdigit;
433*4d6fc14bSjoerg    static const mask blank  = _ISblank;
434*4d6fc14bSjoerg#if defined(__mips__)
435*4d6fc14bSjoerg    static const mask __regex_word = static_cast<mask>(_ISbit(15));
436*4d6fc14bSjoerg#else
437*4d6fc14bSjoerg    static const mask __regex_word = 0x80;
438*4d6fc14bSjoerg#endif
439*4d6fc14bSjoerg#elif defined(_LIBCPP_MSVCRT_LIKE)
440*4d6fc14bSjoerg    typedef unsigned short mask;
441*4d6fc14bSjoerg    static const mask space  = _SPACE;
442*4d6fc14bSjoerg    static const mask print  = _BLANK|_PUNCT|_ALPHA|_DIGIT;
443*4d6fc14bSjoerg    static const mask cntrl  = _CONTROL;
444*4d6fc14bSjoerg    static const mask upper  = _UPPER;
445*4d6fc14bSjoerg    static const mask lower  = _LOWER;
446*4d6fc14bSjoerg    static const mask alpha  = _ALPHA;
447*4d6fc14bSjoerg    static const mask digit  = _DIGIT;
448*4d6fc14bSjoerg    static const mask punct  = _PUNCT;
449*4d6fc14bSjoerg    static const mask xdigit = _HEX;
450*4d6fc14bSjoerg    static const mask blank  = _BLANK;
451*4d6fc14bSjoerg    static const mask __regex_word = 0x80;
452*4d6fc14bSjoerg# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
453*4d6fc14bSjoerg#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
454*4d6fc14bSjoerg# ifdef __APPLE__
455*4d6fc14bSjoerg    typedef __uint32_t mask;
456*4d6fc14bSjoerg# elif defined(__FreeBSD__)
457*4d6fc14bSjoerg    typedef unsigned long mask;
458*4d6fc14bSjoerg# elif defined(__EMSCRIPTEN__) || defined(__NetBSD__)
459*4d6fc14bSjoerg    typedef unsigned short mask;
460*4d6fc14bSjoerg# endif
461*4d6fc14bSjoerg    static const mask space  = _CTYPE_S;
462*4d6fc14bSjoerg    static const mask print  = _CTYPE_R;
463*4d6fc14bSjoerg    static const mask cntrl  = _CTYPE_C;
464*4d6fc14bSjoerg    static const mask upper  = _CTYPE_U;
465*4d6fc14bSjoerg    static const mask lower  = _CTYPE_L;
466*4d6fc14bSjoerg    static const mask alpha  = _CTYPE_A;
467*4d6fc14bSjoerg    static const mask digit  = _CTYPE_D;
468*4d6fc14bSjoerg    static const mask punct  = _CTYPE_P;
469*4d6fc14bSjoerg    static const mask xdigit = _CTYPE_X;
470*4d6fc14bSjoerg
471*4d6fc14bSjoerg# if defined(__NetBSD__)
472*4d6fc14bSjoerg    static const mask blank  = _CTYPE_BL;
473*4d6fc14bSjoerg    // NetBSD defines classes up to 0x2000
474*4d6fc14bSjoerg    // see sys/ctype_bits.h, _CTYPE_Q
475*4d6fc14bSjoerg    static const mask __regex_word = 0x8000;
476*4d6fc14bSjoerg# else
477*4d6fc14bSjoerg    static const mask blank  = _CTYPE_B;
478*4d6fc14bSjoerg    static const mask __regex_word = 0x80;
479*4d6fc14bSjoerg# endif
480*4d6fc14bSjoerg#elif defined(__sun__) || defined(_AIX)
481*4d6fc14bSjoerg    typedef unsigned int mask;
482*4d6fc14bSjoerg    static const mask space  = _ISSPACE;
483*4d6fc14bSjoerg    static const mask print  = _ISPRINT;
484*4d6fc14bSjoerg    static const mask cntrl  = _ISCNTRL;
485*4d6fc14bSjoerg    static const mask upper  = _ISUPPER;
486*4d6fc14bSjoerg    static const mask lower  = _ISLOWER;
487*4d6fc14bSjoerg    static const mask alpha  = _ISALPHA;
488*4d6fc14bSjoerg    static const mask digit  = _ISDIGIT;
489*4d6fc14bSjoerg    static const mask punct  = _ISPUNCT;
490*4d6fc14bSjoerg    static const mask xdigit = _ISXDIGIT;
491*4d6fc14bSjoerg    static const mask blank  = _ISBLANK;
492*4d6fc14bSjoerg    static const mask __regex_word = 0x80;
493*4d6fc14bSjoerg#elif defined(_NEWLIB_VERSION)
494*4d6fc14bSjoerg    // Same type as Newlib's _ctype_ array in newlib/libc/include/ctype.h.
495*4d6fc14bSjoerg    typedef char mask;
496*4d6fc14bSjoerg    static const mask space  = _S;
497*4d6fc14bSjoerg    static const mask print  = _P | _U | _L | _N | _B;
498*4d6fc14bSjoerg    static const mask cntrl  = _C;
499*4d6fc14bSjoerg    static const mask upper  = _U;
500*4d6fc14bSjoerg    static const mask lower  = _L;
501*4d6fc14bSjoerg    static const mask alpha  = _U | _L;
502*4d6fc14bSjoerg    static const mask digit  = _N;
503*4d6fc14bSjoerg    static const mask punct  = _P;
504*4d6fc14bSjoerg    static const mask xdigit = _X | _N;
505*4d6fc14bSjoerg    static const mask blank  = _B;
506*4d6fc14bSjoerg    static const mask __regex_word = 0x80;
507*4d6fc14bSjoerg# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
508*4d6fc14bSjoerg# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
509*4d6fc14bSjoerg# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT
510*4d6fc14bSjoerg#else
511*4d6fc14bSjoerg# error unknown rune table for this platform -- do you mean to define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE?
512*4d6fc14bSjoerg#endif
513*4d6fc14bSjoerg    static const mask alnum  = alpha | digit;
514*4d6fc14bSjoerg    static const mask graph  = alnum | punct;
515*4d6fc14bSjoerg
516*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY ctype_base() {}
517*4d6fc14bSjoerg};
518*4d6fc14bSjoerg
519*4d6fc14bSjoergtemplate <class _CharT> class _LIBCPP_TEMPLATE_VIS ctype;
520*4d6fc14bSjoerg
521*4d6fc14bSjoergtemplate <>
522*4d6fc14bSjoergclass _LIBCPP_TYPE_VIS ctype<wchar_t>
523*4d6fc14bSjoerg    : public locale::facet,
524*4d6fc14bSjoerg      public ctype_base
525*4d6fc14bSjoerg{
526*4d6fc14bSjoergpublic:
527*4d6fc14bSjoerg    typedef wchar_t char_type;
528*4d6fc14bSjoerg
529*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
530*4d6fc14bSjoerg    explicit ctype(size_t __refs = 0)
531*4d6fc14bSjoerg        : locale::facet(__refs) {}
532*4d6fc14bSjoerg
533*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
534*4d6fc14bSjoerg    bool is(mask __m, char_type __c) const
535*4d6fc14bSjoerg    {
536*4d6fc14bSjoerg        return do_is(__m, __c);
537*4d6fc14bSjoerg    }
538*4d6fc14bSjoerg
539*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
540*4d6fc14bSjoerg    const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
541*4d6fc14bSjoerg    {
542*4d6fc14bSjoerg        return do_is(__low, __high, __vec);
543*4d6fc14bSjoerg    }
544*4d6fc14bSjoerg
545*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
546*4d6fc14bSjoerg    const char_type* scan_is(mask __m, const char_type* __low, const char_type* __high) const
547*4d6fc14bSjoerg    {
548*4d6fc14bSjoerg        return do_scan_is(__m, __low, __high);
549*4d6fc14bSjoerg    }
550*4d6fc14bSjoerg
551*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
552*4d6fc14bSjoerg    const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
553*4d6fc14bSjoerg    {
554*4d6fc14bSjoerg        return do_scan_not(__m, __low, __high);
555*4d6fc14bSjoerg    }
556*4d6fc14bSjoerg
557*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
558*4d6fc14bSjoerg    char_type toupper(char_type __c) const
559*4d6fc14bSjoerg    {
560*4d6fc14bSjoerg        return do_toupper(__c);
561*4d6fc14bSjoerg    }
562*4d6fc14bSjoerg
563*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
564*4d6fc14bSjoerg    const char_type* toupper(char_type* __low, const char_type* __high) const
565*4d6fc14bSjoerg    {
566*4d6fc14bSjoerg        return do_toupper(__low, __high);
567*4d6fc14bSjoerg    }
568*4d6fc14bSjoerg
569*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
570*4d6fc14bSjoerg    char_type tolower(char_type __c) const
571*4d6fc14bSjoerg    {
572*4d6fc14bSjoerg        return do_tolower(__c);
573*4d6fc14bSjoerg    }
574*4d6fc14bSjoerg
575*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
576*4d6fc14bSjoerg    const char_type* tolower(char_type* __low, const char_type* __high) const
577*4d6fc14bSjoerg    {
578*4d6fc14bSjoerg        return do_tolower(__low, __high);
579*4d6fc14bSjoerg    }
580*4d6fc14bSjoerg
581*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
582*4d6fc14bSjoerg    char_type widen(char __c) const
583*4d6fc14bSjoerg    {
584*4d6fc14bSjoerg        return do_widen(__c);
585*4d6fc14bSjoerg    }
586*4d6fc14bSjoerg
587*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
588*4d6fc14bSjoerg    const char* widen(const char* __low, const char* __high, char_type* __to) const
589*4d6fc14bSjoerg    {
590*4d6fc14bSjoerg        return do_widen(__low, __high, __to);
591*4d6fc14bSjoerg    }
592*4d6fc14bSjoerg
593*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
594*4d6fc14bSjoerg    char narrow(char_type __c, char __dfault) const
595*4d6fc14bSjoerg    {
596*4d6fc14bSjoerg        return do_narrow(__c, __dfault);
597*4d6fc14bSjoerg    }
598*4d6fc14bSjoerg
599*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
600*4d6fc14bSjoerg    const char_type* narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const
601*4d6fc14bSjoerg    {
602*4d6fc14bSjoerg        return do_narrow(__low, __high, __dfault, __to);
603*4d6fc14bSjoerg    }
604*4d6fc14bSjoerg
605*4d6fc14bSjoerg    static locale::id id;
606*4d6fc14bSjoerg
607*4d6fc14bSjoergprotected:
608*4d6fc14bSjoerg    ~ctype();
609*4d6fc14bSjoerg    virtual bool do_is(mask __m, char_type __c) const;
610*4d6fc14bSjoerg    virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const;
611*4d6fc14bSjoerg    virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const;
612*4d6fc14bSjoerg    virtual const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const;
613*4d6fc14bSjoerg    virtual char_type do_toupper(char_type) const;
614*4d6fc14bSjoerg    virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
615*4d6fc14bSjoerg    virtual char_type do_tolower(char_type) const;
616*4d6fc14bSjoerg    virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
617*4d6fc14bSjoerg    virtual char_type do_widen(char) const;
618*4d6fc14bSjoerg    virtual const char* do_widen(const char* __low, const char* __high, char_type* __dest) const;
619*4d6fc14bSjoerg    virtual char do_narrow(char_type, char __dfault) const;
620*4d6fc14bSjoerg    virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const;
621*4d6fc14bSjoerg};
622*4d6fc14bSjoerg
623*4d6fc14bSjoergtemplate <>
624*4d6fc14bSjoergclass _LIBCPP_TYPE_VIS ctype<char>
625*4d6fc14bSjoerg    : public locale::facet, public ctype_base
626*4d6fc14bSjoerg{
627*4d6fc14bSjoerg    const mask* __tab_;
628*4d6fc14bSjoerg    bool        __del_;
629*4d6fc14bSjoergpublic:
630*4d6fc14bSjoerg    typedef char char_type;
631*4d6fc14bSjoerg
632*4d6fc14bSjoerg    explicit ctype(const mask* __tab = nullptr, bool __del = false, size_t __refs = 0);
633*4d6fc14bSjoerg
634*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
635*4d6fc14bSjoerg    bool is(mask __m, char_type __c) const
636*4d6fc14bSjoerg    {
637*4d6fc14bSjoerg        return isascii(__c) ? (__tab_[static_cast<int>(__c)] & __m) !=0 : false;
638*4d6fc14bSjoerg    }
639*4d6fc14bSjoerg
640*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
641*4d6fc14bSjoerg    const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
642*4d6fc14bSjoerg    {
643*4d6fc14bSjoerg        for (; __low != __high; ++__low, ++__vec)
644*4d6fc14bSjoerg            *__vec = isascii(*__low) ? __tab_[static_cast<int>(*__low)] : 0;
645*4d6fc14bSjoerg        return __low;
646*4d6fc14bSjoerg    }
647*4d6fc14bSjoerg
648*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
649*4d6fc14bSjoerg    const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const
650*4d6fc14bSjoerg    {
651*4d6fc14bSjoerg        for (; __low != __high; ++__low)
652*4d6fc14bSjoerg            if (isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))
653*4d6fc14bSjoerg                break;
654*4d6fc14bSjoerg        return __low;
655*4d6fc14bSjoerg    }
656*4d6fc14bSjoerg
657*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
658*4d6fc14bSjoerg    const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
659*4d6fc14bSjoerg    {
660*4d6fc14bSjoerg        for (; __low != __high; ++__low)
661*4d6fc14bSjoerg            if (!(isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m)))
662*4d6fc14bSjoerg                break;
663*4d6fc14bSjoerg        return __low;
664*4d6fc14bSjoerg    }
665*4d6fc14bSjoerg
666*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
667*4d6fc14bSjoerg    char_type toupper(char_type __c) const
668*4d6fc14bSjoerg    {
669*4d6fc14bSjoerg        return do_toupper(__c);
670*4d6fc14bSjoerg    }
671*4d6fc14bSjoerg
672*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
673*4d6fc14bSjoerg    const char_type* toupper(char_type* __low, const char_type* __high) const
674*4d6fc14bSjoerg    {
675*4d6fc14bSjoerg        return do_toupper(__low, __high);
676*4d6fc14bSjoerg    }
677*4d6fc14bSjoerg
678*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
679*4d6fc14bSjoerg    char_type tolower(char_type __c) const
680*4d6fc14bSjoerg    {
681*4d6fc14bSjoerg        return do_tolower(__c);
682*4d6fc14bSjoerg    }
683*4d6fc14bSjoerg
684*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
685*4d6fc14bSjoerg    const char_type* tolower(char_type* __low, const char_type* __high) const
686*4d6fc14bSjoerg    {
687*4d6fc14bSjoerg        return do_tolower(__low, __high);
688*4d6fc14bSjoerg    }
689*4d6fc14bSjoerg
690*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
691*4d6fc14bSjoerg    char_type widen(char __c) const
692*4d6fc14bSjoerg    {
693*4d6fc14bSjoerg        return do_widen(__c);
694*4d6fc14bSjoerg    }
695*4d6fc14bSjoerg
696*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
697*4d6fc14bSjoerg    const char* widen(const char* __low, const char* __high, char_type* __to) const
698*4d6fc14bSjoerg    {
699*4d6fc14bSjoerg        return do_widen(__low, __high, __to);
700*4d6fc14bSjoerg    }
701*4d6fc14bSjoerg
702*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
703*4d6fc14bSjoerg    char narrow(char_type __c, char __dfault) const
704*4d6fc14bSjoerg    {
705*4d6fc14bSjoerg        return do_narrow(__c, __dfault);
706*4d6fc14bSjoerg    }
707*4d6fc14bSjoerg
708*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
709*4d6fc14bSjoerg    const char* narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const
710*4d6fc14bSjoerg    {
711*4d6fc14bSjoerg        return do_narrow(__low, __high, __dfault, __to);
712*4d6fc14bSjoerg    }
713*4d6fc14bSjoerg
714*4d6fc14bSjoerg    static locale::id id;
715*4d6fc14bSjoerg
716*4d6fc14bSjoerg#ifdef _CACHED_RUNES
717*4d6fc14bSjoerg    static const size_t table_size = _CACHED_RUNES;
718*4d6fc14bSjoerg#else
719*4d6fc14bSjoerg    static const size_t table_size = 256;  // FIXME: Don't hardcode this.
720*4d6fc14bSjoerg#endif
721*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY const mask* table() const  _NOEXCEPT {return __tab_;}
722*4d6fc14bSjoerg    static const mask* classic_table()  _NOEXCEPT;
723*4d6fc14bSjoerg#if defined(__GLIBC__) || defined(__EMSCRIPTEN__)
724*4d6fc14bSjoerg    static const int* __classic_upper_table() _NOEXCEPT;
725*4d6fc14bSjoerg    static const int* __classic_lower_table() _NOEXCEPT;
726*4d6fc14bSjoerg#endif
727*4d6fc14bSjoerg#if defined(__NetBSD__)
728*4d6fc14bSjoerg    static const short* __classic_upper_table() _NOEXCEPT;
729*4d6fc14bSjoerg    static const short* __classic_lower_table() _NOEXCEPT;
730*4d6fc14bSjoerg#endif
731*4d6fc14bSjoerg
732*4d6fc14bSjoergprotected:
733*4d6fc14bSjoerg    ~ctype();
734*4d6fc14bSjoerg    virtual char_type do_toupper(char_type __c) const;
735*4d6fc14bSjoerg    virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
736*4d6fc14bSjoerg    virtual char_type do_tolower(char_type __c) const;
737*4d6fc14bSjoerg    virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
738*4d6fc14bSjoerg    virtual char_type do_widen(char __c) const;
739*4d6fc14bSjoerg    virtual const char* do_widen(const char* __low, const char* __high, char_type* __to) const;
740*4d6fc14bSjoerg    virtual char do_narrow(char_type __c, char __dfault) const;
741*4d6fc14bSjoerg    virtual const char* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const;
742*4d6fc14bSjoerg};
743*4d6fc14bSjoerg
744*4d6fc14bSjoerg// template <class CharT> class ctype_byname;
745*4d6fc14bSjoerg
746*4d6fc14bSjoergtemplate <class _CharT> class _LIBCPP_TEMPLATE_VIS ctype_byname;
747*4d6fc14bSjoerg
748*4d6fc14bSjoergtemplate <>
749*4d6fc14bSjoergclass _LIBCPP_TYPE_VIS ctype_byname<char>
750*4d6fc14bSjoerg    : public ctype<char>
751*4d6fc14bSjoerg{
752*4d6fc14bSjoerg    locale_t __l;
753*4d6fc14bSjoerg
754*4d6fc14bSjoergpublic:
755*4d6fc14bSjoerg    explicit ctype_byname(const char*, size_t = 0);
756*4d6fc14bSjoerg    explicit ctype_byname(const string&, size_t = 0);
757*4d6fc14bSjoerg
758*4d6fc14bSjoergprotected:
759*4d6fc14bSjoerg    ~ctype_byname();
760*4d6fc14bSjoerg    virtual char_type do_toupper(char_type) const;
761*4d6fc14bSjoerg    virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
762*4d6fc14bSjoerg    virtual char_type do_tolower(char_type) const;
763*4d6fc14bSjoerg    virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
764*4d6fc14bSjoerg};
765*4d6fc14bSjoerg
766*4d6fc14bSjoergtemplate <>
767*4d6fc14bSjoergclass _LIBCPP_TYPE_VIS ctype_byname<wchar_t>
768*4d6fc14bSjoerg    : public ctype<wchar_t>
769*4d6fc14bSjoerg{
770*4d6fc14bSjoerg    locale_t __l;
771*4d6fc14bSjoerg
772*4d6fc14bSjoergpublic:
773*4d6fc14bSjoerg    explicit ctype_byname(const char*, size_t = 0);
774*4d6fc14bSjoerg    explicit ctype_byname(const string&, size_t = 0);
775*4d6fc14bSjoerg
776*4d6fc14bSjoergprotected:
777*4d6fc14bSjoerg    ~ctype_byname();
778*4d6fc14bSjoerg    virtual bool do_is(mask __m, char_type __c) const;
779*4d6fc14bSjoerg    virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const;
780*4d6fc14bSjoerg    virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const;
781*4d6fc14bSjoerg    virtual const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const;
782*4d6fc14bSjoerg    virtual char_type do_toupper(char_type) const;
783*4d6fc14bSjoerg    virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
784*4d6fc14bSjoerg    virtual char_type do_tolower(char_type) const;
785*4d6fc14bSjoerg    virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
786*4d6fc14bSjoerg    virtual char_type do_widen(char) const;
787*4d6fc14bSjoerg    virtual const char* do_widen(const char* __low, const char* __high, char_type* __dest) const;
788*4d6fc14bSjoerg    virtual char do_narrow(char_type, char __dfault) const;
789*4d6fc14bSjoerg    virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const;
790*4d6fc14bSjoerg};
791*4d6fc14bSjoerg
792*4d6fc14bSjoergtemplate <class _CharT>
793*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY
794*4d6fc14bSjoergbool
795*4d6fc14bSjoergisspace(_CharT __c, const locale& __loc)
796*4d6fc14bSjoerg{
797*4d6fc14bSjoerg    return use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c);
798*4d6fc14bSjoerg}
799*4d6fc14bSjoerg
800*4d6fc14bSjoergtemplate <class _CharT>
801*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY
802*4d6fc14bSjoergbool
803*4d6fc14bSjoergisprint(_CharT __c, const locale& __loc)
804*4d6fc14bSjoerg{
805*4d6fc14bSjoerg    return use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c);
806*4d6fc14bSjoerg}
807*4d6fc14bSjoerg
808*4d6fc14bSjoergtemplate <class _CharT>
809*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY
810*4d6fc14bSjoergbool
811*4d6fc14bSjoergiscntrl(_CharT __c, const locale& __loc)
812*4d6fc14bSjoerg{
813*4d6fc14bSjoerg    return use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c);
814*4d6fc14bSjoerg}
815*4d6fc14bSjoerg
816*4d6fc14bSjoergtemplate <class _CharT>
817*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY
818*4d6fc14bSjoergbool
819*4d6fc14bSjoergisupper(_CharT __c, const locale& __loc)
820*4d6fc14bSjoerg{
821*4d6fc14bSjoerg    return use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c);
822*4d6fc14bSjoerg}
823*4d6fc14bSjoerg
824*4d6fc14bSjoergtemplate <class _CharT>
825*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY
826*4d6fc14bSjoergbool
827*4d6fc14bSjoergislower(_CharT __c, const locale& __loc)
828*4d6fc14bSjoerg{
829*4d6fc14bSjoerg    return use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c);
830*4d6fc14bSjoerg}
831*4d6fc14bSjoerg
832*4d6fc14bSjoergtemplate <class _CharT>
833*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY
834*4d6fc14bSjoergbool
835*4d6fc14bSjoergisalpha(_CharT __c, const locale& __loc)
836*4d6fc14bSjoerg{
837*4d6fc14bSjoerg    return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c);
838*4d6fc14bSjoerg}
839*4d6fc14bSjoerg
840*4d6fc14bSjoergtemplate <class _CharT>
841*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY
842*4d6fc14bSjoergbool
843*4d6fc14bSjoergisdigit(_CharT __c, const locale& __loc)
844*4d6fc14bSjoerg{
845*4d6fc14bSjoerg    return use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c);
846*4d6fc14bSjoerg}
847*4d6fc14bSjoerg
848*4d6fc14bSjoergtemplate <class _CharT>
849*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY
850*4d6fc14bSjoergbool
851*4d6fc14bSjoergispunct(_CharT __c, const locale& __loc)
852*4d6fc14bSjoerg{
853*4d6fc14bSjoerg    return use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c);
854*4d6fc14bSjoerg}
855*4d6fc14bSjoerg
856*4d6fc14bSjoergtemplate <class _CharT>
857*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY
858*4d6fc14bSjoergbool
859*4d6fc14bSjoergisxdigit(_CharT __c, const locale& __loc)
860*4d6fc14bSjoerg{
861*4d6fc14bSjoerg    return use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c);
862*4d6fc14bSjoerg}
863*4d6fc14bSjoerg
864*4d6fc14bSjoergtemplate <class _CharT>
865*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY
866*4d6fc14bSjoergbool
867*4d6fc14bSjoergisalnum(_CharT __c, const locale& __loc)
868*4d6fc14bSjoerg{
869*4d6fc14bSjoerg    return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c);
870*4d6fc14bSjoerg}
871*4d6fc14bSjoerg
872*4d6fc14bSjoergtemplate <class _CharT>
873*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY
874*4d6fc14bSjoergbool
875*4d6fc14bSjoergisgraph(_CharT __c, const locale& __loc)
876*4d6fc14bSjoerg{
877*4d6fc14bSjoerg    return use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c);
878*4d6fc14bSjoerg}
879*4d6fc14bSjoerg
880*4d6fc14bSjoergtemplate <class _CharT>
881*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY
882*4d6fc14bSjoerg_CharT
883*4d6fc14bSjoergtoupper(_CharT __c, const locale& __loc)
884*4d6fc14bSjoerg{
885*4d6fc14bSjoerg    return use_facet<ctype<_CharT> >(__loc).toupper(__c);
886*4d6fc14bSjoerg}
887*4d6fc14bSjoerg
888*4d6fc14bSjoergtemplate <class _CharT>
889*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY
890*4d6fc14bSjoerg_CharT
891*4d6fc14bSjoergtolower(_CharT __c, const locale& __loc)
892*4d6fc14bSjoerg{
893*4d6fc14bSjoerg    return use_facet<ctype<_CharT> >(__loc).tolower(__c);
894*4d6fc14bSjoerg}
895*4d6fc14bSjoerg
896*4d6fc14bSjoerg// codecvt_base
897*4d6fc14bSjoerg
898*4d6fc14bSjoergclass _LIBCPP_TYPE_VIS codecvt_base
899*4d6fc14bSjoerg{
900*4d6fc14bSjoergpublic:
901*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY codecvt_base() {}
902*4d6fc14bSjoerg    enum result {ok, partial, error, noconv};
903*4d6fc14bSjoerg};
904*4d6fc14bSjoerg
905*4d6fc14bSjoerg// template <class internT, class externT, class stateT> class codecvt;
906*4d6fc14bSjoerg
907*4d6fc14bSjoergtemplate <class _InternT, class _ExternT, class _StateT> class _LIBCPP_TEMPLATE_VIS codecvt;
908*4d6fc14bSjoerg
909*4d6fc14bSjoerg// template <> class codecvt<char, char, mbstate_t>
910*4d6fc14bSjoerg
911*4d6fc14bSjoergtemplate <>
912*4d6fc14bSjoergclass _LIBCPP_TYPE_VIS codecvt<char, char, mbstate_t>
913*4d6fc14bSjoerg    : public locale::facet,
914*4d6fc14bSjoerg      public codecvt_base
915*4d6fc14bSjoerg{
916*4d6fc14bSjoergpublic:
917*4d6fc14bSjoerg    typedef char      intern_type;
918*4d6fc14bSjoerg    typedef char      extern_type;
919*4d6fc14bSjoerg    typedef mbstate_t state_type;
920*4d6fc14bSjoerg
921*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
922*4d6fc14bSjoerg    explicit codecvt(size_t __refs = 0)
923*4d6fc14bSjoerg        : locale::facet(__refs) {}
924*4d6fc14bSjoerg
925*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
926*4d6fc14bSjoerg    result out(state_type& __st,
927*4d6fc14bSjoerg               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
928*4d6fc14bSjoerg               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
929*4d6fc14bSjoerg    {
930*4d6fc14bSjoerg        return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
931*4d6fc14bSjoerg    }
932*4d6fc14bSjoerg
933*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
934*4d6fc14bSjoerg    result unshift(state_type& __st,
935*4d6fc14bSjoerg                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
936*4d6fc14bSjoerg    {
937*4d6fc14bSjoerg        return do_unshift(__st, __to, __to_end, __to_nxt);
938*4d6fc14bSjoerg    }
939*4d6fc14bSjoerg
940*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
941*4d6fc14bSjoerg    result in(state_type& __st,
942*4d6fc14bSjoerg              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
943*4d6fc14bSjoerg              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
944*4d6fc14bSjoerg    {
945*4d6fc14bSjoerg        return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
946*4d6fc14bSjoerg    }
947*4d6fc14bSjoerg
948*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
949*4d6fc14bSjoerg    int encoding() const  _NOEXCEPT
950*4d6fc14bSjoerg    {
951*4d6fc14bSjoerg        return do_encoding();
952*4d6fc14bSjoerg    }
953*4d6fc14bSjoerg
954*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
955*4d6fc14bSjoerg    bool always_noconv() const  _NOEXCEPT
956*4d6fc14bSjoerg    {
957*4d6fc14bSjoerg        return do_always_noconv();
958*4d6fc14bSjoerg    }
959*4d6fc14bSjoerg
960*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
961*4d6fc14bSjoerg    int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
962*4d6fc14bSjoerg    {
963*4d6fc14bSjoerg        return do_length(__st, __frm, __end, __mx);
964*4d6fc14bSjoerg    }
965*4d6fc14bSjoerg
966*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
967*4d6fc14bSjoerg    int max_length() const  _NOEXCEPT
968*4d6fc14bSjoerg    {
969*4d6fc14bSjoerg        return do_max_length();
970*4d6fc14bSjoerg    }
971*4d6fc14bSjoerg
972*4d6fc14bSjoerg    static locale::id id;
973*4d6fc14bSjoerg
974*4d6fc14bSjoergprotected:
975*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
976*4d6fc14bSjoerg    explicit codecvt(const char*, size_t __refs = 0)
977*4d6fc14bSjoerg        : locale::facet(__refs) {}
978*4d6fc14bSjoerg
979*4d6fc14bSjoerg    ~codecvt();
980*4d6fc14bSjoerg
981*4d6fc14bSjoerg    virtual result do_out(state_type& __st,
982*4d6fc14bSjoerg                          const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
983*4d6fc14bSjoerg                          extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
984*4d6fc14bSjoerg    virtual result do_in(state_type& __st,
985*4d6fc14bSjoerg                         const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
986*4d6fc14bSjoerg                         intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
987*4d6fc14bSjoerg    virtual result do_unshift(state_type& __st,
988*4d6fc14bSjoerg                              extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
989*4d6fc14bSjoerg    virtual int do_encoding() const  _NOEXCEPT;
990*4d6fc14bSjoerg    virtual bool do_always_noconv() const  _NOEXCEPT;
991*4d6fc14bSjoerg    virtual int do_length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
992*4d6fc14bSjoerg    virtual int do_max_length() const  _NOEXCEPT;
993*4d6fc14bSjoerg};
994*4d6fc14bSjoerg
995*4d6fc14bSjoerg// template <> class codecvt<wchar_t, char, mbstate_t>
996*4d6fc14bSjoerg
997*4d6fc14bSjoergtemplate <>
998*4d6fc14bSjoergclass _LIBCPP_TYPE_VIS codecvt<wchar_t, char, mbstate_t>
999*4d6fc14bSjoerg    : public locale::facet,
1000*4d6fc14bSjoerg      public codecvt_base
1001*4d6fc14bSjoerg{
1002*4d6fc14bSjoerg    locale_t __l;
1003*4d6fc14bSjoergpublic:
1004*4d6fc14bSjoerg    typedef wchar_t   intern_type;
1005*4d6fc14bSjoerg    typedef char      extern_type;
1006*4d6fc14bSjoerg    typedef mbstate_t state_type;
1007*4d6fc14bSjoerg
1008*4d6fc14bSjoerg    explicit codecvt(size_t __refs = 0);
1009*4d6fc14bSjoerg
1010*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1011*4d6fc14bSjoerg    result out(state_type& __st,
1012*4d6fc14bSjoerg               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
1013*4d6fc14bSjoerg               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
1014*4d6fc14bSjoerg    {
1015*4d6fc14bSjoerg        return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
1016*4d6fc14bSjoerg    }
1017*4d6fc14bSjoerg
1018*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1019*4d6fc14bSjoerg    result unshift(state_type& __st,
1020*4d6fc14bSjoerg                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
1021*4d6fc14bSjoerg    {
1022*4d6fc14bSjoerg        return do_unshift(__st, __to, __to_end, __to_nxt);
1023*4d6fc14bSjoerg    }
1024*4d6fc14bSjoerg
1025*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1026*4d6fc14bSjoerg    result in(state_type& __st,
1027*4d6fc14bSjoerg              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
1028*4d6fc14bSjoerg              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
1029*4d6fc14bSjoerg    {
1030*4d6fc14bSjoerg        return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
1031*4d6fc14bSjoerg    }
1032*4d6fc14bSjoerg
1033*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1034*4d6fc14bSjoerg    int encoding() const  _NOEXCEPT
1035*4d6fc14bSjoerg    {
1036*4d6fc14bSjoerg        return do_encoding();
1037*4d6fc14bSjoerg    }
1038*4d6fc14bSjoerg
1039*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1040*4d6fc14bSjoerg    bool always_noconv() const  _NOEXCEPT
1041*4d6fc14bSjoerg    {
1042*4d6fc14bSjoerg        return do_always_noconv();
1043*4d6fc14bSjoerg    }
1044*4d6fc14bSjoerg
1045*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1046*4d6fc14bSjoerg    int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
1047*4d6fc14bSjoerg    {
1048*4d6fc14bSjoerg        return do_length(__st, __frm, __end, __mx);
1049*4d6fc14bSjoerg    }
1050*4d6fc14bSjoerg
1051*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1052*4d6fc14bSjoerg    int max_length() const  _NOEXCEPT
1053*4d6fc14bSjoerg    {
1054*4d6fc14bSjoerg        return do_max_length();
1055*4d6fc14bSjoerg    }
1056*4d6fc14bSjoerg
1057*4d6fc14bSjoerg    static locale::id id;
1058*4d6fc14bSjoerg
1059*4d6fc14bSjoergprotected:
1060*4d6fc14bSjoerg    explicit codecvt(const char*, size_t __refs = 0);
1061*4d6fc14bSjoerg
1062*4d6fc14bSjoerg    ~codecvt();
1063*4d6fc14bSjoerg
1064*4d6fc14bSjoerg    virtual result do_out(state_type& __st,
1065*4d6fc14bSjoerg                          const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
1066*4d6fc14bSjoerg                          extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
1067*4d6fc14bSjoerg    virtual result do_in(state_type& __st,
1068*4d6fc14bSjoerg                         const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
1069*4d6fc14bSjoerg                         intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
1070*4d6fc14bSjoerg    virtual result do_unshift(state_type& __st,
1071*4d6fc14bSjoerg                              extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
1072*4d6fc14bSjoerg    virtual int do_encoding() const  _NOEXCEPT;
1073*4d6fc14bSjoerg    virtual bool do_always_noconv() const  _NOEXCEPT;
1074*4d6fc14bSjoerg    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
1075*4d6fc14bSjoerg    virtual int do_max_length() const  _NOEXCEPT;
1076*4d6fc14bSjoerg};
1077*4d6fc14bSjoerg
1078*4d6fc14bSjoerg// template <> class codecvt<char16_t, char, mbstate_t> // deprecated in C++20
1079*4d6fc14bSjoerg
1080*4d6fc14bSjoergtemplate <>
1081*4d6fc14bSjoergclass _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_TYPE_VIS codecvt<char16_t, char, mbstate_t>
1082*4d6fc14bSjoerg    : public locale::facet,
1083*4d6fc14bSjoerg      public codecvt_base
1084*4d6fc14bSjoerg{
1085*4d6fc14bSjoergpublic:
1086*4d6fc14bSjoerg    typedef char16_t  intern_type;
1087*4d6fc14bSjoerg    typedef char      extern_type;
1088*4d6fc14bSjoerg    typedef mbstate_t state_type;
1089*4d6fc14bSjoerg
1090*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1091*4d6fc14bSjoerg    explicit codecvt(size_t __refs = 0)
1092*4d6fc14bSjoerg        : locale::facet(__refs) {}
1093*4d6fc14bSjoerg
1094*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1095*4d6fc14bSjoerg    result out(state_type& __st,
1096*4d6fc14bSjoerg               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
1097*4d6fc14bSjoerg               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
1098*4d6fc14bSjoerg    {
1099*4d6fc14bSjoerg        return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
1100*4d6fc14bSjoerg    }
1101*4d6fc14bSjoerg
1102*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1103*4d6fc14bSjoerg    result unshift(state_type& __st,
1104*4d6fc14bSjoerg                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
1105*4d6fc14bSjoerg    {
1106*4d6fc14bSjoerg        return do_unshift(__st, __to, __to_end, __to_nxt);
1107*4d6fc14bSjoerg    }
1108*4d6fc14bSjoerg
1109*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1110*4d6fc14bSjoerg    result in(state_type& __st,
1111*4d6fc14bSjoerg              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
1112*4d6fc14bSjoerg              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
1113*4d6fc14bSjoerg    {
1114*4d6fc14bSjoerg        return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
1115*4d6fc14bSjoerg    }
1116*4d6fc14bSjoerg
1117*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1118*4d6fc14bSjoerg    int encoding() const  _NOEXCEPT
1119*4d6fc14bSjoerg    {
1120*4d6fc14bSjoerg        return do_encoding();
1121*4d6fc14bSjoerg    }
1122*4d6fc14bSjoerg
1123*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1124*4d6fc14bSjoerg    bool always_noconv() const  _NOEXCEPT
1125*4d6fc14bSjoerg    {
1126*4d6fc14bSjoerg        return do_always_noconv();
1127*4d6fc14bSjoerg    }
1128*4d6fc14bSjoerg
1129*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1130*4d6fc14bSjoerg    int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
1131*4d6fc14bSjoerg    {
1132*4d6fc14bSjoerg        return do_length(__st, __frm, __end, __mx);
1133*4d6fc14bSjoerg    }
1134*4d6fc14bSjoerg
1135*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1136*4d6fc14bSjoerg    int max_length() const  _NOEXCEPT
1137*4d6fc14bSjoerg    {
1138*4d6fc14bSjoerg        return do_max_length();
1139*4d6fc14bSjoerg    }
1140*4d6fc14bSjoerg
1141*4d6fc14bSjoerg    static locale::id id;
1142*4d6fc14bSjoerg
1143*4d6fc14bSjoergprotected:
1144*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1145*4d6fc14bSjoerg    explicit codecvt(const char*, size_t __refs = 0)
1146*4d6fc14bSjoerg        : locale::facet(__refs) {}
1147*4d6fc14bSjoerg
1148*4d6fc14bSjoerg    ~codecvt();
1149*4d6fc14bSjoerg
1150*4d6fc14bSjoerg    virtual result do_out(state_type& __st,
1151*4d6fc14bSjoerg                          const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
1152*4d6fc14bSjoerg                          extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
1153*4d6fc14bSjoerg    virtual result do_in(state_type& __st,
1154*4d6fc14bSjoerg                         const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
1155*4d6fc14bSjoerg                         intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
1156*4d6fc14bSjoerg    virtual result do_unshift(state_type& __st,
1157*4d6fc14bSjoerg                              extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
1158*4d6fc14bSjoerg    virtual int do_encoding() const  _NOEXCEPT;
1159*4d6fc14bSjoerg    virtual bool do_always_noconv() const  _NOEXCEPT;
1160*4d6fc14bSjoerg    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
1161*4d6fc14bSjoerg    virtual int do_max_length() const  _NOEXCEPT;
1162*4d6fc14bSjoerg};
1163*4d6fc14bSjoerg
1164*4d6fc14bSjoerg#ifndef _LIBCPP_HAS_NO_CHAR8_T
1165*4d6fc14bSjoerg
1166*4d6fc14bSjoerg// template <> class codecvt<char16_t, char8_t, mbstate_t> // C++20
1167*4d6fc14bSjoerg
1168*4d6fc14bSjoergtemplate <>
1169*4d6fc14bSjoergclass _LIBCPP_TYPE_VIS codecvt<char16_t, char8_t, mbstate_t>
1170*4d6fc14bSjoerg    : public locale::facet,
1171*4d6fc14bSjoerg      public codecvt_base
1172*4d6fc14bSjoerg{
1173*4d6fc14bSjoergpublic:
1174*4d6fc14bSjoerg    typedef char16_t  intern_type;
1175*4d6fc14bSjoerg    typedef char8_t   extern_type;
1176*4d6fc14bSjoerg    typedef mbstate_t state_type;
1177*4d6fc14bSjoerg
1178*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1179*4d6fc14bSjoerg    explicit codecvt(size_t __refs = 0)
1180*4d6fc14bSjoerg        : locale::facet(__refs) {}
1181*4d6fc14bSjoerg
1182*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1183*4d6fc14bSjoerg    result out(state_type& __st,
1184*4d6fc14bSjoerg               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
1185*4d6fc14bSjoerg               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
1186*4d6fc14bSjoerg    {
1187*4d6fc14bSjoerg        return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
1188*4d6fc14bSjoerg    }
1189*4d6fc14bSjoerg
1190*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1191*4d6fc14bSjoerg    result unshift(state_type& __st,
1192*4d6fc14bSjoerg                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
1193*4d6fc14bSjoerg    {
1194*4d6fc14bSjoerg        return do_unshift(__st, __to, __to_end, __to_nxt);
1195*4d6fc14bSjoerg    }
1196*4d6fc14bSjoerg
1197*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1198*4d6fc14bSjoerg    result in(state_type& __st,
1199*4d6fc14bSjoerg              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
1200*4d6fc14bSjoerg              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
1201*4d6fc14bSjoerg    {
1202*4d6fc14bSjoerg        return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
1203*4d6fc14bSjoerg    }
1204*4d6fc14bSjoerg
1205*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1206*4d6fc14bSjoerg    int encoding() const  _NOEXCEPT
1207*4d6fc14bSjoerg    {
1208*4d6fc14bSjoerg        return do_encoding();
1209*4d6fc14bSjoerg    }
1210*4d6fc14bSjoerg
1211*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1212*4d6fc14bSjoerg    bool always_noconv() const  _NOEXCEPT
1213*4d6fc14bSjoerg    {
1214*4d6fc14bSjoerg        return do_always_noconv();
1215*4d6fc14bSjoerg    }
1216*4d6fc14bSjoerg
1217*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1218*4d6fc14bSjoerg    int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
1219*4d6fc14bSjoerg    {
1220*4d6fc14bSjoerg        return do_length(__st, __frm, __end, __mx);
1221*4d6fc14bSjoerg    }
1222*4d6fc14bSjoerg
1223*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1224*4d6fc14bSjoerg    int max_length() const  _NOEXCEPT
1225*4d6fc14bSjoerg    {
1226*4d6fc14bSjoerg        return do_max_length();
1227*4d6fc14bSjoerg    }
1228*4d6fc14bSjoerg
1229*4d6fc14bSjoerg    static locale::id id;
1230*4d6fc14bSjoerg
1231*4d6fc14bSjoergprotected:
1232*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1233*4d6fc14bSjoerg    explicit codecvt(const char*, size_t __refs = 0)
1234*4d6fc14bSjoerg        : locale::facet(__refs) {}
1235*4d6fc14bSjoerg
1236*4d6fc14bSjoerg    ~codecvt();
1237*4d6fc14bSjoerg
1238*4d6fc14bSjoerg    virtual result do_out(state_type& __st,
1239*4d6fc14bSjoerg                          const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
1240*4d6fc14bSjoerg                          extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
1241*4d6fc14bSjoerg    virtual result do_in(state_type& __st,
1242*4d6fc14bSjoerg                         const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
1243*4d6fc14bSjoerg                         intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
1244*4d6fc14bSjoerg    virtual result do_unshift(state_type& __st,
1245*4d6fc14bSjoerg                              extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
1246*4d6fc14bSjoerg    virtual int do_encoding() const  _NOEXCEPT;
1247*4d6fc14bSjoerg    virtual bool do_always_noconv() const  _NOEXCEPT;
1248*4d6fc14bSjoerg    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
1249*4d6fc14bSjoerg    virtual int do_max_length() const  _NOEXCEPT;
1250*4d6fc14bSjoerg};
1251*4d6fc14bSjoerg
1252*4d6fc14bSjoerg#endif
1253*4d6fc14bSjoerg
1254*4d6fc14bSjoerg// template <> class codecvt<char32_t, char, mbstate_t> // deprecated in C++20
1255*4d6fc14bSjoerg
1256*4d6fc14bSjoergtemplate <>
1257*4d6fc14bSjoergclass _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_TYPE_VIS codecvt<char32_t, char, mbstate_t>
1258*4d6fc14bSjoerg    : public locale::facet,
1259*4d6fc14bSjoerg      public codecvt_base
1260*4d6fc14bSjoerg{
1261*4d6fc14bSjoergpublic:
1262*4d6fc14bSjoerg    typedef char32_t  intern_type;
1263*4d6fc14bSjoerg    typedef char      extern_type;
1264*4d6fc14bSjoerg    typedef mbstate_t state_type;
1265*4d6fc14bSjoerg
1266*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1267*4d6fc14bSjoerg    explicit codecvt(size_t __refs = 0)
1268*4d6fc14bSjoerg        : locale::facet(__refs) {}
1269*4d6fc14bSjoerg
1270*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1271*4d6fc14bSjoerg    result out(state_type& __st,
1272*4d6fc14bSjoerg               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
1273*4d6fc14bSjoerg               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
1274*4d6fc14bSjoerg    {
1275*4d6fc14bSjoerg        return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
1276*4d6fc14bSjoerg    }
1277*4d6fc14bSjoerg
1278*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1279*4d6fc14bSjoerg    result unshift(state_type& __st,
1280*4d6fc14bSjoerg                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
1281*4d6fc14bSjoerg    {
1282*4d6fc14bSjoerg        return do_unshift(__st, __to, __to_end, __to_nxt);
1283*4d6fc14bSjoerg    }
1284*4d6fc14bSjoerg
1285*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1286*4d6fc14bSjoerg    result in(state_type& __st,
1287*4d6fc14bSjoerg              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
1288*4d6fc14bSjoerg              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
1289*4d6fc14bSjoerg    {
1290*4d6fc14bSjoerg        return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
1291*4d6fc14bSjoerg    }
1292*4d6fc14bSjoerg
1293*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1294*4d6fc14bSjoerg    int encoding() const  _NOEXCEPT
1295*4d6fc14bSjoerg    {
1296*4d6fc14bSjoerg        return do_encoding();
1297*4d6fc14bSjoerg    }
1298*4d6fc14bSjoerg
1299*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1300*4d6fc14bSjoerg    bool always_noconv() const  _NOEXCEPT
1301*4d6fc14bSjoerg    {
1302*4d6fc14bSjoerg        return do_always_noconv();
1303*4d6fc14bSjoerg    }
1304*4d6fc14bSjoerg
1305*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1306*4d6fc14bSjoerg    int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
1307*4d6fc14bSjoerg    {
1308*4d6fc14bSjoerg        return do_length(__st, __frm, __end, __mx);
1309*4d6fc14bSjoerg    }
1310*4d6fc14bSjoerg
1311*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1312*4d6fc14bSjoerg    int max_length() const  _NOEXCEPT
1313*4d6fc14bSjoerg    {
1314*4d6fc14bSjoerg        return do_max_length();
1315*4d6fc14bSjoerg    }
1316*4d6fc14bSjoerg
1317*4d6fc14bSjoerg    static locale::id id;
1318*4d6fc14bSjoerg
1319*4d6fc14bSjoergprotected:
1320*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1321*4d6fc14bSjoerg    explicit codecvt(const char*, size_t __refs = 0)
1322*4d6fc14bSjoerg        : locale::facet(__refs) {}
1323*4d6fc14bSjoerg
1324*4d6fc14bSjoerg    ~codecvt();
1325*4d6fc14bSjoerg
1326*4d6fc14bSjoerg    virtual result do_out(state_type& __st,
1327*4d6fc14bSjoerg                          const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
1328*4d6fc14bSjoerg                          extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
1329*4d6fc14bSjoerg    virtual result do_in(state_type& __st,
1330*4d6fc14bSjoerg                         const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
1331*4d6fc14bSjoerg                         intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
1332*4d6fc14bSjoerg    virtual result do_unshift(state_type& __st,
1333*4d6fc14bSjoerg                              extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
1334*4d6fc14bSjoerg    virtual int do_encoding() const  _NOEXCEPT;
1335*4d6fc14bSjoerg    virtual bool do_always_noconv() const  _NOEXCEPT;
1336*4d6fc14bSjoerg    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
1337*4d6fc14bSjoerg    virtual int do_max_length() const  _NOEXCEPT;
1338*4d6fc14bSjoerg};
1339*4d6fc14bSjoerg
1340*4d6fc14bSjoerg#ifndef _LIBCPP_HAS_NO_CHAR8_T
1341*4d6fc14bSjoerg
1342*4d6fc14bSjoerg// template <> class codecvt<char32_t, char8_t, mbstate_t> // C++20
1343*4d6fc14bSjoerg
1344*4d6fc14bSjoergtemplate <>
1345*4d6fc14bSjoergclass _LIBCPP_TYPE_VIS codecvt<char32_t, char8_t, mbstate_t>
1346*4d6fc14bSjoerg    : public locale::facet,
1347*4d6fc14bSjoerg      public codecvt_base
1348*4d6fc14bSjoerg{
1349*4d6fc14bSjoergpublic:
1350*4d6fc14bSjoerg    typedef char32_t  intern_type;
1351*4d6fc14bSjoerg    typedef char8_t   extern_type;
1352*4d6fc14bSjoerg    typedef mbstate_t state_type;
1353*4d6fc14bSjoerg
1354*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1355*4d6fc14bSjoerg    explicit codecvt(size_t __refs = 0)
1356*4d6fc14bSjoerg        : locale::facet(__refs) {}
1357*4d6fc14bSjoerg
1358*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1359*4d6fc14bSjoerg    result out(state_type& __st,
1360*4d6fc14bSjoerg               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
1361*4d6fc14bSjoerg               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
1362*4d6fc14bSjoerg    {
1363*4d6fc14bSjoerg        return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
1364*4d6fc14bSjoerg    }
1365*4d6fc14bSjoerg
1366*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1367*4d6fc14bSjoerg    result unshift(state_type& __st,
1368*4d6fc14bSjoerg                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
1369*4d6fc14bSjoerg    {
1370*4d6fc14bSjoerg        return do_unshift(__st, __to, __to_end, __to_nxt);
1371*4d6fc14bSjoerg    }
1372*4d6fc14bSjoerg
1373*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1374*4d6fc14bSjoerg    result in(state_type& __st,
1375*4d6fc14bSjoerg              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
1376*4d6fc14bSjoerg              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
1377*4d6fc14bSjoerg    {
1378*4d6fc14bSjoerg        return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
1379*4d6fc14bSjoerg    }
1380*4d6fc14bSjoerg
1381*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1382*4d6fc14bSjoerg    int encoding() const  _NOEXCEPT
1383*4d6fc14bSjoerg    {
1384*4d6fc14bSjoerg        return do_encoding();
1385*4d6fc14bSjoerg    }
1386*4d6fc14bSjoerg
1387*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1388*4d6fc14bSjoerg    bool always_noconv() const  _NOEXCEPT
1389*4d6fc14bSjoerg    {
1390*4d6fc14bSjoerg        return do_always_noconv();
1391*4d6fc14bSjoerg    }
1392*4d6fc14bSjoerg
1393*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1394*4d6fc14bSjoerg    int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
1395*4d6fc14bSjoerg    {
1396*4d6fc14bSjoerg        return do_length(__st, __frm, __end, __mx);
1397*4d6fc14bSjoerg    }
1398*4d6fc14bSjoerg
1399*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1400*4d6fc14bSjoerg    int max_length() const  _NOEXCEPT
1401*4d6fc14bSjoerg    {
1402*4d6fc14bSjoerg        return do_max_length();
1403*4d6fc14bSjoerg    }
1404*4d6fc14bSjoerg
1405*4d6fc14bSjoerg    static locale::id id;
1406*4d6fc14bSjoerg
1407*4d6fc14bSjoergprotected:
1408*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1409*4d6fc14bSjoerg    explicit codecvt(const char*, size_t __refs = 0)
1410*4d6fc14bSjoerg        : locale::facet(__refs) {}
1411*4d6fc14bSjoerg
1412*4d6fc14bSjoerg    ~codecvt();
1413*4d6fc14bSjoerg
1414*4d6fc14bSjoerg    virtual result do_out(state_type& __st,
1415*4d6fc14bSjoerg                          const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
1416*4d6fc14bSjoerg                          extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
1417*4d6fc14bSjoerg    virtual result do_in(state_type& __st,
1418*4d6fc14bSjoerg                         const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
1419*4d6fc14bSjoerg                         intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
1420*4d6fc14bSjoerg    virtual result do_unshift(state_type& __st,
1421*4d6fc14bSjoerg                              extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
1422*4d6fc14bSjoerg    virtual int do_encoding() const  _NOEXCEPT;
1423*4d6fc14bSjoerg    virtual bool do_always_noconv() const  _NOEXCEPT;
1424*4d6fc14bSjoerg    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
1425*4d6fc14bSjoerg    virtual int do_max_length() const  _NOEXCEPT;
1426*4d6fc14bSjoerg};
1427*4d6fc14bSjoerg
1428*4d6fc14bSjoerg#endif
1429*4d6fc14bSjoerg
1430*4d6fc14bSjoerg// template <class _InternT, class _ExternT, class _StateT> class codecvt_byname
1431*4d6fc14bSjoerg
1432*4d6fc14bSjoergtemplate <class _InternT, class _ExternT, class _StateT>
1433*4d6fc14bSjoergclass _LIBCPP_TEMPLATE_VIS codecvt_byname
1434*4d6fc14bSjoerg    : public codecvt<_InternT, _ExternT, _StateT>
1435*4d6fc14bSjoerg{
1436*4d6fc14bSjoergpublic:
1437*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1438*4d6fc14bSjoerg    explicit codecvt_byname(const char* __nm, size_t __refs = 0)
1439*4d6fc14bSjoerg        : codecvt<_InternT, _ExternT, _StateT>(__nm, __refs) {}
1440*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1441*4d6fc14bSjoerg    explicit codecvt_byname(const string& __nm, size_t __refs = 0)
1442*4d6fc14bSjoerg        : codecvt<_InternT, _ExternT, _StateT>(__nm.c_str(), __refs) {}
1443*4d6fc14bSjoergprotected:
1444*4d6fc14bSjoerg    ~codecvt_byname();
1445*4d6fc14bSjoerg};
1446*4d6fc14bSjoerg
1447*4d6fc14bSjoerg_LIBCPP_SUPPRESS_DEPRECATED_PUSH
1448*4d6fc14bSjoergtemplate <class _InternT, class _ExternT, class _StateT>
1449*4d6fc14bSjoergcodecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname()
1450*4d6fc14bSjoerg{
1451*4d6fc14bSjoerg}
1452*4d6fc14bSjoerg_LIBCPP_SUPPRESS_DEPRECATED_POP
1453*4d6fc14bSjoerg
1454*4d6fc14bSjoerg_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char, char, mbstate_t>)
1455*4d6fc14bSjoerg_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<wchar_t, char, mbstate_t>)
1456*4d6fc14bSjoerg_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>) // deprecated in C++20
1457*4d6fc14bSjoerg_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>) // deprecated in C++20
1458*4d6fc14bSjoerg#ifndef _LIBCPP_HAS_NO_CHAR8_T
1459*4d6fc14bSjoerg_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char8_t, mbstate_t>) // C++20
1460*4d6fc14bSjoerg_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char8_t, mbstate_t>) // C++20
1461*4d6fc14bSjoerg#endif
1462*4d6fc14bSjoerg
1463*4d6fc14bSjoergtemplate <size_t _Np>
1464*4d6fc14bSjoergstruct __narrow_to_utf8
1465*4d6fc14bSjoerg{
1466*4d6fc14bSjoerg    template <class _OutputIterator, class _CharT>
1467*4d6fc14bSjoerg    _OutputIterator
1468*4d6fc14bSjoerg    operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const;
1469*4d6fc14bSjoerg};
1470*4d6fc14bSjoerg
1471*4d6fc14bSjoergtemplate <>
1472*4d6fc14bSjoergstruct __narrow_to_utf8<8>
1473*4d6fc14bSjoerg{
1474*4d6fc14bSjoerg    template <class _OutputIterator, class _CharT>
1475*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1476*4d6fc14bSjoerg    _OutputIterator
1477*4d6fc14bSjoerg    operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const
1478*4d6fc14bSjoerg    {
1479*4d6fc14bSjoerg        for (; __wb < __we; ++__wb, ++__s)
1480*4d6fc14bSjoerg            *__s = *__wb;
1481*4d6fc14bSjoerg        return __s;
1482*4d6fc14bSjoerg    }
1483*4d6fc14bSjoerg};
1484*4d6fc14bSjoerg
1485*4d6fc14bSjoerg_LIBCPP_SUPPRESS_DEPRECATED_PUSH
1486*4d6fc14bSjoergtemplate <>
1487*4d6fc14bSjoergstruct _LIBCPP_TEMPLATE_VIS __narrow_to_utf8<16>
1488*4d6fc14bSjoerg    : public codecvt<char16_t, char, mbstate_t>
1489*4d6fc14bSjoerg{
1490*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1491*4d6fc14bSjoerg    __narrow_to_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
1492*4d6fc14bSjoerg_LIBCPP_SUPPRESS_DEPRECATED_POP
1493*4d6fc14bSjoerg
1494*4d6fc14bSjoerg    _LIBCPP_EXPORTED_FROM_ABI ~__narrow_to_utf8();
1495*4d6fc14bSjoerg
1496*4d6fc14bSjoerg    template <class _OutputIterator, class _CharT>
1497*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1498*4d6fc14bSjoerg    _OutputIterator
1499*4d6fc14bSjoerg    operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const
1500*4d6fc14bSjoerg    {
1501*4d6fc14bSjoerg        result __r = ok;
1502*4d6fc14bSjoerg        mbstate_t __mb;
1503*4d6fc14bSjoerg        while (__wb < __we && __r != error)
1504*4d6fc14bSjoerg        {
1505*4d6fc14bSjoerg            const int __sz = 32;
1506*4d6fc14bSjoerg            char __buf[__sz];
1507*4d6fc14bSjoerg            char* __bn;
1508*4d6fc14bSjoerg            const char16_t* __wn = (const char16_t*)__wb;
1509*4d6fc14bSjoerg            __r = do_out(__mb, (const char16_t*)__wb, (const char16_t*)__we, __wn,
1510*4d6fc14bSjoerg                         __buf, __buf+__sz, __bn);
1511*4d6fc14bSjoerg            if (__r == codecvt_base::error || __wn == (const char16_t*)__wb)
1512*4d6fc14bSjoerg                __throw_runtime_error("locale not supported");
1513*4d6fc14bSjoerg            for (const char* __p = __buf; __p < __bn; ++__p, ++__s)
1514*4d6fc14bSjoerg                *__s = *__p;
1515*4d6fc14bSjoerg            __wb = (const _CharT*)__wn;
1516*4d6fc14bSjoerg        }
1517*4d6fc14bSjoerg        return __s;
1518*4d6fc14bSjoerg    }
1519*4d6fc14bSjoerg};
1520*4d6fc14bSjoerg
1521*4d6fc14bSjoerg_LIBCPP_SUPPRESS_DEPRECATED_PUSH
1522*4d6fc14bSjoergtemplate <>
1523*4d6fc14bSjoergstruct _LIBCPP_TEMPLATE_VIS __narrow_to_utf8<32>
1524*4d6fc14bSjoerg    : public codecvt<char32_t, char, mbstate_t>
1525*4d6fc14bSjoerg{
1526*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1527*4d6fc14bSjoerg    __narrow_to_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
1528*4d6fc14bSjoerg_LIBCPP_SUPPRESS_DEPRECATED_POP
1529*4d6fc14bSjoerg
1530*4d6fc14bSjoerg    _LIBCPP_EXPORTED_FROM_ABI ~__narrow_to_utf8();
1531*4d6fc14bSjoerg
1532*4d6fc14bSjoerg    template <class _OutputIterator, class _CharT>
1533*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1534*4d6fc14bSjoerg    _OutputIterator
1535*4d6fc14bSjoerg    operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const
1536*4d6fc14bSjoerg    {
1537*4d6fc14bSjoerg        result __r = ok;
1538*4d6fc14bSjoerg        mbstate_t __mb;
1539*4d6fc14bSjoerg        while (__wb < __we && __r != error)
1540*4d6fc14bSjoerg        {
1541*4d6fc14bSjoerg            const int __sz = 32;
1542*4d6fc14bSjoerg            char __buf[__sz];
1543*4d6fc14bSjoerg            char* __bn;
1544*4d6fc14bSjoerg            const char32_t* __wn = (const char32_t*)__wb;
1545*4d6fc14bSjoerg            __r = do_out(__mb, (const char32_t*)__wb, (const char32_t*)__we, __wn,
1546*4d6fc14bSjoerg                         __buf, __buf+__sz, __bn);
1547*4d6fc14bSjoerg            if (__r == codecvt_base::error || __wn == (const char32_t*)__wb)
1548*4d6fc14bSjoerg                __throw_runtime_error("locale not supported");
1549*4d6fc14bSjoerg            for (const char* __p = __buf; __p < __bn; ++__p, ++__s)
1550*4d6fc14bSjoerg                *__s = *__p;
1551*4d6fc14bSjoerg            __wb = (const _CharT*)__wn;
1552*4d6fc14bSjoerg        }
1553*4d6fc14bSjoerg        return __s;
1554*4d6fc14bSjoerg    }
1555*4d6fc14bSjoerg};
1556*4d6fc14bSjoerg
1557*4d6fc14bSjoergtemplate <size_t _Np>
1558*4d6fc14bSjoergstruct __widen_from_utf8
1559*4d6fc14bSjoerg{
1560*4d6fc14bSjoerg    template <class _OutputIterator>
1561*4d6fc14bSjoerg    _OutputIterator
1562*4d6fc14bSjoerg    operator()(_OutputIterator __s, const char* __nb, const char* __ne) const;
1563*4d6fc14bSjoerg};
1564*4d6fc14bSjoerg
1565*4d6fc14bSjoergtemplate <>
1566*4d6fc14bSjoergstruct __widen_from_utf8<8>
1567*4d6fc14bSjoerg{
1568*4d6fc14bSjoerg    template <class _OutputIterator>
1569*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1570*4d6fc14bSjoerg    _OutputIterator
1571*4d6fc14bSjoerg    operator()(_OutputIterator __s, const char* __nb, const char* __ne) const
1572*4d6fc14bSjoerg    {
1573*4d6fc14bSjoerg        for (; __nb < __ne; ++__nb, ++__s)
1574*4d6fc14bSjoerg            *__s = *__nb;
1575*4d6fc14bSjoerg        return __s;
1576*4d6fc14bSjoerg    }
1577*4d6fc14bSjoerg};
1578*4d6fc14bSjoerg
1579*4d6fc14bSjoerg_LIBCPP_SUPPRESS_DEPRECATED_PUSH
1580*4d6fc14bSjoergtemplate <>
1581*4d6fc14bSjoergstruct _LIBCPP_TEMPLATE_VIS __widen_from_utf8<16>
1582*4d6fc14bSjoerg    : public codecvt<char16_t, char, mbstate_t>
1583*4d6fc14bSjoerg{
1584*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1585*4d6fc14bSjoerg    __widen_from_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
1586*4d6fc14bSjoerg_LIBCPP_SUPPRESS_DEPRECATED_POP
1587*4d6fc14bSjoerg
1588*4d6fc14bSjoerg    _LIBCPP_EXPORTED_FROM_ABI ~__widen_from_utf8();
1589*4d6fc14bSjoerg
1590*4d6fc14bSjoerg    template <class _OutputIterator>
1591*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1592*4d6fc14bSjoerg    _OutputIterator
1593*4d6fc14bSjoerg    operator()(_OutputIterator __s, const char* __nb, const char* __ne) const
1594*4d6fc14bSjoerg    {
1595*4d6fc14bSjoerg        result __r = ok;
1596*4d6fc14bSjoerg        mbstate_t __mb;
1597*4d6fc14bSjoerg        while (__nb < __ne && __r != error)
1598*4d6fc14bSjoerg        {
1599*4d6fc14bSjoerg            const int __sz = 32;
1600*4d6fc14bSjoerg            char16_t __buf[__sz];
1601*4d6fc14bSjoerg            char16_t* __bn;
1602*4d6fc14bSjoerg            const char* __nn = __nb;
1603*4d6fc14bSjoerg            __r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb+__sz : __ne, __nn,
1604*4d6fc14bSjoerg                        __buf, __buf+__sz, __bn);
1605*4d6fc14bSjoerg            if (__r == codecvt_base::error || __nn == __nb)
1606*4d6fc14bSjoerg                __throw_runtime_error("locale not supported");
1607*4d6fc14bSjoerg            for (const char16_t* __p = __buf; __p < __bn; ++__p, ++__s)
1608*4d6fc14bSjoerg                *__s = *__p;
1609*4d6fc14bSjoerg            __nb = __nn;
1610*4d6fc14bSjoerg        }
1611*4d6fc14bSjoerg        return __s;
1612*4d6fc14bSjoerg    }
1613*4d6fc14bSjoerg};
1614*4d6fc14bSjoerg
1615*4d6fc14bSjoerg_LIBCPP_SUPPRESS_DEPRECATED_PUSH
1616*4d6fc14bSjoergtemplate <>
1617*4d6fc14bSjoergstruct _LIBCPP_TEMPLATE_VIS __widen_from_utf8<32>
1618*4d6fc14bSjoerg    : public codecvt<char32_t, char, mbstate_t>
1619*4d6fc14bSjoerg{
1620*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1621*4d6fc14bSjoerg    __widen_from_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
1622*4d6fc14bSjoerg_LIBCPP_SUPPRESS_DEPRECATED_POP
1623*4d6fc14bSjoerg
1624*4d6fc14bSjoerg    _LIBCPP_EXPORTED_FROM_ABI ~__widen_from_utf8();
1625*4d6fc14bSjoerg
1626*4d6fc14bSjoerg    template <class _OutputIterator>
1627*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY
1628*4d6fc14bSjoerg    _OutputIterator
1629*4d6fc14bSjoerg    operator()(_OutputIterator __s, const char* __nb, const char* __ne) const
1630*4d6fc14bSjoerg    {
1631*4d6fc14bSjoerg        result __r = ok;
1632*4d6fc14bSjoerg        mbstate_t __mb;
1633*4d6fc14bSjoerg        while (__nb < __ne && __r != error)
1634*4d6fc14bSjoerg        {
1635*4d6fc14bSjoerg            const int __sz = 32;
1636*4d6fc14bSjoerg            char32_t __buf[__sz];
1637*4d6fc14bSjoerg            char32_t* __bn;
1638*4d6fc14bSjoerg            const char* __nn = __nb;
1639*4d6fc14bSjoerg            __r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb+__sz : __ne, __nn,
1640*4d6fc14bSjoerg                        __buf, __buf+__sz, __bn);
1641*4d6fc14bSjoerg            if (__r == codecvt_base::error || __nn == __nb)
1642*4d6fc14bSjoerg                __throw_runtime_error("locale not supported");
1643*4d6fc14bSjoerg            for (const char32_t* __p = __buf; __p < __bn; ++__p, ++__s)
1644*4d6fc14bSjoerg                *__s = *__p;
1645*4d6fc14bSjoerg            __nb = __nn;
1646*4d6fc14bSjoerg        }
1647*4d6fc14bSjoerg        return __s;
1648*4d6fc14bSjoerg    }
1649*4d6fc14bSjoerg};
1650*4d6fc14bSjoerg
1651*4d6fc14bSjoerg// template <class charT> class numpunct
1652*4d6fc14bSjoerg
1653*4d6fc14bSjoergtemplate <class _CharT> class _LIBCPP_TEMPLATE_VIS numpunct;
1654*4d6fc14bSjoerg
1655*4d6fc14bSjoergtemplate <>
1656*4d6fc14bSjoergclass _LIBCPP_TYPE_VIS numpunct<char>
1657*4d6fc14bSjoerg    : public locale::facet
1658*4d6fc14bSjoerg{
1659*4d6fc14bSjoergpublic:
1660*4d6fc14bSjoerg    typedef char char_type;
1661*4d6fc14bSjoerg    typedef basic_string<char_type> string_type;
1662*4d6fc14bSjoerg
1663*4d6fc14bSjoerg    explicit numpunct(size_t __refs = 0);
1664*4d6fc14bSjoerg
1665*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY char_type decimal_point() const {return do_decimal_point();}
1666*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY char_type thousands_sep() const {return do_thousands_sep();}
1667*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY string grouping() const         {return do_grouping();}
1668*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY string_type truename() const    {return do_truename();}
1669*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY string_type falsename() const   {return do_falsename();}
1670*4d6fc14bSjoerg
1671*4d6fc14bSjoerg    static locale::id id;
1672*4d6fc14bSjoerg
1673*4d6fc14bSjoergprotected:
1674*4d6fc14bSjoerg    ~numpunct();
1675*4d6fc14bSjoerg    virtual char_type do_decimal_point() const;
1676*4d6fc14bSjoerg    virtual char_type do_thousands_sep() const;
1677*4d6fc14bSjoerg    virtual string do_grouping() const;
1678*4d6fc14bSjoerg    virtual string_type do_truename() const;
1679*4d6fc14bSjoerg    virtual string_type do_falsename() const;
1680*4d6fc14bSjoerg
1681*4d6fc14bSjoerg    char_type __decimal_point_;
1682*4d6fc14bSjoerg    char_type __thousands_sep_;
1683*4d6fc14bSjoerg    string __grouping_;
1684*4d6fc14bSjoerg};
1685*4d6fc14bSjoerg
1686*4d6fc14bSjoergtemplate <>
1687*4d6fc14bSjoergclass _LIBCPP_TYPE_VIS numpunct<wchar_t>
1688*4d6fc14bSjoerg    : public locale::facet
1689*4d6fc14bSjoerg{
1690*4d6fc14bSjoergpublic:
1691*4d6fc14bSjoerg    typedef wchar_t char_type;
1692*4d6fc14bSjoerg    typedef basic_string<char_type> string_type;
1693*4d6fc14bSjoerg
1694*4d6fc14bSjoerg    explicit numpunct(size_t __refs = 0);
1695*4d6fc14bSjoerg
1696*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY char_type decimal_point() const {return do_decimal_point();}
1697*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY char_type thousands_sep() const {return do_thousands_sep();}
1698*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY string grouping() const         {return do_grouping();}
1699*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY string_type truename() const    {return do_truename();}
1700*4d6fc14bSjoerg    _LIBCPP_INLINE_VISIBILITY string_type falsename() const   {return do_falsename();}
1701*4d6fc14bSjoerg
1702*4d6fc14bSjoerg    static locale::id id;
1703*4d6fc14bSjoerg
1704*4d6fc14bSjoergprotected:
1705*4d6fc14bSjoerg    ~numpunct();
1706*4d6fc14bSjoerg    virtual char_type do_decimal_point() const;
1707*4d6fc14bSjoerg    virtual char_type do_thousands_sep() const;
1708*4d6fc14bSjoerg    virtual string do_grouping() const;
1709*4d6fc14bSjoerg    virtual string_type do_truename() const;
1710*4d6fc14bSjoerg    virtual string_type do_falsename() const;
1711*4d6fc14bSjoerg
1712*4d6fc14bSjoerg    char_type __decimal_point_;
1713*4d6fc14bSjoerg    char_type __thousands_sep_;
1714*4d6fc14bSjoerg    string __grouping_;
1715*4d6fc14bSjoerg};
1716*4d6fc14bSjoerg
1717*4d6fc14bSjoerg// template <class charT> class numpunct_byname
1718*4d6fc14bSjoerg
1719*4d6fc14bSjoergtemplate <class _CharT> class _LIBCPP_TEMPLATE_VIS numpunct_byname;
1720*4d6fc14bSjoerg
1721*4d6fc14bSjoergtemplate <>
1722*4d6fc14bSjoergclass _LIBCPP_TYPE_VIS numpunct_byname<char>
1723*4d6fc14bSjoerg: public numpunct<char>
1724*4d6fc14bSjoerg{
1725*4d6fc14bSjoergpublic:
1726*4d6fc14bSjoerg    typedef char char_type;
1727*4d6fc14bSjoerg    typedef basic_string<char_type> string_type;
1728*4d6fc14bSjoerg
1729*4d6fc14bSjoerg    explicit numpunct_byname(const char* __nm, size_t __refs = 0);
1730*4d6fc14bSjoerg    explicit numpunct_byname(const string& __nm, size_t __refs = 0);
1731*4d6fc14bSjoerg
1732*4d6fc14bSjoergprotected:
1733*4d6fc14bSjoerg    ~numpunct_byname();
1734*4d6fc14bSjoerg
1735*4d6fc14bSjoergprivate:
1736*4d6fc14bSjoerg    void __init(const char*);
1737*4d6fc14bSjoerg};
1738*4d6fc14bSjoerg
1739*4d6fc14bSjoergtemplate <>
1740*4d6fc14bSjoergclass _LIBCPP_TYPE_VIS numpunct_byname<wchar_t>
1741*4d6fc14bSjoerg: public numpunct<wchar_t>
1742*4d6fc14bSjoerg{
1743*4d6fc14bSjoergpublic:
1744*4d6fc14bSjoerg    typedef wchar_t char_type;
1745*4d6fc14bSjoerg    typedef basic_string<char_type> string_type;
1746*4d6fc14bSjoerg
1747*4d6fc14bSjoerg    explicit numpunct_byname(const char* __nm, size_t __refs = 0);
1748*4d6fc14bSjoerg    explicit numpunct_byname(const string& __nm, size_t __refs = 0);
1749*4d6fc14bSjoerg
1750*4d6fc14bSjoergprotected:
1751*4d6fc14bSjoerg    ~numpunct_byname();
1752*4d6fc14bSjoerg
1753*4d6fc14bSjoergprivate:
1754*4d6fc14bSjoerg    void __init(const char*);
1755*4d6fc14bSjoerg};
1756*4d6fc14bSjoerg
1757*4d6fc14bSjoerg_LIBCPP_END_NAMESPACE_STD
1758*4d6fc14bSjoerg
1759*4d6fc14bSjoerg#endif // _LIBCPP___LOCALE
1760