libstdc++
|
00001 // -*- C++ -*- forwarding header. 00002 00003 // Copyright (C) 1997-2013 Free Software Foundation, Inc. 00004 // 00005 // This file is part of the GNU ISO C++ Library. This library is free 00006 // software; you can redistribute it and/or modify it under the 00007 // terms of the GNU General Public License as published by the 00008 // Free Software Foundation; either version 3, or (at your option) 00009 // any later version. 00010 00011 // This library is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 00016 // Under Section 7 of GPL version 3, you are granted additional 00017 // permissions described in the GCC Runtime Library Exception, version 00018 // 3.1, as published by the Free Software Foundation. 00019 00020 // You should have received a copy of the GNU General Public License and 00021 // a copy of the GCC Runtime Library Exception along with this program; 00022 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 00023 // <http://www.gnu.org/licenses/>. 00024 00025 /** @file include/cwchar 00026 * This is a Standard C++ Library file. You should @c \#include this file 00027 * in your programs, rather than any of the @a *.h implementation files. 00028 * 00029 * This is the C++ version of the Standard C Library header @c wchar.h, 00030 * and its contents are (mostly) the same as that header, but are all 00031 * contained in the namespace @c std (except for names which are defined 00032 * as macros in C). 00033 */ 00034 00035 // 00036 // ISO C++ 14882: 21.4 00037 // 00038 00039 #pragma GCC system_header 00040 00041 #include <bits/c++config.h> 00042 00043 #if _GLIBCXX_HAVE_WCHAR_H 00044 #include <wchar.h> 00045 #endif 00046 00047 #ifndef _GLIBCXX_CWCHAR 00048 #define _GLIBCXX_CWCHAR 1 00049 00050 // Need to do a bit of trickery here with mbstate_t as char_traits 00051 // assumes it is in wchar.h, regardless of wchar_t specializations. 00052 #ifndef _GLIBCXX_HAVE_MBSTATE_T 00053 extern "C" 00054 { 00055 typedef struct 00056 { 00057 int __fill[6]; 00058 } mbstate_t; 00059 } 00060 #endif 00061 00062 namespace std 00063 { 00064 using ::mbstate_t; 00065 } // namespace std 00066 00067 // Get rid of those macros defined in <wchar.h> in lieu of real functions. 00068 #undef btowc 00069 #undef fgetwc 00070 #undef fgetws 00071 #undef fputwc 00072 #undef fputws 00073 #undef fwide 00074 #undef fwprintf 00075 #undef fwscanf 00076 #undef getwc 00077 #undef getwchar 00078 #undef mbrlen 00079 #undef mbrtowc 00080 #undef mbsinit 00081 #undef mbsrtowcs 00082 #undef putwc 00083 #undef putwchar 00084 #undef swprintf 00085 #undef swscanf 00086 #undef ungetwc 00087 #undef vfwprintf 00088 #if _GLIBCXX_HAVE_VFWSCANF 00089 # undef vfwscanf 00090 #endif 00091 #undef vswprintf 00092 #if _GLIBCXX_HAVE_VSWSCANF 00093 # undef vswscanf 00094 #endif 00095 #undef vwprintf 00096 #if _GLIBCXX_HAVE_VWSCANF 00097 # undef vwscanf 00098 #endif 00099 #undef wcrtomb 00100 #undef wcscat 00101 #undef wcschr 00102 #undef wcscmp 00103 #undef wcscoll 00104 #undef wcscpy 00105 #undef wcscspn 00106 #undef wcsftime 00107 #undef wcslen 00108 #undef wcsncat 00109 #undef wcsncmp 00110 #undef wcsncpy 00111 #undef wcspbrk 00112 #undef wcsrchr 00113 #undef wcsrtombs 00114 #undef wcsspn 00115 #undef wcsstr 00116 #undef wcstod 00117 #if _GLIBCXX_HAVE_WCSTOF 00118 # undef wcstof 00119 #endif 00120 #undef wcstok 00121 #undef wcstol 00122 #undef wcstoul 00123 #undef wcsxfrm 00124 #undef wctob 00125 #undef wmemchr 00126 #undef wmemcmp 00127 #undef wmemcpy 00128 #undef wmemmove 00129 #undef wmemset 00130 #undef wprintf 00131 #undef wscanf 00132 00133 #if _GLIBCXX_USE_WCHAR_T 00134 00135 namespace std _GLIBCXX_VISIBILITY(default) 00136 { 00137 _GLIBCXX_BEGIN_NAMESPACE_VERSION 00138 00139 using ::wint_t; 00140 00141 using ::btowc; 00142 using ::fgetwc; 00143 using ::fgetws; 00144 using ::fputwc; 00145 using ::fputws; 00146 using ::fwide; 00147 using ::fwprintf; 00148 using ::fwscanf; 00149 using ::getwc; 00150 using ::getwchar; 00151 using ::mbrlen; 00152 using ::mbrtowc; 00153 using ::mbsinit; 00154 using ::mbsrtowcs; 00155 using ::putwc; 00156 using ::putwchar; 00157 #ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF 00158 using ::swprintf; 00159 #endif 00160 using ::swscanf; 00161 using ::ungetwc; 00162 using ::vfwprintf; 00163 #if _GLIBCXX_HAVE_VFWSCANF 00164 using ::vfwscanf; 00165 #endif 00166 #ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF 00167 using ::vswprintf; 00168 #endif 00169 #if _GLIBCXX_HAVE_VSWSCANF 00170 using ::vswscanf; 00171 #endif 00172 using ::vwprintf; 00173 #if _GLIBCXX_HAVE_VWSCANF 00174 using ::vwscanf; 00175 #endif 00176 using ::wcrtomb; 00177 using ::wcscat; 00178 using ::wcscmp; 00179 using ::wcscoll; 00180 using ::wcscpy; 00181 using ::wcscspn; 00182 using ::wcsftime; 00183 using ::wcslen; 00184 using ::wcsncat; 00185 using ::wcsncmp; 00186 using ::wcsncpy; 00187 using ::wcsrtombs; 00188 using ::wcsspn; 00189 using ::wcstod; 00190 #if _GLIBCXX_HAVE_WCSTOF 00191 using ::wcstof; 00192 #endif 00193 using ::wcstok; 00194 using ::wcstol; 00195 using ::wcstoul; 00196 using ::wcsxfrm; 00197 using ::wctob; 00198 using ::wmemcmp; 00199 using ::wmemcpy; 00200 using ::wmemmove; 00201 using ::wmemset; 00202 using ::wprintf; 00203 using ::wscanf; 00204 using ::wcschr; 00205 using ::wcspbrk; 00206 using ::wcsrchr; 00207 using ::wcsstr; 00208 using ::wmemchr; 00209 00210 #ifndef __CORRECT_ISO_CPP_WCHAR_H_PROTO 00211 inline wchar_t* 00212 wcschr(wchar_t* __p, wchar_t __c) 00213 { return wcschr(const_cast<const wchar_t*>(__p), __c); } 00214 00215 inline wchar_t* 00216 wcspbrk(wchar_t* __s1, const wchar_t* __s2) 00217 { return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); } 00218 00219 inline wchar_t* 00220 wcsrchr(wchar_t* __p, wchar_t __c) 00221 { return wcsrchr(const_cast<const wchar_t*>(__p), __c); } 00222 00223 inline wchar_t* 00224 wcsstr(wchar_t* __s1, const wchar_t* __s2) 00225 { return wcsstr(const_cast<const wchar_t*>(__s1), __s2); } 00226 00227 inline wchar_t* 00228 wmemchr(wchar_t* __p, wchar_t __c, size_t __n) 00229 { return wmemchr(const_cast<const wchar_t*>(__p), __c, __n); } 00230 #endif 00231 00232 _GLIBCXX_END_NAMESPACE_VERSION 00233 } // namespace 00234 00235 #if _GLIBCXX_USE_C99 00236 00237 #undef wcstold 00238 #undef wcstoll 00239 #undef wcstoull 00240 00241 namespace __gnu_cxx 00242 { 00243 #if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC 00244 extern "C" long double 00245 (wcstold)(const wchar_t * __restrict, wchar_t ** __restrict) throw (); 00246 #endif 00247 #if !_GLIBCXX_USE_C99_DYNAMIC 00248 using ::wcstold; 00249 #endif 00250 #if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC 00251 extern "C" long long int 00252 (wcstoll)(const wchar_t * __restrict, wchar_t ** __restrict, int) throw (); 00253 extern "C" unsigned long long int 00254 (wcstoull)(const wchar_t * __restrict, wchar_t ** __restrict, int) throw (); 00255 #endif 00256 #if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC 00257 using ::wcstoll; 00258 using ::wcstoull; 00259 #endif 00260 } // namespace __gnu_cxx 00261 00262 namespace std 00263 { 00264 using ::__gnu_cxx::wcstold; 00265 using ::__gnu_cxx::wcstoll; 00266 using ::__gnu_cxx::wcstoull; 00267 } // namespace 00268 00269 #endif 00270 00271 #endif //_GLIBCXX_USE_WCHAR_T 00272 00273 #if __cplusplus >= 201103L 00274 00275 #ifdef _GLIBCXX_USE_WCHAR_T 00276 00277 namespace std 00278 { 00279 #if _GLIBCXX_HAVE_WCSTOF 00280 using std::wcstof; 00281 #endif 00282 #if _GLIBCXX_HAVE_VFWSCANF 00283 using std::vfwscanf; 00284 #endif 00285 #if _GLIBCXX_HAVE_VSWSCANF 00286 using std::vswscanf; 00287 #endif 00288 #if _GLIBCXX_HAVE_VWSCANF 00289 using std::vwscanf; 00290 #endif 00291 00292 #if _GLIBCXX_USE_C99 00293 using std::wcstold; 00294 using std::wcstoll; 00295 using std::wcstoull; 00296 #endif 00297 } // namespace 00298 00299 #endif // _GLIBCXX_USE_WCHAR_T 00300 00301 #endif // C++11 00302 00303 #endif