locale-inst.cc revision 97403
197403Sobrien// Locale support -*- C++ -*- 297403Sobrien 397403Sobrien// Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. 497403Sobrien// 597403Sobrien// This file is part of the GNU ISO C++ Library. This library is free 697403Sobrien// software; you can redistribute it and/or modify it under the 797403Sobrien// terms of the GNU General Public License as published by the 897403Sobrien// Free Software Foundation; either version 2, or (at your option) 997403Sobrien// any later version. 1097403Sobrien 1197403Sobrien// This library is distributed in the hope that it will be useful, 1297403Sobrien// but WITHOUT ANY WARRANTY; without even the implied warranty of 1397403Sobrien// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1497403Sobrien// GNU General Public License for more details. 1597403Sobrien 1697403Sobrien// You should have received a copy of the GNU General Public License along 1797403Sobrien// with this library; see the file COPYING. If not, write to the Free 1897403Sobrien// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, 1997403Sobrien// USA. 2097403Sobrien 2197403Sobrien// As a special exception, you may use this file as part of a free software 2297403Sobrien// library without restriction. Specifically, if other files instantiate 2397403Sobrien// templates or use macros or inline functions from this file, or you compile 2497403Sobrien// this file and link it with other files to produce an executable, this 2597403Sobrien// file does not by itself cause the resulting executable to be covered by 2697403Sobrien// the GNU General Public License. This exception does not however 2797403Sobrien// invalidate any other reasons why the executable file might be covered by 2897403Sobrien// the GNU General Public License. 2997403Sobrien 3097403Sobrien// 3197403Sobrien// ISO C++ 14882: 22.1 Locales 3297403Sobrien// 3397403Sobrien 3497403Sobrien#include <cstdlib> 3597403Sobrien#include <clocale> 3697403Sobrien#include <cstring> 3797403Sobrien#include <cassert> 3897403Sobrien#include <limits> 3997403Sobrien#include <exception> 4097403Sobrien#include <locale> 4197403Sobrien#include <istream> 4297403Sobrien#include <ostream> 4397403Sobrien 4497403Sobriennamespace std 4597403Sobrien{ 4697403Sobrien // moneypunct, money_get, and money_put 4797403Sobrien template class moneypunct<char, false>; 4897403Sobrien template class moneypunct<char, true>; 4997403Sobrien template class moneypunct_byname<char, false>; 5097403Sobrien template class moneypunct_byname<char, true>; 5197403Sobrien template class money_get<char, istreambuf_iterator<char> >; 5297403Sobrien template class money_put<char, ostreambuf_iterator<char> >; 5397403Sobrien 5497403Sobrien#ifdef _GLIBCPP_USE_WCHAR_T 5597403Sobrien template class moneypunct<wchar_t, false>; 5697403Sobrien template class moneypunct<wchar_t, true>; 5797403Sobrien template class moneypunct_byname<wchar_t, false>; 5897403Sobrien template class moneypunct_byname<wchar_t, true>; 5997403Sobrien template class money_get<wchar_t, istreambuf_iterator<wchar_t> >; 6097403Sobrien template class money_put<wchar_t, ostreambuf_iterator<wchar_t> >; 6197403Sobrien#endif 6297403Sobrien 6397403Sobrien // numpunct, numpunct_byname, num_get, and num_put 6497403Sobrien template class numpunct<char>; 6597403Sobrien template class numpunct_byname<char>; 6697403Sobrien template class num_get<char, istreambuf_iterator<char> >; 6797403Sobrien template class num_put<char, ostreambuf_iterator<char> >; 6897403Sobrien template 6997403Sobrien ostreambuf_iterator<char> 7097403Sobrien num_put<char, ostreambuf_iterator<char> >:: 7197403Sobrien _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, char, char, 7297403Sobrien long) const; 7397403Sobrien 7497403Sobrien template 7597403Sobrien ostreambuf_iterator<char> 7697403Sobrien num_put<char, ostreambuf_iterator<char> >:: 7797403Sobrien _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, char, char, 7897403Sobrien unsigned long) const; 7997403Sobrien 8097403Sobrien#ifdef _GLIBCPP_USE_LONG_LONG 8197403Sobrien template 8297403Sobrien ostreambuf_iterator<char> 8397403Sobrien num_put<char, ostreambuf_iterator<char> >:: 8497403Sobrien _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, char, char, 8597403Sobrien long long) const; 8697403Sobrien 8797403Sobrien template 8897403Sobrien ostreambuf_iterator<char> 8997403Sobrien num_put<char, ostreambuf_iterator<char> >:: 9097403Sobrien _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, char, char, 9197403Sobrien unsigned long long) const; 9297403Sobrien#endif 9397403Sobrien 9497403Sobrien template 9597403Sobrien ostreambuf_iterator<char> 9697403Sobrien num_put<char, ostreambuf_iterator<char> >:: 9797403Sobrien _M_convert_float(ostreambuf_iterator<char>, ios_base&, char, char, 9897403Sobrien double) const; 9997403Sobrien 10097403Sobrien template 10197403Sobrien ostreambuf_iterator<char> 10297403Sobrien num_put<char, ostreambuf_iterator<char> >:: 10397403Sobrien _M_convert_float(ostreambuf_iterator<char>, ios_base&, char, char, 10497403Sobrien long double) const; 10597403Sobrien 10697403Sobrien#ifdef _GLIBCPP_USE_WCHAR_T 10797403Sobrien template class numpunct<wchar_t>; 10897403Sobrien template class numpunct_byname<wchar_t>; 10997403Sobrien template class num_get<wchar_t, istreambuf_iterator<wchar_t> >; 11097403Sobrien template class num_put<wchar_t, ostreambuf_iterator<wchar_t> >; 11197403Sobrien 11297403Sobrien template 11397403Sobrien ostreambuf_iterator<wchar_t> 11497403Sobrien num_put<wchar_t, ostreambuf_iterator<wchar_t> >:: 11597403Sobrien _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char, 11697403Sobrien char, long) const; 11797403Sobrien 11897403Sobrien template 11997403Sobrien ostreambuf_iterator<wchar_t> 12097403Sobrien num_put<wchar_t, ostreambuf_iterator<wchar_t> >:: 12197403Sobrien _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char, 12297403Sobrien char, unsigned long) const; 12397403Sobrien 12497403Sobrien#ifdef _GLIBCPP_USE_LONG_LONG 12597403Sobrien template 12697403Sobrien ostreambuf_iterator<wchar_t> 12797403Sobrien num_put<wchar_t, ostreambuf_iterator<wchar_t> >:: 12897403Sobrien _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char, 12997403Sobrien char, long long) const; 13097403Sobrien 13197403Sobrien template 13297403Sobrien ostreambuf_iterator<wchar_t> 13397403Sobrien num_put<wchar_t, ostreambuf_iterator<wchar_t> >:: 13497403Sobrien _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char, 13597403Sobrien char, unsigned long long) const; 13697403Sobrien#endif 13797403Sobrien 13897403Sobrien template 13997403Sobrien ostreambuf_iterator<wchar_t> 14097403Sobrien num_put<wchar_t, ostreambuf_iterator<wchar_t> >:: 14197403Sobrien _M_convert_float(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char, 14297403Sobrien double) const; 14397403Sobrien 14497403Sobrien template 14597403Sobrien ostreambuf_iterator<wchar_t> 14697403Sobrien num_put<wchar_t, ostreambuf_iterator<wchar_t> >:: 14797403Sobrien _M_convert_float(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char, 14897403Sobrien long double) const; 14997403Sobrien#endif 15097403Sobrien 15197403Sobrien // time_get and time_put 15297403Sobrien template class __timepunct<char>; 15397403Sobrien template class time_put<char, ostreambuf_iterator<char> >; 15497403Sobrien template class time_put_byname<char, ostreambuf_iterator<char> >; 15597403Sobrien template class time_get<char, istreambuf_iterator<char> >; 15697403Sobrien template class time_get_byname<char, istreambuf_iterator<char> >; 15797403Sobrien 15897403Sobrien#ifdef _GLIBCPP_USE_WCHAR_T 15997403Sobrien template class __timepunct<wchar_t>; 16097403Sobrien template class time_put<wchar_t, ostreambuf_iterator<wchar_t> >; 16197403Sobrien template class time_put_byname<wchar_t, ostreambuf_iterator<wchar_t> >; 16297403Sobrien template class time_get<wchar_t, istreambuf_iterator<wchar_t> >; 16397403Sobrien template class time_get_byname<wchar_t, istreambuf_iterator<wchar_t> >; 16497403Sobrien#endif 16597403Sobrien 16697403Sobrien // messages 16797403Sobrien template class messages<char>; 16897403Sobrien template class messages_byname<char>; 16997403Sobrien#ifdef _GLIBCPP_USE_WCHAR_T 17097403Sobrien template class messages<wchar_t>; 17197403Sobrien template class messages_byname<wchar_t>; 17297403Sobrien#endif 17397403Sobrien 17497403Sobrien // ctype 17597403Sobrien inline template class __ctype_abstract_base<char>; 17697403Sobrien template class ctype_byname<char>; 17797403Sobrien#ifdef _GLIBCPP_USE_WCHAR_T 17897403Sobrien inline template class __ctype_abstract_base<wchar_t>; 17997403Sobrien template class ctype_byname<wchar_t>; 18097403Sobrien#endif 18197403Sobrien 18297403Sobrien // codecvt 18397403Sobrien inline template class __codecvt_abstract_base<char, char, mbstate_t>; 18497403Sobrien inline template class __codecvt_abstract_base<wchar_t, char, mbstate_t>; 18597403Sobrien template class codecvt_byname<char, char, mbstate_t>; 18697403Sobrien#ifdef _GLIBCPP_USE_WCHAR_T 18797403Sobrien template class codecvt_byname<wchar_t, char, mbstate_t>; 18897403Sobrien#endif 18997403Sobrien 19097403Sobrien // collate 19197403Sobrien template class collate<char>; 19297403Sobrien template class collate_byname<char>; 19397403Sobrien#ifdef _GLIBCPP_USE_WCHAR_T 19497403Sobrien template class collate<wchar_t>; 19597403Sobrien template class collate_byname<wchar_t>; 19697403Sobrien#endif 19797403Sobrien 19897403Sobrien // use_facet 19997403Sobrien // NB: use_facet<ctype> is specialized 20097403Sobrien template 20197403Sobrien const codecvt<char, char, mbstate_t>& 20297403Sobrien use_facet<codecvt<char, char, mbstate_t> >(const locale&); 20397403Sobrien 20497403Sobrien template 20597403Sobrien const collate<char>& 20697403Sobrien use_facet<collate<char> >(const locale&); 20797403Sobrien 20897403Sobrien template 20997403Sobrien const numpunct<char>& 21097403Sobrien use_facet<numpunct<char> >(const locale&); 21197403Sobrien 21297403Sobrien template 21397403Sobrien const num_put<char>& 21497403Sobrien use_facet<num_put<char> >(const locale&); 21597403Sobrien 21697403Sobrien template 21797403Sobrien const num_get<char>& 21897403Sobrien use_facet<num_get<char> >(const locale&); 21997403Sobrien 22097403Sobrien template 22197403Sobrien const moneypunct<char, true>& 22297403Sobrien use_facet<moneypunct<char, true> >(const locale&); 22397403Sobrien 22497403Sobrien template 22597403Sobrien const moneypunct<char, false>& 22697403Sobrien use_facet<moneypunct<char, false> >(const locale&); 22797403Sobrien 22897403Sobrien template 22997403Sobrien const money_put<char>& 23097403Sobrien use_facet<money_put<char> >(const locale&); 23197403Sobrien 23297403Sobrien template 23397403Sobrien const money_get<char>& 23497403Sobrien use_facet<money_get<char> >(const locale&); 23597403Sobrien 23697403Sobrien template 23797403Sobrien const __timepunct<char>& 23897403Sobrien use_facet<__timepunct<char> >(const locale&); 23997403Sobrien 24097403Sobrien template 24197403Sobrien const time_put<char>& 24297403Sobrien use_facet<time_put<char> >(const locale&); 24397403Sobrien 24497403Sobrien template 24597403Sobrien const time_get<char>& 24697403Sobrien use_facet<time_get<char> >(const locale&); 24797403Sobrien 24897403Sobrien template 24997403Sobrien const messages<char>& 25097403Sobrien use_facet<messages<char> >(const locale&); 25197403Sobrien 25297403Sobrien#ifdef _GLIBCPP_USE_WCHAR_T 25397403Sobrien template 25497403Sobrien const codecvt<wchar_t, char, mbstate_t>& 25597403Sobrien use_facet<codecvt<wchar_t, char, mbstate_t> >(locale const&); 25697403Sobrien 25797403Sobrien template 25897403Sobrien const collate<wchar_t>& 25997403Sobrien use_facet<collate<wchar_t> >(const locale&); 26097403Sobrien 26197403Sobrien template 26297403Sobrien const numpunct<wchar_t>& 26397403Sobrien use_facet<numpunct<wchar_t> >(const locale&); 26497403Sobrien 26597403Sobrien template 26697403Sobrien const num_put<wchar_t>& 26797403Sobrien use_facet<num_put<wchar_t> >(const locale&); 26897403Sobrien 26997403Sobrien template 27097403Sobrien const num_get<wchar_t>& 27197403Sobrien use_facet<num_get<wchar_t> >(const locale&); 27297403Sobrien 27397403Sobrien template 27497403Sobrien const moneypunct<wchar_t, true>& 27597403Sobrien use_facet<moneypunct<wchar_t, true> >(const locale&); 27697403Sobrien 27797403Sobrien template 27897403Sobrien const moneypunct<wchar_t, false>& 27997403Sobrien use_facet<moneypunct<wchar_t, false> >(const locale&); 28097403Sobrien 28197403Sobrien template 28297403Sobrien const money_put<wchar_t>& 28397403Sobrien use_facet<money_put<wchar_t> >(const locale&); 28497403Sobrien 28597403Sobrien template 28697403Sobrien const money_get<wchar_t>& 28797403Sobrien use_facet<money_get<wchar_t> >(const locale&); 28897403Sobrien 28997403Sobrien template 29097403Sobrien const __timepunct<wchar_t>& 29197403Sobrien use_facet<__timepunct<wchar_t> >(const locale&); 29297403Sobrien 29397403Sobrien template 29497403Sobrien const time_put<wchar_t>& 29597403Sobrien use_facet<time_put<wchar_t> >(const locale&); 29697403Sobrien 29797403Sobrien template 29897403Sobrien const time_get<wchar_t>& 29997403Sobrien use_facet<time_get<wchar_t> >(const locale&); 30097403Sobrien 30197403Sobrien template 30297403Sobrien const messages<wchar_t>& 30397403Sobrien use_facet<messages<wchar_t> >(const locale&); 30497403Sobrien#endif 30597403Sobrien 30697403Sobrien // has_facet 30797403Sobrien template 30897403Sobrien bool 30997403Sobrien has_facet<ctype<char> >(const locale&); 31097403Sobrien 31197403Sobrien template 31297403Sobrien bool 31397403Sobrien has_facet<codecvt<char, char, mbstate_t> >(const locale&); 31497403Sobrien 31597403Sobrien template 31697403Sobrien bool 31797403Sobrien has_facet<collate<char> >(const locale&); 31897403Sobrien 31997403Sobrien template 32097403Sobrien bool 32197403Sobrien has_facet<numpunct<char> >(const locale&); 32297403Sobrien 32397403Sobrien template 32497403Sobrien bool 32597403Sobrien has_facet<num_put<char> >(const locale&); 32697403Sobrien 32797403Sobrien template 32897403Sobrien bool 32997403Sobrien has_facet<num_get<char> >(const locale&); 33097403Sobrien 33197403Sobrien template 33297403Sobrien bool 33397403Sobrien has_facet<moneypunct<char> >(const locale&); 33497403Sobrien 33597403Sobrien template 33697403Sobrien bool 33797403Sobrien has_facet<money_put<char> >(const locale&); 33897403Sobrien 33997403Sobrien template 34097403Sobrien bool 34197403Sobrien has_facet<money_get<char> >(const locale&); 34297403Sobrien 34397403Sobrien template 34497403Sobrien bool 34597403Sobrien has_facet<__timepunct<char> >(const locale&); 34697403Sobrien 34797403Sobrien template 34897403Sobrien bool 34997403Sobrien has_facet<time_put<char> >(const locale&); 35097403Sobrien 35197403Sobrien template 35297403Sobrien bool 35397403Sobrien has_facet<time_get<char> >(const locale&); 35497403Sobrien 35597403Sobrien template 35697403Sobrien bool 35797403Sobrien has_facet<messages<char> >(const locale&); 35897403Sobrien 35997403Sobrien#ifdef _GLIBCPP_USE_WCHAR_T 36097403Sobrien template 36197403Sobrien bool 36297403Sobrien has_facet<ctype<wchar_t> >(const locale&); 36397403Sobrien 36497403Sobrien template 36597403Sobrien bool 36697403Sobrien has_facet<codecvt<wchar_t, char, mbstate_t> >(const locale&); 36797403Sobrien 36897403Sobrien template 36997403Sobrien bool 37097403Sobrien has_facet<collate<wchar_t> >(const locale&); 37197403Sobrien 37297403Sobrien template 37397403Sobrien bool 37497403Sobrien has_facet<numpunct<wchar_t> >(const locale&); 37597403Sobrien 37697403Sobrien template 37797403Sobrien bool 37897403Sobrien has_facet<num_put<wchar_t> >(const locale&); 37997403Sobrien 38097403Sobrien template 38197403Sobrien bool 38297403Sobrien has_facet<num_get<wchar_t> >(const locale&); 38397403Sobrien 38497403Sobrien template 38597403Sobrien bool 38697403Sobrien has_facet<moneypunct<wchar_t> >(const locale&); 38797403Sobrien 38897403Sobrien template 38997403Sobrien bool 39097403Sobrien has_facet<money_put<wchar_t> >(const locale&); 39197403Sobrien 39297403Sobrien template 39397403Sobrien bool 39497403Sobrien has_facet<money_get<wchar_t> >(const locale&); 39597403Sobrien 39697403Sobrien template 39797403Sobrien bool 39897403Sobrien has_facet<__timepunct<wchar_t> >(const locale&); 39997403Sobrien 40097403Sobrien template 40197403Sobrien bool 40297403Sobrien has_facet<time_put<wchar_t> >(const locale&); 40397403Sobrien 40497403Sobrien template 40597403Sobrien bool 40697403Sobrien has_facet<time_get<wchar_t> >(const locale&); 40797403Sobrien 40897403Sobrien template 40997403Sobrien bool 41097403Sobrien has_facet<messages<wchar_t> >(const locale&); 41197403Sobrien#endif 41297403Sobrien 41397403Sobrien // locale 41497403Sobrien template 41597403Sobrien char* 41697403Sobrien __add_grouping<char>(char*, char, char const*, char const*, 41797403Sobrien char const*, char const*); 41897403Sobrien 41997403Sobrien template 42097403Sobrien bool 42197403Sobrien __verify_grouping<char>(const basic_string<char>&, basic_string<char>&); 42297403Sobrien 42397403Sobrien template 42497403Sobrien void 42597403Sobrien __pad<char>(ios_base&, char, char*, const char *, streamsize, 42697403Sobrien streamsize, const bool); 42797403Sobrien 42897403Sobrien template 42997403Sobrien void 43097403Sobrien __pad<char, char_traits<char> >(ios_base&, char, char*, const char *, 43197403Sobrien streamsize, streamsize, const bool); 43297403Sobrien 43397403Sobrien#ifdef _GLIBCPP_USE_WCHAR_T 43497403Sobrien template 43597403Sobrien wchar_t* 43697403Sobrien __add_grouping<wchar_t>(wchar_t*, wchar_t, char const*, char const*, 43797403Sobrien wchar_t const*, wchar_t const*); 43897403Sobrien template 43997403Sobrien bool 44097403Sobrien __verify_grouping<wchar_t>(const basic_string<wchar_t>&, 44197403Sobrien basic_string<wchar_t>&); 44297403Sobrien 44397403Sobrien template 44497403Sobrien void 44597403Sobrien __pad<wchar_t>(ios_base&, wchar_t, wchar_t*, const wchar_t*, 44697403Sobrien streamsize, streamsize, const bool); 44797403Sobrien 44897403Sobrien template 44997403Sobrien void 45097403Sobrien __pad<wchar_t, char_traits<wchar_t> >(ios_base&, wchar_t, wchar_t*, 45197403Sobrien const wchar_t*, streamsize, 45297403Sobrien streamsize, const bool); 45397403Sobrien#endif // _GLIBCPP_USE_WCHAR_T 45497403Sobrien 45597403Sobrien template 45697403Sobrien int 45797403Sobrien __convert_from_v(char*, const int, const char*, double, const __c_locale&, int); 45897403Sobrien 45997403Sobrien template 46097403Sobrien int 46197403Sobrien __convert_from_v(char*, const int, const char*, long double, const __c_locale&, int); 46297403Sobrien 46397403Sobrien template 46497403Sobrien int 46597403Sobrien __convert_from_v(char*, const int, const char*, long, const __c_locale&, int); 46697403Sobrien 46797403Sobrien template 46897403Sobrien int 46997403Sobrien __convert_from_v(char*, const int, const char*, unsigned long, 47097403Sobrien const __c_locale&, int); 47197403Sobrien 47297403Sobrien template 47397403Sobrien int 47497403Sobrien __convert_from_v(char*, const int, const char*, long long, const __c_locale&, int); 47597403Sobrien 47697403Sobrien template 47797403Sobrien int 47897403Sobrien __convert_from_v(char*, const int, const char*, unsigned long long, 47997403Sobrien const __c_locale&, int); 48097403Sobrien} // namespace std 481