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