36 #ifndef _LOCALE_FACETS_H
37 #define _LOCALE_FACETS_H 1
39 #pragma GCC system_header
52 namespace std _GLIBCXX_VISIBILITY(default)
54 _GLIBCXX_BEGIN_NAMESPACE_VERSION
57 #ifdef _GLIBCXX_USE_WCHAR_T
58 # define _GLIBCXX_NUM_FACETS 28
60 # define _GLIBCXX_NUM_FACETS 14
66 template<
typename _Tp>
69 const __c_locale&) throw();
74 __convert_to_v(const
char*,
float&, ios_base::iostate&,
75 const __c_locale&) throw();
79 __convert_to_v(const
char*,
double&, ios_base::iostate&,
80 const __c_locale&) throw();
84 __convert_to_v(const
char*,
long double&, ios_base::iostate&,
85 const __c_locale&) throw();
89 template<typename _CharT, typename _Traits>
93 _S_pad(ios_base& __io, _CharT __fill, _CharT* __news,
102 template<
typename _CharT>
104 __add_grouping(_CharT* __s, _CharT __sep,
105 const char* __gbeg,
size_t __gsize,
106 const _CharT* __first,
const _CharT* __last);
111 template<
typename _CharT>
113 ostreambuf_iterator<_CharT>
114 __write(ostreambuf_iterator<_CharT> __s,
const _CharT* __ws,
int __len)
116 __s._M_put(__ws, __len);
121 template<
typename _CharT,
typename _OutIter>
124 __write(_OutIter __s,
const _CharT* __ws,
int __len)
126 for (
int __j = 0; __j < __len; __j++, ++__s)
144 template<
typename _CharT>
164 {
return this->
do_is(__m, __c); }
181 {
return this->
do_is(__lo, __hi, __vec); }
307 {
return this->
do_widen(__lo, __hi, __to); }
326 {
return this->
do_narrow(__c, __dfault); }
348 char __dfault,
char *__to)
const
349 {
return this->
do_narrow(__lo, __hi, __dfault, __to); }
356 ~__ctype_abstract_base() { }
392 mask* __vec)
const = 0;
537 do_widen(
const char* __lo,
const char* __hi,
584 char __dfault,
char* __dest)
const = 0;
605 template<
typename _CharT>
611 typedef typename __ctype_abstract_base<_CharT>::mask mask;
624 do_is(mask __m, char_type __c)
const;
626 virtual const char_type*
627 do_is(
const char_type* __lo,
const char_type* __hi, mask* __vec)
const;
629 virtual const char_type*
630 do_scan_is(mask __m,
const char_type* __lo,
const char_type* __hi)
const;
632 virtual const char_type*
634 const char_type* __hi)
const;
639 virtual const char_type*
640 do_toupper(char_type* __lo,
const char_type* __hi)
const;
645 virtual const char_type*
646 do_tolower(char_type* __lo,
const char_type* __hi)
const;
652 do_widen(
const char* __lo,
const char* __hi, char_type* __dest)
const;
655 do_narrow(char_type,
char __dfault)
const;
657 virtual const char_type*
658 do_narrow(
const char_type* __lo,
const char_type* __hi,
659 char __dfault,
char* __dest)
const;
662 template<
typename _CharT>
663 locale::id ctype<_CharT>::id;
684 __c_locale _M_c_locale_ctype;
686 __to_type _M_toupper;
687 __to_type _M_tolower;
688 const mask* _M_table;
689 mutable char _M_widen_ok;
690 mutable char _M_widen[1 +
static_cast<unsigned char>(-1)];
691 mutable char _M_narrow[1 +
static_cast<unsigned char>(-1)];
692 mutable char _M_narrow_ok;
699 static const size_t table_size = 1 +
static_cast<unsigned char>(-1);
712 ctype(
const mask* __table = 0,
bool __del =
false,
size_t __refs = 0);
725 ctype(__c_locale __cloc,
const mask* __table = 0,
bool __del =
false,
738 is(mask __m,
char __c)
const;
753 is(
const char* __lo,
const char* __hi, mask* __vec)
const;
767 scan_is(mask __m,
const char* __lo,
const char* __hi)
const;
781 scan_not(mask __m,
const char* __lo,
const char* __hi)
const;
869 return _M_widen[
static_cast<unsigned char>(__c)];
870 this->_M_widen_init();
895 if (_M_widen_ok == 1)
897 __builtin_memcpy(__to, __lo, __hi - __lo);
902 return this->
do_widen(__lo, __hi, __to);
926 if (_M_narrow[static_cast<unsigned char>(__c)])
927 return _M_narrow[
static_cast<unsigned char>(__c)];
928 const char __t =
do_narrow(__c, __dfault);
930 _M_narrow[
static_cast<unsigned char>(__c)] = __t;
958 char __dfault,
char *__to)
const
960 if (__builtin_expect(_M_narrow_ok == 1,
true))
962 __builtin_memcpy(__to, __lo, __hi - __lo);
967 return this->
do_narrow(__lo, __hi, __dfault, __to);
975 table()
const throw()
980 classic_table() throw();
1022 virtual const char_type*
1023 do_toupper(char_type* __lo, const char_type* __hi) const;
1055 virtual const char_type*
1056 do_tolower(char_type* __lo, const char_type* __hi) const;
1101 __builtin_memcpy(__dest, __lo, __hi - __lo);
1150 virtual const char_type*
1152 char,
char* __dest)
const
1154 __builtin_memcpy(__dest, __lo, __hi - __lo);
1159 void _M_narrow_init()
const;
1160 void _M_widen_init()
const;
1163 #ifdef _GLIBCXX_USE_WCHAR_T
1182 typedef wctype_t __wmask_type;
1185 __c_locale _M_c_locale_ctype;
1189 char _M_narrow[128];
1190 wint_t _M_widen[1 +
static_cast<unsigned char>(-1)];
1194 __wmask_type _M_wmask[16];
1209 ctype(
size_t __refs = 0);
1220 ctype(__c_locale __cloc,
size_t __refs = 0);
1224 _M_convert_to_wmask(
const mask __m)
const throw();
1458 char __dfault,
char* __dest)
const;
1462 _M_initialize_ctype() throw();
1464 #endif //_GLIBCXX_USE_WCHAR_T
1467 template<
typename _CharT>
1471 typedef typename ctype<_CharT>::mask mask;
1494 #ifdef _GLIBCXX_USE_WCHAR_T
1508 _GLIBCXX_END_NAMESPACE_VERSION
1514 namespace std _GLIBCXX_VISIBILITY(default)
1516 _GLIBCXX_BEGIN_NAMESPACE_VERSION
1531 _S_odigits_end = _S_odigits + 16,
1532 _S_oudigits = _S_odigits_end,
1533 _S_oudigits_end = _S_oudigits + 16,
1534 _S_oe = _S_odigits + 14,
1535 _S_oE = _S_oudigits + 14,
1536 _S_oend = _S_oudigits_end
1544 static const char* _S_atoms_out;
1548 static const char* _S_atoms_in;
1557 _S_ie = _S_izero + 14,
1558 _S_iE = _S_izero + 20,
1565 _S_format_float(
const ios_base& __io,
char* __fptr,
char __mod)
throw();
1568 template<
typename _CharT>
1569 struct __numpunct_cache :
public locale::facet
1571 const char* _M_grouping;
1572 size_t _M_grouping_size;
1573 bool _M_use_grouping;
1574 const _CharT* _M_truename;
1575 size_t _M_truename_size;
1576 const _CharT* _M_falsename;
1577 size_t _M_falsename_size;
1578 _CharT _M_decimal_point;
1579 _CharT _M_thousands_sep;
1585 _CharT _M_atoms_out[__num_base::_S_oend];
1591 _CharT _M_atoms_in[__num_base::_S_iend];
1595 __numpunct_cache(
size_t __refs = 0)
1596 : facet(__refs), _M_grouping(0), _M_grouping_size(0),
1597 _M_use_grouping(false),
1598 _M_truename(0), _M_truename_size(0), _M_falsename(0),
1599 _M_falsename_size(0), _M_decimal_point(_CharT()),
1600 _M_thousands_sep(_CharT()), _M_allocated(false)
1603 ~__numpunct_cache();
1606 _M_cache(
const locale& __loc);
1610 operator=(
const __numpunct_cache&);
1613 __numpunct_cache(
const __numpunct_cache&);
1616 template<
typename _CharT>
1617 __numpunct_cache<_CharT>::~__numpunct_cache()
1621 delete [] _M_grouping;
1622 delete [] _M_truename;
1623 delete [] _M_falsename;
1641 template<
typename _CharT>
1651 typedef __numpunct_cache<_CharT> __cache_type;
1654 __cache_type* _M_data;
1667 : facet(__refs), _M_data(0)
1668 { _M_initialize_numpunct(); }
1681 : facet(__refs), _M_data(__cache)
1682 { _M_initialize_numpunct(); }
1695 : facet(__refs), _M_data(0)
1696 { _M_initialize_numpunct(__cloc); }
1708 decimal_point()
const
1709 {
return this->do_decimal_point(); }
1721 thousands_sep()
const
1722 {
return this->do_thousands_sep(); }
1753 {
return this->do_grouping(); }
1766 {
return this->do_truename(); }
1779 {
return this->do_falsename(); }
1795 do_decimal_point()
const
1796 {
return _M_data->_M_decimal_point; }
1807 do_thousands_sep()
const
1808 {
return _M_data->_M_thousands_sep; }
1821 {
return _M_data->_M_grouping; }
1834 {
return _M_data->_M_truename; }
1846 do_falsename()
const
1847 {
return _M_data->_M_falsename; }
1851 _M_initialize_numpunct(__c_locale __cloc = 0);
1854 template<
typename _CharT>
1855 locale::id numpunct<_CharT>::id;
1862 numpunct<char>::_M_initialize_numpunct(__c_locale __cloc);
1864 #ifdef _GLIBCXX_USE_WCHAR_T
1870 numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc);
1874 template<
typename _CharT>
1885 if (__builtin_strcmp(__s,
"C") != 0
1886 && __builtin_strcmp(__s,
"POSIX") != 0)
1889 this->_S_create_c_locale(__tmp, __s);
1890 this->_M_initialize_numpunct(__tmp);
1891 this->_S_destroy_c_locale(__tmp);
1900 _GLIBCXX_BEGIN_NAMESPACE_LDBL
1915 template<
typename _CharT,
typename _InIter>
1964 ios_base::iostate& __err,
bool& __v)
const
1965 {
return this->do_get(__in, __end, __io, __err, __v); }
2000 ios_base::iostate& __err,
long& __v)
const
2001 {
return this->do_get(__in, __end, __io, __err, __v); }
2005 ios_base::iostate& __err,
unsigned short& __v)
const
2006 {
return this->do_get(__in, __end, __io, __err, __v); }
2010 ios_base::iostate& __err,
unsigned int& __v)
const
2011 {
return this->do_get(__in, __end, __io, __err, __v); }
2015 ios_base::iostate& __err,
unsigned long& __v)
const
2016 {
return this->do_get(__in, __end, __io, __err, __v); }
2018 #ifdef _GLIBCXX_USE_LONG_LONG
2021 ios_base::iostate& __err,
long long& __v)
const
2022 {
return this->do_get(__in, __end, __io, __err, __v); }
2026 ios_base::iostate& __err,
unsigned long long& __v)
const
2027 {
return this->do_get(__in, __end, __io, __err, __v); }
2059 ios_base::iostate& __err,
float& __v)
const
2060 {
return this->do_get(__in, __end, __io, __err, __v); }
2064 ios_base::iostate& __err,
double& __v)
const
2065 {
return this->do_get(__in, __end, __io, __err, __v); }
2069 ios_base::iostate& __err,
long double& __v)
const
2070 {
return this->do_get(__in, __end, __io, __err, __v); }
2101 ios_base::iostate& __err,
void*& __v)
const
2102 {
return this->do_get(__in, __end, __io, __err, __v); }
2109 _M_extract_float(iter_type, iter_type,
ios_base&, ios_base::iostate&,
2112 template<
typename _ValueT>
2114 _M_extract_int(iter_type, iter_type,
ios_base&, ios_base::iostate&,
2117 template<
typename _CharT2>
2118 typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,
int>::__type
2119 _M_find(
const _CharT2*,
size_t __len, _CharT2 __c)
const
2124 if (__c >= _CharT2(
'0') && __c < _CharT2(_CharT2(
'0') + __len))
2125 __ret = __c - _CharT2(
'0');
2129 if (__c >= _CharT2(
'0') && __c <= _CharT2(
'9'))
2130 __ret = __c - _CharT2(
'0');
2131 else if (__c >= _CharT2(
'a') && __c <= _CharT2(
'f'))
2132 __ret = 10 + (__c - _CharT2(
'a'));
2133 else if (__c >= _CharT2(
'A') && __c <= _CharT2(
'F'))
2134 __ret = 10 + (__c - _CharT2(
'A'));
2139 template<
typename _CharT2>
2140 typename __gnu_cxx::__enable_if<!__is_char<_CharT2>::__value,
2142 _M_find(
const _CharT2* __zero,
size_t __len, _CharT2 __c)
const
2145 const char_type* __q = char_traits<_CharT2>::find(__zero, __len, __c);
2148 __ret = __q - __zero;
2175 ios_base::iostate& __err,
long& __v)
const
2176 {
return _M_extract_int(__beg, __end, __io, __err, __v); }
2180 ios_base::iostate& __err,
unsigned short& __v)
const
2181 {
return _M_extract_int(__beg, __end, __io, __err, __v); }
2185 ios_base::iostate& __err,
unsigned int& __v)
const
2186 {
return _M_extract_int(__beg, __end, __io, __err, __v); }
2190 ios_base::iostate& __err,
unsigned long& __v)
const
2191 {
return _M_extract_int(__beg, __end, __io, __err, __v); }
2193 #ifdef _GLIBCXX_USE_LONG_LONG
2196 ios_base::iostate& __err,
long long& __v)
const
2197 {
return _M_extract_int(__beg, __end, __io, __err, __v); }
2201 ios_base::iostate& __err,
unsigned long long& __v)
const
2202 {
return _M_extract_int(__beg, __end, __io, __err, __v); }
2206 do_get(iter_type, iter_type,
ios_base&, ios_base::iostate& __err,
2210 do_get(iter_type, iter_type,
ios_base&, ios_base::iostate& __err,
2214 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
2216 __do_get(iter_type, iter_type,
ios_base&, ios_base::iostate& __err,
2220 do_get(iter_type, iter_type,
ios_base&, ios_base::iostate& __err,
2221 long double&)
const;
2225 do_get(iter_type, iter_type,
ios_base&, ios_base::iostate& __err,
2229 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
2231 do_get(iter_type, iter_type,
ios_base&, ios_base::iostate& __err,
2232 long double&)
const;
2237 template<
typename _CharT,
typename _InIter>
2238 locale::id num_get<_CharT, _InIter>::id;
2253 template<
typename _CharT,
typename _OutIter>
2294 {
return this->do_put(__s, __f, __fill, __v); }
2336 {
return this->do_put(__s, __f, __fill, __v); }
2340 unsigned long __v)
const
2341 {
return this->do_put(__s, __f, __fill, __v); }
2343 #ifdef _GLIBCXX_USE_LONG_LONG
2346 {
return this->do_put(__s, __f, __fill, __v); }
2350 unsigned long long __v)
const
2351 {
return this->do_put(__s, __f, __fill, __v); }
2399 {
return this->do_put(__s, __f, __fill, __v); }
2403 long double __v)
const
2404 {
return this->do_put(__s, __f, __fill, __v); }
2424 const void* __v)
const
2425 {
return this->do_put(__s, __f, __fill, __v); }
2428 template<
typename _ValueT>
2430 _M_insert_float(iter_type,
ios_base& __io, char_type __fill,
2431 char __mod, _ValueT __v)
const;
2434 _M_group_float(
const char* __grouping,
size_t __grouping_size,
2435 char_type __sep,
const char_type* __p, char_type* __new,
2436 char_type* __cs,
int& __len)
const;
2438 template<
typename _ValueT>
2440 _M_insert_int(iter_type,
ios_base& __io, char_type __fill,
2444 _M_group_int(
const char* __grouping,
size_t __grouping_size,
2445 char_type __sep,
ios_base& __io, char_type* __new,
2446 char_type* __cs,
int& __len)
const;
2450 char_type* __new,
const char_type* __cs,
int& __len)
const;
2471 do_put(iter_type,
ios_base&, char_type __fill,
bool __v)
const;
2475 {
return _M_insert_int(__s, __io, __fill, __v); }
2479 unsigned long __v)
const
2480 {
return _M_insert_int(__s, __io, __fill, __v); }
2482 #ifdef _GLIBCXX_USE_LONG_LONG
2485 long long __v)
const
2486 {
return _M_insert_int(__s, __io, __fill, __v); }
2490 unsigned long long __v)
const
2491 {
return _M_insert_int(__s, __io, __fill, __v); }
2495 do_put(iter_type,
ios_base&, char_type __fill,
double __v)
const;
2498 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
2500 __do_put(iter_type,
ios_base&, char_type __fill,
double __v)
const;
2503 do_put(iter_type,
ios_base&, char_type __fill,
long double __v)
const;
2507 do_put(iter_type,
ios_base&, char_type __fill,
const void* __v)
const;
2510 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
2512 do_put(iter_type,
ios_base&, char_type __fill,
long double __v)
const;
2517 template <
typename _CharT,
typename _OutIter>
2518 locale::id num_put<_CharT, _OutIter>::id;
2520 _GLIBCXX_END_NAMESPACE_LDBL
2528 template<
typename _CharT>
2531 {
return use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c); }
2534 template<
typename _CharT>
2537 {
return use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c); }
2540 template<
typename _CharT>
2543 {
return use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c); }
2546 template<
typename _CharT>
2549 {
return use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c); }
2552 template<
typename _CharT>
2555 {
return use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c); }
2558 template<
typename _CharT>
2561 {
return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c); }
2564 template<
typename _CharT>
2567 {
return use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c); }
2570 template<
typename _CharT>
2573 {
return use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c); }
2576 template<
typename _CharT>
2579 {
return use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c); }
2582 template<
typename _CharT>
2585 {
return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c); }
2588 template<
typename _CharT>
2591 {
return use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c); }
2594 template<
typename _CharT>
2597 {
return use_facet<ctype<_CharT> >(__loc).
toupper(__c); }
2600 template<
typename _CharT>
2603 {
return use_facet<ctype<_CharT> >(__loc).
tolower(__c); }
2605 _GLIBCXX_END_NAMESPACE_VERSION