Compile locale-inst.cc and wlocale-inst.cc as C++11.
[official-gcc.git] / libstdc++-v3 / src / c++11 / locale-inst.cc
blob6cd361687d61f7297e1b03db10795755ce76e825
1 // Locale support -*- C++ -*-
3 // Copyright (C) 1999-2014 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 3, 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 // Under Section 7 of GPL version 3, you are granted additional
17 // permissions described in the GCC Runtime Library Exception, version
18 // 3.1, as published by the Free Software Foundation.
20 // You should have received a copy of the GNU General Public License and
21 // a copy of the GCC Runtime Library Exception along with this program;
22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 // <http://www.gnu.org/licenses/>.
26 // ISO C++ 14882: 22.1 Locales
29 #ifndef _GLIBCXX_USE_CXX11_ABI
30 // Instantiations in this file use the old COW std::string ABI unless included
31 // by another file which defines _GLIBCXX_USE_CXX11_ABI=1. Some instantiations
32 // are guarded by a check for !_GLIBCXX_USE_CXX11_ABI so that they are only
33 // instantiated once, because they are not tagged with abi_tag so should not
34 // be instantiated twice.
35 # define _GLIBCXX_USE_CXX11_ABI 0
36 #endif
38 #include <locale>
40 // Instantiation configuration.
41 #ifndef C
42 # define C char
43 # define C_is_char
44 #endif
46 namespace std _GLIBCXX_VISIBILITY(default)
48 _GLIBCXX_BEGIN_NAMESPACE_VERSION
50 // moneypunct, money_get, and money_put
51 #if ! _GLIBCXX_USE_CXX11_ABI
52 template struct __moneypunct_cache<C, false>;
53 template struct __moneypunct_cache<C, true>;
54 #endif
55 _GLIBCXX_BEGIN_NAMESPACE_CXX11
56 template class moneypunct<C, false>;
57 template class moneypunct<C, true>;
58 template class moneypunct_byname<C, false>;
59 template class moneypunct_byname<C, true>;
60 _GLIBCXX_END_NAMESPACE_CXX11
61 _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11
62 template class money_get<C, istreambuf_iterator<C> >;
63 template class money_put<C, ostreambuf_iterator<C> >;
64 template
65 istreambuf_iterator<C>
66 money_get<C, istreambuf_iterator<C> >::
67 _M_extract<true>(istreambuf_iterator<C>, istreambuf_iterator<C>,
68 ios_base&, ios_base::iostate&, string&) const;
70 template
71 istreambuf_iterator<C>
72 money_get<C, istreambuf_iterator<C> >::
73 _M_extract<false>(istreambuf_iterator<C>, istreambuf_iterator<C>,
74 ios_base&, ios_base::iostate&, string&) const;
76 template
77 ostreambuf_iterator<C>
78 money_put<C, ostreambuf_iterator<C> >::
79 _M_insert<true>(ostreambuf_iterator<C>, ios_base&, C,
80 const string_type&) const;
82 template
83 ostreambuf_iterator<C>
84 money_put<C, ostreambuf_iterator<C> >::
85 _M_insert<false>(ostreambuf_iterator<C>, ios_base&, C,
86 const string_type&) const;
87 _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11
89 // numpunct, numpunct_byname, num_get, and num_put
90 #if ! _GLIBCXX_USE_CXX11_ABI
91 template struct __numpunct_cache<C>;
92 #endif
93 _GLIBCXX_BEGIN_NAMESPACE_CXX11
94 template class numpunct<C>;
95 template class numpunct_byname<C>;
96 _GLIBCXX_END_NAMESPACE_CXX11
97 _GLIBCXX_BEGIN_NAMESPACE_LDBL
98 #if ! _GLIBCXX_USE_CXX11_ABI
99 template class num_get<C, istreambuf_iterator<C> >;
100 #endif
102 template
103 istreambuf_iterator<C>
104 num_get<C, istreambuf_iterator<C> >::
105 _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
106 ios_base&, ios_base::iostate&,
107 long&) const;
109 template
110 istreambuf_iterator<C>
111 num_get<C, istreambuf_iterator<C> >::
112 _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
113 ios_base&, ios_base::iostate&,
114 unsigned short&) const;
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 unsigned int&) const;
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&) const;
130 #ifdef _GLIBCXX_USE_LONG_LONG
131 template
132 istreambuf_iterator<C>
133 num_get<C, istreambuf_iterator<C> >::
134 _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
135 ios_base&, ios_base::iostate&,
136 long long&) const;
138 template
139 istreambuf_iterator<C>
140 num_get<C, istreambuf_iterator<C> >::
141 _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
142 ios_base&, ios_base::iostate&,
143 unsigned long long&) const;
144 #endif
146 #if ! _GLIBCXX_USE_CXX11_ABI
147 template class num_put<C, ostreambuf_iterator<C> >;
149 template
150 ostreambuf_iterator<C>
151 num_put<C, ostreambuf_iterator<C> >::
152 _M_insert_int(ostreambuf_iterator<C>, ios_base&, C,
153 long) const;
155 template
156 ostreambuf_iterator<C>
157 num_put<C, ostreambuf_iterator<C> >::
158 _M_insert_int(ostreambuf_iterator<C>, ios_base&, C,
159 unsigned long) const;
161 #ifdef _GLIBCXX_USE_LONG_LONG
162 template
163 ostreambuf_iterator<C>
164 num_put<C, ostreambuf_iterator<C> >::
165 _M_insert_int(ostreambuf_iterator<C>, ios_base&, C,
166 long long) const;
168 template
169 ostreambuf_iterator<C>
170 num_put<C, ostreambuf_iterator<C> >::
171 _M_insert_int(ostreambuf_iterator<C>, ios_base&, C,
172 unsigned long long) const;
173 #endif
175 template
176 ostreambuf_iterator<C>
177 num_put<C, ostreambuf_iterator<C> >::
178 _M_insert_float(ostreambuf_iterator<C>, ios_base&, C, char,
179 double) const;
181 template
182 ostreambuf_iterator<C>
183 num_put<C, ostreambuf_iterator<C> >::
184 _M_insert_float(ostreambuf_iterator<C>, ios_base&, C, char,
185 long double) const;
186 #endif
187 _GLIBCXX_END_NAMESPACE_LDBL
189 // time_get and time_put
190 #if ! _GLIBCXX_USE_CXX11_ABI
191 template class __timepunct<C>;
192 template struct __timepunct_cache<C>;
193 template class time_put<C, ostreambuf_iterator<C> >;
194 template class time_put_byname<C, ostreambuf_iterator<C> >;
195 #endif
196 _GLIBCXX_BEGIN_NAMESPACE_CXX11
197 template class time_get<C, istreambuf_iterator<C> >;
198 template class time_get_byname<C, istreambuf_iterator<C> >;
199 _GLIBCXX_END_NAMESPACE_CXX11
201 // messages
202 _GLIBCXX_BEGIN_NAMESPACE_CXX11
203 template class messages<C>;
204 template class messages_byname<C>;
205 _GLIBCXX_END_NAMESPACE_CXX11
207 // ctype
208 #if ! _GLIBCXX_USE_CXX11_ABI
209 inline template class __ctype_abstract_base<C>;
210 template class ctype_byname<C>;
211 #endif
213 // codecvt
214 #if ! _GLIBCXX_USE_CXX11_ABI
215 inline template class __codecvt_abstract_base<C, char, mbstate_t>;
216 template class codecvt_byname<C, char, mbstate_t>;
217 #endif
219 // collate
220 _GLIBCXX_BEGIN_NAMESPACE_CXX11
221 template class collate<C>;
222 template class collate_byname<C>;
223 _GLIBCXX_END_NAMESPACE_CXX11
225 // use_facet
226 #if ! _GLIBCXX_USE_CXX11_ABI
227 template
228 const ctype<C>&
229 use_facet<ctype<C> >(const locale&);
231 template
232 const codecvt<C, char, mbstate_t>&
233 use_facet<codecvt<C, char, mbstate_t> >(const locale&);
234 #endif
236 template
237 const collate<C>&
238 use_facet<collate<C> >(const locale&);
240 template
241 const numpunct<C>&
242 use_facet<numpunct<C> >(const locale&);
244 #if ! _GLIBCXX_USE_CXX11_ABI
245 template
246 const num_put<C>&
247 use_facet<num_put<C> >(const locale&);
249 template
250 const num_get<C>&
251 use_facet<num_get<C> >(const locale&);
252 #endif
254 template
255 const moneypunct<C, true>&
256 use_facet<moneypunct<C, true> >(const locale&);
258 template
259 const moneypunct<C, false>&
260 use_facet<moneypunct<C, false> >(const locale&);
262 template
263 const money_put<C>&
264 use_facet<money_put<C> >(const locale&);
266 template
267 const money_get<C>&
268 use_facet<money_get<C> >(const locale&);
270 #if ! _GLIBCXX_USE_CXX11_ABI
271 template
272 const __timepunct<C>&
273 use_facet<__timepunct<C> >(const locale&);
275 template
276 const time_put<C>&
277 use_facet<time_put<C> >(const locale&);
278 #endif
280 template
281 const time_get<C>&
282 use_facet<time_get<C> >(const locale&);
284 template
285 const messages<C>&
286 use_facet<messages<C> >(const locale&);
288 // has_facet
289 #if ! _GLIBCXX_USE_CXX11_ABI
290 template
291 bool
292 has_facet<ctype<C> >(const locale&);
294 template
295 bool
296 has_facet<codecvt<C, char, mbstate_t> >(const locale&);
297 #endif
299 template
300 bool
301 has_facet<collate<C> >(const locale&);
303 template
304 bool
305 has_facet<numpunct<C> >(const locale&);
307 #if ! _GLIBCXX_USE_CXX11_ABI
308 template
309 bool
310 has_facet<num_put<C> >(const locale&);
312 template
313 bool
314 has_facet<num_get<C> >(const locale&);
315 #endif
317 template
318 bool
319 has_facet<moneypunct<C> >(const locale&);
321 template
322 bool
323 has_facet<money_put<C> >(const locale&);
325 template
326 bool
327 has_facet<money_get<C> >(const locale&);
329 #if ! _GLIBCXX_USE_CXX11_ABI
330 template
331 bool
332 has_facet<__timepunct<C> >(const locale&);
334 template
335 bool
336 has_facet<time_put<C> >(const locale&);
337 #endif
339 template
340 bool
341 has_facet<time_get<C> >(const locale&);
343 template
344 bool
345 has_facet<messages<C> >(const locale&);
348 #if ! _GLIBCXX_USE_CXX11_ABI
349 // locale functions.
350 template
352 __add_grouping<C>(C*, C, char const*, size_t,
353 C const*, C const*);
355 template class __pad<C, char_traits<C> >;
357 template
359 __int_to_char(C*, unsigned long, const C*,
360 ios_base::fmtflags, bool);
362 #ifdef _GLIBCXX_USE_LONG_LONG
363 template
365 __int_to_char(C*, unsigned long long, const C*,
366 ios_base::fmtflags, bool);
367 #endif
368 #endif
370 _GLIBCXX_END_NAMESPACE_VERSION
371 } // namespace
373 // XXX GLIBCXX_ABI Deprecated
374 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined C_is_char \
375 && _GLIBCXX_USE_CXX11_ABI == 0
377 #define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
378 extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak))
380 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIjEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
381 _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIjEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
382 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIlEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
383 _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIlEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
384 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intImEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
385 _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intImEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
386 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intItEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
387 _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intItEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
388 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIxEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
389 _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIxEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
390 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIyEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
391 _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIyEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
392 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIlEES4_S4_RSt8ios_basecT_,
393 _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIlEES3_S3_RSt8ios_basecT_);
394 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intImEES4_S4_RSt8ios_basecT_,
395 _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intImEES3_S3_RSt8ios_basecT_);
396 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIxEES4_S4_RSt8ios_basecT_,
397 _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIxEES3_S3_RSt8ios_basecT_);
398 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIyEES4_S4_RSt8ios_basecT_,
399 _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIyEES3_S3_RSt8ios_basecT_);
400 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIdEES4_S4_RSt8ios_baseccT_,
401 _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIdEES3_S3_RSt8ios_baseccT_);
402 _GLIBCXX_LDBL_COMPAT(_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIdEES3_S3_RSt8ios_baseccT_,
403 _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIeEES3_S3_RSt8ios_baseccT_);
404 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb0EEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRSs,
405 _ZNKSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb0EEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRSs);
406 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb1EEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRSs,
407 _ZNKSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb1EEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRSs);
408 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb0EEES4_S4_RSt8ios_basecRKSs,
409 _ZNKSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb0EEES3_S3_RSt8ios_basecRKSs);
410 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb1EEES4_S4_RSt8ios_basecRKSs,
411 _ZNKSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb1EEES3_S3_RSt8ios_basecRKSs);
413 #endif // _GLIBCXX_LONG_DOUBLE_COMPAT