# cwchar

Go to the documentation of this file.

    00001 // -*- C++ -*- forwarding header.
    00002
    00003 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
    00004 // Free Software Foundation, Inc.
    00005 //
    00006 // This file is part of the GNU ISO C++ Library.  This library is free
    00007 // software; you can redistribute it and/or modify it under the
    00008 // terms of the GNU General Public License as published by the
    00009 // Free Software Foundation; either version 2, or (at your option)
    00010 // any later version.
    00011
    00012 // This library is distributed in the hope that it will be useful,
    00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00015 // GNU General Public License for more details.
    00016
    00017 // You should have received a copy of the GNU General Public License along
    00018 // with this library; see the file COPYING.  If not, write to the Free
    00019 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
    00020 // USA.
    00021
    00022 // As a special exception, you may use this file as part of a free software
    00023 // library without restriction.  Specifically, if other files instantiate
    00024 // templates or use macros or inline functions from this file, or you compile
    00025 // this file and link it with other files to produce an executable, this
    00026 // file does not by itself cause the resulting executable to be covered by
    00027 // the GNU General Public License.  This exception does not however
    00028 // invalidate any other reasons why the executable file might be covered by
    00029 // the GNU General Public License.
    00030
    00031 //
    00032 // ISO C++ 14882: 21.4
    00033 //
    00034
    00044 #ifndef _CPP_CWCHAR
    00045 #define _CPP_CWCHAR 1
    00046
    00047 #pragma GCC system_header
    00048
    00049 #include <bits/c++config.h>
    00050 #include <cstddef>
    00051 #include <ctime>
    00052
    00053 #if _GLIBCPP_HAVE_WCHAR_H
    00054 #include <wchar.h>
    00055 #endif
    00056
    00057 // Need to do a bit of trickery here with mbstate_t as char_traits
    00058 // assumes it is in wchar.h, regardless of wchar_t specializations.
    00059 #ifndef _GLIBCPP_HAVE_MBSTATE_T
    00060 extern "C"
    00061 {
    00062   typedef struct
    00063   {
    00064     int __fill[6];
    00065   } mbstate_t;
    00066 }
    00067 #endif
    00068
    00069 namespace std
    00070 {
    00071   using ::mbstate_t;
    00072 }
    00073
    00074 // Get rid of those macros defined in <wchar.h> in lieu of real functions.
    00075 #undef btowc
    00076 #undef fgetwc
    00077 #undef fgetws
    00078 #undef fputwc
    00079 #undef fputws
    00080 #undef fwide
    00081 #undef fwprintf
    00082 #undef fwscanf
    00083 #undef getwc
    00084 #undef getwchar
    00085 #undef mbrlen
    00086 #undef mbrtowc
    00087 #undef mbsinit
    00088 #undef mbsrtowcs
    00089 #undef putwc
    00090 #undef putwchar
    00091 #undef swprintf
    00092 #undef swscanf
    00093 #undef ungetwc
    00094 #undef vfwprintf
    00095 #undef vfwscanf
    00096 #undef vswprintf
    00097 #undef vswscanf
    00098 #undef vwprintf
    00099 #undef vwscanf
    00100 #undef wcrtomb
    00101 #undef wcscat
    00102 #undef wcschr
    00103 #undef wcscmp
    00104 #undef wcscoll
    00105 #undef wcscpy
    00106 #undef wcscspn
    00107 #undef wcsftime
    00108 #undef wcslen
    00109 #undef wcsncat
    00110 #undef wcsncmp
    00111 #undef wcsncpy
    00112 #undef wcspbrk
    00113 #undef wcsrchr
    00114 #undef wcsrtombs
    00115 #undef wcsspn
    00116 #undef wcsstr
    00117 #undef wcstod
    00118 #undef wcstof
    00119 #undef wcstok
    00120 #undef wcstol
    00121 #undef wcstoul
    00122 #undef wcsxfrm
    00123 #undef wctob
    00124 #undef wmemchr
    00125 #undef wmemcmp
    00126 #undef wmemcpy
    00127 #undef wmemmove
    00128 #undef wmemset
    00129 #undef wprintf
    00130 #undef wscanf
    00131
    00132 #if _GLIBCPP_USE_WCHAR_T
    00133 namespace std
    00134 {
    00135   using ::wint_t;
    00136
    00137   using ::btowc;
    00138   using ::fgetwc;
    00139   using ::fgetws;
    00140   using ::fputwc;
    00141   using ::fputws;
    00142   using ::fwide;
    00143   using ::fwprintf;
    00144   using ::fwscanf;
    00145   using ::getwc;
    00146   using ::getwchar;
    00147   using ::mbrlen;
    00148   using ::mbrtowc;
    00149   using ::mbsinit;
    00150   using ::mbsrtowcs;
    00151   using ::putwc;
    00152   using ::putwchar;
    00153   using ::swprintf;
    00154   using ::swscanf;
    00155   using ::ungetwc;
    00156   using ::vfwprintf;
    00157   using ::vfwscanf;
    00158   using ::vswprintf;
    00159   using ::vswscanf;
    00160   using ::vwprintf;
    00161   using ::vwscanf;
    00162   using ::wcrtomb;
    00163   using ::wcscat;
    00164   using ::wcscmp;
    00165   using ::wcscoll;
    00166   using ::wcscpy;
    00167   using ::wcscspn;
    00168   using ::wcsftime;
    00169   using ::wcslen;
    00170   using ::wcsncat;
    00171   using ::wcsncmp;
    00172   using ::wcsncpy;
    00173   using ::wcsrtombs;
    00174   using ::wcsspn;
    00175   using ::wcstod;
    00176   using ::wcstof;
    00177   using ::wcstok;
    00178   using ::wcstol;
    00179   using ::wcstoul;
    00180   using ::wcsxfrm;
    00181   using ::wctob;
    00182   using ::wmemcmp;
    00183   using ::wmemcpy;
    00184   using ::wmemmove;
    00185   using ::wmemset;
    00186   using ::wprintf;
    00187   using ::wscanf;
    00188
    00189   using ::wcschr;
    00190
    00191   inline wchar_t*
    00192   wcschr(wchar_t* __p, wchar_t __c)
    00193   { return wcschr(const_cast<const wchar_t*>(__p), __c); }
    00194
    00195   using ::wcspbrk;
    00196
    00197   inline wchar_t*
    00198   wcspbrk(wchar_t* __s1, wchar_t* __s2)
    00199   { return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); }
    00200
    00201   using ::wcsrchr;
    00202
    00203   inline wchar_t*
    00204   wcsrchr(wchar_t* __p, wchar_t __c)
    00205   { return wcsrchr(const_cast<const wchar_t*>(__p), __c); }
    00206
    00207   using ::wcsstr;
    00208
    00209   inline wchar_t*
    00210   wcsstr(wchar_t* __s1, wchar_t* __s2)
    00211   { return wcsstr(const_cast<const wchar_t*>(__s1), __s2); }
    00212
    00213   using ::wmemchr;
    00214
    00215   inline wchar_t*
    00216   wmemchr(wchar_t* __p, wchar_t __c, size_t __n)
    00217   { return wmemchr(const_cast<const wchar_t*>(__p), __c, __n); }
    00218 }
    00219
    00220 #if _GLIBCPP_USE_C99
    00221
    00222 #undef wcstold
    00223 #undef wcstoll
    00224 #undef wcstoull
    00225
    00226 namespace __gnu_cxx
    00227 {
    00228 #if _GLIBCPP_USE_C99_CHECK || _GLIBCPP_USE_C99_DYNAMIC
    00229   extern "C" long double
    00230     (wcstold)(const wchar_t * restrict, wchar_t ** restrict);
    00231 #endif
    00232 #if !_GLIBCPP_USE_C99_DYNAMIC
    00233   using ::wcstold;
    00234 #endif
    00235 #if _GLIBCPP_USE_C99_LONG_LONG_CHECK || _GLIBCPP_USE_C99_LONG_LONG_DYNAMIC
    00236   extern "C" long long int
    00237     (wcstoll)(const wchar_t * restrict, wchar_t ** restrict, int);
    00238   extern "C" unsigned long long int
    00239     (wcstoull)(const wchar_t * restrict, wchar_t ** restrict, int);
    00240 #endif
    00241 #if !_GLIBCPP_USE_C99_LONG_LONG_DYNAMIC
    00242   using ::wcstoll;
    00243   using ::wcstoull;
    00244 #endif
    00245 }
    00246
    00247 namespace std
    00248 {
    00249   using __gnu_cxx::wcstold;
    00250   using __gnu_cxx::wcstoll;
    00251   using __gnu_cxx::wcstoull;
    00252 }
    00253 #endif
    00254
    00255 #endif //_GLIBCPP_USE_WCHAR_T
    00256
    00257 #endif