OSDN Git Service

2002-01-28 Phil Edwards <pme@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / include / c_std / std_cwchar.h
1 // -*- C++ -*- forwarding header.
2
3 // Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
4 //
5 // This file is part of the GNU ISO C++ Library.  This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 2, or (at your option)
9 // any later version.
10
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING.  If not, write to the Free
18 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19 // USA.
20
21 // As a special exception, you may use this file as part of a free software
22 // library without restriction.  Specifically, if other files instantiate
23 // templates or use macros or inline functions from this file, or you compile
24 // this file and link it with other files to produce an executable, this
25 // file does not by itself cause the resulting executable to be covered by
26 // the GNU General Public License.  This exception does not however
27 // invalidate any other reasons why the executable file might be covered by
28 // the GNU General Public License.
29
30 //
31 // ISO C++ 14882: 21.4
32 //
33
34 /** @file cwchar
35  *  This is a Standard C++ Library file.  You should @c #include this file
36  *  in your programs, rather than any of the "*.h" implementation files.
37  *
38  *  This is the C++ version of the Standard C Library header @c wchar.h,
39  *  and its contents are (mostly) the same as that header, but are all
40  *  contained in the namespace @c std.
41  */
42
43 #ifndef _CPP_CWCHAR
44 #define _CPP_CWCHAR 1
45
46 #include <bits/c++config.h>
47 #include <cstddef>
48 #include <ctime>
49
50 #if _GLIBCPP_HAVE_WCHAR_H
51 #pragma GCC system_header
52 #include <wchar.h>
53 #endif
54
55 // Need to do a bit of trickery here with mbstate_t as char_traits
56 // assumes it is in wchar.h, regardless of wchar_t specializations.
57 #ifndef _GLIBCPP_HAVE_MBSTATE_T
58 extern "C" 
59 {
60   typedef struct 
61   {
62     int __fill[6];
63   } mbstate_t;
64 }
65 #endif
66
67 namespace std 
68 {
69   using ::mbstate_t;
70 }
71
72 // Get rid of those macros defined in <wchar.h> in lieu of real functions.
73 #undef btowc
74 #undef fgetwc
75 #undef fgetws
76 #undef fputwc
77 #undef fputws
78 #undef fwide
79 #undef fwprintf
80 #undef fwscanf
81 #undef getwc
82 #undef getwchar
83 #undef mbrlen
84 #undef mbrtowc
85 #undef mbsinit
86 #undef mbsrtowcs
87 #undef putwc
88 #undef putwchar
89 #undef swprintf
90 #undef swscanf
91 #undef ungetwc
92 #undef vfwprintf
93 #undef vfwscanf
94 #undef vswprintf
95 #undef vswscanf
96 #undef vwprintf
97 #undef vwscanf
98 #undef wcrtomb
99 #undef wcscat
100 #undef wcschr
101 #undef wcscmp
102 #undef wcscoll
103 #undef wcscpy
104 #undef wcscspn
105 #undef wcsftime
106 #undef wcslen
107 #undef wcsncat
108 #undef wcsncmp
109 #undef wcsncpy
110 #undef wcspbrk
111 #undef wcsrchr
112 #undef wcsrtombs
113 #undef wcsspn
114 #undef wcsstr
115 #undef wcstod
116 #undef wcstof
117 #undef wcstok
118 #undef wcstol
119 #undef wcstoul
120 #undef wcsxfrm
121 #undef wctob
122 #undef wmemchr
123 #undef wmemcmp
124 #undef wmemcpy
125 #undef wmemmove
126 #undef wmemset
127 #undef wprintf
128 #undef wscanf
129
130 #if _GLIBCPP_USE_WCHAR_T
131 namespace std
132 {
133   using ::wint_t;
134
135   using ::btowc;
136   using ::fgetwc;
137   using ::fgetws;
138   using ::fputwc;
139   using ::fputws;
140   using ::fwide;
141   using ::fwprintf;
142   using ::fwscanf;
143   using ::getwc;
144   using ::getwchar;
145   using ::mbrlen;
146   using ::mbrtowc;
147   using ::mbsinit;
148   using ::mbsrtowcs;
149   using ::putwc;
150   using ::putwchar;
151   using ::swprintf;
152   using ::swscanf;
153   using ::ungetwc;
154   using ::vfwprintf;
155   using ::vfwscanf;
156   using ::vswprintf;
157   using ::vswscanf;
158   using ::vwprintf;
159   using ::vwscanf;
160   using ::wcrtomb;
161   using ::wcscat;
162   using ::wcscmp;
163   using ::wcscoll;
164   using ::wcscpy;
165   using ::wcscspn;
166   using ::wcsftime;
167   using ::wcslen;
168   using ::wcsncat;
169   using ::wcsncmp;
170   using ::wcsncpy;
171   using ::wcsrtombs;
172   using ::wcsspn;
173   using ::wcstod;
174   using ::wcstof;
175   using ::wcstok;
176   using ::wcstol;
177   using ::wcstoul;
178   using ::wcsxfrm;
179   using ::wctob;
180   using ::wmemcmp;
181   using ::wmemcpy;
182   using ::wmemmove;
183   using ::wmemset;
184   using ::wprintf;
185   using ::wscanf;
186
187   using ::wcschr;
188
189   inline wchar_t*
190   wcschr(wchar_t* __p, wchar_t __c)
191   { return wcschr(const_cast<const wchar_t*>(__p), __c); }
192
193   using ::wcspbrk;
194
195   inline wchar_t*
196   wcspbrk(wchar_t* __s1, wchar_t* __s2)
197   { return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); }
198
199   using ::wcsrchr;
200
201   inline wchar_t*
202   wcsrchr(wchar_t* __p, wchar_t __c)
203   { return wcsrchr(const_cast<const wchar_t*>(__p), __c); }
204
205   using ::wcsstr;
206
207   inline wchar_t*
208   wcsstr(wchar_t* __s1, wchar_t* __s2)
209   { return wcsstr(const_cast<const wchar_t*>(__s1), __s2); }
210
211   using ::wmemchr;
212
213   inline wchar_t*
214   wmemchr(wchar_t* __p, wchar_t __c, size_t __n)
215   { return wmemchr(const_cast<const wchar_t*>(__p), __c, __n); }
216 }
217
218 #if _GLIBCPP_USE_C99
219
220 #undef wcstold
221 #undef wcstoll
222 #undef wcstoull
223
224 namespace __gnu_cxx
225 {
226   using ::wcstold;
227   using ::wcstoll;
228   using ::wcstoull;
229 }
230
231 namespace std
232 {
233   using __gnu_cxx::wcstold;
234   using __gnu_cxx::wcstoll;
235   using __gnu_cxx::wcstoull;
236 }
237 #endif
238
239 #endif //_GLIBCPP_USE_WCHAR_T
240
241 #endif