2005-12-18 Benjamin Kosnik <bkoz@redhat.com>
[official-gcc.git] / libstdc++-v3 / include / c_std / std_cwchar.h
blob8f03a416ad0a5af160a757a75e784feafbe025b5
1 // -*- C++ -*- forwarding header.
3 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
4 // Free Software Foundation, Inc.
5 //
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 2, or (at your option)
10 // any later version.
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING. If not, write to the Free
19 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
20 // USA.
22 // As a special exception, you may use this file as part of a free software
23 // library without restriction. Specifically, if other files instantiate
24 // templates or use macros or inline functions from this file, or you compile
25 // this file and link it with other files to produce an executable, this
26 // file does not by itself cause the resulting executable to be covered by
27 // the GNU General Public License. This exception does not however
28 // invalidate any other reasons why the executable file might be covered by
29 // the GNU General Public License.
32 // ISO C++ 14882: 21.4
35 /** @file cwchar
36 * This is a Standard C++ Library file. You should @c #include this file
37 * in your programs, rather than any of the "*.h" implementation files.
39 * This is the C++ version of the Standard C Library header @c wchar.h,
40 * and its contents are (mostly) the same as that header, but are all
41 * contained in the namespace @c std (except for names which are defined
42 * as macros in C).
45 #ifndef _GLIBCXX_CWCHAR
46 #define _GLIBCXX_CWCHAR 1
48 #pragma GCC system_header
50 #include <bits/c++config.h>
51 #include <cstddef>
52 #include <ctime>
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
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;
208 using ::wcschr;
210 inline wchar_t*
211 wcschr(wchar_t* __p, wchar_t __c)
212 { return wcschr(const_cast<const wchar_t*>(__p), __c); }
214 using ::wcspbrk;
216 inline wchar_t*
217 wcspbrk(wchar_t* __s1, const wchar_t* __s2)
218 { return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); }
220 using ::wcsrchr;
222 inline wchar_t*
223 wcsrchr(wchar_t* __p, wchar_t __c)
224 { return wcsrchr(const_cast<const wchar_t*>(__p), __c); }
226 using ::wcsstr;
228 inline wchar_t*
229 wcsstr(wchar_t* __s1, const wchar_t* __s2)
230 { return wcsstr(const_cast<const wchar_t*>(__s1), __s2); }
232 using ::wmemchr;
234 inline wchar_t*
235 wmemchr(wchar_t* __p, wchar_t __c, size_t __n)
236 { return wmemchr(const_cast<const wchar_t*>(__p), __c, __n); }
238 _GLIBCXX_END_NAMESPACE
240 #if _GLIBCXX_USE_C99
242 #undef wcstold
243 #undef wcstoll
244 #undef wcstoull
246 _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
248 #if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
249 extern "C" long double
250 (wcstold)(const wchar_t * restrict, wchar_t ** restrict);
251 #endif
252 #if !_GLIBCXX_USE_C99_DYNAMIC
253 using ::wcstold;
254 #endif
255 #if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
256 extern "C" long long int
257 (wcstoll)(const wchar_t * restrict, wchar_t ** restrict, int);
258 extern "C" unsigned long long int
259 (wcstoull)(const wchar_t * restrict, wchar_t ** restrict, int);
260 #endif
261 #if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
262 using ::wcstoll;
263 using ::wcstoull;
264 #endif
266 _GLIBCXX_END_NAMESPACE
268 _GLIBCXX_BEGIN_NAMESPACE(std)
270 using ::__gnu_cxx::wcstold;
271 using ::__gnu_cxx::wcstoll;
272 using ::__gnu_cxx::wcstoull;
274 _GLIBCXX_END_NAMESPACE
276 #endif
278 #endif //_GLIBCXX_USE_WCHAR_T
280 #endif