blob: b767bb09457d0c78f1a51bad0ceb2919f8484ed1 [file] [log] [blame]
Howard Hinnantc51e1022010-05-11 19:42:16 +00001// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
5//
6// This file is distributed under the University of Illinois Open Source
7// License. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10
11#ifndef _LIBCPP___LOCALE
12#define _LIBCPP___LOCALE
13
14#include <__config>
15#include <string>
16#include <memory>
17#include <utility>
18#include <mutex>
19#include <cstdint>
20#include <cctype>
21#include <xlocale.h>
22
23#pragma GCC system_header
24
25_LIBCPP_BEGIN_NAMESPACE_STD
26
27class locale;
28
29template <class _Facet> bool has_facet(const locale&) throw();
30template <class _Facet> const _Facet& use_facet(const locale&);
31
32class locale
33{
34public:
35 // types:
36 class facet;
37 class id;
38
39 typedef int category;
40 static const category // values assigned here are for exposition only
41 none = 0,
42 collate = LC_COLLATE_MASK,
43 ctype = LC_CTYPE_MASK,
44 monetary = LC_MONETARY_MASK,
45 numeric = LC_NUMERIC_MASK,
46 time = LC_TIME_MASK,
47 messages = LC_MESSAGES_MASK,
48 all = collate | ctype | monetary | numeric | time | messages;
49
50 // construct/copy/destroy:
51 locale() throw();
52 locale(const locale&) throw();
53 explicit locale(const char*);
54 explicit locale(const string&);
55 locale(const locale&, const char*, category);
56 locale(const locale&, const string&, category);
57 template <class _Facet> locale(const locale&, _Facet*);
58 locale(const locale&, const locale&, category);
59
60 ~locale() throw();
61
62 const locale& operator=(const locale&) throw();
63
64 template <class _Facet> locale combine(const locale&) const;
65
66 // locale operations:
67 string name() const;
68 bool operator==(const locale&) const;
69 bool operator!=(const locale& __y) const {return !(*this == __y);}
70 template <class _CharT, class _Traits, class _Allocator>
71 bool operator()(const basic_string<_CharT, _Traits, _Allocator>&,
72 const basic_string<_CharT, _Traits, _Allocator>&) const;
73
74 // global locale objects:
75 static locale global(const locale&);
76 static const locale& classic();
77
78private:
79 class __imp;
80 __imp* __locale_;
81
82 void __install_ctor(const locale&, facet*, long);
83 static locale& __global();
84 bool has_facet(id&) const;
85 const facet* use_facet(id&) const;
86
87 template <class _Facet> friend bool has_facet(const locale&) throw();
88 template <class _Facet> friend const _Facet& use_facet(const locale&);
89};
90
91class locale::facet
92 : public __shared_count
93{
94protected:
95 explicit facet(size_t __refs = 0)
96 : __shared_count(static_cast<long>(__refs)-1) {}
97
98 virtual ~facet();
99
100// facet(const facet&) = delete; // effectively done in __shared_count
101// void operator=(const facet&) = delete;
102private:
103 virtual void __on_zero_shared();
104};
105
106class locale::id
107{
108 once_flag __flag_;
109 int32_t __id_;
110
111 static int32_t __next_id;
112public:
113 id() {}
114private:
115 void __init();
116 void operator=(const id&); // = delete;
117 id(const id&); // = delete;
118public: // only needed for tests
119 long __get();
120
121 friend class locale;
122 friend class locale::__imp;
123};
124
125template <class _Facet>
126inline _LIBCPP_INLINE_VISIBILITY
127locale::locale(const locale& __other, _Facet* __f)
128{
129 __install_ctor(__other, __f, __f ? __f->id.__get() : 0);
130}
131
132template <class _Facet>
133locale
134locale::combine(const locale& __other) const
135{
136 if (!_STD::has_facet<_Facet>(__other))
137 throw runtime_error("locale::combine: locale missing facet");
138 return locale(*this, &const_cast<_Facet&>(_STD::use_facet<_Facet>(__other)));
139}
140
141template <class _Facet>
142inline _LIBCPP_INLINE_VISIBILITY
143bool
144has_facet(const locale& __l) throw()
145{
146 return __l.has_facet(_Facet::id);
147}
148
149template <class _Facet>
150inline _LIBCPP_INLINE_VISIBILITY
151const _Facet&
152use_facet(const locale& __l)
153{
154 return static_cast<const _Facet&>(*__l.use_facet(_Facet::id));
155}
156
157// template <class _CharT> class collate;
158
159template <class _CharT>
160class collate
161 : public locale::facet
162{
163public:
164 typedef _CharT char_type;
165 typedef basic_string<char_type> string_type;
166
167 explicit collate(size_t __refs = 0)
168 : locale::facet(__refs) {}
169
170 int compare(const char_type* __lo1, const char_type* __hi1,
171 const char_type* __lo2, const char_type* __hi2) const
172 {
173 return do_compare(__lo1, __hi1, __lo2, __hi2);
174 }
175
176 string_type transform(const char_type* __lo, const char_type* __hi) const
177 {
178 return do_transform(__lo, __hi);
179 }
180
181 long hash(const char_type* __lo, const char_type* __hi) const
182 {
183 return do_hash(__lo, __hi);
184 }
185
186 static locale::id id;
187
188protected:
189 ~collate();
190 virtual int do_compare(const char_type* __lo1, const char_type* __hi1,
191 const char_type* __lo2, const char_type* __hi2) const;
192 virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const
193 {return string_type(__lo, __hi);}
194 virtual long do_hash(const char_type* __lo, const char_type* __hi) const;
195};
196
197template <class _CharT> locale::id collate<_CharT>::id;
198
199template <class _CharT>
200collate<_CharT>::~collate()
201{
202}
203
204template <class _CharT>
205int
206collate<_CharT>::do_compare(const char_type* __lo1, const char_type* __hi1,
207 const char_type* __lo2, const char_type* __hi2) const
208{
209 for (; __lo2 != __hi2; ++__lo1, ++__lo2)
210 {
211 if (__lo1 == __hi1 || *__lo1 < *__lo2)
212 return -1;
213 if (*__lo2 < *__lo1)
214 return 1;
215 }
216 return __lo1 != __hi1;
217}
218
219template <class _CharT>
220long
221collate<_CharT>::do_hash(const char_type* lo, const char_type* hi) const
222{
223 size_t h = 0;
224 const size_t sr = __CHAR_BIT__ * sizeof(size_t) - 8;
225 const size_t mask = size_t(0xF) << (sr + 4);
226 for(const char_type* p = lo; p != hi; ++p)
227 {
228 h = (h << 4) + *p;
229 size_t g = h & mask;
230 h ^= g | (g >> sr);
231 }
232 return static_cast<long>(h);
233}
234
235extern template class collate<char>;
236extern template class collate<wchar_t>;
237
238// template <class CharT> class collate_byname;
239
240template <class _CharT> class collate_byname;
241
242template <>
243class collate_byname<char>
244 : public collate<char>
245{
246 locale_t __l;
247public:
248 typedef char char_type;
249 typedef basic_string<char_type> string_type;
250
251 explicit collate_byname(const char* __n, size_t __refs = 0);
252 explicit collate_byname(const string& __n, size_t __refs = 0);
253
254protected:
255 ~collate_byname();
256 virtual int do_compare(const char_type* __lo1, const char_type* __hi1,
257 const char_type* __lo2, const char_type* __hi2) const;
258 virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const;
259};
260
261template <>
262class collate_byname<wchar_t>
263 : public collate<wchar_t>
264{
265 locale_t __l;
266public:
267 typedef wchar_t char_type;
268 typedef basic_string<char_type> string_type;
269
270 explicit collate_byname(const char* __n, size_t __refs = 0);
271 explicit collate_byname(const string& __n, size_t __refs = 0);
272
273protected:
274 ~collate_byname();
275
276 virtual int do_compare(const char_type* __lo1, const char_type* __hi1,
277 const char_type* __lo2, const char_type* __hi2) const;
278 virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const;
279};
280
281template <class _CharT, class _Traits, class _Allocator>
282bool
283locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
284 const basic_string<_CharT, _Traits, _Allocator>& __y) const
285{
286 return _STD::use_facet<_STD::collate<_CharT> >(*this).compare(
287 __x.data(), __x.data() + __x.size(),
288 __y.data(), __y.data() + __y.size()) < 0;
289}
290
291// template <class charT> class ctype
292
293class ctype_base {
294public:
295 typedef __uint32_t mask;
296
297 static const mask space = _CTYPE_S;
298 static const mask print = _CTYPE_R;
299 static const mask cntrl = _CTYPE_C;
300 static const mask upper = _CTYPE_U;
301 static const mask lower = _CTYPE_L;
302 static const mask alpha = _CTYPE_A;
303 static const mask digit = _CTYPE_D;
304 static const mask punct = _CTYPE_P;
305 static const mask xdigit = _CTYPE_X;
306 static const mask blank = _CTYPE_B;
307 static const mask alnum = alpha | digit;
308 static const mask graph = alnum | punct;
309
310 _LIBCPP_ALWAYS_INLINE ctype_base() {}
311};
312
313template <class _CharT> class ctype;
314
315template <>
316class ctype<wchar_t>
317 : public locale::facet,
318 public ctype_base
319{
320public:
321 typedef wchar_t char_type;
322
323 _LIBCPP_ALWAYS_INLINE
324 explicit ctype(size_t __refs = 0)
325 : locale::facet(__refs) {}
326
327 _LIBCPP_ALWAYS_INLINE
328 bool is(mask __m, char_type __c) const
329 {
330 return do_is(__m, __c);
331 }
332
333 _LIBCPP_ALWAYS_INLINE
334 const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
335 {
336 return do_is(__low, __high, __vec);
337 }
338
339 _LIBCPP_ALWAYS_INLINE
340 const char_type* scan_is(mask __m, const char_type* __low, const char_type* __high) const
341 {
342 return do_scan_is(__m, __low, __high);
343 }
344
345 _LIBCPP_ALWAYS_INLINE
346 const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
347 {
348 return do_scan_not(__m, __low, __high);
349 }
350
351 _LIBCPP_ALWAYS_INLINE
352 char_type toupper(char_type __c) const
353 {
354 return do_toupper(__c);
355 }
356
357 _LIBCPP_ALWAYS_INLINE
358 const char_type* toupper(char_type* __low, const char_type* __high) const
359 {
360 return do_toupper(__low, __high);
361 }
362
363 _LIBCPP_ALWAYS_INLINE
364 char_type tolower(char_type __c) const
365 {
366 return do_tolower(__c);
367 }
368
369 _LIBCPP_ALWAYS_INLINE
370 const char_type* tolower(char_type* __low, const char_type* __high) const
371 {
372 return do_tolower(__low, __high);
373 }
374
375 _LIBCPP_ALWAYS_INLINE
376 char_type widen(char __c) const
377 {
378 return do_widen(__c);
379 }
380
381 _LIBCPP_ALWAYS_INLINE
382 const char* widen(const char* __low, const char* __high, char_type* __to) const
383 {
384 return do_widen(__low, __high, __to);
385 }
386
387 _LIBCPP_ALWAYS_INLINE
388 char narrow(char_type __c, char __dfault) const
389 {
390 return do_narrow(__c, __dfault);
391 }
392
393 _LIBCPP_ALWAYS_INLINE
394 const char_type* narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const
395 {
396 return do_narrow(__low, __high, __dfault, __to);
397 }
398
399 static locale::id id;
400
401protected:
402 ~ctype();
403 virtual bool do_is(mask __m, char_type __c) const;
404 virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const;
405 virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const;
406 virtual const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const;
407 virtual char_type do_toupper(char_type) const;
408 virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
409 virtual char_type do_tolower(char_type) const;
410 virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
411 virtual char_type do_widen(char) const;
412 virtual const char* do_widen(const char* __low, const char* __high, char_type* __dest) const;
413 virtual char do_narrow(char_type, char __dfault) const;
414 virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const;
415};
416
417template <>
418class ctype<char>
419 : public locale::facet, public ctype_base
420{
421 const mask* __tab_;
422 bool __del_;
423public:
424 typedef char char_type;
425
426 explicit ctype(const mask* __tab = 0, bool __del = false, size_t __refs = 0);
427
428 _LIBCPP_ALWAYS_INLINE
429 bool is(mask __m, char_type __c) const
430 {
431 return isascii(__c) ? __tab_[__c] & __m : false;
432 }
433
434 _LIBCPP_ALWAYS_INLINE
435 const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
436 {
437 for (; __low != __high; ++__low, ++__vec)
438 *__vec = isascii(*__low) ? __tab_[*__low] : 0;
439 return __low;
440 }
441
442 _LIBCPP_ALWAYS_INLINE
443 const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const
444 {
445 for (; __low != __high; ++__low)
446 if (isascii(*__low) && (__tab_[*__low] & __m))
447 break;
448 return __low;
449 }
450
451 _LIBCPP_ALWAYS_INLINE
452 const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
453 {
454 for (; __low != __high; ++__low)
455 if (!(isascii(*__low) && (__tab_[*__low] & __m)))
456 break;
457 return __low;
458 }
459
460 _LIBCPP_ALWAYS_INLINE
461 char_type toupper(char_type __c) const
462 {
463 return do_toupper(__c);
464 }
465
466 _LIBCPP_ALWAYS_INLINE
467 const char_type* toupper(char_type* __low, const char_type* __high) const
468 {
469 return do_toupper(__low, __high);
470 }
471
472 _LIBCPP_ALWAYS_INLINE
473 char_type tolower(char_type __c) const
474 {
475 return do_tolower(__c);
476 }
477
478 _LIBCPP_ALWAYS_INLINE
479 const char_type* tolower(char_type* __low, const char_type* __high) const
480 {
481 return do_tolower(__low, __high);
482 }
483
484 _LIBCPP_ALWAYS_INLINE
485 char_type widen(char __c) const
486 {
487 return do_widen(__c);
488 }
489
490 _LIBCPP_ALWAYS_INLINE
491 const char* widen(const char* __low, const char* __high, char_type* __to) const
492 {
493 return do_widen(__low, __high, __to);
494 }
495
496 _LIBCPP_ALWAYS_INLINE
497 char narrow(char_type __c, char __dfault) const
498 {
499 return do_narrow(__c, __dfault);
500 }
501
502 _LIBCPP_ALWAYS_INLINE
503 const char* narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const
504 {
505 return do_narrow(__low, __high, __dfault, __to);
506 }
507
508 static locale::id id;
509
510 static const size_t table_size = _CACHED_RUNES;
511 const mask* table() const throw() {return __tab_;}
512 static const mask* classic_table() throw();
513
514protected:
515 ~ctype();
516 virtual char_type do_toupper(char_type __c) const;
517 virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
518 virtual char_type do_tolower(char_type __c) const;
519 virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
520 virtual char_type do_widen(char __c) const;
521 virtual const char* do_widen(const char* __low, const char* __high, char_type* __to) const;
522 virtual char do_narrow(char_type __c, char __dfault) const;
523 virtual const char* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const;
524};
525
526// template <class CharT> class ctype_byname;
527
528template <class _CharT> class ctype_byname;
529
530template <>
531class ctype_byname<char>
532 : public ctype<char>
533{
534 locale_t __l;
535
536public:
537 explicit ctype_byname(const char*, size_t = 0);
538 explicit ctype_byname(const string&, size_t = 0);
539
540protected:
541 ~ctype_byname();
542 virtual char_type do_toupper(char_type) const;
543 virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
544 virtual char_type do_tolower(char_type) const;
545 virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
546};
547
548template <>
549class ctype_byname<wchar_t>
550 : public ctype<wchar_t>
551{
552 locale_t __l;
553
554public:
555 explicit ctype_byname(const char*, size_t = 0);
556 explicit ctype_byname(const string&, size_t = 0);
557
558protected:
559 ~ctype_byname();
560 virtual bool do_is(mask __m, char_type __c) const;
561 virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const;
562 virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const;
563 virtual const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const;
564 virtual char_type do_toupper(char_type) const;
565 virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
566 virtual char_type do_tolower(char_type) const;
567 virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
568 virtual char_type do_widen(char) const;
569 virtual const char* do_widen(const char* __low, const char* __high, char_type* __dest) const;
570 virtual char do_narrow(char_type, char __dfault) const;
571 virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const;
572};
573
574template <class _CharT>
575inline _LIBCPP_INLINE_VISIBILITY
576bool
577isspace(_CharT __c, const locale& __loc)
578{
579 return use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c);
580}
581
582template <class _CharT>
583inline _LIBCPP_INLINE_VISIBILITY
584bool
585isprint(_CharT __c, const locale& __loc)
586{
587 return use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c);
588}
589
590template <class _CharT>
591inline _LIBCPP_INLINE_VISIBILITY
592bool
593iscntrl(_CharT __c, const locale& __loc)
594{
595 return use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c);
596}
597
598template <class _CharT>
599inline _LIBCPP_INLINE_VISIBILITY
600bool
601isupper(_CharT __c, const locale& __loc)
602{
603 return use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c);
604}
605
606template <class _CharT>
607inline _LIBCPP_INLINE_VISIBILITY
608bool
609islower(_CharT __c, const locale& __loc)
610{
611 return use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c);
612}
613
614template <class _CharT>
615inline _LIBCPP_INLINE_VISIBILITY
616bool
617isalpha(_CharT __c, const locale& __loc)
618{
619 return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c);
620}
621
622template <class _CharT>
623inline _LIBCPP_INLINE_VISIBILITY
624bool
625isdigit(_CharT __c, const locale& __loc)
626{
627 return use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c);
628}
629
630template <class _CharT>
631inline _LIBCPP_INLINE_VISIBILITY
632bool
633ispunct(_CharT __c, const locale& __loc)
634{
635 return use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c);
636}
637
638template <class _CharT>
639inline _LIBCPP_INLINE_VISIBILITY
640bool
641isxdigit(_CharT __c, const locale& __loc)
642{
643 return use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c);
644}
645
646template <class _CharT>
647inline _LIBCPP_INLINE_VISIBILITY
648bool
649isalnum(_CharT __c, const locale& __loc)
650{
651 return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c);
652}
653
654template <class _CharT>
655inline _LIBCPP_INLINE_VISIBILITY
656bool
657isgraph(_CharT __c, const locale& __loc)
658{
659 return use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c);
660}
661
662template <class _CharT>
663inline _LIBCPP_INLINE_VISIBILITY
664_CharT
665toupper(_CharT __c, const locale& __loc)
666{
667 return use_facet<ctype<_CharT> >(__loc).toupper(__c);
668}
669
670template <class _CharT>
671inline _LIBCPP_INLINE_VISIBILITY
672_CharT
673tolower(_CharT __c, const locale& __loc)
674{
675 return use_facet<ctype<_CharT> >(__loc).tolower(__c);
676}
677
678// codecvt_base
679
680class codecvt_base
681{
682public:
683 _LIBCPP_ALWAYS_INLINE codecvt_base() {}
684 enum result {ok, partial, error, noconv};
685};
686
687// template <class internT, class externT, class stateT> class codecvt;
688
689template <class _InternT, class _ExternT, class _StateT> class codecvt;
690
691// template <> class codecvt<char, char, mbstate_t>
692
693template <>
694class codecvt<char, char, mbstate_t>
695 : public locale::facet,
696 public codecvt_base
697{
698public:
699 typedef char intern_type;
700 typedef char extern_type;
701 typedef mbstate_t state_type;
702
703 _LIBCPP_ALWAYS_INLINE
704 explicit codecvt(size_t __refs = 0)
705 : locale::facet(__refs) {}
706
707 _LIBCPP_ALWAYS_INLINE
708 result out(state_type& __st,
709 const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
710 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
711 {
712 return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
713 }
714
715 _LIBCPP_ALWAYS_INLINE
716 result unshift(state_type& __st,
717 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
718 {
719 return do_unshift(__st, __to, __to_end, __to_nxt);
720 }
721
722 _LIBCPP_ALWAYS_INLINE
723 result in(state_type& __st,
724 const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
725 intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
726 {
727 return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
728 }
729
730 _LIBCPP_ALWAYS_INLINE
731 int encoding() const throw()
732 {
733 return do_encoding();
734 }
735
736 _LIBCPP_ALWAYS_INLINE
737 bool always_noconv() const throw()
738 {
739 return do_always_noconv();
740 }
741
742 _LIBCPP_ALWAYS_INLINE
743 int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
744 {
745 return do_length(__st, __frm, __end, __mx);
746 }
747
748 _LIBCPP_ALWAYS_INLINE
749 int max_length() const throw()
750 {
751 return do_max_length();
752 }
753
754 static locale::id id;
755
756protected:
757 _LIBCPP_ALWAYS_INLINE
758 explicit codecvt(const char*, size_t __refs = 0)
759 : locale::facet(__refs) {}
760
761 ~codecvt();
762
763 virtual result do_out(state_type& __st,
764 const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
765 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
766 virtual result do_in(state_type& __st,
767 const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
768 intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
769 virtual result do_unshift(state_type& __st,
770 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
771 virtual int do_encoding() const throw();
772 virtual bool do_always_noconv() const throw();
773 virtual int do_length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
774 virtual int do_max_length() const throw();
775};
776
777// template <> class codecvt<wchar_t, char, mbstate_t>
778
779template <>
780class codecvt<wchar_t, char, mbstate_t>
781 : public locale::facet,
782 public codecvt_base
783{
784 locale_t __l;
785public:
786 typedef wchar_t intern_type;
787 typedef char extern_type;
788 typedef mbstate_t state_type;
789
790 explicit codecvt(size_t __refs = 0);
791
792 _LIBCPP_ALWAYS_INLINE
793 result out(state_type& __st,
794 const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
795 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
796 {
797 return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
798 }
799
800 _LIBCPP_ALWAYS_INLINE
801 result unshift(state_type& __st,
802 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
803 {
804 return do_unshift(__st, __to, __to_end, __to_nxt);
805 }
806
807 _LIBCPP_ALWAYS_INLINE
808 result in(state_type& __st,
809 const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
810 intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
811 {
812 return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
813 }
814
815 _LIBCPP_ALWAYS_INLINE
816 int encoding() const throw()
817 {
818 return do_encoding();
819 }
820
821 _LIBCPP_ALWAYS_INLINE
822 bool always_noconv() const throw()
823 {
824 return do_always_noconv();
825 }
826
827 _LIBCPP_ALWAYS_INLINE
828 int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
829 {
830 return do_length(__st, __frm, __end, __mx);
831 }
832
833 _LIBCPP_ALWAYS_INLINE
834 int max_length() const throw()
835 {
836 return do_max_length();
837 }
838
839 static locale::id id;
840
841protected:
842 explicit codecvt(const char*, size_t __refs = 0);
843
844 ~codecvt();
845
846 virtual result do_out(state_type& __st,
847 const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
848 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
849 virtual result do_in(state_type& __st,
850 const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
851 intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
852 virtual result do_unshift(state_type& __st,
853 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
854 virtual int do_encoding() const throw();
855 virtual bool do_always_noconv() const throw();
856 virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
857 virtual int do_max_length() const throw();
858};
859
860// template <> class codecvt<char16_t, char, mbstate_t>
861
862template <>
863class codecvt<char16_t, char, mbstate_t>
864 : public locale::facet,
865 public codecvt_base
866{
867public:
868 typedef char16_t intern_type;
869 typedef char extern_type;
870 typedef mbstate_t state_type;
871
872 _LIBCPP_ALWAYS_INLINE
873 explicit codecvt(size_t __refs = 0)
874 : locale::facet(__refs) {}
875
876 _LIBCPP_ALWAYS_INLINE
877 result out(state_type& __st,
878 const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
879 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
880 {
881 return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
882 }
883
884 _LIBCPP_ALWAYS_INLINE
885 result unshift(state_type& __st,
886 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
887 {
888 return do_unshift(__st, __to, __to_end, __to_nxt);
889 }
890
891 _LIBCPP_ALWAYS_INLINE
892 result in(state_type& __st,
893 const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
894 intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
895 {
896 return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
897 }
898
899 _LIBCPP_ALWAYS_INLINE
900 int encoding() const throw()
901 {
902 return do_encoding();
903 }
904
905 _LIBCPP_ALWAYS_INLINE
906 bool always_noconv() const throw()
907 {
908 return do_always_noconv();
909 }
910
911 _LIBCPP_ALWAYS_INLINE
912 int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
913 {
914 return do_length(__st, __frm, __end, __mx);
915 }
916
917 _LIBCPP_ALWAYS_INLINE
918 int max_length() const throw()
919 {
920 return do_max_length();
921 }
922
923 static locale::id id;
924
925protected:
926 _LIBCPP_ALWAYS_INLINE
927 explicit codecvt(const char*, size_t __refs = 0)
928 : locale::facet(__refs) {}
929
930 ~codecvt();
931
932 virtual result do_out(state_type& __st,
933 const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
934 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
935 virtual result do_in(state_type& __st,
936 const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
937 intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
938 virtual result do_unshift(state_type& __st,
939 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
940 virtual int do_encoding() const throw();
941 virtual bool do_always_noconv() const throw();
942 virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
943 virtual int do_max_length() const throw();
944};
945
946// template <> class codecvt<char32_t, char, mbstate_t>
947
948template <>
949class codecvt<char32_t, char, mbstate_t>
950 : public locale::facet,
951 public codecvt_base
952{
953public:
954 typedef char32_t intern_type;
955 typedef char extern_type;
956 typedef mbstate_t state_type;
957
958 _LIBCPP_ALWAYS_INLINE
959 explicit codecvt(size_t __refs = 0)
960 : locale::facet(__refs) {}
961
962 _LIBCPP_ALWAYS_INLINE
963 result out(state_type& __st,
964 const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
965 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
966 {
967 return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
968 }
969
970 _LIBCPP_ALWAYS_INLINE
971 result unshift(state_type& __st,
972 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
973 {
974 return do_unshift(__st, __to, __to_end, __to_nxt);
975 }
976
977 _LIBCPP_ALWAYS_INLINE
978 result in(state_type& __st,
979 const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
980 intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
981 {
982 return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
983 }
984
985 _LIBCPP_ALWAYS_INLINE
986 int encoding() const throw()
987 {
988 return do_encoding();
989 }
990
991 _LIBCPP_ALWAYS_INLINE
992 bool always_noconv() const throw()
993 {
994 return do_always_noconv();
995 }
996
997 _LIBCPP_ALWAYS_INLINE
998 int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
999 {
1000 return do_length(__st, __frm, __end, __mx);
1001 }
1002
1003 _LIBCPP_ALWAYS_INLINE
1004 int max_length() const throw()
1005 {
1006 return do_max_length();
1007 }
1008
1009 static locale::id id;
1010
1011protected:
1012 _LIBCPP_ALWAYS_INLINE
1013 explicit codecvt(const char*, size_t __refs = 0)
1014 : locale::facet(__refs) {}
1015
1016 ~codecvt();
1017
1018 virtual result do_out(state_type& __st,
1019 const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
1020 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
1021 virtual result do_in(state_type& __st,
1022 const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
1023 intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
1024 virtual result do_unshift(state_type& __st,
1025 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
1026 virtual int do_encoding() const throw();
1027 virtual bool do_always_noconv() const throw();
1028 virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
1029 virtual int do_max_length() const throw();
1030};
1031
1032// template <> class codecvt<char32_t, char, mbstate_t>
1033
1034template <>
1035class codecvt<char32_t, char16_t, mbstate_t>
1036 : public locale::facet,
1037 public codecvt_base
1038{
1039public:
1040 typedef char32_t intern_type;
1041 typedef char16_t extern_type;
1042 typedef mbstate_t state_type;
1043
1044 _LIBCPP_ALWAYS_INLINE
1045 explicit codecvt(size_t __refs = 0)
1046 : locale::facet(__refs) {}
1047
1048 _LIBCPP_ALWAYS_INLINE
1049 result out(state_type& __st,
1050 const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
1051 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
1052 {
1053 return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
1054 }
1055
1056 _LIBCPP_ALWAYS_INLINE
1057 result unshift(state_type& __st,
1058 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
1059 {
1060 return do_unshift(__st, __to, __to_end, __to_nxt);
1061 }
1062
1063 _LIBCPP_ALWAYS_INLINE
1064 result in(state_type& __st,
1065 const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
1066 intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
1067 {
1068 return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
1069 }
1070
1071 _LIBCPP_ALWAYS_INLINE
1072 int encoding() const throw()
1073 {
1074 return do_encoding();
1075 }
1076
1077 _LIBCPP_ALWAYS_INLINE
1078 bool always_noconv() const throw()
1079 {
1080 return do_always_noconv();
1081 }
1082
1083 _LIBCPP_ALWAYS_INLINE
1084 int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
1085 {
1086 return do_length(__st, __frm, __end, __mx);
1087 }
1088
1089 _LIBCPP_ALWAYS_INLINE
1090 int max_length() const throw()
1091 {
1092 return do_max_length();
1093 }
1094
1095 static locale::id id;
1096
1097protected:
1098 _LIBCPP_ALWAYS_INLINE
1099 explicit codecvt(const char*, size_t __refs = 0)
1100 : locale::facet(__refs) {}
1101
1102 ~codecvt();
1103
1104 virtual result do_out(state_type& __st,
1105 const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
1106 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
1107 virtual result do_in(state_type& __st,
1108 const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
1109 intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
1110 virtual result do_unshift(state_type& __st,
1111 extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
1112 virtual int do_encoding() const throw();
1113 virtual bool do_always_noconv() const throw();
1114 virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
1115 virtual int do_max_length() const throw();
1116};
1117
1118// template <class _InternT, class _ExternT, class _StateT> class codecvt_byname
1119
1120template <class _InternT, class _ExternT, class _StateT>
1121class codecvt_byname
1122 : public codecvt<_InternT, _ExternT, _StateT>
1123{
1124public:
1125 explicit codecvt_byname(const char* __nm, size_t __refs = 0)
1126 : codecvt<_InternT, _ExternT, _StateT>(__nm, __refs) {}
1127 explicit codecvt_byname(const string& __nm, size_t __refs = 0)
1128 : codecvt<_InternT, _ExternT, _StateT>(__nm.c_str(), __refs) {}
1129protected:
1130 ~codecvt_byname();
1131};
1132
1133template <class _InternT, class _ExternT, class _StateT>
1134codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname()
1135{
1136}
1137
1138extern template class codecvt_byname<char, char, mbstate_t>;
1139extern template class codecvt_byname<wchar_t, char, mbstate_t>;
1140extern template class codecvt_byname<char16_t, char, mbstate_t>;
1141extern template class codecvt_byname<char32_t, char, mbstate_t>;
1142
1143void __throw_runtime_error(const char*);
1144
1145template <size_t _N>
1146struct __narrow_to_utf8
1147{
1148 template <class _OutputIterator, class _CharT>
1149 _OutputIterator
1150 operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const;
1151};
1152
1153template <>
1154struct __narrow_to_utf8<8>
1155{
1156 template <class _OutputIterator, class _CharT>
1157 _LIBCPP_ALWAYS_INLINE
1158 _OutputIterator
1159 operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const
1160 {
1161 for (; __wb < __we; ++__wb, ++__s)
1162 *__s = *__wb;
1163 return __s;
1164 }
1165};
1166
1167template <>
1168struct __narrow_to_utf8<16>
1169 : public codecvt<char16_t, char, mbstate_t>
1170{
1171 _LIBCPP_ALWAYS_INLINE
1172 __narrow_to_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
1173
1174 ~__narrow_to_utf8();
1175
1176 template <class _OutputIterator, class _CharT>
1177 _LIBCPP_ALWAYS_INLINE
1178 _OutputIterator
1179 operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const
1180 {
1181 result __r = ok;
1182 mbstate_t __mb;
1183 while (__wb < __we && __r != error)
1184 {
1185 const int __sz = 32;
1186 char __buf[__sz];
1187 char* __bn;
1188 const char16_t* __wn = (const char16_t*)__wb;
1189 __r = do_out(__mb, (const char16_t*)__wb, (const char16_t*)__we, __wn,
1190 __buf, __buf+__sz, __bn);
1191 if (__r == codecvt_base::error || __wn == (const char16_t*)__wb)
1192 __throw_runtime_error("locale not supported");
1193 for (const char* __p = __buf; __p < __bn; ++__p, ++__s)
1194 *__s = *__p;
1195 __wb = (const _CharT*)__wn;
1196 }
1197 return __s;
1198 }
1199};
1200
1201template <>
1202struct __narrow_to_utf8<32>
1203 : public codecvt<char32_t, char, mbstate_t>
1204{
1205 _LIBCPP_ALWAYS_INLINE
1206 __narrow_to_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
1207
1208 ~__narrow_to_utf8();
1209
1210 template <class _OutputIterator, class _CharT>
1211 _LIBCPP_ALWAYS_INLINE
1212 _OutputIterator
1213 operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const
1214 {
1215 result __r = ok;
1216 mbstate_t __mb;
1217 while (__wb < __we && __r != error)
1218 {
1219 const int __sz = 32;
1220 char __buf[__sz];
1221 char* __bn;
1222 const char32_t* __wn = (const char32_t*)__wb;
1223 __r = do_out(__mb, (const char32_t*)__wb, (const char32_t*)__we, __wn,
1224 __buf, __buf+__sz, __bn);
1225 if (__r == codecvt_base::error || __wn == (const char32_t*)__wb)
1226 __throw_runtime_error("locale not supported");
1227 for (const char* __p = __buf; __p < __bn; ++__p, ++__s)
1228 *__s = *__p;
1229 __wb = (const _CharT*)__wn;
1230 }
1231 return __s;
1232 }
1233};
1234
1235template <size_t _N>
1236struct __widen_from_utf8
1237{
1238 template <class _OutputIterator>
1239 _OutputIterator
1240 operator()(_OutputIterator __s, const char* __nb, const char* __ne) const;
1241};
1242
1243template <>
1244struct __widen_from_utf8<8>
1245{
1246 template <class _OutputIterator>
1247 _LIBCPP_ALWAYS_INLINE
1248 _OutputIterator
1249 operator()(_OutputIterator __s, const char* __nb, const char* __ne) const
1250 {
1251 for (; __nb < __ne; ++__nb, ++__s)
1252 *__s = *__nb;
1253 return __s;
1254 }
1255};
1256
1257template <>
1258struct __widen_from_utf8<16>
1259 : public codecvt<char16_t, char, mbstate_t>
1260{
1261 _LIBCPP_ALWAYS_INLINE
1262 __widen_from_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
1263
1264 ~__widen_from_utf8();
1265
1266 template <class _OutputIterator>
1267 _LIBCPP_ALWAYS_INLINE
1268 _OutputIterator
1269 operator()(_OutputIterator __s, const char* __nb, const char* __ne) const
1270 {
1271 result __r = ok;
1272 mbstate_t __mb;
1273 while (__nb < __ne && __r != error)
1274 {
1275 const int __sz = 32;
1276 char16_t __buf[__sz];
1277 char16_t* __bn;
1278 const char* __nn = __nb;
1279 __r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb+__sz : __ne, __nn,
1280 __buf, __buf+__sz, __bn);
1281 if (__r == codecvt_base::error || __nn == __nb)
1282 __throw_runtime_error("locale not supported");
1283 for (const char16_t* __p = __buf; __p < __bn; ++__p, ++__s)
1284 *__s = (wchar_t)*__p;
1285 __nb = __nn;
1286 }
1287 return __s;
1288 }
1289};
1290
1291template <>
1292struct __widen_from_utf8<32>
1293 : public codecvt<char32_t, char, mbstate_t>
1294{
1295 _LIBCPP_ALWAYS_INLINE
1296 __widen_from_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
1297
1298 ~__widen_from_utf8();
1299
1300 template <class _OutputIterator>
1301 _LIBCPP_ALWAYS_INLINE
1302 _OutputIterator
1303 operator()(_OutputIterator __s, const char* __nb, const char* __ne) const
1304 {
1305 result __r = ok;
1306 mbstate_t __mb;
1307 while (__nb < __ne && __r != error)
1308 {
1309 const int __sz = 32;
1310 char32_t __buf[__sz];
1311 char32_t* __bn;
1312 const char* __nn = __nb;
1313 __r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb+__sz : __ne, __nn,
1314 __buf, __buf+__sz, __bn);
1315 if (__r == codecvt_base::error || __nn == __nb)
1316 __throw_runtime_error("locale not supported");
1317 for (const char32_t* __p = __buf; __p < __bn; ++__p, ++__s)
1318 *__s = (wchar_t)*__p;
1319 __nb = __nn;
1320 }
1321 return __s;
1322 }
1323};
1324
1325// template <class charT> class numpunct
1326
1327template <class _CharT> class numpunct;
1328
1329template <>
1330class numpunct<char>
1331 : public locale::facet
1332{
1333public:
1334 typedef char char_type;
1335 typedef basic_string<char_type> string_type;
1336
1337 explicit numpunct(size_t __refs = 0);
1338
1339 _LIBCPP_ALWAYS_INLINE char_type decimal_point() const {return do_decimal_point();}
1340 _LIBCPP_ALWAYS_INLINE char_type thousands_sep() const {return do_thousands_sep();}
1341 _LIBCPP_ALWAYS_INLINE string grouping() const {return do_grouping();}
1342 _LIBCPP_ALWAYS_INLINE string_type truename() const {return do_truename();}
1343 _LIBCPP_ALWAYS_INLINE string_type falsename() const {return do_falsename();}
1344
1345 static locale::id id;
1346
1347protected:
1348 ~numpunct();
1349 virtual char_type do_decimal_point() const;
1350 virtual char_type do_thousands_sep() const;
1351 virtual string do_grouping() const;
1352 virtual string_type do_truename() const;
1353 virtual string_type do_falsename() const;
1354
1355 char_type __decimal_point_;
1356 char_type __thousands_sep_;
1357 string __grouping_;
1358};
1359
1360template <>
1361class numpunct<wchar_t>
1362 : public locale::facet
1363{
1364public:
1365 typedef wchar_t char_type;
1366 typedef basic_string<char_type> string_type;
1367
1368 explicit numpunct(size_t __refs = 0);
1369
1370 _LIBCPP_ALWAYS_INLINE char_type decimal_point() const {return do_decimal_point();}
1371 _LIBCPP_ALWAYS_INLINE char_type thousands_sep() const {return do_thousands_sep();}
1372 _LIBCPP_ALWAYS_INLINE string grouping() const {return do_grouping();}
1373 _LIBCPP_ALWAYS_INLINE string_type truename() const {return do_truename();}
1374 _LIBCPP_ALWAYS_INLINE string_type falsename() const {return do_falsename();}
1375
1376 static locale::id id;
1377
1378protected:
1379 ~numpunct();
1380 virtual char_type do_decimal_point() const;
1381 virtual char_type do_thousands_sep() const;
1382 virtual string do_grouping() const;
1383 virtual string_type do_truename() const;
1384 virtual string_type do_falsename() const;
1385
1386 char_type __decimal_point_;
1387 char_type __thousands_sep_;
1388 string __grouping_;
1389};
1390
1391// template <class charT> class numpunct_byname
1392
1393template <class charT> class numpunct_byname;
1394
1395template <>
1396class numpunct_byname<char>
1397: public numpunct<char>
1398{
1399public:
1400 typedef char char_type;
1401 typedef basic_string<char_type> string_type;
1402
1403 explicit numpunct_byname(const char* __nm, size_t __refs = 0);
1404 explicit numpunct_byname(const string& __nm, size_t __refs = 0);
1405
1406protected:
1407 ~numpunct_byname();
1408
1409private:
1410 void __init(const char*);
1411};
1412
1413template <>
1414class numpunct_byname<wchar_t>
1415: public numpunct<wchar_t>
1416{
1417public:
1418 typedef wchar_t char_type;
1419 typedef basic_string<char_type> string_type;
1420
1421 explicit numpunct_byname(const char* __nm, size_t __refs = 0);
1422 explicit numpunct_byname(const string& __nm, size_t __refs = 0);
1423
1424protected:
1425 ~numpunct_byname();
1426
1427private:
1428 void __init(const char*);
1429};
1430
1431_LIBCPP_END_NAMESPACE_STD
1432
1433#endif // _LIBCPP___LOCALE