1 // Locale support -*- C++ -*-
3 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
4 // Free Software Foundation, Inc.
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 2, or (at your option)
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING. If not, write to the Free
19 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
22 // As a special exception, you may use this file as part of a free software
23 // library without restriction. Specifically, if other files instantiate
24 // templates or use macros or inline functions from this file, or you compile
25 // this file and link it with other files to produce an executable, this
26 // file does not by itself cause the resulting executable to be covered by
27 // the GNU General Public License. This exception does not however
28 // invalidate any other reasons why the executable file might be covered by
29 // the GNU General Public License.
32 // ISO C++ 14882: 22.1 Locales
35 /** @file locale_facets.h
36 * This is an internal header file, included by other library headers.
37 * You should not attempt to use it directly.
40 #ifndef _CPP_BITS_LOCFACETS_H
41 #define _CPP_BITS_LOCFACETS_H 1
43 #pragma GCC system_header
45 #include <ctime> // For struct tm
46 #include <cwctype> // For wctype_t
47 #include <ios> // For ios_base
51 // NB: Don't instantiate required wchar_t facets if no wchar_t support.
52 #ifdef _GLIBCPP_USE_WCHAR_T
53 # define _GLIBCPP_NUM_FACETS 28
55 # define _GLIBCPP_NUM_FACETS 14
58 template<typename _CharT
, typename _Traits
>
61 // 22.2.1.1 Template class ctype
62 // Include host and configuration specific ctype enums for ctype_base.
63 #include <bits/ctype_base.h>
65 // Common base for ctype<_CharT>.
66 template<typename _CharT
>
67 class __ctype_abstract_base
: public locale::facet
, public ctype_base
71 typedef _CharT char_type
;
74 is(mask __m
, char_type __c
) const
75 { return this->do_is(__m
, __c
); }
78 is(const char_type
*__lo
, const char_type
*__hi
, mask
*__vec
) const
79 { return this->do_is(__lo
, __hi
, __vec
); }
82 scan_is(mask __m
, const char_type
* __lo
, const char_type
* __hi
) const
83 { return this->do_scan_is(__m
, __lo
, __hi
); }
86 scan_not(mask __m
, const char_type
* __lo
, const char_type
* __hi
) const
87 { return this->do_scan_not(__m
, __lo
, __hi
); }
90 toupper(char_type __c
) const
91 { return this->do_toupper(__c
); }
94 toupper(char_type
*__lo
, const char_type
* __hi
) const
95 { return this->do_toupper(__lo
, __hi
); }
98 tolower(char_type __c
) const
99 { return this->do_tolower(__c
); }
102 tolower(char_type
* __lo
, const char_type
* __hi
) const
103 { return this->do_tolower(__lo
, __hi
); }
106 widen(char __c
) const
107 { return this->do_widen(__c
); }
110 widen(const char* __lo
, const char* __hi
, char_type
* __to
) const
111 { return this->do_widen(__lo
, __hi
, __to
); }
114 narrow(char_type __c
, char __dfault
) const
115 { return this->do_narrow(__c
, __dfault
); }
118 narrow(const char_type
* __lo
, const char_type
* __hi
,
119 char __dfault
, char *__to
) const
120 { return this->do_narrow(__lo
, __hi
, __dfault
, __to
); }
124 __ctype_abstract_base(size_t __refs
= 0): locale::facet(__refs
) { }
127 ~__ctype_abstract_base() { }
130 do_is(mask __m
, char_type __c
) const = 0;
132 virtual const char_type
*
133 do_is(const char_type
* __lo
, const char_type
* __hi
,
134 mask
* __vec
) const = 0;
136 virtual const char_type
*
137 do_scan_is(mask __m
, const char_type
* __lo
,
138 const char_type
* __hi
) const = 0;
140 virtual const char_type
*
141 do_scan_not(mask __m
, const char_type
* __lo
,
142 const char_type
* __hi
) const = 0;
145 do_toupper(char_type
) const = 0;
147 virtual const char_type
*
148 do_toupper(char_type
* __lo
, const char_type
* __hi
) const = 0;
151 do_tolower(char_type
) const = 0;
153 virtual const char_type
*
154 do_tolower(char_type
* __lo
, const char_type
* __hi
) const = 0;
157 do_widen(char) const = 0;
160 do_widen(const char* __lo
, const char* __hi
,
161 char_type
* __dest
) const = 0;
164 do_narrow(char_type
, char __dfault
) const = 0;
166 virtual const char_type
*
167 do_narrow(const char_type
* __lo
, const char_type
* __hi
,
168 char __dfault
, char* __dest
) const = 0;
171 // NB: Generic, mostly useless implementation.
172 template<typename _CharT
>
173 class ctype
: public __ctype_abstract_base
<_CharT
>
177 typedef _CharT char_type
;
178 typedef typename
ctype::mask mask
;
180 static locale::id id
;
183 ctype(size_t __refs
= 0) : __ctype_abstract_base
<_CharT
>(__refs
) { }
190 do_is(mask __m
, char_type __c
) const;
192 virtual const char_type
*
193 do_is(const char_type
* __lo
, const char_type
* __hi
, mask
* __vec
) const;
195 virtual const char_type
*
196 do_scan_is(mask __m
, const char_type
* __lo
, const char_type
* __hi
) const;
198 virtual const char_type
*
199 do_scan_not(mask __m
, const char_type
* __lo
,
200 const char_type
* __hi
) const;
203 do_toupper(char_type __c
) const;
205 virtual const char_type
*
206 do_toupper(char_type
* __lo
, const char_type
* __hi
) const;
209 do_tolower(char_type __c
) const;
211 virtual const char_type
*
212 do_tolower(char_type
* __lo
, const char_type
* __hi
) const;
215 do_widen(char __c
) const;
218 do_widen(const char* __lo
, const char* __hi
, char_type
* __dest
) const;
221 do_narrow(char_type
, char __dfault
) const;
223 virtual const char_type
*
224 do_narrow(const char_type
* __lo
, const char_type
* __hi
,
225 char __dfault
, char* __dest
) const;
228 template<typename _CharT
>
229 locale::id ctype
<_CharT
>::id
;
231 // 22.2.1.3 ctype<char> specialization.
233 class ctype
<char> : public __ctype_abstract_base
<char>
237 typedef char char_type
;
241 __c_locale _M_c_locale_ctype
;
243 __to_type _M_toupper
;
244 __to_type _M_tolower
;
245 const mask
* _M_table
;
248 static locale::id id
;
249 static const size_t table_size
= 1 + static_cast<unsigned char>(-1);
252 ctype(const mask
* __table
= 0, bool __del
= false, size_t __refs
= 0);
255 ctype(__c_locale __cloc
, const mask
* __table
= 0, bool __del
= false,
259 is(mask __m
, char __c
) const;
262 is(const char* __lo
, const char* __hi
, mask
* __vec
) const;
265 scan_is(mask __m
, const char* __lo
, const char* __hi
) const;
268 scan_not(mask __m
, const char* __lo
, const char* __hi
) const;
272 table() const throw()
276 classic_table() throw();
282 do_is(mask __m
, char_type __c
) const;
284 virtual const char_type
*
285 do_is(const char_type
* __lo
, const char_type
* __hi
, mask
* __vec
) const;
287 virtual const char_type
*
288 do_scan_is(mask __m
, const char_type
* __lo
, const char_type
* __hi
) const;
290 virtual const char_type
*
291 do_scan_not(mask __m
, const char_type
* __lo
,
292 const char_type
* __hi
) const;
295 do_toupper(char_type
) const;
297 virtual const char_type
*
298 do_toupper(char_type
* __lo
, const char_type
* __hi
) const;
301 do_tolower(char_type
) const;
303 virtual const char_type
*
304 do_tolower(char_type
* __lo
, const char_type
* __hi
) const;
307 do_widen(char) const;
310 do_widen(const char* __lo
, const char* __hi
, char_type
* __dest
) const;
313 do_narrow(char_type
, char __dfault
) const;
315 virtual const char_type
*
316 do_narrow(const char_type
* __lo
, const char_type
* __hi
,
317 char __dfault
, char* __dest
) const;
322 use_facet
<ctype
<char> >(const locale
& __loc
);
324 #ifdef _GLIBCPP_USE_WCHAR_T
325 // 22.2.1.3 ctype<wchar_t> specialization
327 class ctype
<wchar_t> : public __ctype_abstract_base
<wchar_t>
331 typedef wchar_t char_type
;
332 typedef wctype_t __wmask_type
;
335 __c_locale _M_c_locale_ctype
;
339 static locale::id id
;
342 ctype(size_t __refs
= 0);
345 ctype(__c_locale __cloc
, size_t __refs
= 0);
349 _M_convert_to_wmask(const mask __m
) const;
355 do_is(mask __m
, char_type __c
) const;
357 virtual const char_type
*
358 do_is(const char_type
* __lo
, const char_type
* __hi
, mask
* __vec
) const;
360 virtual const char_type
*
361 do_scan_is(mask __m
, const char_type
* __lo
, const char_type
* __hi
) const;
363 virtual const char_type
*
364 do_scan_not(mask __m
, const char_type
* __lo
,
365 const char_type
* __hi
) const;
368 do_toupper(char_type
) const;
370 virtual const char_type
*
371 do_toupper(char_type
* __lo
, const char_type
* __hi
) const;
374 do_tolower(char_type
) const;
376 virtual const char_type
*
377 do_tolower(char_type
* __lo
, const char_type
* __hi
) const;
380 do_widen(char) const;
383 do_widen(const char* __lo
, const char* __hi
, char_type
* __dest
) const;
386 do_narrow(char_type
, char __dfault
) const;
388 virtual const char_type
*
389 do_narrow(const char_type
* __lo
, const char_type
* __hi
,
390 char __dfault
, char* __dest
) const;
395 const ctype
<wchar_t>&
396 use_facet
<ctype
<wchar_t> >(const locale
& __loc
);
397 #endif //_GLIBCPP_USE_WCHAR_T
399 // Include host and configuration specific ctype inlines.
400 #include <bits/ctype_inline.h>
402 // 22.2.1.2 Template class ctype_byname
403 template<typename _CharT
>
404 class ctype_byname
: public ctype
<_CharT
>
407 typedef _CharT char_type
;
410 ctype_byname(const char* __s
, size_t __refs
= 0);
417 // 22.2.1.4 Class ctype_byname specializations.
419 ctype_byname
<char>::ctype_byname(const char*, size_t refs
);
422 ctype_byname
<wchar_t>::ctype_byname(const char*, size_t refs
);
424 // 22.2.1.5 Template class codecvt
425 #include <bits/codecvt.h>
428 // 22.2.2 The numeric category.
432 // String literal of acceptable (narrow) input, for num_get.
433 // "0123456789eEabcdfABCDF"
434 static const char _S_atoms
[];
445 // Construct and return valid scanf format for floating point types.
447 _S_format_float(const ios_base
& __io
, char* __fptr
, char __mod
,
450 // Construct and return valid scanf format for integer types.
452 _S_format_int(const ios_base
& __io
, char* __fptr
, char __mod
, char __modl
);
456 template<typename _CharT
>
457 class numpunct
: public locale::facet
461 typedef _CharT char_type
;
462 typedef basic_string
<_CharT
> string_type
;
464 static locale::id id
;
467 char_type _M_decimal_point
;
468 char_type _M_thousands_sep
;
469 const char* _M_grouping
;
470 const char_type
* _M_truename
;
471 const char_type
* _M_falsename
;
475 numpunct(size_t __refs
= 0) : locale::facet(__refs
)
476 { _M_initialize_numpunct(); }
479 numpunct(__c_locale __cloc
, size_t __refs
= 0) : locale::facet(__refs
)
480 { _M_initialize_numpunct(__cloc
); }
483 decimal_point() const
484 { return this->do_decimal_point(); }
487 thousands_sep() const
488 { return this->do_thousands_sep(); }
492 { return this->do_grouping(); }
496 { return this->do_truename(); }
500 { return this->do_falsename(); }
507 do_decimal_point() const
508 { return _M_decimal_point
; }
511 do_thousands_sep() const
512 { return _M_thousands_sep
; }
516 { return _M_grouping
; }
520 { return _M_truename
; }
524 { return _M_falsename
; }
526 // For use at construction time only.
528 _M_initialize_numpunct(__c_locale __cloc
= _S_c_locale
);
531 template<typename _CharT
>
532 locale::id numpunct
<_CharT
>::id
;
535 numpunct
<char>::~numpunct();
539 numpunct
<char>::_M_initialize_numpunct(__c_locale __cloc
);
541 #ifdef _GLIBCPP_USE_WCHAR_T
543 numpunct
<wchar_t>::~numpunct();
547 numpunct
<wchar_t>::_M_initialize_numpunct(__c_locale __cloc
);
550 template<typename _CharT
>
551 class numpunct_byname
: public numpunct
<_CharT
>
554 __c_locale _M_c_locale_numpunct
;
557 typedef _CharT char_type
;
558 typedef basic_string
<_CharT
> string_type
;
561 numpunct_byname(const char* __s
, size_t __refs
= 0)
562 : numpunct
<_CharT
>(__refs
)
564 _S_create_c_locale(_M_c_locale_numpunct
, __s
);
565 _M_initialize_numpunct(_M_c_locale_numpunct
);
571 { _S_destroy_c_locale(_M_c_locale_numpunct
); }
574 template<typename _CharT
, typename _InIter
>
575 class num_get
: public locale::facet
, public __num_base
579 typedef _CharT char_type
;
580 typedef _InIter iter_type
;
582 static locale::id id
;
585 num_get(size_t __refs
= 0) : locale::facet(__refs
) { }
588 get(iter_type __in
, iter_type __end
, ios_base
& __io
,
589 ios_base::iostate
& __err
, bool& __v
) const
590 { return this->do_get(__in
, __end
, __io
, __err
, __v
); }
593 get(iter_type __in
, iter_type __end
, ios_base
& __io
,
594 ios_base::iostate
& __err
, long& __v
) const
595 { return this->do_get(__in
, __end
, __io
, __err
, __v
); }
598 get(iter_type __in
, iter_type __end
, ios_base
& __io
,
599 ios_base::iostate
& __err
, unsigned short& __v
) const
600 { return this->do_get(__in
, __end
, __io
, __err
, __v
); }
603 get(iter_type __in
, iter_type __end
, ios_base
& __io
,
604 ios_base::iostate
& __err
, unsigned int& __v
) const
605 { return this->do_get(__in
, __end
, __io
, __err
, __v
); }
608 get(iter_type __in
, iter_type __end
, ios_base
& __io
,
609 ios_base::iostate
& __err
, unsigned long& __v
) const
610 { return this->do_get(__in
, __end
, __io
, __err
, __v
); }
612 #ifdef _GLIBCPP_USE_LONG_LONG
614 get(iter_type __in
, iter_type __end
, ios_base
& __io
,
615 ios_base::iostate
& __err
, long long& __v
) const
616 { return this->do_get(__in
, __end
, __io
, __err
, __v
); }
619 get(iter_type __in
, iter_type __end
, ios_base
& __io
,
620 ios_base::iostate
& __err
, unsigned long long& __v
) const
621 { return this->do_get(__in
, __end
, __io
, __err
, __v
); }
625 get(iter_type __in
, iter_type __end
, ios_base
& __io
,
626 ios_base::iostate
& __err
, float& __v
) const
627 { return this->do_get(__in
, __end
, __io
, __err
, __v
); }
630 get(iter_type __in
, iter_type __end
, ios_base
& __io
,
631 ios_base::iostate
& __err
, double& __v
) const
632 { return this->do_get(__in
, __end
, __io
, __err
, __v
); }
635 get(iter_type __in
, iter_type __end
, ios_base
& __io
,
636 ios_base::iostate
& __err
, long double& __v
) const
637 { return this->do_get(__in
, __end
, __io
, __err
, __v
); }
640 get(iter_type __in
, iter_type __end
, ios_base
& __io
,
641 ios_base::iostate
& __err
, void*& __v
) const
642 { return this->do_get(__in
, __end
, __io
, __err
, __v
); }
645 virtual ~num_get() { }
648 _M_extract_float(iter_type
, iter_type
, ios_base
&, ios_base::iostate
&,
649 string
& __xtrc
) const;
652 _M_extract_int(iter_type
, iter_type
, ios_base
&, ios_base::iostate
&,
653 string
& __xtrc
, int& __base
) const;
656 do_get(iter_type
, iter_type
, ios_base
&, ios_base::iostate
&, bool&) const;
660 do_get(iter_type
, iter_type
, ios_base
&, ios_base::iostate
&, long&) const;
663 do_get(iter_type
, iter_type
, ios_base
&, ios_base::iostate
& __err
,
664 unsigned short&) const;
667 do_get(iter_type
, iter_type
, ios_base
&, ios_base::iostate
& __err
,
668 unsigned int&) const;
671 do_get(iter_type
, iter_type
, ios_base
&, ios_base::iostate
& __err
,
672 unsigned long&) const;
674 #ifdef _GLIBCPP_USE_LONG_LONG
676 do_get(iter_type
, iter_type
, ios_base
&, ios_base::iostate
& __err
,
680 do_get(iter_type
, iter_type
, ios_base
&, ios_base::iostate
& __err
,
681 unsigned long long&) const;
685 do_get(iter_type
, iter_type
, ios_base
&, ios_base::iostate
& __err
,
689 do_get(iter_type
, iter_type
, ios_base
&, ios_base::iostate
& __err
,
693 do_get(iter_type
, iter_type
, ios_base
&, ios_base::iostate
& __err
,
697 do_get(iter_type
, iter_type
, ios_base
&, ios_base::iostate
& __err
,
701 template<typename _CharT
, typename _InIter
>
702 locale::id num_get
<_CharT
, _InIter
>::id
;
705 // Partial specialization for istreambuf_iterator, so can use traits_type.
706 template<typename _CharT
>
707 class num_get
<_CharT
, istreambuf_iterator
<_CharT
> >;
710 _M_extract_float(iter_type
, iter_type
, ios_base
&, ios_base::iostate
&,
711 string
& __xtrc
) const;
714 _M_extract_int(iter_type
, iter_type
, ios_base
&, ios_base::iostate
&,
715 string
& __xtrc
, int& __base
) const;
718 do_get(iter_type
, iter_type
, ios_base
&, ios_base::iostate
&, bool&) const;
721 template<typename _CharT
, typename _OutIter
>
722 class num_put
: public locale::facet
, public __num_base
726 typedef _CharT char_type
;
727 typedef _OutIter iter_type
;
729 static locale::id id
;
732 num_put(size_t __refs
= 0) : locale::facet(__refs
) { }
735 put(iter_type __s
, ios_base
& __f
, char_type __fill
, bool __v
) const
736 { return this->do_put(__s
, __f
, __fill
, __v
); }
739 put(iter_type __s
, ios_base
& __f
, char_type __fill
, long __v
) const
740 { return this->do_put(__s
, __f
, __fill
, __v
); }
743 put(iter_type __s
, ios_base
& __f
, char_type __fill
,
744 unsigned long __v
) const
745 { return this->do_put(__s
, __f
, __fill
, __v
); }
747 #ifdef _GLIBCPP_USE_LONG_LONG
749 put(iter_type __s
, ios_base
& __f
, char_type __fill
, long long __v
) const
750 { return this->do_put(__s
, __f
, __fill
, __v
); }
753 put(iter_type __s
, ios_base
& __f
, char_type __fill
,
754 unsigned long long __v
) const
755 { return this->do_put(__s
, __f
, __fill
, __v
); }
759 put(iter_type __s
, ios_base
& __f
, char_type __fill
, double __v
) const
760 { return this->do_put(__s
, __f
, __fill
, __v
); }
763 put(iter_type __s
, ios_base
& __f
, char_type __fill
,
764 long double __v
) const
765 { return this->do_put(__s
, __f
, __fill
, __v
); }
768 put(iter_type __s
, ios_base
& __f
, char_type __fill
,
769 const void* __v
) const
770 { return this->do_put(__s
, __f
, __fill
, __v
); }
773 template<typename _ValueT
>
775 _M_convert_float(iter_type
, ios_base
& __io
, char_type __fill
,
776 char __mod
, _ValueT __v
) const;
778 template<typename _ValueT
>
780 _M_convert_int(iter_type
, ios_base
& __io
, char_type __fill
,
781 char __mod
, char __modl
, _ValueT __v
) const;
784 _M_widen_float(iter_type
, ios_base
& __io
, char_type __fill
, char* __cs
,
788 _M_widen_int(iter_type
, ios_base
& __io
, char_type __fill
, char* __cs
,
792 _M_insert(iter_type
, ios_base
& __io
, char_type __fill
,
793 const char_type
* __ws
, int __len
) const;
799 do_put(iter_type
, ios_base
&, char_type __fill
, bool __v
) const;
802 do_put(iter_type
, ios_base
&, char_type __fill
, long __v
) const;
805 do_put(iter_type
, ios_base
&, char_type __fill
, unsigned long) const;
807 #ifdef _GLIBCPP_USE_LONG_LONG
809 do_put(iter_type
, ios_base
&, char_type __fill
, long long __v
) const;
812 do_put(iter_type
, ios_base
&, char_type __fill
, unsigned long long) const;
816 do_put(iter_type
, ios_base
&, char_type __fill
, double __v
) const;
819 do_put(iter_type
, ios_base
&, char_type __fill
, long double __v
) const;
822 do_put(iter_type
, ios_base
&, char_type __fill
, const void* __v
) const;
825 template <typename _CharT
, typename _OutIter
>
826 locale::id num_put
<_CharT
, _OutIter
>::id
;
829 template<typename _CharT
>
830 class collate
: public locale::facet
834 typedef _CharT char_type
;
835 typedef basic_string
<_CharT
> string_type
;
838 // Underlying "C" library locale information saved from
839 // initialization, needed by collate_byname as well.
840 __c_locale _M_c_locale_collate
;
843 static locale::id id
;
846 collate(size_t __refs
= 0)
847 : locale::facet(__refs
)
848 { _M_c_locale_collate
= _S_c_locale
; }
851 collate(__c_locale __cloc
, size_t __refs
= 0)
852 : locale::facet(__refs
)
853 { _M_c_locale_collate
= _S_clone_c_locale(__cloc
); }
856 compare(const _CharT
* __lo1
, const _CharT
* __hi1
,
857 const _CharT
* __lo2
, const _CharT
* __hi2
) const
858 { return this->do_compare(__lo1
, __hi1
, __lo2
, __hi2
); }
861 transform(const _CharT
* __lo
, const _CharT
* __hi
) const
862 { return this->do_transform(__lo
, __hi
); }
865 hash(const _CharT
* __lo
, const _CharT
* __hi
) const
866 { return this->do_hash(__lo
, __hi
); }
868 // Used to abstract out _CharT bits in virtual member functions, below.
870 _M_compare(const _CharT
*, const _CharT
*) const;
873 _M_transform(_CharT
*, const _CharT
*, size_t) const;
879 if (_M_c_locale_collate
!= _S_c_locale
)
880 _S_destroy_c_locale(_M_c_locale_collate
);
884 do_compare(const _CharT
* __lo1
, const _CharT
* __hi1
,
885 const _CharT
* __lo2
, const _CharT
* __hi2
) const;
888 do_transform(const _CharT
* __lo
, const _CharT
* __hi
) const;
891 do_hash(const _CharT
* __lo
, const _CharT
* __hi
) const;
894 template<typename _CharT
>
895 locale::id collate
<_CharT
>::id
;
900 collate
<char>::_M_compare(const char*, const char*) const;
904 collate
<char>::_M_transform(char*, const char*, size_t) const;
906 #ifdef _GLIBCPP_USE_WCHAR_T
909 collate
<wchar_t>::_M_compare(const wchar_t*, const wchar_t*) const;
913 collate
<wchar_t>::_M_transform(wchar_t*, const wchar_t*, size_t) const;
916 template<typename _CharT
>
917 class collate_byname
: public collate
<_CharT
>
920 typedef _CharT char_type
;
921 typedef basic_string
<_CharT
> string_type
;
924 collate_byname(const char* __s
, size_t __refs
= 0)
925 : collate
<_CharT
>(__refs
)
927 if (_M_c_locale_collate
!= _S_c_locale
)
928 _S_destroy_c_locale(_M_c_locale_collate
);
929 _S_create_c_locale(_M_c_locale_collate
, __s
);
934 ~collate_byname() { }
941 enum dateorder
{ no_order
, dmy
, mdy
, ymd
, ydm
};
944 template<typename _CharT
>
945 class __timepunct
: public locale::facet
949 typedef _CharT __char_type
;
950 typedef basic_string
<_CharT
> __string_type
;
952 static locale::id id
;
954 // List of all known timezones, with GMT first.
955 static const _CharT
* _S_timezones
[14];
958 __c_locale _M_c_locale_timepunct
;
959 const char* _M_name_timepunct
;
960 const _CharT
* _M_date_format
;
961 const _CharT
* _M_date_era_format
;
962 const _CharT
* _M_time_format
;
963 const _CharT
* _M_time_era_format
;
964 const _CharT
* _M_date_time_format
;
965 const _CharT
* _M_date_time_era_format
;
968 const _CharT
* _M_am_pm_format
;
970 // Day names, starting with "C"'s Sunday.
971 const _CharT
* _M_day1
;
972 const _CharT
* _M_day2
;
973 const _CharT
* _M_day3
;
974 const _CharT
* _M_day4
;
975 const _CharT
* _M_day5
;
976 const _CharT
* _M_day6
;
977 const _CharT
* _M_day7
;
979 // Abbreviated day names, starting with "C"'s Sun.
980 const _CharT
* _M_day_a1
;
981 const _CharT
* _M_day_a2
;
982 const _CharT
* _M_day_a3
;
983 const _CharT
* _M_day_a4
;
984 const _CharT
* _M_day_a5
;
985 const _CharT
* _M_day_a6
;
986 const _CharT
* _M_day_a7
;
988 // Month names, starting with "C"'s January.
989 const _CharT
* _M_month01
;
990 const _CharT
* _M_month02
;
991 const _CharT
* _M_month03
;
992 const _CharT
* _M_month04
;
993 const _CharT
* _M_month05
;
994 const _CharT
* _M_month06
;
995 const _CharT
* _M_month07
;
996 const _CharT
* _M_month08
;
997 const _CharT
* _M_month09
;
998 const _CharT
* _M_month10
;
999 const _CharT
* _M_month11
;
1000 const _CharT
* _M_month12
;
1002 // Abbreviated month names, starting with "C"'s Jan.
1003 const _CharT
* _M_month_a01
;
1004 const _CharT
* _M_month_a02
;
1005 const _CharT
* _M_month_a03
;
1006 const _CharT
* _M_month_a04
;
1007 const _CharT
* _M_month_a05
;
1008 const _CharT
* _M_month_a06
;
1009 const _CharT
* _M_month_a07
;
1010 const _CharT
* _M_month_a08
;
1011 const _CharT
* _M_month_a09
;
1012 const _CharT
* _M_month_a10
;
1013 const _CharT
* _M_month_a11
;
1014 const _CharT
* _M_month_a12
;
1018 __timepunct(size_t __refs
= 0)
1019 : locale::facet(__refs
), _M_name_timepunct("C")
1020 { _M_initialize_timepunct(); }
1023 __timepunct(__c_locale __cloc
, const char* __s
, size_t __refs
= 0)
1024 : locale::facet(__refs
), _M_name_timepunct(__s
)
1025 { _M_initialize_timepunct(__cloc
); }
1028 _M_put(_CharT
* __s
, size_t __maxlen
, const _CharT
* __format
,
1029 const tm
* __tm
) const;
1032 _M_date_formats(const _CharT
** __date
) const
1034 // Always have default first.
1035 __date
[0] = _M_date_format
;
1036 __date
[1] = _M_date_era_format
;
1040 _M_time_formats(const _CharT
** __time
) const
1042 // Always have default first.
1043 __time
[0] = _M_time_format
;
1044 __time
[1] = _M_time_era_format
;
1048 _M_ampm(const _CharT
** __ampm
) const
1055 _M_date_time_formats(const _CharT
** __dt
) const
1057 // Always have default first.
1058 __dt
[0] = _M_date_time_format
;
1059 __dt
[1] = _M_date_time_era_format
;
1063 _M_days(const _CharT
** __days
) const
1065 __days
[0] = _M_day1
;
1066 __days
[1] = _M_day2
;
1067 __days
[2] = _M_day3
;
1068 __days
[3] = _M_day4
;
1069 __days
[4] = _M_day5
;
1070 __days
[5] = _M_day6
;
1071 __days
[6] = _M_day7
;
1075 _M_days_abbreviated(const _CharT
** __days
) const
1077 __days
[0] = _M_day_a1
;
1078 __days
[1] = _M_day_a2
;
1079 __days
[2] = _M_day_a3
;
1080 __days
[3] = _M_day_a4
;
1081 __days
[4] = _M_day_a5
;
1082 __days
[5] = _M_day_a6
;
1083 __days
[6] = _M_day_a7
;
1087 _M_months(const _CharT
** __months
) const
1089 __months
[0] = _M_month01
;
1090 __months
[1] = _M_month02
;
1091 __months
[2] = _M_month03
;
1092 __months
[3] = _M_month04
;
1093 __months
[4] = _M_month05
;
1094 __months
[5] = _M_month06
;
1095 __months
[6] = _M_month07
;
1096 __months
[7] = _M_month08
;
1097 __months
[8] = _M_month09
;
1098 __months
[9] = _M_month10
;
1099 __months
[10] = _M_month11
;
1100 __months
[11] = _M_month12
;
1104 _M_months_abbreviated(const _CharT
** __months
) const
1106 __months
[0] = _M_month_a01
;
1107 __months
[1] = _M_month_a02
;
1108 __months
[2] = _M_month_a03
;
1109 __months
[3] = _M_month_a04
;
1110 __months
[4] = _M_month_a05
;
1111 __months
[5] = _M_month_a06
;
1112 __months
[6] = _M_month_a07
;
1113 __months
[7] = _M_month_a08
;
1114 __months
[8] = _M_month_a09
;
1115 __months
[9] = _M_month_a10
;
1116 __months
[10] = _M_month_a11
;
1117 __months
[11] = _M_month_a12
;
1124 // For use at construction time only.
1126 _M_initialize_timepunct(__c_locale __cloc
= _S_c_locale
);
1129 template<typename _CharT
>
1130 locale::id __timepunct
<_CharT
>::id
;
1134 __timepunct
<char>::~__timepunct();
1138 __timepunct
<char>::_S_timezones
[14];
1142 __timepunct
<char>::_M_initialize_timepunct(__c_locale __cloc
);
1146 __timepunct
<char>::_M_put(char*, size_t, const char*, const tm
*) const;
1148 #ifdef _GLIBCPP_USE_WCHAR_T
1150 __timepunct
<wchar_t>::~__timepunct();
1154 __timepunct
<wchar_t>::_S_timezones
[14];
1158 __timepunct
<wchar_t>::_M_initialize_timepunct(__c_locale __cloc
);
1162 __timepunct
<wchar_t>::_M_put(wchar_t*, size_t, const wchar_t*,
1167 template<typename _CharT
>
1168 const _CharT
* __timepunct
<_CharT
>::_S_timezones
[14];
1171 template<typename _CharT
, typename _InIter
>
1172 class time_get
: public locale::facet
, public time_base
1176 typedef _CharT char_type
;
1177 typedef _InIter iter_type
;
1178 typedef basic_string
<_CharT
> __string_type
;
1180 static locale::id id
;
1183 time_get(size_t __refs
= 0)
1184 : locale::facet (__refs
) { }
1188 { return this->do_date_order(); }
1191 get_time(iter_type __beg
, iter_type __end
, ios_base
& __io
,
1192 ios_base::iostate
& __err
, tm
* __tm
) const
1193 { return this->do_get_time(__beg
, __end
, __io
, __err
, __tm
); }
1196 get_date(iter_type __beg
, iter_type __end
, ios_base
& __io
,
1197 ios_base::iostate
& __err
, tm
* __tm
) const
1198 { return this->do_get_date(__beg
, __end
, __io
, __err
, __tm
); }
1201 get_weekday(iter_type __beg
, iter_type __end
, ios_base
& __io
,
1202 ios_base::iostate
& __err
, tm
* __tm
) const
1203 { return this->do_get_weekday(__beg
, __end
, __io
, __err
, __tm
); }
1206 get_monthname(iter_type __beg
, iter_type __end
, ios_base
& __io
,
1207 ios_base::iostate
& __err
, tm
* __tm
) const
1208 { return this->do_get_monthname(__beg
, __end
, __io
, __err
, __tm
); }
1211 get_year(iter_type __beg
, iter_type __end
, ios_base
& __io
,
1212 ios_base::iostate
& __err
, tm
* __tm
) const
1213 { return this->do_get_year(__beg
, __end
, __io
, __err
, __tm
); }
1220 do_date_order() const;
1223 do_get_time(iter_type __beg
, iter_type __end
, ios_base
& __io
,
1224 ios_base::iostate
& __err
, tm
* __tm
) const;
1227 do_get_date(iter_type __beg
, iter_type __end
, ios_base
& __io
,
1228 ios_base::iostate
& __err
, tm
* __tm
) const;
1231 do_get_weekday(iter_type __beg
, iter_type __end
, ios_base
&,
1232 ios_base::iostate
& __err
, tm
* __tm
) const;
1235 do_get_monthname(iter_type __beg
, iter_type __end
, ios_base
&,
1236 ios_base::iostate
& __err
, tm
* __tm
) const;
1239 do_get_year(iter_type __beg
, iter_type __end
, ios_base
& __io
,
1240 ios_base::iostate
& __err
, tm
* __tm
) const;
1242 // Extract numeric component of length __len.
1244 _M_extract_num(iter_type
& __beg
, iter_type
& __end
, int& __member
,
1245 int __min
, int __max
, size_t __len
,
1246 const ctype
<_CharT
>& __ctype
,
1247 ios_base::iostate
& __err
) const;
1249 // Extract day or month name, or any unique array of string
1250 // literals in a const _CharT* array.
1252 _M_extract_name(iter_type
& __beg
, iter_type
& __end
, int& __member
,
1253 const _CharT
** __names
, size_t __indexlen
,
1254 ios_base::iostate
& __err
) const;
1256 // Extract on a component-by-component basis, via __format argument.
1258 _M_extract_via_format(iter_type
& __beg
, iter_type
& __end
, ios_base
& __io
,
1259 ios_base::iostate
& __err
, tm
* __tm
,
1260 const _CharT
* __format
) const;
1263 template<typename _CharT
, typename _InIter
>
1264 locale::id time_get
<_CharT
, _InIter
>::id
;
1266 template<typename _CharT
, typename _InIter
>
1267 class time_get_byname
: public time_get
<_CharT
, _InIter
>
1271 typedef _CharT char_type
;
1272 typedef _InIter iter_type
;
1275 time_get_byname(const char*, size_t __refs
= 0)
1276 : time_get
<_CharT
, _InIter
>(__refs
) { }
1280 ~time_get_byname() { }
1283 template<typename _CharT
, typename _OutIter
>
1284 class time_put
: public locale::facet
, public time_base
1288 typedef _CharT char_type
;
1289 typedef _OutIter iter_type
;
1291 static locale::id id
;
1294 time_put(size_t __refs
= 0)
1295 : locale::facet(__refs
) { }
1298 put(iter_type __s
, ios_base
& __io
, char_type __fill
, const tm
* __tm
,
1299 const _CharT
* __beg
, const _CharT
* __end
) const;
1302 put(iter_type __s
, ios_base
& __io
, char_type __fill
,
1303 const tm
* __tm
, char __format
, char __mod
= 0) const
1304 { return this->do_put(__s
, __io
, __fill
, __tm
, __format
, __mod
); }
1312 do_put(iter_type __s
, ios_base
& __io
, char_type __fill
, const tm
* __tm
,
1313 char __format
, char __mod
) const;
1316 template<typename _CharT
, typename _OutIter
>
1317 locale::id time_put
<_CharT
, _OutIter
>::id
;
1319 template<typename _CharT
, typename _OutIter
>
1320 class time_put_byname
: public time_put
<_CharT
, _OutIter
>
1324 typedef _CharT char_type
;
1325 typedef _OutIter iter_type
;
1328 time_put_byname(const char* /*__s*/, size_t __refs
= 0)
1329 : time_put
<_CharT
, _OutIter
>(__refs
)
1334 ~time_put_byname() { }
1341 enum part
{ none
, space
, symbol
, sign
, value
};
1342 struct pattern
{ char field
[4]; };
1344 static const pattern _S_default_pattern
;
1346 // Construct and return valid pattern consisting of some combination of:
1347 // space none symbol sign value
1349 _S_construct_pattern(char __precedes
, char __space
, char __posn
);
1352 template<typename _CharT
, bool _Intl
>
1353 class moneypunct
: public locale::facet
, public money_base
1357 typedef _CharT char_type
;
1358 typedef basic_string
<_CharT
> string_type
;
1360 static const bool intl
= _Intl
;
1361 static locale::id id
;
1364 const char* _M_grouping
;
1365 char_type _M_decimal_point
;
1366 char_type _M_thousands_sep
;
1367 const char_type
* _M_curr_symbol
;
1368 const char_type
* _M_positive_sign
;
1369 const char_type
* _M_negative_sign
;
1371 pattern _M_pos_format
;
1372 pattern _M_neg_format
;
1376 moneypunct(size_t __refs
= 0) : locale::facet(__refs
)
1377 { _M_initialize_moneypunct(); }
1380 moneypunct(__c_locale __cloc
, const char* __s
, size_t __refs
= 0)
1381 : locale::facet(__refs
)
1382 { _M_initialize_moneypunct(__cloc
, __s
); }
1385 decimal_point() const
1386 { return this->do_decimal_point(); }
1389 thousands_sep() const
1390 { return this->do_thousands_sep(); }
1394 { return this->do_grouping(); }
1398 { return this->do_curr_symbol(); }
1401 positive_sign() const
1402 { return this->do_positive_sign(); }
1405 negative_sign() const
1406 { return this->do_negative_sign(); }
1410 { return this->do_frac_digits(); }
1414 { return this->do_pos_format(); }
1418 { return this->do_neg_format(); }
1425 do_decimal_point() const
1426 { return _M_decimal_point
; }
1429 do_thousands_sep() const
1430 { return _M_thousands_sep
; }
1434 { return _M_grouping
; }
1437 do_curr_symbol() const
1438 { return _M_curr_symbol
; }
1441 do_positive_sign() const
1442 { return _M_positive_sign
; }
1445 do_negative_sign() const
1446 { return _M_negative_sign
; }
1449 do_frac_digits() const
1450 { return _M_frac_digits
; }
1453 do_pos_format() const
1454 { return _M_pos_format
; }
1457 do_neg_format() const
1458 { return _M_neg_format
; }
1460 // For use at construction time only.
1462 _M_initialize_moneypunct(__c_locale __cloc
= _S_c_locale
,
1463 const char* __name
= NULL
);
1466 template<typename _CharT
, bool _Intl
>
1467 locale::id moneypunct
<_CharT
, _Intl
>::id
;
1469 template<typename _CharT
, bool _Intl
>
1470 const bool moneypunct
<_CharT
, _Intl
>::intl
;
1473 moneypunct
<char, true>::~moneypunct();
1476 moneypunct
<char, false>::~moneypunct();
1480 moneypunct
<char, true>::_M_initialize_moneypunct(__c_locale
, const char*);
1484 moneypunct
<char, false>::_M_initialize_moneypunct(__c_locale
, const char*);
1486 #ifdef _GLIBCPP_USE_WCHAR_T
1488 moneypunct
<wchar_t, true>::~moneypunct();
1491 moneypunct
<wchar_t, false>::~moneypunct();
1495 moneypunct
<wchar_t, true>::_M_initialize_moneypunct(__c_locale
,
1500 moneypunct
<wchar_t, false>::_M_initialize_moneypunct(__c_locale
,
1504 template<typename _CharT
, bool _Intl
>
1505 class moneypunct_byname
: public moneypunct
<_CharT
, _Intl
>
1507 __c_locale _M_c_locale_moneypunct
;
1510 typedef _CharT char_type
;
1511 typedef basic_string
<_CharT
> string_type
;
1513 static const bool intl
= _Intl
;
1516 moneypunct_byname(const char* __s
, size_t __refs
= 0)
1517 : moneypunct
<_CharT
, _Intl
>(__refs
)
1519 _S_create_c_locale(_M_c_locale_moneypunct
, __s
);
1520 _M_initialize_moneypunct(_M_c_locale_moneypunct
);
1525 ~moneypunct_byname()
1526 { _S_destroy_c_locale(_M_c_locale_moneypunct
); }
1529 template<typename _CharT
, bool _Intl
>
1530 const bool moneypunct_byname
<_CharT
, _Intl
>::intl
;
1532 template<typename _CharT
, typename _InIter
>
1533 class money_get
: public locale::facet
1537 typedef _CharT char_type
;
1538 typedef _InIter iter_type
;
1539 typedef basic_string
<_CharT
> string_type
;
1541 static locale::id id
;
1544 money_get(size_t __refs
= 0) : locale::facet(__refs
) { }
1547 get(iter_type __s
, iter_type __end
, bool __intl
, ios_base
& __io
,
1548 ios_base::iostate
& __err
, long double& __units
) const
1549 { return this->do_get(__s
, __end
, __intl
, __io
, __err
, __units
); }
1552 get(iter_type __s
, iter_type __end
, bool __intl
, ios_base
& __io
,
1553 ios_base::iostate
& __err
, string_type
& __digits
) const
1554 { return this->do_get(__s
, __end
, __intl
, __io
, __err
, __digits
); }
1561 do_get(iter_type __s
, iter_type __end
, bool __intl
, ios_base
& __io
,
1562 ios_base::iostate
& __err
, long double& __units
) const;
1565 do_get(iter_type __s
, iter_type __end
, bool __intl
, ios_base
& __io
,
1566 ios_base::iostate
& __err
, string_type
& __digits
) const;
1569 template<typename _CharT
, typename _InIter
>
1570 locale::id money_get
<_CharT
, _InIter
>::id
;
1572 template<typename _CharT
, typename _OutIter
>
1573 class money_put
: public locale::facet
1576 typedef _CharT char_type
;
1577 typedef _OutIter iter_type
;
1578 typedef basic_string
<_CharT
> string_type
;
1580 static locale::id id
;
1583 money_put(size_t __refs
= 0) : locale::facet(__refs
) { }
1586 put(iter_type __s
, bool __intl
, ios_base
& __io
,
1587 char_type __fill
, long double __units
) const
1588 { return this->do_put(__s
, __intl
, __io
, __fill
, __units
); }
1591 put(iter_type __s
, bool __intl
, ios_base
& __io
,
1592 char_type __fill
, const string_type
& __digits
) const
1593 { return this->do_put(__s
, __intl
, __io
, __fill
, __digits
); }
1600 do_put(iter_type __s
, bool __intl
, ios_base
& __io
, char_type __fill
,
1601 long double __units
) const;
1604 do_put(iter_type __s
, bool __intl
, ios_base
& __io
, char_type __fill
,
1605 const string_type
& __digits
) const;
1608 template<typename _CharT
, typename _OutIter
>
1609 locale::id money_put
<_CharT
, _OutIter
>::id
;
1612 struct messages_base
1614 typedef int catalog
;
1617 template<typename _CharT
>
1618 class messages
: public locale::facet
, public messages_base
1622 typedef _CharT char_type
;
1623 typedef basic_string
<_CharT
> string_type
;
1626 // Underlying "C" library locale information saved from
1627 // initialization, needed by messages_byname as well.
1628 __c_locale _M_c_locale_messages
;
1630 // Only needed if glibc < 2.3
1631 const char* _M_name_messages
;
1635 static locale::id id
;
1638 messages(size_t __refs
= 0)
1639 : locale::facet(__refs
), _M_name_messages("C")
1640 { _M_c_locale_messages
= _S_c_locale
; }
1644 messages(__c_locale __cloc
, const char* __name
, size_t __refs
= 0)
1645 : locale::facet(__refs
)
1647 _M_name_messages
= __name
;
1648 _M_c_locale_messages
= _S_clone_c_locale(__cloc
);
1652 open(const basic_string
<char>& __s
, const locale
& __loc
) const
1653 { return this->do_open(__s
, __loc
); }
1655 // Non-standard and unorthodox, yet effective.
1657 open(const basic_string
<char>&, const locale
&, const char*) const;
1660 get(catalog __c
, int __set
, int __msgid
, const string_type
& __s
) const
1661 { return this->do_get(__c
, __set
, __msgid
, __s
); }
1664 close(catalog __c
) const
1665 { return this->do_close(__c
); }
1671 if (_M_c_locale_messages
!= _S_c_locale
)
1672 _S_destroy_c_locale(_M_c_locale_messages
);
1676 do_open(const basic_string
<char>&, const locale
&) const;
1679 do_get(catalog
, int, int, const string_type
& __dfault
) const;
1682 do_close(catalog
) const;
1684 // Returns a locale and codeset-converted string, given a char* message.
1686 _M_convert_to_char(const string_type
& __msg
) const
1689 return reinterpret_cast<char*>(const_cast<_CharT
*>(__msg
.c_str()));
1692 // Returns a locale and codeset-converted string, given a char* message.
1694 _M_convert_from_char(char* __msg
) const
1696 // Length of message string without terminating null.
1697 size_t __len
= char_traits
<char>::length(__msg
) - 1;
1699 // "everybody can easily convert the string using
1700 // mbsrtowcs/wcsrtombs or with iconv()"
1702 // Convert char* to _CharT in locale used to open catalog.
1703 // XXX need additional template parameter on messages class for this..
1704 // typedef typename codecvt<char, _CharT, _StateT> __codecvt_type;
1705 typedef typename codecvt
<char, _CharT
, mbstate_t> __codecvt_type
;
1707 __codecvt_type::state_type __state
;
1708 // XXX may need to initialize state.
1709 //initialize_state(__state._M_init());
1712 // XXX what size for this string?
1713 _CharT
* __to
= static_cast<_CharT
*>(__builtin_alloca(__len
+ 1));
1714 const __codecvt_type
& __cvt
= use_facet
<__codecvt_type
>(_M_locale_conv
);
1715 __cvt
.out(__state
, __msg
, __msg
+ __len
, __from_next
,
1716 __to
, __to
+ __len
+ 1, __to_next
);
1717 return string_type(__to
);
1720 typedef ctype
<_CharT
> __ctype_type
;
1721 // const __ctype_type& __cvt = use_facet<__ctype_type>(_M_locale_msg);
1722 const __ctype_type
& __cvt
= use_facet
<__ctype_type
>(locale());
1723 // XXX Again, proper length of converted string an issue here.
1724 // For now, assume the converted length is not larger.
1725 _CharT
* __dest
= static_cast<_CharT
*>(__builtin_alloca(__len
+ 1));
1726 __cvt
.widen(__msg
, __msg
+ __len
, __dest
);
1727 return basic_string
<_CharT
>(__dest
);
1729 return string_type();
1733 template<typename _CharT
>
1734 locale::id messages
<_CharT
>::id
;
1736 // Specializations for required instantiations.
1739 messages
<char>::do_get(catalog
, int, int, const string
&) const;
1741 #ifdef _GLIBCPP_USE_WCHAR_T
1744 messages
<wchar_t>::do_get(catalog
, int, int, const wstring
&) const;
1747 // Include host and configuration specific messages virtual functions.
1748 #include <bits/messages_members.h>
1750 template<typename _CharT
>
1751 class messages_byname
: public messages
<_CharT
>
1754 typedef _CharT char_type
;
1755 typedef basic_string
<_CharT
> string_type
;
1758 messages_byname(const char* __s
, size_t __refs
= 0)
1759 : messages
<_CharT
>(__refs
)
1761 _M_name_messages
= __s
;
1762 if (_M_c_locale_messages
!= _S_c_locale
)
1763 _S_destroy_c_locale(_M_c_locale_messages
);
1764 _S_create_c_locale(_M_c_locale_messages
, __s
);
1774 // Subclause convenience interfaces, inlines.
1775 // NB: These are inline because, when used in a loop, some compilers
1776 // can hoist the body out of the loop; then it's just as fast as the
1777 // C is*() function.
1778 template<typename _CharT
>
1780 isspace(_CharT __c
, const locale
& __loc
)
1781 { return use_facet
<ctype
<_CharT
> >(__loc
).is(ctype_base::space
, __c
); }
1783 template<typename _CharT
>
1785 isprint(_CharT __c
, const locale
& __loc
)
1786 { return use_facet
<ctype
<_CharT
> >(__loc
).is(ctype_base::print
, __c
); }
1788 template<typename _CharT
>
1790 iscntrl(_CharT __c
, const locale
& __loc
)
1791 { return use_facet
<ctype
<_CharT
> >(__loc
).is(ctype_base::cntrl
, __c
); }
1793 template<typename _CharT
>
1795 isupper(_CharT __c
, const locale
& __loc
)
1796 { return use_facet
<ctype
<_CharT
> >(__loc
).is(ctype_base::upper
, __c
); }
1798 template<typename _CharT
>
1799 inline bool islower(_CharT __c
, const locale
& __loc
)
1800 { return use_facet
<ctype
<_CharT
> >(__loc
).is(ctype_base::lower
, __c
); }
1802 template<typename _CharT
>
1804 isalpha(_CharT __c
, const locale
& __loc
)
1805 { return use_facet
<ctype
<_CharT
> >(__loc
).is(ctype_base::alpha
, __c
); }
1807 template<typename _CharT
>
1809 isdigit(_CharT __c
, const locale
& __loc
)
1810 { return use_facet
<ctype
<_CharT
> >(__loc
).is(ctype_base::digit
, __c
); }
1812 template<typename _CharT
>
1814 ispunct(_CharT __c
, const locale
& __loc
)
1815 { return use_facet
<ctype
<_CharT
> >(__loc
).is(ctype_base::punct
, __c
); }
1817 template<typename _CharT
>
1819 isxdigit(_CharT __c
, const locale
& __loc
)
1820 { return use_facet
<ctype
<_CharT
> >(__loc
).is(ctype_base::xdigit
, __c
); }
1822 template<typename _CharT
>
1824 isalnum(_CharT __c
, const locale
& __loc
)
1825 { return use_facet
<ctype
<_CharT
> >(__loc
).is(ctype_base::alnum
, __c
); }
1827 template<typename _CharT
>
1829 isgraph(_CharT __c
, const locale
& __loc
)
1830 { return use_facet
<ctype
<_CharT
> >(__loc
).is(ctype_base::graph
, __c
); }
1832 template<typename _CharT
>
1834 toupper(_CharT __c
, const locale
& __loc
)
1835 { return use_facet
<ctype
<_CharT
> >(__loc
).toupper(__c
); }
1837 template<typename _CharT
>
1839 tolower(_CharT __c
, const locale
& __loc
)
1840 { return use_facet
<ctype
<_CharT
> >(__loc
).tolower(__c
); }