38 #if _GLIBCXX_C_LOCALE_GNU
39 const ctype_base::mask*
40 ctype<char>::classic_table() throw()
41 {
return _S_get_c_locale()->__ctype_b; }
43 const ctype_base::mask*
44 ctype<char>::classic_table() throw()
46 const ctype_base::mask* __ret;
47 char* __old = setlocale(LC_CTYPE, NULL);
49 if (__builtin_strcmp(__old,
"C"))
51 const size_t __len = __builtin_strlen(__old) + 1;
52 __sav =
new char[__len];
53 __builtin_memcpy(__sav, __old, __len);
54 setlocale(LC_CTYPE,
"C");
56 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
57 __ret = *__ctype_b_loc();
63 setlocale(LC_CTYPE, __sav);
70 #if _GLIBCXX_C_LOCALE_GNU
71 ctype<char>::ctype(__c_locale __cloc,
const mask* __table,
bool __del,
73 : facet(__refs), _M_c_locale_ctype(_S_clone_c_locale(__cloc)),
74 _M_del(__table != 0 && __del),
75 _M_toupper(_M_c_locale_ctype->__ctype_toupper),
76 _M_tolower(_M_c_locale_ctype->__ctype_tolower),
77 _M_table(__table ? __table : _M_c_locale_ctype->__ctype_b),
78 _M_widen_ok(0), _M_narrow_ok(0)
80 __builtin_memset(_M_widen, 0,
sizeof(_M_widen));
81 __builtin_memset(_M_narrow, 0,
sizeof(_M_narrow));
86 : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
87 _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
89 char* __old = setlocale(LC_CTYPE, NULL);
91 if (__builtin_strcmp(__old,
"C"))
93 const size_t __len = __builtin_strlen(__old) + 1;
94 __sav =
new char[__len];
95 __builtin_memcpy(__sav, __old, __len);
96 setlocale(LC_CTYPE,
"C");
98 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
99 _M_toupper = *__ctype_toupper_loc();
100 _M_tolower = *__ctype_tolower_loc();
101 _M_table = __table ? __table : *__ctype_b_loc();
103 _M_toupper = __ctype_toupper;
104 _M_tolower = __ctype_tolower;
105 _M_table = __table ? __table : __ctype_b;
109 setlocale(LC_CTYPE, __sav);
112 __builtin_memset(_M_widen, 0,
sizeof(_M_widen));
113 __builtin_memset(_M_narrow, 0,
sizeof(_M_narrow));
117 #if _GLIBCXX_C_LOCALE_GNU
119 : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
120 _M_del(__table != 0 && __del),
121 _M_toupper(_M_c_locale_ctype->__ctype_toupper),
122 _M_tolower(_M_c_locale_ctype->__ctype_tolower),
123 _M_table(__table ? __table : _M_c_locale_ctype->__ctype_b),
124 _M_widen_ok(0), _M_narrow_ok(0)
126 __builtin_memset(_M_widen, 0,
sizeof(_M_widen));
127 __builtin_memset(_M_narrow, 0,
sizeof(_M_narrow));
131 : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
132 _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
134 char* __old = setlocale(LC_CTYPE, NULL);
136 if (__builtin_strcmp(__old,
"C"))
138 const size_t __len = __builtin_strlen(__old) + 1;
139 __sav =
new char[__len];
140 __builtin_memcpy(__sav, __old, __len);
141 setlocale(LC_CTYPE,
"C");
143 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
144 _M_toupper = *__ctype_toupper_loc();
145 _M_tolower = *__ctype_tolower_loc();
146 _M_table = __table ? __table : *__ctype_b_loc();
148 _M_toupper = __ctype_toupper;
149 _M_tolower = __ctype_tolower;
150 _M_table = __table ? __table : __ctype_b;
154 setlocale(LC_CTYPE, __sav);
157 __builtin_memset(_M_widen, 0,
sizeof(_M_widen));
158 __builtin_memset(_M_narrow, 0,
sizeof(_M_narrow));
164 {
return _M_toupper[
static_cast<unsigned char>(__c)]; }
169 while (__low < __high)
171 *__low = _M_toupper[
static_cast<unsigned char>(*__low)];
179 {
return _M_tolower[
static_cast<unsigned char>(__c)]; }
184 while (__low < __high)
186 *__low = _M_tolower[
static_cast<unsigned char>(*__low)];
virtual char_type do_toupper(char_type __c) const
Convert to uppercase.
virtual char_type do_tolower(char_type __c) const
Convert to lowercase.
ctype(const mask *__table=0, bool __del=false, size_t __refs=0)
Constructor performs initialization.