]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/libstdc++/src/locale-inst.cc
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / libstdc++ / src / locale-inst.cc
1 // Locale support -*- C++ -*-
2
3 // Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
4 // Free Software Foundation, Inc.
5 //
6 // This file is part of the GNU ISO C++ Library.  This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 2, or (at your option)
10 // any later version.
11
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 // GNU General Public License for more details.
16
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING.  If not, write to the Free
19 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
20 // USA.
21
22 // As a special exception, you may use this file as part of a free software
23 // library without restriction.  Specifically, if other files instantiate
24 // templates or use macros or inline functions from this file, or you compile
25 // this file and link it with other files to produce an executable, this
26 // file does not by itself cause the resulting executable to be covered by
27 // the GNU General Public License.  This exception does not however
28 // invalidate any other reasons why the executable file might be covered by
29 // the GNU General Public License.
30
31 //
32 // ISO C++ 14882: 22.1  Locales
33 //
34
35 #include <locale>
36
37 // Instantiation configuration.
38 #ifndef C
39 # define C char
40 # define C_is_char
41 #endif
42
43 _GLIBCXX_BEGIN_NAMESPACE(std)
44
45   // moneypunct, money_get, and money_put
46   template class moneypunct<C, false>;
47   template class moneypunct<C, true>;
48   template struct __moneypunct_cache<C, false>;
49   template struct __moneypunct_cache<C, true>;
50   template class moneypunct_byname<C, false>;
51   template class moneypunct_byname<C, true>;
52 _GLIBCXX_BEGIN_LDBL_NAMESPACE
53   template class money_get<C, istreambuf_iterator<C> >;
54   template class money_put<C, ostreambuf_iterator<C> >;
55   template
56     istreambuf_iterator<C>
57     money_get<C, istreambuf_iterator<C> >::
58     _M_extract<true>(istreambuf_iterator<C>, istreambuf_iterator<C>,
59                      ios_base&, ios_base::iostate&, string&) const;
60
61   template
62     istreambuf_iterator<C>
63     money_get<C, istreambuf_iterator<C> >::
64     _M_extract<false>(istreambuf_iterator<C>, istreambuf_iterator<C>,
65                       ios_base&, ios_base::iostate&, string&) const;
66
67   template
68     ostreambuf_iterator<C>
69     money_put<C, ostreambuf_iterator<C> >::
70     _M_insert<true>(ostreambuf_iterator<C>, ios_base&, C, 
71                     const string_type&) const;
72
73   template
74     ostreambuf_iterator<C>
75     money_put<C, ostreambuf_iterator<C> >::
76     _M_insert<false>(ostreambuf_iterator<C>, ios_base&, C, 
77                      const string_type&) const;
78 _GLIBCXX_END_LDBL_NAMESPACE
79
80   // numpunct, numpunct_byname, num_get, and num_put
81   template class numpunct<C>;
82   template struct __numpunct_cache<C>;
83   template class numpunct_byname<C>;
84 _GLIBCXX_BEGIN_LDBL_NAMESPACE
85   template class num_get<C, istreambuf_iterator<C> >;
86   template class num_put<C, ostreambuf_iterator<C> >; 
87   template
88     istreambuf_iterator<C>
89     num_get<C, istreambuf_iterator<C> >::
90     _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
91                    ios_base&, ios_base::iostate&,
92                    long&) const;
93
94   template
95     istreambuf_iterator<C>
96     num_get<C, istreambuf_iterator<C> >::
97     _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
98                    ios_base&, ios_base::iostate&, 
99                    unsigned short&) const;
100
101   template
102     istreambuf_iterator<C>
103     num_get<C, istreambuf_iterator<C> >::
104     _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
105                    ios_base&, ios_base::iostate&,
106                    unsigned int&) const;
107
108   template
109     istreambuf_iterator<C>
110     num_get<C, istreambuf_iterator<C> >::
111     _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
112                    ios_base&, ios_base::iostate&,
113                    unsigned long&) const;
114
115 #ifdef _GLIBCXX_USE_LONG_LONG
116   template
117     istreambuf_iterator<C>
118     num_get<C, istreambuf_iterator<C> >::
119     _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
120                    ios_base&, ios_base::iostate&,
121                    long long&) const;
122
123   template
124     istreambuf_iterator<C>
125     num_get<C, istreambuf_iterator<C> >::
126     _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
127                    ios_base&, ios_base::iostate&,
128                    unsigned long long&) const;
129 #endif
130
131   template
132     ostreambuf_iterator<C>
133     num_put<C, ostreambuf_iterator<C> >::
134     _M_insert_int(ostreambuf_iterator<C>, ios_base&, C, 
135                   long) const;
136
137   template
138     ostreambuf_iterator<C>
139     num_put<C, ostreambuf_iterator<C> >::
140     _M_insert_int(ostreambuf_iterator<C>, ios_base&, C, 
141                   unsigned long) const;
142
143 #ifdef _GLIBCXX_USE_LONG_LONG
144   template
145     ostreambuf_iterator<C>
146     num_put<C, ostreambuf_iterator<C> >::
147     _M_insert_int(ostreambuf_iterator<C>, ios_base&, C, 
148                   long long) const;
149
150   template
151     ostreambuf_iterator<C>
152     num_put<C, ostreambuf_iterator<C> >::
153     _M_insert_int(ostreambuf_iterator<C>, ios_base&, C, 
154                   unsigned long long) const;
155 #endif
156
157   template
158     ostreambuf_iterator<C>
159     num_put<C, ostreambuf_iterator<C> >::
160     _M_insert_float(ostreambuf_iterator<C>, ios_base&, C, char, 
161                     double) const;
162
163   template
164     ostreambuf_iterator<C>
165     num_put<C, ostreambuf_iterator<C> >::
166     _M_insert_float(ostreambuf_iterator<C>, ios_base&, C, char, 
167                     long double) const;
168 _GLIBCXX_END_LDBL_NAMESPACE
169
170   // time_get and time_put
171   template class __timepunct<C>;
172   template struct __timepunct_cache<C>;
173   template class time_put<C, ostreambuf_iterator<C> >;
174   template class time_put_byname<C, ostreambuf_iterator<C> >;
175   template class time_get<C, istreambuf_iterator<C> >;
176   template class time_get_byname<C, istreambuf_iterator<C> >;
177
178   // messages
179   template class messages<C>;
180   template class messages_byname<C>;
181   
182   // ctype
183   template class __ctype_abstract_base<C>;
184   template class ctype_byname<C>;
185   
186   // codecvt
187   template class __codecvt_abstract_base<C, char, mbstate_t>;
188   template class codecvt_byname<C, char, mbstate_t>;
189
190   // collate
191   template class collate<C>;
192   template class collate_byname<C>;
193     
194   // use_facet
195   // NB: use_facet<ctype> is specialized
196   template
197     const codecvt<C, char, mbstate_t>& 
198     use_facet<codecvt<C, char, mbstate_t> >(const locale&);
199
200   template
201     const collate<C>& 
202     use_facet<collate<C> >(const locale&);
203
204   template
205     const numpunct<C>& 
206     use_facet<numpunct<C> >(const locale&);
207
208   template 
209     const num_put<C>& 
210     use_facet<num_put<C> >(const locale&);
211
212   template 
213     const num_get<C>& 
214     use_facet<num_get<C> >(const locale&);
215
216   template
217     const moneypunct<C, true>& 
218     use_facet<moneypunct<C, true> >(const locale&);
219
220   template
221     const moneypunct<C, false>& 
222     use_facet<moneypunct<C, false> >(const locale&);
223
224   template 
225     const money_put<C>& 
226     use_facet<money_put<C> >(const locale&);
227
228   template 
229     const money_get<C>& 
230     use_facet<money_get<C> >(const locale&);
231
232   template
233     const __timepunct<C>& 
234     use_facet<__timepunct<C> >(const locale&);
235
236   template 
237     const time_put<C>& 
238     use_facet<time_put<C> >(const locale&);
239
240   template 
241     const time_get<C>& 
242     use_facet<time_get<C> >(const locale&);
243
244   template 
245     const messages<C>& 
246     use_facet<messages<C> >(const locale&);
247
248   // has_facet
249   template 
250     bool
251     has_facet<ctype<C> >(const locale&);
252
253   template 
254     bool
255     has_facet<codecvt<C, char, mbstate_t> >(const locale&);
256
257   template 
258     bool
259     has_facet<collate<C> >(const locale&);
260
261   template 
262     bool
263     has_facet<numpunct<C> >(const locale&);
264
265   template 
266     bool
267     has_facet<num_put<C> >(const locale&);
268
269   template 
270     bool
271     has_facet<num_get<C> >(const locale&);
272
273   template 
274     bool
275     has_facet<moneypunct<C> >(const locale&);
276
277   template 
278     bool
279     has_facet<money_put<C> >(const locale&);
280
281   template 
282     bool
283     has_facet<money_get<C> >(const locale&);
284
285   template 
286     bool
287     has_facet<__timepunct<C> >(const locale&);
288
289   template 
290     bool
291     has_facet<time_put<C> >(const locale&);
292
293   template 
294     bool
295     has_facet<time_get<C> >(const locale&);
296
297   template 
298     bool
299     has_facet<messages<C> >(const locale&);
300
301
302   // locale functions.
303   template
304     C*
305     __add_grouping<C>(C*, C, char const*, size_t, 
306                          C const*, C const*);
307
308   template class __pad<C, char_traits<C> >;
309
310   template
311     int
312     __int_to_char(C*, unsigned long, const C*,
313                   ios_base::fmtflags, bool);
314
315 #ifdef _GLIBCXX_USE_LONG_LONG
316   template
317     int
318     __int_to_char(C*, unsigned long long, const C*, 
319                   ios_base::fmtflags, bool);
320 #endif
321
322 _GLIBCXX_END_NAMESPACE
323
324 // XXX GLIBCXX_ABI Deprecated
325 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined C_is_char
326
327 #define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
328   extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak))
329
330 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIjEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
331                      _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIjEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
332 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIlEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
333                      _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIlEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
334 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intImEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
335                      _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intImEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
336 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intItEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
337                      _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intItEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
338 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIxEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
339                      _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIxEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
340 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIyEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
341                      _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIyEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
342 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIlEES4_S4_RSt8ios_basecT_,
343                      _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIlEES3_S3_RSt8ios_basecT_);
344 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intImEES4_S4_RSt8ios_basecT_,
345                      _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intImEES3_S3_RSt8ios_basecT_);
346 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIxEES4_S4_RSt8ios_basecT_,
347                      _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIxEES3_S3_RSt8ios_basecT_);
348 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIyEES4_S4_RSt8ios_basecT_,
349                      _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIyEES3_S3_RSt8ios_basecT_);
350 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIdEES4_S4_RSt8ios_baseccT_,
351                      _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIdEES3_S3_RSt8ios_baseccT_);
352 _GLIBCXX_LDBL_COMPAT(_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIdEES3_S3_RSt8ios_baseccT_,
353                      _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIeEES3_S3_RSt8ios_baseccT_);
354 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb0EEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRSs,
355                      _ZNKSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb0EEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRSs);
356 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb1EEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRSs,
357                      _ZNKSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb1EEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRSs);
358 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb0EEES4_S4_RSt8ios_basecRKSs,
359                      _ZNKSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb0EEES3_S3_RSt8ios_basecRKSs);
360 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb1EEES4_S4_RSt8ios_basecRKSs,
361                      _ZNKSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb1EEES3_S3_RSt8ios_basecRKSs);
362
363 #endif // _GLIBCXX_LONG_DOUBLE_COMPAT