# locale-inst.cc

    00001 // Locale support -*- C++ -*-
    00002
    00003 // Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
    00004 //
    00005 // This file is part of the GNU ISO C++ Library.  This library is free
    00006 // software; you can redistribute it and/or modify it under the
    00007 // terms of the GNU General Public License as published by the
    00008 // Free Software Foundation; either version 2, or (at your option)
    00009 // any later version.
    00010
    00011 // This library is distributed in the hope that it will be useful,
    00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00014 // GNU General Public License for more details.
    00015
    00016 // You should have received a copy of the GNU General Public License along
    00017 // with this library; see the file COPYING.  If not, write to the Free
    00018 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
    00019 // USA.
    00020
    00021 // As a special exception, you may use this file as part of a free software
    00022 // library without restriction.  Specifically, if other files instantiate
    00023 // templates or use macros or inline functions from this file, or you compile
    00024 // this file and link it with other files to produce an executable, this
    00025 // file does not by itself cause the resulting executable to be covered by
    00026 // the GNU General Public License.  This exception does not however
    00027 // invalidate any other reasons why the executable file might be covered by
    00028 // the GNU General Public License.
    00029
    00030 //
    00031 // ISO C++ 14882: 22.1  Locales
    00032 //
    00033
    00034 #include <cstdlib>
    00035 #include <clocale>
    00036 #include <cstring>
    00037 #include <cassert>
    00038 #include <limits>
    00039 #include <exception>
    00040 #include <locale>
    00041 #include <istream>
    00042 #include <ostream>
    00043
    00044 namespace std
    00045 {
    00046   // moneypunct, money_get, and money_put
    00047   template class moneypunct<char, false>;
    00048   template class moneypunct<char, true>;
    00049   template class moneypunct_byname<char, false>;
    00050   template class moneypunct_byname<char, true>;
    00051   template class money_get<char, istreambuf_iterator<char> >;
    00052   template class money_put<char, ostreambuf_iterator<char> >;
    00053
    00054 #ifdef _GLIBCPP_USE_WCHAR_T
    00055   template class moneypunct<wchar_t, false>;
    00056   template class moneypunct<wchar_t, true>;
    00057   template class moneypunct_byname<wchar_t, false>;
    00058   template class moneypunct_byname<wchar_t, true>;
    00059   template class money_get<wchar_t, istreambuf_iterator<wchar_t> >;
    00060   template class money_put<wchar_t, ostreambuf_iterator<wchar_t> >;
    00061 #endif
    00062
    00063   // numpunct, numpunct_byname, num_get, and num_put
    00064   template class numpunct<char>;
    00065   template class numpunct_byname<char>;
    00066   template class num_get<char, istreambuf_iterator<char> >;
    00067   template class num_put<char, ostreambuf_iterator<char> >;
    00068   template
    00069     ostreambuf_iterator<char>
    00070     num_put<char, ostreambuf_iterator<char> >::
    00071     _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, char, char,
    00072            long) const;
    00073
    00074   template
    00075     ostreambuf_iterator<char>
    00076     num_put<char, ostreambuf_iterator<char> >::
    00077     _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, char, char,
    00078            unsigned long) const;
    00079
    00080 #ifdef _GLIBCPP_USE_LONG_LONG
    00081   template
    00082     ostreambuf_iterator<char>
    00083     num_put<char, ostreambuf_iterator<char> >::
    00084     _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, char, char,
    00085            long long) const;
    00086
    00087   template
    00088     ostreambuf_iterator<char>
    00089     num_put<char, ostreambuf_iterator<char> >::
    00090     _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, char, char,
    00091            unsigned long long) const;
    00092 #endif
    00093
    00094   template
    00095     ostreambuf_iterator<char>
    00096     num_put<char, ostreambuf_iterator<char> >::
    00097     _M_convert_float(ostreambuf_iterator<char>, ios_base&, char, char,
    00098              double) const;
    00099
    00100   template
    00101     ostreambuf_iterator<char>
    00102     num_put<char, ostreambuf_iterator<char> >::
    00103     _M_convert_float(ostreambuf_iterator<char>, ios_base&, char, char,
    00104             long double) const;
    00105
    00106 #ifdef _GLIBCPP_USE_WCHAR_T
    00107   template class numpunct<wchar_t>;
    00108   template class numpunct_byname<wchar_t>;
    00109   template class num_get<wchar_t, istreambuf_iterator<wchar_t> >;
    00110   template class num_put<wchar_t, ostreambuf_iterator<wchar_t> >;
    00111
    00112   template
    00113     ostreambuf_iterator<wchar_t>
    00114     num_put<wchar_t, ostreambuf_iterator<wchar_t> >::
    00115     _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char,
    00116            char, long) const;
    00117
    00118   template
    00119     ostreambuf_iterator<wchar_t>
    00120     num_put<wchar_t, ostreambuf_iterator<wchar_t> >::
    00121     _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char,
    00122            char, unsigned long) const;
    00123
    00124 #ifdef _GLIBCPP_USE_LONG_LONG
    00125   template
    00126     ostreambuf_iterator<wchar_t>
    00127     num_put<wchar_t, ostreambuf_iterator<wchar_t> >::
    00128     _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char,
    00129            char, long long) const;
    00130
    00131   template
    00132     ostreambuf_iterator<wchar_t>
    00133     num_put<wchar_t, ostreambuf_iterator<wchar_t> >::
    00134     _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char,
    00135            char, unsigned long long) const;
    00136 #endif
    00137
    00138   template
    00139     ostreambuf_iterator<wchar_t>
    00140     num_put<wchar_t, ostreambuf_iterator<wchar_t> >::
    00141     _M_convert_float(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char,
    00142              double) const;
    00143
    00144   template
    00145     ostreambuf_iterator<wchar_t>
    00146     num_put<wchar_t, ostreambuf_iterator<wchar_t> >::
    00147     _M_convert_float(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char,
    00148              long double) const;
    00149 #endif
    00150
    00151   // time_get and time_put
    00152   template class __timepunct<char>;
    00153   template class time_put<char, ostreambuf_iterator<char> >;
    00154   template class time_put_byname<char, ostreambuf_iterator<char> >;
    00155   template class time_get<char, istreambuf_iterator<char> >;
    00156   template class time_get_byname<char, istreambuf_iterator<char> >;
    00157
    00158 #ifdef _GLIBCPP_USE_WCHAR_T
    00159   template class __timepunct<wchar_t>;
    00160   template class time_put<wchar_t, ostreambuf_iterator<wchar_t> >;
    00161   template class time_put_byname<wchar_t, ostreambuf_iterator<wchar_t> >;
    00162   template class time_get<wchar_t, istreambuf_iterator<wchar_t> >;
    00163   template class time_get_byname<wchar_t, istreambuf_iterator<wchar_t> >;
    00164 #endif
    00165
    00166   // messages
    00167   template class messages<char>;
    00168   template class messages_byname<char>;
    00169 #ifdef _GLIBCPP_USE_WCHAR_T
    00170   template class messages<wchar_t>;
    00171   template class messages_byname<wchar_t>;
    00172 #endif
    00173
    00174   // ctype
    00175   inline template class __ctype_abstract_base<char>;
    00176   template class ctype_byname<char>;
    00177 #ifdef _GLIBCPP_USE_WCHAR_T
    00178   inline template class __ctype_abstract_base<wchar_t>;
    00179   template class ctype_byname<wchar_t>;
    00180 #endif
    00181
    00182   // codecvt
    00183   inline template class __codecvt_abstract_base<char, char, mbstate_t>;
    00184   inline template class __codecvt_abstract_base<wchar_t, char, mbstate_t>;
    00185   template class codecvt_byname<char, char, mbstate_t>;
    00186 #ifdef _GLIBCPP_USE_WCHAR_T
    00187   template class codecvt_byname<wchar_t, char, mbstate_t>;
    00188 #endif
    00189
    00190   // collate
    00191   template class collate<char>;
    00192   template class collate_byname<char>;
    00193 #ifdef _GLIBCPP_USE_WCHAR_T
    00194   template class collate<wchar_t>;
    00195   template class collate_byname<wchar_t>;
    00196 #endif
    00197
    00198   // use_facet
    00199   // NB: use_facet<ctype> is specialized
    00200   template
    00201     const codecvt<char, char, mbstate_t>&
    00202     use_facet<codecvt<char, char, mbstate_t> >(const locale&);
    00203
    00204   template
    00205     const collate<char>&
    00206     use_facet<collate<char> >(const locale&);
    00207
    00208   template
    00209     const numpunct<char>&
    00210     use_facet<numpunct<char> >(const locale&);
    00211
    00212   template
    00213     const num_put<char>&
    00214     use_facet<num_put<char> >(const locale&);
    00215
    00216   template
    00217     const num_get<char>&
    00218     use_facet<num_get<char> >(const locale&);
    00219
    00220   template
    00221     const moneypunct<char, true>&
    00222     use_facet<moneypunct<char, true> >(const locale&);
    00223
    00224   template
    00225     const moneypunct<char, false>&
    00226     use_facet<moneypunct<char, false> >(const locale&);
    00227
    00228   template
    00229     const money_put<char>&
    00230     use_facet<money_put<char> >(const locale&);
    00231
    00232   template
    00233     const money_get<char>&
    00234     use_facet<money_get<char> >(const locale&);
    00235
    00236   template
    00237     const __timepunct<char>&
    00238     use_facet<__timepunct<char> >(const locale&);
    00239
    00240   template
    00241     const time_put<char>&
    00242     use_facet<time_put<char> >(const locale&);
    00243
    00244   template
    00245     const time_get<char>&
    00246     use_facet<time_get<char> >(const locale&);
    00247
    00248   template
    00249     const messages<char>&
    00250     use_facet<messages<char> >(const locale&);
    00251
    00252 #ifdef _GLIBCPP_USE_WCHAR_T
    00253   template
    00254     const codecvt<wchar_t, char, mbstate_t>&
    00255     use_facet<codecvt<wchar_t, char, mbstate_t> >(locale const&);
    00256
    00257   template
    00258     const collate<wchar_t>&
    00259     use_facet<collate<wchar_t> >(const locale&);
    00260
    00261   template
    00262     const numpunct<wchar_t>&
    00263     use_facet<numpunct<wchar_t> >(const locale&);
    00264
    00265   template
    00266     const num_put<wchar_t>&
    00267     use_facet<num_put<wchar_t> >(const locale&);
    00268
    00269   template
    00270     const num_get<wchar_t>&
    00271     use_facet<num_get<wchar_t> >(const locale&);
    00272
    00273   template
    00274     const moneypunct<wchar_t, true>&
    00275     use_facet<moneypunct<wchar_t, true> >(const locale&);
    00276
    00277   template
    00278     const moneypunct<wchar_t, false>&
    00279     use_facet<moneypunct<wchar_t, false> >(const locale&);
    00280
    00281   template
    00282     const money_put<wchar_t>&
    00283     use_facet<money_put<wchar_t> >(const locale&);
    00284
    00285   template
    00286     const money_get<wchar_t>&
    00287     use_facet<money_get<wchar_t> >(const locale&);
    00288
    00289   template
    00290     const __timepunct<wchar_t>&
    00291     use_facet<__timepunct<wchar_t> >(const locale&);
    00292
    00293   template
    00294     const time_put<wchar_t>&
    00295     use_facet<time_put<wchar_t> >(const locale&);
    00296
    00297   template
    00298     const time_get<wchar_t>&
    00299     use_facet<time_get<wchar_t> >(const locale&);
    00300
    00301   template
    00302     const messages<wchar_t>&
    00303     use_facet<messages<wchar_t> >(const locale&);
    00304 #endif
    00305
    00306   // has_facet
    00307   template
    00308     bool
    00309     has_facet<ctype<char> >(const locale&);
    00310
    00311   template
    00312     bool
    00313     has_facet<codecvt<char, char, mbstate_t> >(const locale&);
    00314
    00315   template
    00316     bool
    00317     has_facet<collate<char> >(const locale&);
    00318
    00319   template
    00320     bool
    00321     has_facet<numpunct<char> >(const locale&);
    00322
    00323   template
    00324     bool
    00325     has_facet<num_put<char> >(const locale&);
    00326
    00327   template
    00328     bool
    00329     has_facet<num_get<char> >(const locale&);
    00330
    00331   template
    00332     bool
    00333     has_facet<moneypunct<char> >(const locale&);
    00334
    00335   template
    00336     bool
    00337     has_facet<money_put<char> >(const locale&);
    00338
    00339   template
    00340     bool
    00341     has_facet<money_get<char> >(const locale&);
    00342
    00343   template
    00344     bool
    00345     has_facet<__timepunct<char> >(const locale&);
    00346
    00347   template
    00348     bool
    00349     has_facet<time_put<char> >(const locale&);
    00350
    00351   template
    00352     bool
    00353     has_facet<time_get<char> >(const locale&);
    00354
    00355   template
    00356     bool
    00357     has_facet<messages<char> >(const locale&);
    00358
    00359 #ifdef _GLIBCPP_USE_WCHAR_T
    00360  template
    00361     bool
    00362     has_facet<ctype<wchar_t> >(const locale&);
    00363
    00364   template
    00365     bool
    00366     has_facet<codecvt<wchar_t, char, mbstate_t> >(const locale&);
    00367
    00368   template
    00369     bool
    00370     has_facet<collate<wchar_t> >(const locale&);
    00371
    00372   template
    00373     bool
    00374     has_facet<numpunct<wchar_t> >(const locale&);
    00375
    00376   template
    00377     bool
    00378     has_facet<num_put<wchar_t> >(const locale&);
    00379
    00380   template
    00381     bool
    00382     has_facet<num_get<wchar_t> >(const locale&);
    00383
    00384   template
    00385     bool
    00386     has_facet<moneypunct<wchar_t> >(const locale&);
    00387
    00388   template
    00389     bool
    00390     has_facet<money_put<wchar_t> >(const locale&);
    00391
    00392   template
    00393     bool
    00394     has_facet<money_get<wchar_t> >(const locale&);
    00395
    00396   template
    00397     bool
    00398     has_facet<__timepunct<wchar_t> >(const locale&);
    00399
    00400   template
    00401     bool
    00402     has_facet<time_put<wchar_t> >(const locale&);
    00403
    00404   template
    00405     bool
    00406     has_facet<time_get<wchar_t> >(const locale&);
    00407
    00408   template
    00409     bool
    00410     has_facet<messages<wchar_t> >(const locale&);
    00411 #endif
    00412
    00413   // locale
    00414   template
    00415     char*
    00416     __add_grouping<char>(char*, char, char const*, char const*,
    00417              char const*, char const*);
    00418
    00419   template
    00420     bool
    00421     __verify_grouping<char>(const basic_string<char>&, basic_string<char>&);
    00422
    00423   template
    00424     void
    00425     __pad<char>(ios_base&, char, char*, const char *, streamsize,
    00426         streamsize, const bool);
    00427
    00428   template
    00429     void
    00430     __pad<char, char_traits<char> >(ios_base&, char, char*, const char *,
    00431                     streamsize, streamsize, const bool);
    00432
    00433 #ifdef _GLIBCPP_USE_WCHAR_T
    00434   template
    00435     wchar_t*
    00436     __add_grouping<wchar_t>(wchar_t*, wchar_t, char const*, char const*,
    00437                 wchar_t const*, wchar_t const*);
    00438   template
    00439     bool
    00440     __verify_grouping<wchar_t>(const basic_string<wchar_t>&,
    00441                    basic_string<wchar_t>&);
    00442
    00443   template
    00444     void
    00445     __pad<wchar_t>(ios_base&, wchar_t, wchar_t*, const wchar_t*,
    00446            streamsize, streamsize, const bool);
    00447
    00448   template
    00449     void
    00450     __pad<wchar_t, char_traits<wchar_t> >(ios_base&, wchar_t, wchar_t*,
    00451                       const wchar_t*, streamsize,
    00452                       streamsize, const bool);
    00453 #endif // _GLIBCPP_USE_WCHAR_T
    00454
    00455   template
    00456     int
    00457     __convert_from_v(char*, const int, const char*, double, const __c_locale&, int);
    00458
    00459   template
    00460     int
    00461     __convert_from_v(char*, const int, const char*, long double, const __c_locale&, int);
    00462
    00463   template
    00464     int
    00465     __convert_from_v(char*, const int, const char*, long, const __c_locale&, int);
    00466
    00467   template
    00468     int
    00469     __convert_from_v(char*, const int, const char*, unsigned long,
    00470              const __c_locale&, int);
    00471
    00472   template
    00473     int
    00474     __convert_from_v(char*, const int, const char*, long long, const __c_locale&, int);
    00475
    00476   template
    00477     int
    00478     __convert_from_v(char*, const int, const char*, unsigned long long,
    00479              const __c_locale&, int);
    00480 } // namespace std