locale-inst.cc revision 97403
1// Locale support -*- C++ -*-
2
3// Copyright (C) 1999, 2000, 2001, 2002 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 <cstdlib>
35#include <clocale>
36#include <cstring>
37#include <cassert>
38#include <limits>
39#include <exception>
40#include <locale>
41#include <istream>
42#include <ostream>
43
44namespace std
45{
46  // moneypunct, money_get, and money_put
47  template class moneypunct<char, false>;
48  template class moneypunct<char, true>;
49  template class moneypunct_byname<char, false>;
50  template class moneypunct_byname<char, true>;
51  template class money_get<char, istreambuf_iterator<char> >;
52  template class money_put<char, ostreambuf_iterator<char> >;
53
54#ifdef _GLIBCPP_USE_WCHAR_T
55  template class moneypunct<wchar_t, false>;
56  template class moneypunct<wchar_t, true>;
57  template class moneypunct_byname<wchar_t, false>;
58  template class moneypunct_byname<wchar_t, true>;
59  template class money_get<wchar_t, istreambuf_iterator<wchar_t> >;
60  template class money_put<wchar_t, ostreambuf_iterator<wchar_t> >;
61#endif
62
63  // numpunct, numpunct_byname, num_get, and num_put
64  template class numpunct<char>;
65  template class numpunct_byname<char>;
66  template class num_get<char, istreambuf_iterator<char> >;
67  template class num_put<char, ostreambuf_iterator<char> >;
68  template
69    ostreambuf_iterator<char>
70    num_put<char, ostreambuf_iterator<char> >::
71    _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, char, char,
72		   long) const;
73
74  template
75    ostreambuf_iterator<char>
76    num_put<char, ostreambuf_iterator<char> >::
77    _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, char, char,
78		   unsigned long) const;
79
80#ifdef _GLIBCPP_USE_LONG_LONG
81  template
82    ostreambuf_iterator<char>
83    num_put<char, ostreambuf_iterator<char> >::
84    _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, char, char,
85		   long long) const;
86
87  template
88    ostreambuf_iterator<char>
89    num_put<char, ostreambuf_iterator<char> >::
90    _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, char, char,
91		   unsigned long long) const;
92#endif
93
94  template
95    ostreambuf_iterator<char>
96    num_put<char, ostreambuf_iterator<char> >::
97    _M_convert_float(ostreambuf_iterator<char>, ios_base&, char, char,
98		     double) const;
99
100  template
101    ostreambuf_iterator<char>
102    num_put<char, ostreambuf_iterator<char> >::
103    _M_convert_float(ostreambuf_iterator<char>, ios_base&, char, char,
104		    long double) const;
105
106#ifdef _GLIBCPP_USE_WCHAR_T
107  template class numpunct<wchar_t>;
108  template class numpunct_byname<wchar_t>;
109  template class num_get<wchar_t, istreambuf_iterator<wchar_t> >;
110  template class num_put<wchar_t, ostreambuf_iterator<wchar_t> >;
111
112  template
113    ostreambuf_iterator<wchar_t>
114    num_put<wchar_t, ostreambuf_iterator<wchar_t> >::
115    _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char,
116		   char, long) const;
117
118  template
119    ostreambuf_iterator<wchar_t>
120    num_put<wchar_t, ostreambuf_iterator<wchar_t> >::
121    _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char,
122		   char, unsigned long) const;
123
124#ifdef _GLIBCPP_USE_LONG_LONG
125  template
126    ostreambuf_iterator<wchar_t>
127    num_put<wchar_t, ostreambuf_iterator<wchar_t> >::
128    _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char,
129		   char, long long) const;
130
131  template
132    ostreambuf_iterator<wchar_t>
133    num_put<wchar_t, ostreambuf_iterator<wchar_t> >::
134    _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char,
135		   char, unsigned long long) const;
136#endif
137
138  template
139    ostreambuf_iterator<wchar_t>
140    num_put<wchar_t, ostreambuf_iterator<wchar_t> >::
141    _M_convert_float(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char,
142		     double) const;
143
144  template
145    ostreambuf_iterator<wchar_t>
146    num_put<wchar_t, ostreambuf_iterator<wchar_t> >::
147    _M_convert_float(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char,
148		     long double) const;
149#endif
150
151  // time_get and time_put
152  template class __timepunct<char>;
153  template class time_put<char, ostreambuf_iterator<char> >;
154  template class time_put_byname<char, ostreambuf_iterator<char> >;
155  template class time_get<char, istreambuf_iterator<char> >;
156  template class time_get_byname<char, istreambuf_iterator<char> >;
157
158#ifdef _GLIBCPP_USE_WCHAR_T
159  template class __timepunct<wchar_t>;
160  template class time_put<wchar_t, ostreambuf_iterator<wchar_t> >;
161  template class time_put_byname<wchar_t, ostreambuf_iterator<wchar_t> >;
162  template class time_get<wchar_t, istreambuf_iterator<wchar_t> >;
163  template class time_get_byname<wchar_t, istreambuf_iterator<wchar_t> >;
164#endif
165
166  // messages
167  template class messages<char>;
168  template class messages_byname<char>;
169#ifdef _GLIBCPP_USE_WCHAR_T
170  template class messages<wchar_t>;
171  template class messages_byname<wchar_t>;
172#endif
173
174  // ctype
175  inline template class __ctype_abstract_base<char>;
176  template class ctype_byname<char>;
177#ifdef _GLIBCPP_USE_WCHAR_T
178  inline template class __ctype_abstract_base<wchar_t>;
179  template class ctype_byname<wchar_t>;
180#endif
181
182  // codecvt
183  inline template class __codecvt_abstract_base<char, char, mbstate_t>;
184  inline template class __codecvt_abstract_base<wchar_t, char, mbstate_t>;
185  template class codecvt_byname<char, char, mbstate_t>;
186#ifdef _GLIBCPP_USE_WCHAR_T
187  template class codecvt_byname<wchar_t, char, mbstate_t>;
188#endif
189
190  // collate
191  template class collate<char>;
192  template class collate_byname<char>;
193#ifdef _GLIBCPP_USE_WCHAR_T
194  template class collate<wchar_t>;
195  template class collate_byname<wchar_t>;
196#endif
197
198  // use_facet
199  // NB: use_facet<ctype> is specialized
200  template
201    const codecvt<char, char, mbstate_t>&
202    use_facet<codecvt<char, char, mbstate_t> >(const locale&);
203
204  template
205    const collate<char>&
206    use_facet<collate<char> >(const locale&);
207
208  template
209    const numpunct<char>&
210    use_facet<numpunct<char> >(const locale&);
211
212  template
213    const num_put<char>&
214    use_facet<num_put<char> >(const locale&);
215
216  template
217    const num_get<char>&
218    use_facet<num_get<char> >(const locale&);
219
220  template
221    const moneypunct<char, true>&
222    use_facet<moneypunct<char, true> >(const locale&);
223
224  template
225    const moneypunct<char, false>&
226    use_facet<moneypunct<char, false> >(const locale&);
227
228  template
229    const money_put<char>&
230    use_facet<money_put<char> >(const locale&);
231
232  template
233    const money_get<char>&
234    use_facet<money_get<char> >(const locale&);
235
236  template
237    const __timepunct<char>&
238    use_facet<__timepunct<char> >(const locale&);
239
240  template
241    const time_put<char>&
242    use_facet<time_put<char> >(const locale&);
243
244  template
245    const time_get<char>&
246    use_facet<time_get<char> >(const locale&);
247
248  template
249    const messages<char>&
250    use_facet<messages<char> >(const locale&);
251
252#ifdef _GLIBCPP_USE_WCHAR_T
253  template
254    const codecvt<wchar_t, char, mbstate_t>&
255    use_facet<codecvt<wchar_t, char, mbstate_t> >(locale const&);
256
257  template
258    const collate<wchar_t>&
259    use_facet<collate<wchar_t> >(const locale&);
260
261  template
262    const numpunct<wchar_t>&
263    use_facet<numpunct<wchar_t> >(const locale&);
264
265  template
266    const num_put<wchar_t>&
267    use_facet<num_put<wchar_t> >(const locale&);
268
269  template
270    const num_get<wchar_t>&
271    use_facet<num_get<wchar_t> >(const locale&);
272
273  template
274    const moneypunct<wchar_t, true>&
275    use_facet<moneypunct<wchar_t, true> >(const locale&);
276
277  template
278    const moneypunct<wchar_t, false>&
279    use_facet<moneypunct<wchar_t, false> >(const locale&);
280
281  template
282    const money_put<wchar_t>&
283    use_facet<money_put<wchar_t> >(const locale&);
284
285  template
286    const money_get<wchar_t>&
287    use_facet<money_get<wchar_t> >(const locale&);
288
289  template
290    const __timepunct<wchar_t>&
291    use_facet<__timepunct<wchar_t> >(const locale&);
292
293  template
294    const time_put<wchar_t>&
295    use_facet<time_put<wchar_t> >(const locale&);
296
297  template
298    const time_get<wchar_t>&
299    use_facet<time_get<wchar_t> >(const locale&);
300
301  template
302    const messages<wchar_t>&
303    use_facet<messages<wchar_t> >(const locale&);
304#endif
305
306  // has_facet
307  template
308    bool
309    has_facet<ctype<char> >(const locale&);
310
311  template
312    bool
313    has_facet<codecvt<char, char, mbstate_t> >(const locale&);
314
315  template
316    bool
317    has_facet<collate<char> >(const locale&);
318
319  template
320    bool
321    has_facet<numpunct<char> >(const locale&);
322
323  template
324    bool
325    has_facet<num_put<char> >(const locale&);
326
327  template
328    bool
329    has_facet<num_get<char> >(const locale&);
330
331  template
332    bool
333    has_facet<moneypunct<char> >(const locale&);
334
335  template
336    bool
337    has_facet<money_put<char> >(const locale&);
338
339  template
340    bool
341    has_facet<money_get<char> >(const locale&);
342
343  template
344    bool
345    has_facet<__timepunct<char> >(const locale&);
346
347  template
348    bool
349    has_facet<time_put<char> >(const locale&);
350
351  template
352    bool
353    has_facet<time_get<char> >(const locale&);
354
355  template
356    bool
357    has_facet<messages<char> >(const locale&);
358
359#ifdef _GLIBCPP_USE_WCHAR_T
360 template
361    bool
362    has_facet<ctype<wchar_t> >(const locale&);
363
364  template
365    bool
366    has_facet<codecvt<wchar_t, char, mbstate_t> >(const locale&);
367
368  template
369    bool
370    has_facet<collate<wchar_t> >(const locale&);
371
372  template
373    bool
374    has_facet<numpunct<wchar_t> >(const locale&);
375
376  template
377    bool
378    has_facet<num_put<wchar_t> >(const locale&);
379
380  template
381    bool
382    has_facet<num_get<wchar_t> >(const locale&);
383
384  template
385    bool
386    has_facet<moneypunct<wchar_t> >(const locale&);
387
388  template
389    bool
390    has_facet<money_put<wchar_t> >(const locale&);
391
392  template
393    bool
394    has_facet<money_get<wchar_t> >(const locale&);
395
396  template
397    bool
398    has_facet<__timepunct<wchar_t> >(const locale&);
399
400  template
401    bool
402    has_facet<time_put<wchar_t> >(const locale&);
403
404  template
405    bool
406    has_facet<time_get<wchar_t> >(const locale&);
407
408  template
409    bool
410    has_facet<messages<wchar_t> >(const locale&);
411#endif
412
413  // locale
414  template
415    char*
416    __add_grouping<char>(char*, char, char const*, char const*,
417			 char const*, char const*);
418
419  template
420    bool
421    __verify_grouping<char>(const basic_string<char>&, basic_string<char>&);
422
423  template
424    void
425    __pad<char>(ios_base&, char, char*, const char *, streamsize,
426		streamsize, const bool);
427
428  template
429    void
430    __pad<char, char_traits<char> >(ios_base&, char, char*, const char *,
431				    streamsize, streamsize, const bool);
432
433#ifdef _GLIBCPP_USE_WCHAR_T
434  template
435    wchar_t*
436    __add_grouping<wchar_t>(wchar_t*, wchar_t, char const*, char const*,
437			    wchar_t const*, wchar_t const*);
438  template
439    bool
440    __verify_grouping<wchar_t>(const basic_string<wchar_t>&,
441			       basic_string<wchar_t>&);
442
443  template
444    void
445    __pad<wchar_t>(ios_base&, wchar_t, wchar_t*, const wchar_t*,
446		   streamsize, streamsize, const bool);
447
448  template
449    void
450    __pad<wchar_t, char_traits<wchar_t> >(ios_base&, wchar_t, wchar_t*,
451					  const wchar_t*, streamsize,
452					  streamsize, const bool);
453#endif // _GLIBCPP_USE_WCHAR_T
454
455  template
456    int
457    __convert_from_v(char*, const int, const char*, double, const __c_locale&, int);
458
459  template
460    int
461    __convert_from_v(char*, const int, const char*, long double, const __c_locale&, int);
462
463  template
464    int
465    __convert_from_v(char*, const int, const char*, long, const __c_locale&, int);
466
467  template
468    int
469    __convert_from_v(char*, const int, const char*, unsigned long,
470		     const __c_locale&, int);
471
472  template
473    int
474    __convert_from_v(char*, const int, const char*, long long, const __c_locale&, int);
475
476  template
477    int
478    __convert_from_v(char*, const int, const char*, unsigned long long,
479		     const __c_locale&, int);
480} // namespace std
481