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