# cwchar

Go to the documentation of this file.

    00001 // -*- C++ -*- forwarding header.
    00002
    00003 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
    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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
    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 /** @file include/cwchar
    00032  *  This is a Standard C++ Library file.  You should @c #include this file
    00033  *  in your programs, rather than any of the "*.h" implementation files.
    00034  *
    00035  *  This is the C++ version of the Standard C Library header @c wchar.h,
    00036  *  and its contents are (mostly) the same as that header, but are all
    00037  *  contained in the namespace @c std (except for names which are defined
    00038  *  as macros in C).
    00039  */
    00040
    00041 //
    00042 // ISO C++ 14882: 21.4
    00043 //
    00044
    00045 #ifndef _GLIBCXX_CWCHAR
    00046 #define _GLIBCXX_CWCHAR 1
    00047
    00048 #pragma GCC system_header
    00049
    00050 #include <bits/c++config.h>
    00051 #include <cstddef>
    00052 #include <ctime>
    00053
    00054 #if _GLIBCXX_HAVE_WCHAR_H
    00055 #include <wchar.h>
    00056 #endif
    00057
    00058 // Need to do a bit of trickery here with mbstate_t as char_traits
    00059 // assumes it is in wchar.h, regardless of wchar_t specializations.
    00060 #ifndef _GLIBCXX_HAVE_MBSTATE_T
    00061 extern "C"
    00062 {
    00063   typedef struct
    00064   {
    00065     int __fill[6];
    00066   } mbstate_t;
    00067 }
    00068 #endif
    00069
    00070 _GLIBCXX_BEGIN_NAMESPACE(std)
    00071
    00072   using ::mbstate_t;
    00073
    00074 _GLIBCXX_END_NAMESPACE
    00075
    00076 // Get rid of those macros defined in <wchar.h> in lieu of real functions.
    00077 #undef btowc
    00078 #undef fgetwc
    00079 #undef fgetws
    00080 #undef fputwc
    00081 #undef fputws
    00082 #undef fwide
    00083 #undef fwprintf
    00084 #undef fwscanf
    00085 #undef getwc
    00086 #undef getwchar
    00087 #undef mbrlen
    00088 #undef mbrtowc
    00089 #undef mbsinit
    00090 #undef mbsrtowcs
    00091 #undef putwc
    00092 #undef putwchar
    00093 #undef swprintf
    00094 #undef swscanf
    00095 #undef ungetwc
    00096 #undef vfwprintf
    00097 #if _GLIBCXX_HAVE_VFWSCANF
    00098 # undef vfwscanf
    00099 #endif
    00100 #undef vswprintf
    00101 #if _GLIBCXX_HAVE_VSWSCANF
    00102 # undef vswscanf
    00103 #endif
    00104 #undef vwprintf
    00105 #if _GLIBCXX_HAVE_VWSCANF
    00106 # undef vwscanf
    00107 #endif
    00108 #undef wcrtomb
    00109 #undef wcscat
    00110 #undef wcschr
    00111 #undef wcscmp
    00112 #undef wcscoll
    00113 #undef wcscpy
    00114 #undef wcscspn
    00115 #undef wcsftime
    00116 #undef wcslen
    00117 #undef wcsncat
    00118 #undef wcsncmp
    00119 #undef wcsncpy
    00120 #undef wcspbrk
    00121 #undef wcsrchr
    00122 #undef wcsrtombs
    00123 #undef wcsspn
    00124 #undef wcsstr
    00125 #undef wcstod
    00126 #if _GLIBCXX_HAVE_WCSTOF
    00127 # undef wcstof
    00128 #endif
    00129 #undef wcstok
    00130 #undef wcstol
    00131 #undef wcstoul
    00132 #undef wcsxfrm
    00133 #undef wctob
    00134 #undef wmemchr
    00135 #undef wmemcmp
    00136 #undef wmemcpy
    00137 #undef wmemmove
    00138 #undef wmemset
    00139 #undef wprintf
    00140 #undef wscanf
    00141
    00142 #if _GLIBCXX_USE_WCHAR_T
    00143
    00144 _GLIBCXX_BEGIN_NAMESPACE(std)
    00145
    00146   using ::wint_t;
    00147
    00148   using ::btowc;
    00149   using ::fgetwc;
    00150   using ::fgetws;
    00151   using ::fputwc;
    00152   using ::fputws;
    00153   using ::fwide;
    00154   using ::fwprintf;
    00155   using ::fwscanf;
    00156   using ::getwc;
    00157   using ::getwchar;
    00158   using ::mbrlen;
    00159   using ::mbrtowc;
    00160   using ::mbsinit;
    00161   using ::mbsrtowcs;
    00162   using ::putwc;
    00163   using ::putwchar;
    00164   using ::swprintf;
    00165   using ::swscanf;
    00166   using ::ungetwc;
    00167   using ::vfwprintf;
    00168 #if _GLIBCXX_HAVE_VFWSCANF
    00169   using ::vfwscanf;
    00170 #endif
    00171   using ::vswprintf;
    00172 #if _GLIBCXX_HAVE_VSWSCANF
    00173   using ::vswscanf;
    00174 #endif
    00175   using ::vwprintf;
    00176 #if _GLIBCXX_HAVE_VWSCANF
    00177   using ::vwscanf;
    00178 #endif
    00179   using ::wcrtomb;
    00180   using ::wcscat;
    00181   using ::wcscmp;
    00182   using ::wcscoll;
    00183   using ::wcscpy;
    00184   using ::wcscspn;
    00185   using ::wcsftime;
    00186   using ::wcslen;
    00187   using ::wcsncat;
    00188   using ::wcsncmp;
    00189   using ::wcsncpy;
    00190   using ::wcsrtombs;
    00191   using ::wcsspn;
    00192   using ::wcstod;
    00193 #if _GLIBCXX_HAVE_WCSTOF
    00194   using ::wcstof;
    00195 #endif
    00196   using ::wcstok;
    00197   using ::wcstol;
    00198   using ::wcstoul;
    00199   using ::wcsxfrm;
    00200   using ::wctob;
    00201   using ::wmemcmp;
    00202   using ::wmemcpy;
    00203   using ::wmemmove;
    00204   using ::wmemset;
    00205   using ::wprintf;
    00206   using ::wscanf;
    00207
    00208   using ::wcschr;
    00209
    00210   inline wchar_t*
    00211   wcschr(wchar_t* __p, wchar_t __c)
    00212   { return wcschr(const_cast<const wchar_t*>(__p), __c); }
    00213
    00214   using ::wcspbrk;
    00215
    00216   inline wchar_t*
    00217   wcspbrk(wchar_t* __s1, const wchar_t* __s2)
    00218   { return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); }
    00219
    00220   using ::wcsrchr;
    00221
    00222   inline wchar_t*
    00223   wcsrchr(wchar_t* __p, wchar_t __c)
    00224   { return wcsrchr(const_cast<const wchar_t*>(__p), __c); }
    00225
    00226   using ::wcsstr;
    00227
    00228   inline wchar_t*
    00229   wcsstr(wchar_t* __s1, const wchar_t* __s2)
    00230   { return wcsstr(const_cast<const wchar_t*>(__s1), __s2); }
    00231
    00232   using ::wmemchr;
    00233
    00234   inline wchar_t*
    00235   wmemchr(wchar_t* __p, wchar_t __c, size_t __n)
    00236   { return wmemchr(const_cast<const wchar_t*>(__p), __c, __n); }
    00237
    00238 _GLIBCXX_END_NAMESPACE
    00239
    00240 #if _GLIBCXX_USE_C99
    00241
    00242 #undef wcstold
    00243 #undef wcstoll
    00244 #undef wcstoull
    00245
    00246 _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
    00247
    00248 #if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
    00249   extern "C" long double
    00250     (wcstold)(const wchar_t * restrict, wchar_t ** restrict);
    00251 #endif
    00252 #if !_GLIBCXX_USE_C99_DYNAMIC
    00253   using ::wcstold;
    00254 #endif
    00255 #if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
    00256   extern "C" long long int
    00257     (wcstoll)(const wchar_t * restrict, wchar_t ** restrict, int);
    00258   extern "C" unsigned long long int
    00259     (wcstoull)(const wchar_t * restrict, wchar_t ** restrict, int);
    00260 #endif
    00261 #if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
    00262   using ::wcstoll;
    00263   using ::wcstoull;
    00264 #endif
    00265
    00266 _GLIBCXX_END_NAMESPACE
    00267
    00268 _GLIBCXX_BEGIN_NAMESPACE(std)
    00269
    00270   using ::__gnu_cxx::wcstold;
    00271   using ::__gnu_cxx::wcstoll;
    00272   using ::__gnu_cxx::wcstoull;
    00273
    00274 _GLIBCXX_END_NAMESPACE
    00275
    00276 #endif
    00277
    00278 #endif //_GLIBCXX_USE_WCHAR_T
    00279
    00280 #endif