OSDN Git Service

2000-04-21 Benjamin Kosnik <bkoz@redhat.com>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / src / locale-inst.cc
1 // Locale support -*- C++ -*-
2
3 // Copyright (C) 1999, 2000 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: 22.1  Locales
32 //
33
34 #include <bits/std_clocale.h>
35 #include <bits/std_cstring.h>
36 #include <bits/std_cassert.h>
37 #include <bits/std_limits.h>
38 #include <bits/std_exception.h>
39 #include <bits/std_stdexcept.h>
40 #include <bits/std_locale.h>
41 #include <bits/locale_facets.tcc>
42 #include <bits/std_istream.h>
43 #include <bits/std_ostream.h>
44
45 namespace std {
46
47   typedef ostreambuf_iterator<char, char_traits<char> > obuf_iterator;
48   typedef istreambuf_iterator<char, char_traits<char> > ibuf_iterator;
49   typedef ostreambuf_iterator<wchar_t, char_traits<wchar_t> > wobuf_iterator;
50   typedef istreambuf_iterator<wchar_t, char_traits<wchar_t> > wibuf_iterator;
51
52   // moneypunct, money_get, and money_put
53
54   const money_base::pattern
55     money_base::__default_pattern = {{symbol, sign, none, value}};
56
57   template class moneypunct<char, false>;
58   template class moneypunct<char, true>;
59   template class moneypunct_byname<char, false>;
60   template class moneypunct_byname<char, true>;
61   template class _Moneypunct<char>;
62   template class money_get<char, obuf_iterator>;
63   template class money_put<char, obuf_iterator>;
64   template class money_get<char, ibuf_iterator>;
65   template class money_put<char, ibuf_iterator>;
66   template class _Format_cache<char>;
67
68 #ifdef _GLIBCPP_USE_WCHAR_T
69   template class moneypunct<wchar_t, false>;
70   template class moneypunct<wchar_t, true>;
71   template class moneypunct_byname<wchar_t, false>;
72   template class moneypunct_byname<wchar_t, true>;
73   template class _Moneypunct<wchar_t>;
74   template class money_get<wchar_t, wobuf_iterator>;
75   template class money_put<wchar_t, wobuf_iterator>;
76   template class money_get<wchar_t, wibuf_iterator>;
77   template class money_put<wchar_t, wibuf_iterator>;
78   template class _Format_cache<wchar_t>;
79 #endif
80
81   // numpunct, numpunct_byname, num_get, and num_put
82   template class numpunct<char>;
83   template class numpunct_byname<char>;
84   template class _Numpunct<char>;
85   template class num_get<char, ibuf_iterator>;
86   template class num_put<char, obuf_iterator>;
87 #ifdef _GLIBCPP_USE_WCHAR_T
88   template class numpunct<wchar_t>;
89   template class numpunct_byname<wchar_t>;
90   template class _Numpunct<wchar_t>;
91   template class num_get<wchar_t, wibuf_iterator>;
92   template class num_put<wchar_t, wobuf_iterator>;
93 #endif
94
95   // _Punct
96   template class _Punct<char>;
97 #ifdef _GLIBCPP_USE_WCHAR_T
98   template class _Punct<wchar_t>;
99 #endif
100   
101   // time_get and time_put
102   //template class time_get<char, obuf_iterator>;
103   template class time_put<char, obuf_iterator>;
104   template class time_get<char, ibuf_iterator>;
105   template class time_put<char, ibuf_iterator>;
106 #ifdef _GLIBCPP_USE_WCHAR_T
107   //template class time_get<wchar_t, wobuf_iterator>;
108   template class time_put<wchar_t, wobuf_iterator>;
109   template class time_get<wchar_t, wibuf_iterator>;
110   template class time_put<wchar_t, wibuf_iterator>;
111 #endif
112
113   // messages
114   template class _Messages<char>;
115   template class messages<char>;
116   template class messages_byname<char>;
117 #ifdef _GLIBCPP_USE_WCHAR_T
118   template class _Messages<wchar_t>;
119   template class messages<wchar_t>;
120   template class messages_byname<wchar_t>;
121 #endif
122   
123   // ctype
124   //  template class ctype<unsigned char>; // No definitions avail.
125   //  template class ctype<signed char>; // No definitions avail.
126   template class _Ctype<char>;
127   template class _Ctype_nois<char>;
128   template class ctype_byname<char>;
129   template class _Codecvt<char, char, mbstate_t>;
130 #ifdef _GLIBCPP_USE_WCHAR_T
131   template class _Ctype<wchar_t>;
132   template class _Ctype_nois<wchar_t>;
133   template class ctype_byname<wchar_t>;
134   template class _Codecvt<wchar_t, char, mbstate_t>;
135 #endif
136   
137   // collate
138   template class _Collate<char>;
139   template class collate_byname<char>;
140   template class _Weekdaynames<char, int>;
141   template class _Monthnames<char, int>;
142 #ifdef _GLIBCPP_USE_WCHAR_T
143   template class _Collate<wchar_t>;
144   template class collate_byname<wchar_t>;
145   template class _Weekdaynames<wchar_t, int>;
146   template class _Monthnames<wchar_t, int>;
147 #endif
148     
149   // use_facet
150   template 
151     const num_put<char, obuf_iterator >& 
152     use_facet<num_put<char, obuf_iterator> >(const locale &);
153   template 
154     const num_get<char, ibuf_iterator >& 
155     use_facet<num_get<char, ibuf_iterator> >(const locale &);
156   template
157     const ctype<char>&
158     use_facet<ctype<char> >(const locale& __loc);
159   template
160     const codecvt<char, char, mbstate_t>& 
161     use_facet<codecvt<char, char, mbstate_t> >(locale const &);
162   template 
163     const num_put<char, obuf_iterator>& 
164     _Use_facet_failure_handler<num_put<char, obuf_iterator> >
165     (const locale &);
166 #ifdef _GLIBCPP_USE_WCHAR_T
167   template 
168     const num_put<wchar_t, wobuf_iterator>& 
169     use_facet<num_put<wchar_t, wobuf_iterator> >(const locale &);
170   template 
171     const num_get<wchar_t, wibuf_iterator>& 
172     use_facet<num_get<wchar_t, wibuf_iterator> >(const locale &);
173   template
174     const ctype<wchar_t>&
175     use_facet<ctype<wchar_t> >(const locale& __loc);
176   template
177     const codecvt<wchar_t, wchar_t, mbstate_t>& 
178     use_facet<codecvt<wchar_t, wchar_t, mbstate_t> >(locale const &);
179   template
180     const codecvt<wchar_t, char, mbstate_t>& 
181     use_facet<codecvt<wchar_t, char, mbstate_t> >(locale const &);
182   template 
183     const num_put<wchar_t, wobuf_iterator>& 
184     _Use_facet_failure_handler<num_put<wchar_t, wobuf_iterator> >
185     (const locale &);
186 #endif
187
188   // has_facet
189   template 
190     bool
191     has_facet<numpunct<char> >(const locale &);
192 #ifdef _GLIBCPP_USE_WCHAR_T
193   template 
194     bool
195     has_facet<numpunct<wchar_t> >(const locale &);
196 #endif
197
198   //
199   // iterator
200   //
201   typedef vector<locale::facet*> vec_pfacet;
202   template 
203     void 
204     vec_pfacet::
205     insert(vec_pfacet::iterator, vec_pfacet::size_type, 
206            const vec_pfacet::value_type&);
207
208   typedef istreambuf_iterator<char, char_traits<char> > istreambuf_iter;
209   typedef ostreambuf_iterator<char, char_traits<char> > ostreambuf_iter;
210
211
212   template 
213     istreambuf_iter 
214     __match_parallel<istreambuf_iter, char>
215     (istreambuf_iter, istreambuf_iter, int, const string*, int*, int&, bool&);
216
217
218 #ifdef _GLIBCPP_USE_WCHAR_T
219   typedef istreambuf_iterator<wchar_t,char_traits<wchar_t> > wistreambuf_iter;
220   typedef ostreambuf_iterator<wchar_t,char_traits<wchar_t> > wostreambuf_iter;
221
222   template 
223     wistreambuf_iter 
224     __match_parallel<wistreambuf_iter, wchar_t>
225    (wistreambuf_iter, wistreambuf_iter, int, const wstring*, int*, int&, bool&);
226 #endif
227
228
229   //
230   // locale
231   //
232   template 
233     bool
234     locale::operator()(const string&, const string&) const;
235
236   template
237     ostreambuf_iter
238     _S_fill<char, ostreambuf_iter, output_iterator_tag>
239     (ostreambuf_iter, char, int, output_iterator_tag);
240
241   template 
242     ostreambuf_iter
243     _S_pad_numeric<char, ostreambuf_iter>
244     (ostreambuf_iter, ios_base::fmtflags, char, int, char const*, char const*, 
245      char const*);
246
247   template
248     char*
249     _S_group_digits<char>(char*, char, char const*, char const*, 
250                           char const*, char const*);
251
252   template 
253     ostreambuf_iter
254     _S_format<char, ostreambuf_iter, unsigned long>
255     (ostreambuf_iter, ios_base &, char, bool, unsigned long);
256
257 #ifdef _GLIBCPP_USE_LONG_LONG
258   template
259     ostreambuf_iter
260     _S_format<char, ostreambuf_iter, unsigned long long>
261     (ostreambuf_iter, ios_base &, char, bool, unsigned long long);
262 #endif
263
264 #ifdef _GLIBCPP_USE_WCHAR_T
265   template 
266     bool
267     locale::operator()(const wstring&, const wstring&) const;
268
269   typedef ostreambuf_iterator<wchar_t> wostreambuf_iter;
270
271   template
272     wostreambuf_iter
273     _S_fill<wchar_t, wostreambuf_iter, output_iterator_tag>
274     (wostreambuf_iter, wchar_t, int, output_iterator_tag);
275
276   template 
277     wostreambuf_iter
278     _S_pad_numeric<wchar_t, wostreambuf_iter>
279     (wostreambuf_iter, ios_base::fmtflags, wchar_t __fill, int, wchar_t const*, 
280      wchar_t const*, wchar_t const*);
281
282   template
283     wchar_t*
284     _S_group_digits<wchar_t>(wchar_t*, wchar_t, char const*, char const*, 
285                              wchar_t const*, wchar_t const*);
286
287   template 
288     wostreambuf_iter
289     _S_format<wchar_t, wostreambuf_iter, unsigned long>
290     (wostreambuf_iter, ios_base &, wchar_t, bool, unsigned long);
291
292 #ifdef _GLIBCPP_USE_LONG_LONG
293   template
294     wostreambuf_iter
295     _S_format<wchar_t, wostreambuf_iter, unsigned long long>
296     (wostreambuf_iter, ios_base &, wchar_t, bool, unsigned long long);
297 #endif
298 #endif // _GLIBCPP_USE_WCHAR_T
299
300   template 
301     locale::facet** 
302     fill_n<locale::facet**, unsigned int, locale::facet*>
303     (locale::facet**, unsigned int, locale::facet* const &);
304
305 } //std
306
307
308
309
310
311