locale-inst.cc revision 211755
197403Sobrien// Locale support -*- C++ -*- 297403Sobrien 3169691Skan// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 4132720Skan// Free Software Foundation, Inc. 597403Sobrien// 697403Sobrien// This file is part of the GNU ISO C++ Library. This library is free 797403Sobrien// software; you can redistribute it and/or modify it under the 897403Sobrien// terms of the GNU General Public License as published by the 997403Sobrien// Free Software Foundation; either version 2, or (at your option) 1097403Sobrien// any later version. 1197403Sobrien 1297403Sobrien// This library is distributed in the hope that it will be useful, 1397403Sobrien// but WITHOUT ANY WARRANTY; without even the implied warranty of 1497403Sobrien// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1597403Sobrien// GNU General Public License for more details. 1697403Sobrien 1797403Sobrien// You should have received a copy of the GNU General Public License along 1897403Sobrien// with this library; see the file COPYING. If not, write to the Free 19169691Skan// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 2097403Sobrien// USA. 2197403Sobrien 2297403Sobrien// As a special exception, you may use this file as part of a free software 2397403Sobrien// library without restriction. Specifically, if other files instantiate 2497403Sobrien// templates or use macros or inline functions from this file, or you compile 2597403Sobrien// this file and link it with other files to produce an executable, this 2697403Sobrien// file does not by itself cause the resulting executable to be covered by 2797403Sobrien// the GNU General Public License. This exception does not however 2897403Sobrien// invalidate any other reasons why the executable file might be covered by 2997403Sobrien// the GNU General Public License. 3097403Sobrien 3197403Sobrien// 3297403Sobrien// ISO C++ 14882: 22.1 Locales 3397403Sobrien// 3497403Sobrien 3597403Sobrien#include <locale> 3697403Sobrien 37132720Skan// Instantiation configuration. 38132720Skan#ifndef C 39132720Skan# define C char 40169691Skan# define C_is_char 41132720Skan#endif 42132720Skan 43169691Skan_GLIBCXX_BEGIN_NAMESPACE(std) 44169691Skan 4597403Sobrien // moneypunct, money_get, and money_put 46132720Skan template class moneypunct<C, false>; 47132720Skan template class moneypunct<C, true>; 48132720Skan template struct __moneypunct_cache<C, false>; 49132720Skan template struct __moneypunct_cache<C, true>; 50132720Skan template class moneypunct_byname<C, false>; 51132720Skan template class moneypunct_byname<C, true>; 52169691Skan_GLIBCXX_BEGIN_LDBL_NAMESPACE 53132720Skan template class money_get<C, istreambuf_iterator<C> >; 54132720Skan template class money_put<C, ostreambuf_iterator<C> >; 5597403Sobrien template 56132720Skan istreambuf_iterator<C> 57132720Skan money_get<C, istreambuf_iterator<C> >:: 58132720Skan _M_extract<true>(istreambuf_iterator<C>, istreambuf_iterator<C>, 59132720Skan ios_base&, ios_base::iostate&, string&) const; 6097403Sobrien 6197403Sobrien template 62132720Skan istreambuf_iterator<C> 63132720Skan money_get<C, istreambuf_iterator<C> >:: 64132720Skan _M_extract<false>(istreambuf_iterator<C>, istreambuf_iterator<C>, 65132720Skan ios_base&, ios_base::iostate&, string&) const; 6697403Sobrien 6797403Sobrien template 68132720Skan ostreambuf_iterator<C> 69132720Skan money_put<C, ostreambuf_iterator<C> >:: 70132720Skan _M_insert<true>(ostreambuf_iterator<C>, ios_base&, C, 71132720Skan const string_type&) const; 7297403Sobrien 7397403Sobrien template 74132720Skan ostreambuf_iterator<C> 75132720Skan money_put<C, ostreambuf_iterator<C> >:: 76132720Skan _M_insert<false>(ostreambuf_iterator<C>, ios_base&, C, 77132720Skan const string_type&) const; 78169691Skan_GLIBCXX_END_LDBL_NAMESPACE 7997403Sobrien 80132720Skan // numpunct, numpunct_byname, num_get, and num_put 81132720Skan template class numpunct<C>; 82132720Skan template struct __numpunct_cache<C>; 83132720Skan template class numpunct_byname<C>; 84169691Skan_GLIBCXX_BEGIN_LDBL_NAMESPACE 85132720Skan template class num_get<C, istreambuf_iterator<C> >; 86132720Skan template class num_put<C, ostreambuf_iterator<C> >; 8797403Sobrien template 88132720Skan istreambuf_iterator<C> 89132720Skan num_get<C, istreambuf_iterator<C> >:: 90132720Skan _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>, 91132720Skan ios_base&, ios_base::iostate&, 92132720Skan long&) const; 9397403Sobrien 9497403Sobrien template 95132720Skan istreambuf_iterator<C> 96132720Skan num_get<C, istreambuf_iterator<C> >:: 97132720Skan _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>, 98132720Skan ios_base&, ios_base::iostate&, 99132720Skan unsigned short&) const; 10097403Sobrien 10197403Sobrien template 102132720Skan istreambuf_iterator<C> 103132720Skan num_get<C, istreambuf_iterator<C> >:: 104132720Skan _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>, 105132720Skan ios_base&, ios_base::iostate&, 106132720Skan unsigned int&) const; 10797403Sobrien 10897403Sobrien template 109132720Skan istreambuf_iterator<C> 110132720Skan num_get<C, istreambuf_iterator<C> >:: 111132720Skan _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>, 112132720Skan ios_base&, ios_base::iostate&, 113132720Skan unsigned long&) const; 11497403Sobrien 115132720Skan#ifdef _GLIBCXX_USE_LONG_LONG 11697403Sobrien template 117132720Skan istreambuf_iterator<C> 118132720Skan num_get<C, istreambuf_iterator<C> >:: 119132720Skan _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>, 120132720Skan ios_base&, ios_base::iostate&, 121132720Skan long long&) const; 12297403Sobrien 12397403Sobrien template 124132720Skan istreambuf_iterator<C> 125132720Skan num_get<C, istreambuf_iterator<C> >:: 126132720Skan _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>, 127132720Skan ios_base&, ios_base::iostate&, 128132720Skan unsigned long long&) const; 12997403Sobrien#endif 13097403Sobrien 13197403Sobrien template 132132720Skan ostreambuf_iterator<C> 133132720Skan num_put<C, ostreambuf_iterator<C> >:: 134132720Skan _M_insert_int(ostreambuf_iterator<C>, ios_base&, C, 135132720Skan long) const; 13697403Sobrien 13797403Sobrien template 138132720Skan ostreambuf_iterator<C> 139132720Skan num_put<C, ostreambuf_iterator<C> >:: 140132720Skan _M_insert_int(ostreambuf_iterator<C>, ios_base&, C, 141132720Skan unsigned long) const; 14297403Sobrien 143132720Skan#ifdef _GLIBCXX_USE_LONG_LONG 144117397Skan template 145132720Skan ostreambuf_iterator<C> 146132720Skan num_put<C, ostreambuf_iterator<C> >:: 147132720Skan _M_insert_int(ostreambuf_iterator<C>, ios_base&, C, 148132720Skan long long) const; 149117397Skan 150117397Skan template 151132720Skan ostreambuf_iterator<C> 152132720Skan num_put<C, ostreambuf_iterator<C> >:: 153132720Skan _M_insert_int(ostreambuf_iterator<C>, ios_base&, C, 154132720Skan unsigned long long) const; 155117397Skan#endif 156117397Skan 157117397Skan template 158132720Skan ostreambuf_iterator<C> 159132720Skan num_put<C, ostreambuf_iterator<C> >:: 160132720Skan _M_insert_float(ostreambuf_iterator<C>, ios_base&, C, char, 161132720Skan double) const; 162117397Skan 163117397Skan template 164132720Skan ostreambuf_iterator<C> 165132720Skan num_put<C, ostreambuf_iterator<C> >:: 166132720Skan _M_insert_float(ostreambuf_iterator<C>, ios_base&, C, char, 167132720Skan long double) const; 168169691Skan_GLIBCXX_END_LDBL_NAMESPACE 169169691Skan 17097403Sobrien // time_get and time_put 171132720Skan template class __timepunct<C>; 172132720Skan template struct __timepunct_cache<C>; 173132720Skan template class time_put<C, ostreambuf_iterator<C> >; 174132720Skan template class time_put_byname<C, ostreambuf_iterator<C> >; 175132720Skan template class time_get<C, istreambuf_iterator<C> >; 176132720Skan template class time_get_byname<C, istreambuf_iterator<C> >; 17797403Sobrien 17897403Sobrien // messages 179132720Skan template class messages<C>; 180132720Skan template class messages_byname<C>; 18197403Sobrien 18297403Sobrien // ctype 183211755Srpaulo template class __ctype_abstract_base<C>; 184132720Skan template class ctype_byname<C>; 18597403Sobrien 18697403Sobrien // codecvt 187211755Srpaulo template class __codecvt_abstract_base<C, char, mbstate_t>; 188132720Skan template class codecvt_byname<C, char, mbstate_t>; 18997403Sobrien 19097403Sobrien // collate 191132720Skan template class collate<C>; 192132720Skan template class collate_byname<C>; 19397403Sobrien 19497403Sobrien // use_facet 19597403Sobrien // NB: use_facet<ctype> is specialized 19697403Sobrien template 197132720Skan const codecvt<C, char, mbstate_t>& 198132720Skan use_facet<codecvt<C, char, mbstate_t> >(const locale&); 19997403Sobrien 20097403Sobrien template 201132720Skan const collate<C>& 202132720Skan use_facet<collate<C> >(const locale&); 20397403Sobrien 20497403Sobrien template 205132720Skan const numpunct<C>& 206132720Skan use_facet<numpunct<C> >(const locale&); 20797403Sobrien 20897403Sobrien template 209132720Skan const num_put<C>& 210132720Skan use_facet<num_put<C> >(const locale&); 21197403Sobrien 21297403Sobrien template 213132720Skan const num_get<C>& 214132720Skan use_facet<num_get<C> >(const locale&); 21597403Sobrien 21697403Sobrien template 217132720Skan const moneypunct<C, true>& 218132720Skan use_facet<moneypunct<C, true> >(const locale&); 21997403Sobrien 22097403Sobrien template 221132720Skan const moneypunct<C, false>& 222132720Skan use_facet<moneypunct<C, false> >(const locale&); 22397403Sobrien 22497403Sobrien template 225132720Skan const money_put<C>& 226132720Skan use_facet<money_put<C> >(const locale&); 22797403Sobrien 22897403Sobrien template 229132720Skan const money_get<C>& 230132720Skan use_facet<money_get<C> >(const locale&); 23197403Sobrien 23297403Sobrien template 233132720Skan const __timepunct<C>& 234132720Skan use_facet<__timepunct<C> >(const locale&); 23597403Sobrien 23697403Sobrien template 237132720Skan const time_put<C>& 238132720Skan use_facet<time_put<C> >(const locale&); 23997403Sobrien 24097403Sobrien template 241132720Skan const time_get<C>& 242132720Skan use_facet<time_get<C> >(const locale&); 24397403Sobrien 24497403Sobrien template 245132720Skan const messages<C>& 246132720Skan use_facet<messages<C> >(const locale&); 24797403Sobrien 24897403Sobrien // has_facet 24997403Sobrien template 25097403Sobrien bool 251132720Skan has_facet<ctype<C> >(const locale&); 25297403Sobrien 25397403Sobrien template 25497403Sobrien bool 255132720Skan has_facet<codecvt<C, char, mbstate_t> >(const locale&); 25697403Sobrien 25797403Sobrien template 25897403Sobrien bool 259132720Skan has_facet<collate<C> >(const locale&); 26097403Sobrien 26197403Sobrien template 26297403Sobrien bool 263132720Skan has_facet<numpunct<C> >(const locale&); 26497403Sobrien 26597403Sobrien template 26697403Sobrien bool 267132720Skan has_facet<num_put<C> >(const locale&); 26897403Sobrien 26997403Sobrien template 27097403Sobrien bool 271132720Skan has_facet<num_get<C> >(const locale&); 27297403Sobrien 27397403Sobrien template 27497403Sobrien bool 275132720Skan has_facet<moneypunct<C> >(const locale&); 27697403Sobrien 27797403Sobrien template 27897403Sobrien bool 279132720Skan has_facet<money_put<C> >(const locale&); 28097403Sobrien 28197403Sobrien template 28297403Sobrien bool 283132720Skan has_facet<money_get<C> >(const locale&); 28497403Sobrien 28597403Sobrien template 28697403Sobrien bool 287132720Skan has_facet<__timepunct<C> >(const locale&); 28897403Sobrien 28997403Sobrien template 29097403Sobrien bool 291132720Skan has_facet<time_put<C> >(const locale&); 29297403Sobrien 29397403Sobrien template 29497403Sobrien bool 295132720Skan has_facet<time_get<C> >(const locale&); 29697403Sobrien 29797403Sobrien template 29897403Sobrien bool 299132720Skan has_facet<messages<C> >(const locale&); 30097403Sobrien 30197403Sobrien 302132720Skan // locale functions. 303117397Skan template 304132720Skan C* 305132720Skan __add_grouping<C>(C*, C, char const*, size_t, 306132720Skan C const*, C const*); 307117397Skan 308132720Skan template class __pad<C, char_traits<C> >; 309117397Skan 31097403Sobrien template 31197403Sobrien int 312132720Skan __int_to_char(C*, unsigned long, const C*, 313117397Skan ios_base::fmtflags, bool); 314117397Skan 315132720Skan#ifdef _GLIBCXX_USE_LONG_LONG 316117397Skan template 317117397Skan int 318132720Skan __int_to_char(C*, unsigned long long, const C*, 319117397Skan ios_base::fmtflags, bool); 320117397Skan#endif 321169691Skan 322169691Skan_GLIBCXX_END_NAMESPACE 323169691Skan 324169691Skan// XXX GLIBCXX_ABI Deprecated 325169691Skan#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined C_is_char 326169691Skan 327169691Skan#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \ 328169691Skan extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak)) 329169691Skan 330169691Skan_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIjEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, 331169691Skan _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIjEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); 332169691Skan_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIlEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, 333169691Skan _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIlEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); 334169691Skan_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intImEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, 335169691Skan _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intImEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); 336169691Skan_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intItEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, 337169691Skan _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intItEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); 338169691Skan_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIxEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, 339169691Skan _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIxEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); 340169691Skan_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIyEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, 341169691Skan _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIyEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); 342169691Skan_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIlEES4_S4_RSt8ios_basecT_, 343169691Skan _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIlEES3_S3_RSt8ios_basecT_); 344169691Skan_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intImEES4_S4_RSt8ios_basecT_, 345169691Skan _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intImEES3_S3_RSt8ios_basecT_); 346169691Skan_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIxEES4_S4_RSt8ios_basecT_, 347169691Skan _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIxEES3_S3_RSt8ios_basecT_); 348169691Skan_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIyEES4_S4_RSt8ios_basecT_, 349169691Skan _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIyEES3_S3_RSt8ios_basecT_); 350169691Skan_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIdEES4_S4_RSt8ios_baseccT_, 351169691Skan _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIdEES3_S3_RSt8ios_baseccT_); 352169691Skan_GLIBCXX_LDBL_COMPAT(_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIdEES3_S3_RSt8ios_baseccT_, 353169691Skan _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIeEES3_S3_RSt8ios_baseccT_); 354169691Skan_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb0EEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRSs, 355169691Skan _ZNKSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb0EEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRSs); 356169691Skan_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb1EEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRSs, 357169691Skan _ZNKSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb1EEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRSs); 358169691Skan_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb0EEES4_S4_RSt8ios_basecRKSs, 359169691Skan _ZNKSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb0EEES3_S3_RSt8ios_basecRKSs); 360169691Skan_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb1EEES4_S4_RSt8ios_basecRKSs, 361169691Skan _ZNKSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb1EEES3_S3_RSt8ios_basecRKSs); 362169691Skan 363169691Skan#endif // _GLIBCXX_LONG_DOUBLE_COMPAT 364