Merged revisions 143552,143554,143557,143560,143562,143564-143567,143570-143573,14357...
[official-gcc.git] / libstdc++-v3 / include / c_std / cwchar
bloba6ffe0ab466750174cfc6e6eff8badc23b0e8559
1 // -*- C++ -*- forwarding header.
3 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
4 // 2006, 2007, 2009
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 2, or (at your option)
11 // any later version.
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.
18 // You should have received a copy of the GNU General Public License along
19 // with this library; see the file COPYING.  If not, write to the Free
20 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21 // USA.
23 // As a special exception, you may use this file as part of a free software
24 // library without restriction.  Specifically, if other files instantiate
25 // templates or use macros or inline functions from this file, or you compile
26 // this file and link it with other files to produce an executable, this
27 // file does not by itself cause the resulting executable to be covered by
28 // the GNU General Public License.  This exception does not however
29 // invalidate any other reasons why the executable file might be covered by
30 // the GNU General Public License.
32 /** @file include/cwchar
33  *  This is a Standard C++ Library file.  You should @c #include this file
34  *  in your programs, rather than any of the "*.h" implementation files.
35  *
36  *  This is the C++ version of the Standard C Library header @c wchar.h,
37  *  and its contents are (mostly) the same as that header, but are all
38  *  contained in the namespace @c std (except for names which are defined
39  *  as macros in C).
40  */
43 // ISO C++ 14882: 21.4
46 #ifndef _GLIBCXX_CWCHAR
47 #define _GLIBCXX_CWCHAR 1
49 #pragma GCC system_header
51 #include <bits/c++config.h>
52 #include <cstddef>
54 #if _GLIBCXX_HAVE_WCHAR_H
55 #include <wchar.h>
56 #endif
58 // Need to do a bit of trickery here with mbstate_t as char_traits
59 // assumes it is in wchar.h, regardless of wchar_t specializations.
60 #ifndef _GLIBCXX_HAVE_MBSTATE_T
61 extern "C"
63   typedef struct
64   {
65     int __fill[6];
66   } mbstate_t;
68 #endif
70 _GLIBCXX_BEGIN_NAMESPACE(std)
72   using ::mbstate_t;
74 _GLIBCXX_END_NAMESPACE
76 // Get rid of those macros defined in <wchar.h> in lieu of real functions.
77 #undef btowc
78 #undef fgetwc
79 #undef fgetws
80 #undef fputwc
81 #undef fputws
82 #undef fwide
83 #undef fwprintf
84 #undef fwscanf
85 #undef getwc
86 #undef getwchar
87 #undef mbrlen
88 #undef mbrtowc
89 #undef mbsinit
90 #undef mbsrtowcs
91 #undef putwc
92 #undef putwchar
93 #undef swprintf
94 #undef swscanf
95 #undef ungetwc
96 #undef vfwprintf
97 #if _GLIBCXX_HAVE_VFWSCANF
98 # undef vfwscanf
99 #endif
100 #undef vswprintf
101 #if _GLIBCXX_HAVE_VSWSCANF
102 # undef vswscanf
103 #endif
104 #undef vwprintf
105 #if _GLIBCXX_HAVE_VWSCANF
106 # undef vwscanf
107 #endif
108 #undef wcrtomb
109 #undef wcscat
110 #undef wcschr
111 #undef wcscmp
112 #undef wcscoll
113 #undef wcscpy
114 #undef wcscspn
115 #undef wcsftime
116 #undef wcslen
117 #undef wcsncat
118 #undef wcsncmp
119 #undef wcsncpy
120 #undef wcspbrk
121 #undef wcsrchr
122 #undef wcsrtombs
123 #undef wcsspn
124 #undef wcsstr
125 #undef wcstod
126 #if _GLIBCXX_HAVE_WCSTOF
127 # undef wcstof
128 #endif
129 #undef wcstok
130 #undef wcstol
131 #undef wcstoul
132 #undef wcsxfrm
133 #undef wctob
134 #undef wmemchr
135 #undef wmemcmp
136 #undef wmemcpy
137 #undef wmemmove
138 #undef wmemset
139 #undef wprintf
140 #undef wscanf
142 #if _GLIBCXX_USE_WCHAR_T
144 _GLIBCXX_BEGIN_NAMESPACE(std)
146   using ::wint_t;
148   using ::btowc;
149   using ::fgetwc;
150   using ::fgetws;
151   using ::fputwc;
152   using ::fputws;
153   using ::fwide;
154   using ::fwprintf;
155   using ::fwscanf;
156   using ::getwc;
157   using ::getwchar;
158   using ::mbrlen;
159   using ::mbrtowc;
160   using ::mbsinit;
161   using ::mbsrtowcs;
162   using ::putwc;
163   using ::putwchar;
164   using ::swprintf;
165   using ::swscanf;
166   using ::ungetwc;
167   using ::vfwprintf;
168 #if _GLIBCXX_HAVE_VFWSCANF
169   using ::vfwscanf;
170 #endif
171   using ::vswprintf;
172 #if _GLIBCXX_HAVE_VSWSCANF
173   using ::vswscanf;
174 #endif
175   using ::vwprintf;
176 #if _GLIBCXX_HAVE_VWSCANF
177   using ::vwscanf;
178 #endif
179   using ::wcrtomb;
180   using ::wcscat;
181   using ::wcscmp;
182   using ::wcscoll;
183   using ::wcscpy;
184   using ::wcscspn;
185   using ::wcsftime;
186   using ::wcslen;
187   using ::wcsncat;
188   using ::wcsncmp;
189   using ::wcsncpy;
190   using ::wcsrtombs;
191   using ::wcsspn;
192   using ::wcstod;
193 #if _GLIBCXX_HAVE_WCSTOF
194   using ::wcstof;
195 #endif
196   using ::wcstok;
197   using ::wcstol;
198   using ::wcstoul;
199   using ::wcsxfrm;
200   using ::wctob;
201   using ::wmemcmp;
202   using ::wmemcpy;
203   using ::wmemmove;
204   using ::wmemset;
205   using ::wprintf;
206   using ::wscanf;
207   using ::wcschr;
208   using ::wcspbrk;
209   using ::wcsrchr;
210   using ::wcsstr;
211   using ::wmemchr;
213 #ifndef __CORRECT_ISO_CPP_WCHAR_H_PROTO
214   inline wchar_t*
215   wcschr(wchar_t* __p, wchar_t __c)
216   { return wcschr(const_cast<const wchar_t*>(__p), __c); }
218   inline wchar_t*
219   wcspbrk(wchar_t* __s1, const wchar_t* __s2)
220   { return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); }
222   inline wchar_t*
223   wcsrchr(wchar_t* __p, wchar_t __c)
224   { return wcsrchr(const_cast<const wchar_t*>(__p), __c); }
226   inline wchar_t*
227   wcsstr(wchar_t* __s1, const wchar_t* __s2)
228   { return wcsstr(const_cast<const wchar_t*>(__s1), __s2); }
230   inline wchar_t*
231   wmemchr(wchar_t* __p, wchar_t __c, size_t __n)
232   { return wmemchr(const_cast<const wchar_t*>(__p), __c, __n); }
233 #endif
235 _GLIBCXX_END_NAMESPACE
237 #if _GLIBCXX_USE_C99
239 #undef wcstold
240 #undef wcstoll
241 #undef wcstoull
243 _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
245 #if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
246   extern "C" long double
247     (wcstold)(const wchar_t * restrict, wchar_t ** restrict);
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);
255   extern "C" unsigned long long int
256     (wcstoull)(const wchar_t * restrict, wchar_t ** restrict, int);
257 #endif
258 #if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
259   using ::wcstoll;
260   using ::wcstoull;
261 #endif
263 _GLIBCXX_END_NAMESPACE
265 _GLIBCXX_BEGIN_NAMESPACE(std)
267   using ::__gnu_cxx::wcstold;
268   using ::__gnu_cxx::wcstoll;
269   using ::__gnu_cxx::wcstoull;
271 _GLIBCXX_END_NAMESPACE
273 #endif
275 #endif //_GLIBCXX_USE_WCHAR_T
277 #endif