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