1 // Locale support -*- C++ -*-
3 // Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
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)
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 // 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,
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.
31 // ISO C++ 14882: 22.1 Locales
34 #include <bits/std_clocale.h>
35 #include <bits/std_cstring.h>
36 #include <bits/std_cassert.h>
37 #include <bits/std_limits.h>
39 #include <bits/std_stdexcept.h>
40 #include <bits/std_locale.h>
41 #include <bits/locale_facets.tcc>
42 #include <bits/std_istream.h>
43 #include <bits/std_ostream.h>
47 typedef ostreambuf_iterator<char, char_traits<char> > obuf_iterator;
48 typedef istreambuf_iterator<char, char_traits<char> > ibuf_iterator;
49 typedef ostreambuf_iterator<wchar_t, char_traits<wchar_t> > wobuf_iterator;
50 typedef istreambuf_iterator<wchar_t, char_traits<wchar_t> > wibuf_iterator;
52 // moneypunct, money_get, and money_put
53 template class moneypunct<char, false>;
54 template class moneypunct<char, true>;
55 template class moneypunct_byname<char, false>;
56 template class moneypunct_byname<char, true>;
57 template class money_get<char, ibuf_iterator>;
58 template class money_put<char, obuf_iterator>;
60 #ifdef _GLIBCPP_USE_WCHAR_T
61 template class moneypunct<wchar_t, false>;
62 template class moneypunct<wchar_t, true>;
63 template class moneypunct_byname<wchar_t, false>;
64 template class moneypunct_byname<wchar_t, true>;
65 template class money_get<wchar_t, wibuf_iterator>;
66 template class money_put<wchar_t, wobuf_iterator>;
69 // numpunct, numpunct_byname, num_get, and num_put
70 template class numpunct<char>;
71 template class numpunct_byname<char>;
72 template class num_get<char, ibuf_iterator>;
73 template class num_put<char, obuf_iterator>;
76 num_put<char, obuf_iterator>::
77 _M_convert_int(obuf_iterator, ios_base&, char, char, char, long) const;
81 num_put<char, obuf_iterator>::
82 _M_convert_int(obuf_iterator, ios_base&, char, char, char,
85 #ifdef _GLIBCPP_USE_LONG_LONG
88 num_put<char, obuf_iterator>::
89 _M_convert_int(obuf_iterator, ios_base&, char, char, char,
94 num_put<char, obuf_iterator>::
95 _M_convert_int(obuf_iterator, ios_base&, char, char, char,
96 unsigned long long) const;
101 num_put<char, obuf_iterator>::
102 _M_convert_float(obuf_iterator, ios_base&, char, char, double) const;
106 num_put<char, obuf_iterator>::
107 _M_convert_float(obuf_iterator, ios_base&, char, char,
110 #ifdef _GLIBCPP_USE_WCHAR_T
111 template class numpunct<wchar_t>;
112 template class numpunct_byname<wchar_t>;
113 template class num_get<wchar_t, wibuf_iterator>;
114 template class num_put<wchar_t, wobuf_iterator>;
118 num_put<wchar_t, wobuf_iterator>::
119 _M_convert_int(wobuf_iterator, ios_base&, wchar_t, char, char, long) const;
123 num_put<wchar_t, wobuf_iterator>::
124 _M_convert_int(wobuf_iterator, ios_base&, wchar_t, char, char,
125 unsigned long) const;
127 #ifdef _GLIBCPP_USE_LONG_LONG
130 num_put<wchar_t, wobuf_iterator>::
131 _M_convert_int(wobuf_iterator, ios_base&, wchar_t, char, char,
136 num_put<wchar_t, wobuf_iterator>::
137 _M_convert_int(wobuf_iterator, ios_base&, wchar_t, char, char,
138 unsigned long long) const;
143 num_put<wchar_t, wobuf_iterator>::
144 _M_convert_float(wobuf_iterator, ios_base&, wchar_t, char,
149 num_put<wchar_t, wobuf_iterator>::
150 _M_convert_float(wobuf_iterator, ios_base&, wchar_t, char,
154 // time_get and time_put
155 template class __timepunct<char>;
156 template class time_put<char, obuf_iterator>;
157 template class time_put_byname<char, obuf_iterator>;
158 template class time_get<char, ibuf_iterator>;
159 template class time_get_byname<char, ibuf_iterator>;
161 #ifdef _GLIBCPP_USE_WCHAR_T
162 template class __timepunct<wchar_t>;
163 template class time_put<wchar_t, wobuf_iterator>;
164 template class time_put_byname<wchar_t, wobuf_iterator>;
165 template class time_get<wchar_t, wibuf_iterator>;
166 template class time_get_byname<wchar_t, wibuf_iterator>;
170 template class messages<char>;
171 template class messages_byname<char>;
172 #ifdef _GLIBCPP_USE_WCHAR_T
173 template class messages<wchar_t>;
174 template class messages_byname<wchar_t>;
178 template class __ctype_abstract_base<char>;
179 template class ctype_byname<char>;
180 #ifdef _GLIBCPP_USE_WCHAR_T
181 template class __ctype_abstract_base<wchar_t>;
182 template class ctype_byname<wchar_t>;
186 template class __codecvt_abstract_base<char, char, mbstate_t>;
187 template class __codecvt_abstract_base<wchar_t, char, mbstate_t>;
188 template class codecvt_byname<char, char, mbstate_t>;
189 #ifdef _GLIBCPP_USE_WCHAR_T
190 template class codecvt_byname<wchar_t, char, mbstate_t>;
194 template class collate<char>;
195 template class collate_byname<char>;
196 #ifdef _GLIBCPP_USE_WCHAR_T
197 template class collate<wchar_t>;
198 template class collate_byname<wchar_t>;
203 const numpunct<char>&
204 use_facet<numpunct<char> >(const locale&);
207 const num_put<char, obuf_iterator >&
208 use_facet<num_put<char, obuf_iterator> >(const locale&);
211 const num_get<char, ibuf_iterator >&
212 use_facet<num_get<char, ibuf_iterator> >(const locale&);
215 const codecvt<char, char, mbstate_t>&
216 use_facet<codecvt<char, char, mbstate_t> >(const locale&);
220 use_facet<collate<char> >(const locale&);
223 const moneypunct<char, true>&
224 use_facet<moneypunct<char, true> >(const locale&);
227 const moneypunct<char, false>&
228 use_facet<moneypunct<char, false> >(const locale&);
231 const __timepunct<char>&
232 use_facet<__timepunct<char> >(const locale&);
234 #ifdef _GLIBCPP_USE_WCHAR_T
236 const numpunct<wchar_t>&
237 use_facet<numpunct<wchar_t> >(const locale&);
240 const num_put<wchar_t, wobuf_iterator>&
241 use_facet<num_put<wchar_t, wobuf_iterator> >(const locale&);
244 const num_get<wchar_t, wibuf_iterator>&
245 use_facet<num_get<wchar_t, wibuf_iterator> >(const locale&);
248 const codecvt<wchar_t, char, mbstate_t>&
249 use_facet<codecvt<wchar_t, char, mbstate_t> >(locale const&);
252 const collate<wchar_t>&
253 use_facet<collate<wchar_t> >(const locale&);
256 const moneypunct<wchar_t, true>&
257 use_facet<moneypunct<wchar_t, true> >(const locale&);
260 const moneypunct<wchar_t, false>&
261 use_facet<moneypunct<wchar_t, false> >(const locale&);
264 const __timepunct<wchar_t>&
265 use_facet<__timepunct<wchar_t> >(const locale&);
271 has_facet<numpunct<char> >(const locale&);
274 has_facet<num_put<char> >(const locale&);
277 has_facet<num_get<char> >(const locale&);
280 has_facet<ctype<char> >(const locale&);
282 #ifdef _GLIBCPP_USE_WCHAR_T
285 has_facet<numpunct<wchar_t> >(const locale&);
288 has_facet<num_put<wchar_t> >(const locale&);
291 has_facet<num_get<wchar_t> >(const locale&);
294 has_facet<ctype<wchar_t> >(const locale&);
300 typedef vector<locale::facet*> vec_pfacet;
304 insert(vec_pfacet::iterator, vec_pfacet::size_type,
305 const vec_pfacet::value_type&);
309 _M_fill_insert(vec_pfacet::iterator, vec_pfacet::size_type,
310 const vec_pfacet::value_type&);
316 typedef istreambuf_iterator<char, char_traits<char> > istreambuf_iter;
317 typedef ostreambuf_iterator<char, char_traits<char> > ostreambuf_iter;
319 #ifdef _GLIBCPP_USE_WCHAR_T
320 typedef istreambuf_iterator<wchar_t, char_traits<wchar_t> > wistreambuf_iter;
321 typedef ostreambuf_iterator<wchar_t, char_traits<wchar_t> > wostreambuf_iter;
326 locale::operator()(const string&, const string&) const;
330 __add_grouping<char>(char*, char, char const*, char const*,
331 char const*, char const*);
335 __verify_grouping<char>(const basic_string<char>&, basic_string<char>&);
339 __pad<char>(ios_base&, char, char*, const char *, streamsize,
340 streamsize, const bool);
344 __pad<char, char_traits<char> >(ios_base&, char, char*, const char *,
345 streamsize, streamsize, const bool);
347 #ifdef _GLIBCPP_USE_WCHAR_T
350 locale::operator()(const wstring&, const wstring&) const;
352 typedef ostreambuf_iterator<wchar_t> wostreambuf_iter;
356 __add_grouping<wchar_t>(wchar_t*, wchar_t, char const*, char const*,
357 wchar_t const*, wchar_t const*);
360 __verify_grouping<wchar_t>(const basic_string<wchar_t>&,
361 basic_string<wchar_t>&);
365 __pad<wchar_t>(ios_base&, wchar_t, wchar_t*, const wchar_t*,
366 streamsize, streamsize, const bool);
370 __pad<wchar_t, char_traits<wchar_t> >(ios_base&, wchar_t, wchar_t*,
371 const wchar_t*, streamsize,
372 streamsize, const bool);
373 #endif // _GLIBCPP_USE_WCHAR_T
377 fill_n<locale::facet**, size_t, locale::facet*>
378 (locale::facet**, size_t, locale::facet* const&);
381 __normal_iterator<locale::facet**, vector<locale::facet*> >
382 fill_n(__normal_iterator<locale::facet**, vector<locale::facet*> >,
383 size_t, locale::facet* const&);
387 fill(__normal_iterator<locale::facet**, vector<locale::facet*> >,
388 __normal_iterator<locale::facet**, vector<locale::facet*> >,
389 locale::facet* const&);