1 // -*- C++ -*- forwarding header. 2 3 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 4 // Free Software Foundation, Inc. 5 // 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) 10 // any later version. 11 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. 16 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, 20 // USA. 21 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. 30 31 // 32 // ISO C++ 14882: 21.4 33 // 34 35 /** @file cwchar 36 * This is a Standard C++ Library file. You should @c #include this file 37 * in your programs, rather than any of the "*.h" implementation files. 38 * 39 * This is the C++ version of the Standard C Library header @c wchar.h, 40 * and its contents are (mostly) the same as that header, but are all 41 * contained in the namespace @c std. 42 */ 43 44 #ifndef _CPP_CWCHAR 45 #define _CPP_CWCHAR 1 46 47 #pragma GCC system_header 48 49 #include <bits/c++config.h> 50 #include <cstddef> 51 #include <ctime> 52 53 #if _GLIBCPP_HAVE_WCHAR_H 54 #include <wchar.h> 55 #endif 56 57 // Need to do a bit of trickery here with mbstate_t as char_traits 58 // assumes it is in wchar.h, regardless of wchar_t specializations. 59 #ifndef _GLIBCPP_HAVE_MBSTATE_T 60 extern "C" 61 { 62 typedef struct 63 { 64 int __fill[6]; 65 } mbstate_t; 66 } 67 #endif 68 69 namespace std 70 { 71 using ::mbstate_t; 72 } 73 74 // Get rid of those macros defined in <wchar.h> in lieu of real functions. 75 #undef btowc 76 #undef fgetwc 77 #undef fgetws 78 #undef fputwc 79 #undef fputws 80 #undef fwide 81 #undef fwprintf 82 #undef fwscanf 83 #undef getwc 84 #undef getwchar 85 #undef mbrlen 86 #undef mbrtowc 87 #undef mbsinit 88 #undef mbsrtowcs 89 #undef putwc 90 #undef putwchar 91 #undef swprintf 92 #undef swscanf 93 #undef ungetwc 94 #undef vfwprintf 95 #undef vfwscanf 96 #undef vswprintf 97 #undef vswscanf 98 #undef vwprintf 99 #undef vwscanf 100 #undef wcrtomb 101 #undef wcscat 102 #undef wcschr 103 #undef wcscmp 104 #undef wcscoll 105 #undef wcscpy 106 #undef wcscspn 107 #undef wcsftime 108 #undef wcslen 109 #undef wcsncat 110 #undef wcsncmp 111 #undef wcsncpy 112 #undef wcspbrk 113 #undef wcsrchr 114 #undef wcsrtombs 115 #undef wcsspn 116 #undef wcsstr 117 #undef wcstod 118 #undef wcstof 119 #undef wcstok 120 #undef wcstol 121 #undef wcstoul 122 #undef wcsxfrm 123 #undef wctob 124 #undef wmemchr 125 #undef wmemcmp 126 #undef wmemcpy 127 #undef wmemmove 128 #undef wmemset 129 #undef wprintf 130 #undef wscanf 131 132 #if _GLIBCPP_USE_WCHAR_T 133 namespace std 134 { 135 using ::wint_t; 136 137 using ::btowc; 138 using ::fgetwc; 139 using ::fgetws; 140 using ::fputwc; 141 using ::fputws; 142 using ::fwide; 143 using ::fwprintf; 144 using ::fwscanf; 145 using ::getwc; 146 using ::getwchar; 147 using ::mbrlen; 148 using ::mbrtowc; 149 using ::mbsinit; 150 using ::mbsrtowcs; 151 using ::putwc; 152 using ::putwchar; 153 using ::swprintf; 154 using ::swscanf; 155 using ::ungetwc; 156 using ::vfwprintf; 157 using ::vfwscanf; 158 using ::vswprintf; 159 using ::vswscanf; 160 using ::vwprintf; 161 using ::vwscanf; 162 using ::wcrtomb; 163 using ::wcscat; 164 using ::wcscmp; 165 using ::wcscoll; 166 using ::wcscpy; 167 using ::wcscspn; 168 using ::wcsftime; 169 using ::wcslen; 170 using ::wcsncat; 171 using ::wcsncmp; 172 using ::wcsncpy; 173 using ::wcsrtombs; 174 using ::wcsspn; 175 using ::wcstod; 176 using ::wcstof; 177 using ::wcstok; 178 using ::wcstol; 179 using ::wcstoul; 180 using ::wcsxfrm; 181 using ::wctob; 182 using ::wmemcmp; 183 using ::wmemcpy; 184 using ::wmemmove; 185 using ::wmemset; 186 using ::wprintf; 187 using ::wscanf; 188 189 using ::wcschr; 190 191 inline wchar_t* 192 wcschr(wchar_t* __p, wchar_t __c) 193 { return wcschr(const_cast<const wchar_t*>(__p), __c); } 194 195 using ::wcspbrk; 196 197 inline wchar_t* 198 wcspbrk(wchar_t* __s1, wchar_t* __s2) 199 { return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); } 200 201 using ::wcsrchr; 202 203 inline wchar_t* 204 wcsrchr(wchar_t* __p, wchar_t __c) 205 { return wcsrchr(const_cast<const wchar_t*>(__p), __c); } 206 207 using ::wcsstr; 208 209 inline wchar_t* 210 wcsstr(wchar_t* __s1, wchar_t* __s2) 211 { return wcsstr(const_cast<const wchar_t*>(__s1), __s2); } 212 213 using ::wmemchr; 214 215 inline wchar_t* 216 wmemchr(wchar_t* __p, wchar_t __c, size_t __n) 217 { return wmemchr(const_cast<const wchar_t*>(__p), __c, __n); } 218 } 219 220 #if _GLIBCPP_USE_C99 221 222 #undef wcstold 223 #undef wcstoll 224 #undef wcstoull 225 226 namespace __gnu_cxx 227 { 228 using ::wcstold; 229 using ::wcstoll; 230 using ::wcstoull; 231 } 232 233 namespace std 234 { 235 using __gnu_cxx::wcstold; 236 using __gnu_cxx::wcstoll; 237 using __gnu_cxx::wcstoull; 238 } 239 #endif 240 241 #endif //_GLIBCPP_USE_WCHAR_T 242 243 #endif 244