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