11 #ifndef _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
12 #define _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
19 #define LC_COLLATE_MASK _M_COLLATE
20 #define LC_CTYPE_MASK _M_CTYPE
21 #define LC_MONETARY_MASK _M_MONETARY
22 #define LC_NUMERIC_MASK _M_NUMERIC
23 #define LC_TIME_MASK _M_TIME
24 #define LC_MESSAGES_MASK _M_MESSAGES
25 #define LC_ALL_MASK ( LC_COLLATE_MASK \
35 : __locale(
nullptr), __locale_str(
nullptr) {}
37 : __locale(
nullptr), __locale_str(
nullptr) {}
38 locale_t(_locale_t __xlocale,
const char* __xlocale_str)
39 : __locale(__xlocale), __locale_str(__xlocale_str) {}
42 return __left.__locale == __right.__locale;
45 friend bool operator==(
const locale_t& __left,
int __right) {
46 return __left.__locale ==
nullptr && __right == 0;
49 friend bool operator==(
const locale_t& __left,
long long __right) {
50 return __left.__locale ==
nullptr && __right == 0;
53 friend bool operator==(
const locale_t& __left, std::nullptr_t) {
54 return __left.__locale ==
nullptr;
57 friend bool operator==(
int __left,
const locale_t& __right) {
58 return __left == 0 &&
nullptr == __right.__locale;
61 friend bool operator==(std::nullptr_t,
const locale_t& __right) {
62 return nullptr == __right.__locale;
66 return !(__left == __right);
69 friend bool operator!=(
const locale_t& __left,
int __right) {
70 return !(__left == __right);
73 friend bool operator!=(
const locale_t& __left,
long long __right) {
74 return !(__left == __right);
77 friend bool operator!=(
const locale_t& __left, std::nullptr_t __right) {
78 return !(__left == __right);
81 friend bool operator!=(
int __left,
const locale_t& __right) {
82 return !(__left == __right);
85 friend bool operator!=(std::nullptr_t __left,
const locale_t& __right) {
86 return !(__left == __right);
89 operator bool()
const {
90 return __locale !=
nullptr;
93 const char* __get_locale()
const {
return __locale_str; }
95 operator _locale_t()
const {
100 const char* __locale_str;
104 #define freelocale _free_locale
113 lconv *localeconv_l(
locale_t loc );
114 size_t mbrlen_l(
const char *__restrict s,
size_t n,
115 mbstate_t *__restrict ps,
locale_t loc);
116 size_t mbsrtowcs_l(
wchar_t *__restrict dst,
const char **__restrict src,
117 size_t len, mbstate_t *__restrict ps,
locale_t loc );
118 size_t wcrtomb_l(
char *__restrict s,
wchar_t wc, mbstate_t *__restrict ps,
120 size_t mbrtowc_l(
wchar_t *__restrict pwc,
const char *__restrict s,
121 size_t n, mbstate_t *__restrict ps,
locale_t loc);
122 size_t mbsnrtowcs_l(
wchar_t *__restrict dst,
const char **__restrict src,
123 size_t nms,
size_t len, mbstate_t *__restrict ps,
locale_t loc);
124 size_t wcsnrtombs_l(
char *__restrict dst,
const wchar_t **__restrict src,
125 size_t nwc,
size_t len, mbstate_t *__restrict ps,
locale_t loc);
126 wint_t btowc_l(
int c,
locale_t loc );
127 int wctob_l( wint_t c,
locale_t loc );
129 decltype(MB_CUR_MAX) MB_CUR_MAX_L(
locale_t __l );
132 #define mbtowc_l _mbtowc_l
133 #define strtoll_l _strtoi64_l
134 #define strtoull_l _strtoui64_l
135 #define strtod_l _strtod_l
136 #if defined(_LIBCPP_MSVCRT)
137 #define strtof_l _strtof_l
138 #define strtold_l _strtold_l
140 float strtof_l(
const char*,
char**,
locale_t);
141 long double strtold_l(
const char*,
char**,
locale_t);
143 inline _LIBCPP_INLINE_VISIBILITY
145 islower_l(
int c, _locale_t loc)
147 return _islower_l((
int)c, loc);
150 inline _LIBCPP_INLINE_VISIBILITY
152 isupper_l(
int c, _locale_t loc)
154 return _isupper_l((
int)c, loc);
157 #define isdigit_l _isdigit_l
158 #define isxdigit_l _isxdigit_l
159 #define strcoll_l _strcoll_l
160 #define strxfrm_l _strxfrm_l
161 #define wcscoll_l _wcscoll_l
162 #define wcsxfrm_l _wcsxfrm_l
163 #define toupper_l _toupper_l
164 #define tolower_l _tolower_l
165 #define iswspace_l _iswspace_l
166 #define iswprint_l _iswprint_l
167 #define iswcntrl_l _iswcntrl_l
168 #define iswupper_l _iswupper_l
169 #define iswlower_l _iswlower_l
170 #define iswalpha_l _iswalpha_l
171 #define iswdigit_l _iswdigit_l
172 #define iswpunct_l _iswpunct_l
173 #define iswxdigit_l _iswxdigit_l
174 #define towupper_l _towupper_l
175 #define towlower_l _towlower_l
176 #if defined(__MINGW32__) && __MSVCRT_VERSION__ < 0x0800
177 #define strftime_l( __s, __l, __f, __tm, __loc ) strftime( __s, __l, __f, __tm )
179 #define strftime_l _strftime_l
181 #define sscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
182 #define sprintf_l( __s, __l, __f, ... ) _sprintf_l( __s, __f, __l, __VA_ARGS__ )
183 #define vsprintf_l( __s, __l, __f, ... ) _vsprintf_l( __s, __f, __l, __VA_ARGS__ )
184 #define vsnprintf_l( __s, __n, __l, __f, ... ) _vsnprintf_l( __s, __n, __f, __l, __VA_ARGS__ )
185 _LIBCPP_FUNC_VIS
int snprintf_l(
char *ret,
size_t n,
locale_t loc,
const char *format, ...);
186 _LIBCPP_FUNC_VIS
int asprintf_l(
char **ret,
locale_t loc,
const char *format, ... );
187 _LIBCPP_FUNC_VIS
int vasprintf_l(
char **ret,
locale_t loc,
const char *format, va_list ap );
190 inline int isblank_l(
int c,
locale_t )
192 return ( c ==
' ' || c ==
'\t' );
194 inline int iswblank_l( wint_t c,
locale_t )
196 return ( c == L
' ' || c == L
'\t' );
199 #endif // _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H