2002-01-04 Benjamin Kosnik <bkoz@redhat.com>
[official-gcc.git] / libstdc++-v3 / src / locale-inst.cc
blobe2f6d7764fe6955bed54997e1fefc0e623f9baf9
1 // Locale support -*- C++ -*-
3 // Copyright (C) 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.
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.
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.
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.
31 // ISO C++ 14882: 22.1 Locales
34 #include <cstdlib>
35 #include <clocale>
36 #include <cstring>
37 #include <cassert>
38 #include <limits>
39 #include <exception>
40 #include <stdexcept>
41 #include <locale>
42 #include <istream>
43 #include <ostream>
45 namespace std
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;
52 // moneypunct, money_get, and money_put
53 template class moneypunct<char, false>;
54 template class moneypunct<char, true>;
55 template class moneypunct_byname<char, false>;
56 template class moneypunct_byname<char, true>;
57 template class money_get<char, ibuf_iterator>;
58 template class money_put<char, obuf_iterator>;
60 #ifdef _GLIBCPP_USE_WCHAR_T
61 template class moneypunct<wchar_t, false>;
62 template class moneypunct<wchar_t, true>;
63 template class moneypunct_byname<wchar_t, false>;
64 template class moneypunct_byname<wchar_t, true>;
65 template class money_get<wchar_t, wibuf_iterator>;
66 template class money_put<wchar_t, wobuf_iterator>;
67 #endif
69 // numpunct, numpunct_byname, num_get, and num_put
70 template class numpunct<char>;
71 template class numpunct_byname<char>;
72 template class num_get<char, ibuf_iterator>;
73 template class num_put<char, obuf_iterator>;
74 template
75 obuf_iterator
76 num_put<char, obuf_iterator>::
77 _M_convert_int(obuf_iterator, ios_base&, char, char, char, long) const;
79 template
80 obuf_iterator
81 num_put<char, obuf_iterator>::
82 _M_convert_int(obuf_iterator, ios_base&, char, char, char,
83 unsigned long) const;
85 #ifdef _GLIBCPP_USE_LONG_LONG
86 template
87 obuf_iterator
88 num_put<char, obuf_iterator>::
89 _M_convert_int(obuf_iterator, ios_base&, char, char, char,
90 long long) const;
92 template
93 obuf_iterator
94 num_put<char, obuf_iterator>::
95 _M_convert_int(obuf_iterator, ios_base&, char, char, char,
96 unsigned long long) const;
97 #endif
99 template
100 obuf_iterator
101 num_put<char, obuf_iterator>::
102 _M_convert_float(obuf_iterator, ios_base&, char, char, double) const;
104 template
105 obuf_iterator
106 num_put<char, obuf_iterator>::
107 _M_convert_float(obuf_iterator, ios_base&, char, char,
108 long double) const;
110 #ifdef _GLIBCPP_USE_WCHAR_T
111 template class numpunct<wchar_t>;
112 template class numpunct_byname<wchar_t>;
113 template class num_get<wchar_t, wibuf_iterator>;
114 template class num_put<wchar_t, wobuf_iterator>;
116 template
117 wobuf_iterator
118 num_put<wchar_t, wobuf_iterator>::
119 _M_convert_int(wobuf_iterator, ios_base&, wchar_t, char, char, long) const;
121 template
122 wobuf_iterator
123 num_put<wchar_t, wobuf_iterator>::
124 _M_convert_int(wobuf_iterator, ios_base&, wchar_t, char, char,
125 unsigned long) const;
127 #ifdef _GLIBCPP_USE_LONG_LONG
128 template
129 wobuf_iterator
130 num_put<wchar_t, wobuf_iterator>::
131 _M_convert_int(wobuf_iterator, ios_base&, wchar_t, char, char,
132 long long) const;
134 template
135 wobuf_iterator
136 num_put<wchar_t, wobuf_iterator>::
137 _M_convert_int(wobuf_iterator, ios_base&, wchar_t, char, char,
138 unsigned long long) const;
139 #endif
141 template
142 wobuf_iterator
143 num_put<wchar_t, wobuf_iterator>::
144 _M_convert_float(wobuf_iterator, ios_base&, wchar_t, char,
145 double) const;
147 template
148 wobuf_iterator
149 num_put<wchar_t, wobuf_iterator>::
150 _M_convert_float(wobuf_iterator, ios_base&, wchar_t, char,
151 long double) const;
152 #endif
154 // time_get and time_put
155 template class __timepunct<char>;
156 template class time_put<char, obuf_iterator>;
157 template class time_put_byname<char, obuf_iterator>;
158 template class time_get<char, ibuf_iterator>;
159 template class time_get_byname<char, ibuf_iterator>;
161 #ifdef _GLIBCPP_USE_WCHAR_T
162 template class __timepunct<wchar_t>;
163 template class time_put<wchar_t, wobuf_iterator>;
164 template class time_put_byname<wchar_t, wobuf_iterator>;
165 template class time_get<wchar_t, wibuf_iterator>;
166 template class time_get_byname<wchar_t, wibuf_iterator>;
167 #endif
169 // messages
170 template class messages<char>;
171 template class messages_byname<char>;
172 #ifdef _GLIBCPP_USE_WCHAR_T
173 template class messages<wchar_t>;
174 template class messages_byname<wchar_t>;
175 #endif
177 // ctype
178 template class __ctype_abstract_base<char>;
179 template class ctype_byname<char>;
180 #ifdef _GLIBCPP_USE_WCHAR_T
181 template class __ctype_abstract_base<wchar_t>;
182 template class ctype_byname<wchar_t>;
183 #endif
185 // codecvt
186 template class __codecvt_abstract_base<char, char, mbstate_t>;
187 template class __codecvt_abstract_base<wchar_t, char, mbstate_t>;
188 template class codecvt_byname<char, char, mbstate_t>;
189 #ifdef _GLIBCPP_USE_WCHAR_T
190 template class codecvt_byname<wchar_t, char, mbstate_t>;
191 #endif
193 // collate
194 template class collate<char>;
195 template class collate_byname<char>;
196 #ifdef _GLIBCPP_USE_WCHAR_T
197 template class collate<wchar_t>;
198 template class collate_byname<wchar_t>;
199 #endif
201 // use_facet
202 template
203 const numpunct<char>&
204 use_facet<numpunct<char> >(const locale&);
206 template
207 const num_put<char, obuf_iterator >&
208 use_facet<num_put<char, obuf_iterator> >(const locale&);
210 template
211 const num_get<char, ibuf_iterator >&
212 use_facet<num_get<char, ibuf_iterator> >(const locale&);
214 template
215 const codecvt<char, char, mbstate_t>&
216 use_facet<codecvt<char, char, mbstate_t> >(const locale&);
218 template
219 const collate<char>&
220 use_facet<collate<char> >(const locale&);
222 template
223 const moneypunct<char, true>&
224 use_facet<moneypunct<char, true> >(const locale&);
226 template
227 const moneypunct<char, false>&
228 use_facet<moneypunct<char, false> >(const locale&);
230 template
231 const __timepunct<char>&
232 use_facet<__timepunct<char> >(const locale&);
234 #ifdef _GLIBCPP_USE_WCHAR_T
235 template
236 const numpunct<wchar_t>&
237 use_facet<numpunct<wchar_t> >(const locale&);
239 template
240 const num_put<wchar_t, wobuf_iterator>&
241 use_facet<num_put<wchar_t, wobuf_iterator> >(const locale&);
243 template
244 const num_get<wchar_t, wibuf_iterator>&
245 use_facet<num_get<wchar_t, wibuf_iterator> >(const locale&);
247 template
248 const codecvt<wchar_t, char, mbstate_t>&
249 use_facet<codecvt<wchar_t, char, mbstate_t> >(locale const&);
251 template
252 const collate<wchar_t>&
253 use_facet<collate<wchar_t> >(const locale&);
255 template
256 const moneypunct<wchar_t, true>&
257 use_facet<moneypunct<wchar_t, true> >(const locale&);
259 template
260 const moneypunct<wchar_t, false>&
261 use_facet<moneypunct<wchar_t, false> >(const locale&);
263 template
264 const __timepunct<wchar_t>&
265 use_facet<__timepunct<wchar_t> >(const locale&);
266 #endif
268 // has_facet
269 template
270 bool
271 has_facet<numpunct<char> >(const locale&);
272 template
273 bool
274 has_facet<num_put<char> >(const locale&);
275 template
276 bool
277 has_facet<num_get<char> >(const locale&);
278 template
279 bool
280 has_facet<ctype<char> >(const locale&);
282 #ifdef _GLIBCPP_USE_WCHAR_T
283 template
284 bool
285 has_facet<numpunct<wchar_t> >(const locale&);
286 template
287 bool
288 has_facet<num_put<wchar_t> >(const locale&);
289 template
290 bool
291 has_facet<num_get<wchar_t> >(const locale&);
292 template
293 bool
294 has_facet<ctype<wchar_t> >(const locale&);
295 #endif
298 // iterator
300 typedef vector<locale::facet*> vec_pfacet;
301 template
302 void
303 vec_pfacet::
304 insert(vec_pfacet::iterator, vec_pfacet::size_type,
305 const vec_pfacet::value_type&);
306 template
307 void
308 vec_pfacet::
309 _M_fill_insert(vec_pfacet::iterator, vec_pfacet::size_type,
310 const vec_pfacet::value_type&);
314 // locale
316 typedef istreambuf_iterator<char, char_traits<char> > istreambuf_iter;
317 typedef ostreambuf_iterator<char, char_traits<char> > ostreambuf_iter;
319 #ifdef _GLIBCPP_USE_WCHAR_T
320 typedef istreambuf_iterator<wchar_t, char_traits<wchar_t> > wistreambuf_iter;
321 typedef ostreambuf_iterator<wchar_t, char_traits<wchar_t> > wostreambuf_iter;
322 #endif
324 template
325 bool
326 locale::operator()(const string&, const string&) const;
328 template
329 char*
330 __add_grouping<char>(char*, char, char const*, char const*,
331 char const*, char const*);
333 template
334 bool
335 __verify_grouping<char>(const basic_string<char>&, basic_string<char>&);
337 template
338 void
339 __pad<char>(ios_base&, char, char*, const char *, streamsize,
340 streamsize, const bool);
342 template
343 void
344 __pad<char, char_traits<char> >(ios_base&, char, char*, const char *,
345 streamsize, streamsize, const bool);
347 #ifdef _GLIBCPP_USE_WCHAR_T
348 template
349 bool
350 locale::operator()(const wstring&, const wstring&) const;
352 typedef ostreambuf_iterator<wchar_t> wostreambuf_iter;
354 template
355 wchar_t*
356 __add_grouping<wchar_t>(wchar_t*, wchar_t, char const*, char const*,
357 wchar_t const*, wchar_t const*);
358 template
359 bool
360 __verify_grouping<wchar_t>(const basic_string<wchar_t>&,
361 basic_string<wchar_t>&);
363 template
364 void
365 __pad<wchar_t>(ios_base&, wchar_t, wchar_t*, const wchar_t*,
366 streamsize, streamsize, const bool);
368 template
369 void
370 __pad<wchar_t, char_traits<wchar_t> >(ios_base&, wchar_t, wchar_t*,
371 const wchar_t*, streamsize,
372 streamsize, const bool);
373 #endif // _GLIBCPP_USE_WCHAR_T
375 template
376 locale::facet**
377 fill_n<locale::facet**, size_t, locale::facet*>
378 (locale::facet**, size_t, locale::facet* const&);
380 template
381 __normal_iterator<locale::facet**, vector<locale::facet*> >
382 fill_n(__normal_iterator<locale::facet**, vector<locale::facet*> >,
383 size_t, locale::facet* const&);
385 template
386 void
387 fill(__normal_iterator<locale::facet**, vector<locale::facet*> >,
388 __normal_iterator<locale::facet**, vector<locale::facet*> >,
389 locale::facet* const&);
390 } // namespace std