OSDN Git Service

2000-12-06 Benjamin Kosnik <bkoz@kredhat.com>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / src / locale-inst.cc
1 // Locale support -*- C++ -*-
2
3 // Copyright (C) 1999, 2000 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 <bits/std_clocale.h>
35 #include <bits/std_cstring.h>
36 #include <bits/std_cassert.h>
37 #include <bits/std_limits.h>
38 #include <exception>
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>
44
45 namespace std {
46
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;
51
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 _Moneypunct<char>;
58   template class money_get<char, obuf_iterator>;
59   template class money_put<char, obuf_iterator>;
60   template class money_get<char, ibuf_iterator>;
61   template class money_put<char, ibuf_iterator>;
62   template class _Format_cache<char>;
63
64 #ifdef _GLIBCPP_USE_WCHAR_T
65   template class moneypunct<wchar_t, false>;
66   template class moneypunct<wchar_t, true>;
67   template class moneypunct_byname<wchar_t, false>;
68   template class moneypunct_byname<wchar_t, true>;
69   template class _Moneypunct<wchar_t>;
70   template class money_get<wchar_t, wobuf_iterator>;
71   template class money_put<wchar_t, wobuf_iterator>;
72   template class money_get<wchar_t, wibuf_iterator>;
73   template class money_put<wchar_t, wibuf_iterator>;
74   template class _Format_cache<wchar_t>;
75 #endif
76
77   // numpunct, numpunct_byname, num_get, and num_put
78   template class numpunct<char>;
79   template class numpunct_byname<char>;
80   template class _Numpunct<char>;
81   template class num_get<char, ibuf_iterator>;
82   template class num_put<char, obuf_iterator>;
83 #ifdef _GLIBCPP_USE_WCHAR_T
84   template class numpunct<wchar_t>;
85   template class numpunct_byname<wchar_t>;
86   template class _Numpunct<wchar_t>;
87   template class num_get<wchar_t, wibuf_iterator>;
88   template class num_put<wchar_t, wobuf_iterator>;
89 #endif
90
91   // _Punct
92   template class _Punct<char>;
93 #ifdef _GLIBCPP_USE_WCHAR_T
94   template class _Punct<wchar_t>;
95 #endif
96   
97   // time_get and time_put
98   template class time_put<char, obuf_iterator>;
99   template class time_put_byname<char, obuf_iterator>;
100   template class time_get<char, ibuf_iterator>;
101   template class time_get_byname<char, ibuf_iterator>;
102
103 #ifdef _GLIBCPP_USE_WCHAR_T
104   template class time_put<wchar_t, wobuf_iterator>;
105   template class time_put_byname<wchar_t, wobuf_iterator>;
106   template class time_get<wchar_t, wibuf_iterator>;
107   template class time_get_byname<wchar_t, wibuf_iterator>;
108 #endif
109
110   // messages
111   template class _Messages<char>;
112   template class messages<char>;
113   template class messages_byname<char>;
114 #ifdef _GLIBCPP_USE_WCHAR_T
115   template class _Messages<wchar_t>;
116   template class messages<wchar_t>;
117   template class messages_byname<wchar_t>;
118 #endif
119   
120   // ctype
121   template class __ctype_abstract_base<char>;
122   template class ctype_byname<char>;
123 #ifdef _GLIBCPP_USE_WCHAR_T
124   template class __ctype_abstract_base<wchar_t>;
125   template class ctype_byname<wchar_t>;
126 #endif
127   
128   // codecvt
129   template class __codecvt_abstract_base<char, char, mbstate_t>;
130   template class __codecvt_abstract_base<wchar_t, char, mbstate_t>;
131   template class codecvt_byname<char, char, mbstate_t>;
132 #ifdef _GLIBCPP_USE_WCHAR_T
133   template class codecvt_byname<wchar_t, char, mbstate_t>;
134 #endif
135
136   // collate
137   template class _Collate<char>;
138   template class collate_byname<char>;
139   template class _Weekdaynames<char, int>;
140   template class _Monthnames<char, int>;
141 #ifdef _GLIBCPP_USE_WCHAR_T
142   template class _Collate<wchar_t>;
143   template class collate_byname<wchar_t>;
144   template class _Weekdaynames<wchar_t, int>;
145   template class _Monthnames<wchar_t, int>;
146 #endif
147     
148   // use_facet
149   template 
150     const num_put<char, obuf_iterator >& 
151     use_facet<num_put<char, obuf_iterator> >(const locale &);
152   template 
153     const num_get<char, ibuf_iterator >& 
154     use_facet<num_get<char, ibuf_iterator> >(const locale &);
155   template
156     const codecvt<char, char, mbstate_t>& 
157     use_facet<codecvt<char, char, mbstate_t> >(const locale&);
158    template 
159     const num_put<char, obuf_iterator>& 
160     _Use_facet_failure_handler<num_put<char, obuf_iterator> >
161     (const locale &);
162 #ifdef _GLIBCPP_USE_WCHAR_T
163   template 
164     const num_put<wchar_t, wobuf_iterator>& 
165     use_facet<num_put<wchar_t, wobuf_iterator> >(const locale &);
166   template 
167     const num_get<wchar_t, wibuf_iterator>& 
168     use_facet<num_get<wchar_t, wibuf_iterator> >(const locale &);
169   template
170     const codecvt<wchar_t, char, mbstate_t>& 
171     use_facet<codecvt<wchar_t, char, mbstate_t> >(locale const &);
172   template 
173     const num_put<wchar_t, wobuf_iterator>& 
174     _Use_facet_failure_handler<num_put<wchar_t, wobuf_iterator> >
175     (const locale &);
176 #endif
177
178   // has_facet
179   template 
180     bool
181     has_facet<numpunct<char> >(const locale &);
182 #ifdef _GLIBCPP_USE_WCHAR_T
183   template 
184     bool
185     has_facet<numpunct<wchar_t> >(const locale &);
186 #endif
187
188   //
189   // iterator
190   //
191   typedef vector<locale::facet*> vec_pfacet;
192   template 
193     void 
194     vec_pfacet::
195     insert(vec_pfacet::iterator, vec_pfacet::size_type, 
196            const vec_pfacet::value_type&);
197   template 
198     void 
199     vec_pfacet::
200     _M_fill_insert(vec_pfacet::iterator, vec_pfacet::size_type, 
201                    const vec_pfacet::value_type&);
202
203
204   typedef istreambuf_iterator<char, char_traits<char> > istreambuf_iter;
205   typedef ostreambuf_iterator<char, char_traits<char> > ostreambuf_iter;
206
207
208   template 
209     istreambuf_iter 
210     __match_parallel<istreambuf_iter, char>
211     (istreambuf_iter, istreambuf_iter, int, const string*, int*, int&, bool&);
212
213
214 #ifdef _GLIBCPP_USE_WCHAR_T
215   typedef istreambuf_iterator<wchar_t,char_traits<wchar_t> > wistreambuf_iter;
216   typedef ostreambuf_iterator<wchar_t,char_traits<wchar_t> > wostreambuf_iter;
217
218   template 
219     wistreambuf_iter 
220     __match_parallel<wistreambuf_iter, wchar_t>
221    (wistreambuf_iter, wistreambuf_iter, int, const wstring*, int*, int&, bool&);
222 #endif
223
224
225   //
226   // locale
227   //
228   template 
229     bool
230     locale::operator()(const string&, const string&) const;
231
232   template
233     ostreambuf_iter
234     _S_fill<char, ostreambuf_iter, output_iterator_tag>
235     (ostreambuf_iter, char, int, output_iterator_tag);
236
237   template 
238     ostreambuf_iter
239     _S_pad_numeric<char, ostreambuf_iter>
240     (ostreambuf_iter, ios_base::fmtflags, char, int, char const*, char const*, 
241      char const*);
242
243   template
244     char*
245     _S_group_digits<char>(char*, char, char const*, char const*, 
246                           char const*, char const*);
247
248   template 
249     ostreambuf_iter
250     _S_format<char, ostreambuf_iter, unsigned long>
251     (ostreambuf_iter, ios_base &, char, bool, unsigned long);
252
253 #ifdef _GLIBCPP_USE_LONG_LONG
254   template
255     ostreambuf_iter
256     _S_format<char, ostreambuf_iter, unsigned long long>
257     (ostreambuf_iter, ios_base &, char, bool, unsigned long long);
258 #endif
259
260 #ifdef _GLIBCPP_USE_WCHAR_T
261   template 
262     bool
263     locale::operator()(const wstring&, const wstring&) const;
264
265   typedef ostreambuf_iterator<wchar_t> wostreambuf_iter;
266
267   template
268     wostreambuf_iter
269     _S_fill<wchar_t, wostreambuf_iter, output_iterator_tag>
270     (wostreambuf_iter, wchar_t, int, output_iterator_tag);
271
272   template 
273     wostreambuf_iter
274     _S_pad_numeric<wchar_t, wostreambuf_iter>
275     (wostreambuf_iter, ios_base::fmtflags, wchar_t __fill, int, wchar_t const*, 
276      wchar_t const*, wchar_t const*);
277
278   template
279     wchar_t*
280     _S_group_digits<wchar_t>(wchar_t*, wchar_t, char const*, char const*, 
281                              wchar_t const*, wchar_t const*);
282
283   template 
284     wostreambuf_iter
285     _S_format<wchar_t, wostreambuf_iter, unsigned long>
286     (wostreambuf_iter, ios_base &, wchar_t, bool, unsigned long);
287
288 #ifdef _GLIBCPP_USE_LONG_LONG
289   template
290     wostreambuf_iter
291     _S_format<wchar_t, wostreambuf_iter, unsigned long long>
292     (wostreambuf_iter, ios_base &, wchar_t, bool, unsigned long long);
293 #endif
294 #endif // _GLIBCPP_USE_WCHAR_T
295
296   template 
297     locale::facet** 
298     fill_n<locale::facet**, unsigned int, locale::facet*>
299     (locale::facet**, unsigned int, locale::facet* const &);
300
301   template 
302     locale::facet** 
303     fill_n<locale::facet**, unsigned long, locale::facet*>
304     (locale::facet**, unsigned long, locale::facet* const &);
305
306 } //std
307