1 // -*- C++ -*- forwarding header. 2 3 // Copyright (C) 1997-2024 Free Software Foundation, Inc. 4 // 5 // This file is part of the GNU ISO C++ Library. This library is free 6 // software; you can redistribute it and/or modify it under the 7 // terms of the GNU General Public License as published by the 8 // Free Software Foundation; either version 3, or (at your option) 9 // any later version. 10 11 // This library is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // GNU General Public License for more details. 15 16 // Under Section 7 of GPL version 3, you are granted additional 17 // permissions described in the GCC Runtime Library Exception, version 18 // 3.1, as published by the Free Software Foundation. 19 20 // You should have received a copy of the GNU General Public License and 21 // a copy of the GCC Runtime Library Exception along with this program; 22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 // <http://www.gnu.org/licenses/>. 24 25 /** @file include/cwchar 26 * This is a Standard C++ Library file. You should @c #include this file 27 * in your programs, rather than any of the @a *.h implementation files. 28 * 29 * This is the C++ version of the Standard C Library header @c wchar.h, 30 * and its contents are (mostly) the same as that header, but are all 31 * contained in the namespace @c std (except for names which are defined 32 * as macros in C). 33 */ 34 35 // 36 // ISO C++ 14882: 21.4 37 // 38 39 #ifndef _GLIBCXX_CWCHAR 40 #define _GLIBCXX_CWCHAR 1 41 42 #pragma GCC system_header 43 44 #include <bits/c++config.h> 45 46 #if _GLIBCXX_HAVE_WCHAR_H 47 #include <wchar.h> 48 #endif 49 50 // Need to do a bit of trickery here with mbstate_t as char_traits 51 // assumes it is in wchar.h, regardless of wchar_t specializations. 52 #ifndef _GLIBCXX_HAVE_MBSTATE_T 53 extern "C" 54 { 55 typedef struct 56 { 57 int __fill[6]; 58 } mbstate_t; 59 } 60 #endif 61 62 namespace std 63 { 64 using ::mbstate_t; 65 } // namespace std 66 67 // Get rid of those macros defined in <wchar.h> in lieu of real functions. 68 #undef btowc 69 #undef fgetwc 70 #undef fgetws 71 #undef fputwc 72 #undef fputws 73 #undef fwide 74 #undef fwprintf 75 #undef fwscanf 76 #undef getwc 77 #undef getwchar 78 #undef mbrlen 79 #undef mbrtowc 80 #undef mbsinit 81 #undef mbsrtowcs 82 #undef putwc 83 #undef putwchar 84 #undef swprintf 85 #undef swscanf 86 #undef ungetwc 87 #undef vfwprintf 88 #if _GLIBCXX_HAVE_VFWSCANF 89 # undef vfwscanf 90 #endif 91 #undef vswprintf 92 #if _GLIBCXX_HAVE_VSWSCANF 93 # undef vswscanf 94 #endif 95 #undef vwprintf 96 #if _GLIBCXX_HAVE_VWSCANF 97 # undef vwscanf 98 #endif 99 #undef wcrtomb 100 #undef wcscat 101 #undef wcschr 102 #undef wcscmp 103 #undef wcscoll 104 #undef wcscpy 105 #undef wcscspn 106 #undef wcsftime 107 #undef wcslen 108 #undef wcsncat 109 #undef wcsncmp 110 #undef wcsncpy 111 #undef wcspbrk 112 #undef wcsrchr 113 #undef wcsrtombs 114 #undef wcsspn 115 #undef wcsstr 116 #undef wcstod 117 #if _GLIBCXX_HAVE_WCSTOF 118 # undef wcstof 119 #endif 120 #undef wcstok 121 #undef wcstol 122 #undef wcstoul 123 #undef wcsxfrm 124 #undef wctob 125 #undef wmemchr 126 #undef wmemcmp 127 #undef wmemcpy 128 #undef wmemmove 129 #undef wmemset 130 #undef wprintf 131 #undef wscanf 132 133 #if _GLIBCXX_USE_WCHAR_T 134 135 namespace std _GLIBCXX_VISIBILITY(default) 136 { 137 _GLIBCXX_BEGIN_NAMESPACE_VERSION 138 139 using ::wint_t; 140 141 using ::btowc; 142 using ::fgetwc; 143 using ::fgetws; 144 using ::fputwc; 145 using ::fputws; 146 using ::fwide; 147 using ::fwprintf; 148 using ::fwscanf; 149 using ::getwc; 150 using ::getwchar; 151 using ::mbrlen; 152 using ::mbrtowc; 153 using ::mbsinit; 154 using ::mbsrtowcs; 155 using ::putwc; 156 using ::putwchar; 157 using ::swprintf; 158 using ::swscanf; 159 using ::ungetwc; 160 using ::vfwprintf; 161 #if _GLIBCXX_HAVE_VFWSCANF 162 using ::vfwscanf; 163 #endif 164 using ::vswprintf; 165 #if _GLIBCXX_HAVE_VSWSCANF 166 using ::vswscanf; 167 #endif 168 using ::vwprintf; 169 #if _GLIBCXX_HAVE_VWSCANF 170 using ::vwscanf; 171 #endif 172 using ::wcrtomb; 173 using ::wcscat; 174 using ::wcscmp; 175 using ::wcscoll; 176 using ::wcscpy; 177 using ::wcscspn; 178 using ::wcsftime; 179 using ::wcslen; 180 using ::wcsncat; 181 using ::wcsncmp; 182 using ::wcsncpy; 183 using ::wcsrtombs; 184 using ::wcsspn; 185 using ::wcstod; 186 #if _GLIBCXX_HAVE_WCSTOF 187 using ::wcstof; 188 #endif 189 using ::wcstok; 190 using ::wcstol; 191 using ::wcstoul; 192 using ::wcsxfrm; 193 using ::wctob; 194 using ::wmemcmp; 195 using ::wmemcpy; 196 using ::wmemmove; 197 using ::wmemset; 198 using ::wprintf; 199 using ::wscanf; 200 using ::wcschr; 201 using ::wcspbrk; 202 using ::wcsrchr; 203 using ::wcsstr; 204 using ::wmemchr; 205 206 #ifndef __CORRECT_ISO_CPP_WCHAR_H_PROTO 207 inline wchar_t* 208 wcschr(wchar_t* __p, wchar_t __c) 209 { return wcschr(const_cast<const wchar_t*>(__p), __c); } 210 211 inline wchar_t* 212 wcspbrk(wchar_t* __s1, const wchar_t* __s2) 213 { return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); } 214 215 inline wchar_t* 216 wcsrchr(wchar_t* __p, wchar_t __c) 217 { return wcsrchr(const_cast<const wchar_t*>(__p), __c); } 218 219 inline wchar_t* 220 wcsstr(wchar_t* __s1, const wchar_t* __s2) 221 { return wcsstr(const_cast<const wchar_t*>(__s1), __s2); } 222 223 inline wchar_t* 224 wmemchr(wchar_t* __p, wchar_t __c, size_t __n) 225 { return wmemchr(const_cast<const wchar_t*>(__p), __c, __n); } 226 #endif 227 228 _GLIBCXX_END_NAMESPACE_VERSION 229 } // namespace 230 231 #if _GLIBCXX_USE_C99_WCHAR 232 233 #undef wcstold 234 #undef wcstoll 235 #undef wcstoull 236 237 namespace __gnu_cxx 238 { 239 #if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC 240 extern "C" long double 241 (wcstold)(const wchar_t * __restrict, wchar_t ** __restrict) throw (); 242 #endif 243 #if !_GLIBCXX_USE_C99_DYNAMIC 244 using ::wcstold; 245 #endif 246 #if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC 247 extern "C" long long int 248 (wcstoll)(const wchar_t * __restrict, wchar_t ** __restrict, int) throw (); 249 extern "C" unsigned long long int 250 (wcstoull)(const wchar_t * __restrict, wchar_t ** __restrict, int) throw (); 251 #endif 252 #if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC 253 using ::wcstoll; 254 using ::wcstoull; 255 #endif 256 } // namespace __gnu_cxx 257 258 namespace std 259 { 260 using ::__gnu_cxx::wcstold; 261 using ::__gnu_cxx::wcstoll; 262 using ::__gnu_cxx::wcstoull; 263 } // namespace std 264 265 #endif 266 267 #endif //_GLIBCXX_USE_WCHAR_T 268 269 #endif 270