# 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
    00035 /** @file cwchar
    00036  *  This is a Standard C++ Library file.  You should @c #include this file
    00037  *  in your programs, rather than any of the "*.h" implementation files.
    00038  *
    00039  *  This is the C++ version of the Standard C Library header @c wchar.h,
    00040  *  and its contents are (mostly) the same as that header, but are all
    00041  *  contained in the namespace @c std.
    00042  */
    00043
    00044 #ifndef _GLIBCXX_CWCHAR
    00045 #define _GLIBCXX_CWCHAR 1
    00046
    00047 #pragma GCC system_header
    00048
    00049 #include <bits/c++config.h>
    00050 #include <cstddef>
    00051 #include <ctime>
    00052
    00053 #if _GLIBCXX_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 _GLIBCXX_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 #if _GLIBCXX_HAVE_VFWSCANF
    00096 # undef vfwscanf
    00097 #endif
    00098 #undef vswprintf
    00099 #if _GLIBCXX_HAVE_VSWSCANF
    00100 # undef vswscanf
    00101 #endif
    00102 #undef vwprintf
    00103 #if _GLIBCXX_HAVE_VWSCANF
    00104 # undef vwscanf
    00105 #endif
    00106 #undef wcrtomb
    00107 #undef wcscat
    00108 #undef wcschr
    00109 #undef wcscmp
    00110 #undef wcscoll
    00111 #undef wcscpy
    00112 #undef wcscspn
    00113 #undef wcsftime
    00114 #undef wcslen
    00115 #undef wcsncat
    00116 #undef wcsncmp
    00117 #undef wcsncpy
    00118 #undef wcspbrk
    00119 #undef wcsrchr
    00120 #undef wcsrtombs
    00121 #undef wcsspn
    00122 #undef wcsstr
    00123 #undef wcstod
    00124 #if _GLIBCXX_HAVE_WCSTOF
    00125 # undef wcstof
    00126 #endif
    00127 #undef wcstok
    00128 #undef wcstol
    00129 #undef wcstoul
    00130 #undef wcsxfrm
    00131 #undef wctob
    00132 #undef wmemchr
    00133 #undef wmemcmp
    00134 #undef wmemcpy
    00135 #undef wmemmove
    00136 #undef wmemset
    00137 #undef wprintf
    00138 #undef wscanf
    00139
    00140 #if _GLIBCXX_USE_WCHAR_T
    00141 namespace std
    00142 {
    00143   using ::wint_t;
    00144
    00145   using ::btowc;
    00146   using ::fgetwc;
    00147   using ::fgetws;
    00148   using ::fputwc;
    00149   using ::fputws;
    00150   using ::fwide;
    00151   using ::fwprintf;
    00152   using ::fwscanf;
    00153   using ::getwc;
    00154   using ::getwchar;
    00155   using ::mbrlen;
    00156   using ::mbrtowc;
    00157   using ::mbsinit;
    00158   using ::mbsrtowcs;
    00159   using ::putwc;
    00160   using ::putwchar;
    00161   using ::swprintf;
    00162   using ::swscanf;
    00163   using ::ungetwc;
    00164   using ::vfwprintf;
    00165 #if _GLIBCXX_HAVE_VFWSCANF
    00166   using ::vfwscanf;
    00167 #endif
    00168   using ::vswprintf;
    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
    00205   using ::wcschr;
    00206
    00207   inline wchar_t*
    00208   wcschr(wchar_t* __p, wchar_t __c)
    00209   { return wcschr(const_cast<const wchar_t*>(__p), __c); }
    00210
    00211   using ::wcspbrk;
    00212
    00213   inline wchar_t*
    00214   wcspbrk(wchar_t* __s1, wchar_t* __s2)
    00215   { return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); }
    00216
    00217   using ::wcsrchr;
    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   using ::wcsstr;
    00224
    00225   inline wchar_t*
    00226   wcsstr(wchar_t* __s1, wchar_t* __s2)
    00227   { return wcsstr(const_cast<const wchar_t*>(__s1), __s2); }
    00228
    00229   using ::wmemchr;
    00230
    00231   inline wchar_t*
    00232   wmemchr(wchar_t* __p, wchar_t __c, size_t __n)
    00233   { return wmemchr(const_cast<const wchar_t*>(__p), __c, __n); }
    00234 }
    00235
    00236 #if _GLIBCXX_USE_C99
    00237
    00238 #undef wcstold
    00239 #undef wcstoll
    00240 #undef wcstoull
    00241
    00242 namespace __gnu_cxx
    00243 {
    00244 #if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
    00245   extern "C" long double
    00246     (wcstold)(const wchar_t * restrict, wchar_t ** restrict);
    00247 #endif
    00248 #if !_GLIBCXX_USE_C99_DYNAMIC
    00249   using ::wcstold;
    00250 #endif
    00251 #if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
    00252   extern "C" long long int
    00253     (wcstoll)(const wchar_t * restrict, wchar_t ** restrict, int);
    00254   extern "C" unsigned long long int
    00255     (wcstoull)(const wchar_t * restrict, wchar_t ** restrict, int);
    00256 #endif
    00257 #if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
    00258   using ::wcstoll;
    00259   using ::wcstoull;
    00260 #endif
    00261 }
    00262
    00263 namespace std
    00264 {
    00265   using __gnu_cxx::wcstold;
    00266   using __gnu_cxx::wcstoll;
    00267   using __gnu_cxx::wcstoull;
    00268 }
    00269 #endif
    00270
    00271 #endif //_GLIBCXX_USE_WCHAR_T
    00272
    00273 #endif