103a78d15Sespie // Locale support -*- C++ -*- 203a78d15Sespie 303a78d15Sespie // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 403a78d15Sespie // Free Software Foundation, Inc. 503a78d15Sespie // 603a78d15Sespie // This file is part of the GNU ISO C++ Library. This library is free 703a78d15Sespie // software; you can redistribute it and/or modify it under the 803a78d15Sespie // terms of the GNU General Public License as published by the 903a78d15Sespie // Free Software Foundation; either version 2, or (at your option) 1003a78d15Sespie // any later version. 1103a78d15Sespie 1203a78d15Sespie // This library is distributed in the hope that it will be useful, 1303a78d15Sespie // but WITHOUT ANY WARRANTY; without even the implied warranty of 1403a78d15Sespie // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1503a78d15Sespie // GNU General Public License for more details. 1603a78d15Sespie 1703a78d15Sespie // You should have received a copy of the GNU General Public License along 1803a78d15Sespie // with this library; see the file COPYING. If not, write to the Free 1903a78d15Sespie // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, 2003a78d15Sespie // USA. 2103a78d15Sespie 2203a78d15Sespie // As a special exception, you may use this file as part of a free software 2303a78d15Sespie // library without restriction. Specifically, if other files instantiate 2403a78d15Sespie // templates or use macros or inline functions from this file, or you compile 2503a78d15Sespie // this file and link it with other files to produce an executable, this 2603a78d15Sespie // file does not by itself cause the resulting executable to be covered by 2703a78d15Sespie // the GNU General Public License. This exception does not however 2803a78d15Sespie // invalidate any other reasons why the executable file might be covered by 2903a78d15Sespie // the GNU General Public License. 3003a78d15Sespie 3103a78d15Sespie // 3203a78d15Sespie // ISO C++ 14882: 22.1 Locales 3303a78d15Sespie // 3403a78d15Sespie 3503a78d15Sespie /** @file locale_facets.h 3603a78d15Sespie * This is an internal header file, included by other library headers. 3703a78d15Sespie * You should not attempt to use it directly. 3803a78d15Sespie */ 3903a78d15Sespie 4003a78d15Sespie #ifndef _CPP_BITS_LOCFACETS_H 4103a78d15Sespie #define _CPP_BITS_LOCFACETS_H 1 4203a78d15Sespie 4303a78d15Sespie #pragma GCC system_header 4403a78d15Sespie 4503a78d15Sespie #include <ctime> // For struct tm 4603a78d15Sespie #include <cwctype> // For wctype_t 4703a78d15Sespie #include <iosfwd> 4803a78d15Sespie #include <bits/ios_base.h> // For ios_base, ios_base::iostate 4903a78d15Sespie #include <streambuf> 5003a78d15Sespie 5103a78d15Sespie namespace std 5203a78d15Sespie { 5303a78d15Sespie // NB: Don't instantiate required wchar_t facets if no wchar_t support. 54*c2fb3212Sespie #if defined(_GLIBCPP_USE_WCHAR_T) || defined(_GLIBCPP_USE_TYPE_WCHAR_T) 5503a78d15Sespie # define _GLIBCPP_NUM_FACETS 28 5603a78d15Sespie #else 5703a78d15Sespie # define _GLIBCPP_NUM_FACETS 14 5803a78d15Sespie #endif 5903a78d15Sespie 6003a78d15Sespie // Convert string to numeric value of type _Tv and store results. 6103a78d15Sespie // NB: This is specialized for all required types, there is no 6203a78d15Sespie // generic definition. 6303a78d15Sespie template<typename _Tv> 6403a78d15Sespie void 6503a78d15Sespie __convert_to_v(const char* __in, _Tv& __out, ios_base::iostate& __err, 6603a78d15Sespie const __c_locale& __cloc, int __base = 10); 6703a78d15Sespie 6803a78d15Sespie // Explicit specializations for required types. 6903a78d15Sespie template<> 7003a78d15Sespie void 7103a78d15Sespie __convert_to_v(const char*, long&, ios_base::iostate&, 7203a78d15Sespie const __c_locale&, int); 7303a78d15Sespie 7403a78d15Sespie template<> 7503a78d15Sespie void 7603a78d15Sespie __convert_to_v(const char*, unsigned long&, ios_base::iostate&, 7703a78d15Sespie const __c_locale&, int); 7803a78d15Sespie 7903a78d15Sespie #ifdef _GLIBCPP_USE_LONG_LONG 8003a78d15Sespie template<> 8103a78d15Sespie void 8203a78d15Sespie __convert_to_v(const char*, long long&, ios_base::iostate&, 8303a78d15Sespie const __c_locale&, int); 8403a78d15Sespie 8503a78d15Sespie template<> 8603a78d15Sespie void 8703a78d15Sespie __convert_to_v(const char*, unsigned long long&, ios_base::iostate&, 8803a78d15Sespie const __c_locale&, int); 8903a78d15Sespie #endif 9003a78d15Sespie 9103a78d15Sespie template<> 9203a78d15Sespie void 9303a78d15Sespie __convert_to_v(const char*, float&, ios_base::iostate&, 9403a78d15Sespie const __c_locale&, int); 9503a78d15Sespie 9603a78d15Sespie template<> 9703a78d15Sespie void 9803a78d15Sespie __convert_to_v(const char*, double&, ios_base::iostate&, 9903a78d15Sespie const __c_locale&, int); 10003a78d15Sespie 10103a78d15Sespie template<> 10203a78d15Sespie void 10303a78d15Sespie __convert_to_v(const char*, long double&, ios_base::iostate&, 10403a78d15Sespie const __c_locale&, int); 10503a78d15Sespie 10603a78d15Sespie // NB: __pad is a struct, rather than a function, so it can be 10703a78d15Sespie // partially-specialized. 10803a78d15Sespie template<typename _CharT, typename _Traits> 10903a78d15Sespie struct __pad 11003a78d15Sespie { 11103a78d15Sespie static void 11203a78d15Sespie _S_pad(ios_base& __io, _CharT __fill, _CharT* __news, 11303a78d15Sespie const _CharT* __olds, const streamsize __newlen, 11403a78d15Sespie const streamsize __oldlen, const bool __num); 11503a78d15Sespie }; 11603a78d15Sespie 11703a78d15Sespie // Used by both numeric and monetary facets. 11803a78d15Sespie // Check to make sure that the __grouping_tmp string constructed in 11903a78d15Sespie // money_get or num_get matches the canonical grouping for a given 12003a78d15Sespie // locale. 12103a78d15Sespie // __grouping_tmp is parsed L to R 12203a78d15Sespie // 1,222,444 == __grouping_tmp of "\1\3\3" 12303a78d15Sespie // __grouping is parsed R to L 12403a78d15Sespie // 1,222,444 == __grouping of "\3" == "\3\3\3" 12503a78d15Sespie template<typename _CharT> 12603a78d15Sespie bool 12703a78d15Sespie __verify_grouping(const basic_string<_CharT>& __grouping, 12803a78d15Sespie basic_string<_CharT>& __grouping_tmp); 12903a78d15Sespie 13003a78d15Sespie // Used by both numeric and monetary facets. 13103a78d15Sespie // Inserts "group separator" characters into an array of characters. 13203a78d15Sespie // It's recursive, one iteration per group. It moves the characters 13303a78d15Sespie // in the buffer this way: "xxxx12345" -> "12,345xxx". Call this 13403a78d15Sespie // only with __gbeg != __gend. 13503a78d15Sespie template<typename _CharT> 13603a78d15Sespie _CharT* 13703a78d15Sespie __add_grouping(_CharT* __s, _CharT __sep, 13803a78d15Sespie const char* __gbeg, const char* __gend, 13903a78d15Sespie const _CharT* __first, const _CharT* __last); 14003a78d15Sespie 14103a78d15Sespie // This template permits specializing facet output code for 14203a78d15Sespie // ostreambuf_iterator. For ostreambuf_iterator, sputn is 14303a78d15Sespie // significantly more efficient than incrementing iterators. 14403a78d15Sespie template<typename _CharT> 14503a78d15Sespie inline 14603a78d15Sespie ostreambuf_iterator<_CharT> __write(ostreambuf_iterator<_CharT> __s,const _CharT * __ws,int __len)14703a78d15Sespie __write(ostreambuf_iterator<_CharT> __s, const _CharT* __ws, int __len) 14803a78d15Sespie { 14903a78d15Sespie __s._M_put(__ws, __len); 15003a78d15Sespie return __s; 15103a78d15Sespie } 15203a78d15Sespie 15303a78d15Sespie // This is the unspecialized form of the template. 15403a78d15Sespie template<typename _CharT, typename _OutIter> 15503a78d15Sespie inline 15603a78d15Sespie _OutIter __write(_OutIter __s,const _CharT * __ws,int __len)15703a78d15Sespie __write(_OutIter __s, const _CharT* __ws, int __len) 15803a78d15Sespie { 15903a78d15Sespie for (int __j = 0; __j < __len; __j++, ++__s) 16003a78d15Sespie *__s = __ws[__j]; 16103a78d15Sespie return __s; 16203a78d15Sespie } 16303a78d15Sespie 16403a78d15Sespie // 22.2.1.1 Template class ctype 16503a78d15Sespie // Include host and configuration specific ctype enums for ctype_base. 16603a78d15Sespie #include <bits/ctype_base.h> 16703a78d15Sespie 16803a78d15Sespie // Common base for ctype<_CharT>. 16903a78d15Sespie template<typename _CharT> 17003a78d15Sespie class __ctype_abstract_base : public locale::facet, public ctype_base 17103a78d15Sespie { 17203a78d15Sespie public: 17303a78d15Sespie // Types: 17403a78d15Sespie typedef _CharT char_type; 17503a78d15Sespie 17603a78d15Sespie bool is(mask __m,char_type __c)17703a78d15Sespie is(mask __m, char_type __c) const 17803a78d15Sespie { return this->do_is(__m, __c); } 17903a78d15Sespie 18003a78d15Sespie const char_type* is(const char_type * __lo,const char_type * __hi,mask * __vec)18103a78d15Sespie is(const char_type *__lo, const char_type *__hi, mask *__vec) const 18203a78d15Sespie { return this->do_is(__lo, __hi, __vec); } 18303a78d15Sespie 18403a78d15Sespie const char_type* scan_is(mask __m,const char_type * __lo,const char_type * __hi)18503a78d15Sespie scan_is(mask __m, const char_type* __lo, const char_type* __hi) const 18603a78d15Sespie { return this->do_scan_is(__m, __lo, __hi); } 18703a78d15Sespie 18803a78d15Sespie const char_type* scan_not(mask __m,const char_type * __lo,const char_type * __hi)18903a78d15Sespie scan_not(mask __m, const char_type* __lo, const char_type* __hi) const 19003a78d15Sespie { return this->do_scan_not(__m, __lo, __hi); } 19103a78d15Sespie 19203a78d15Sespie char_type toupper(char_type __c)19303a78d15Sespie toupper(char_type __c) const 19403a78d15Sespie { return this->do_toupper(__c); } 19503a78d15Sespie 19603a78d15Sespie const char_type* toupper(char_type * __lo,const char_type * __hi)19703a78d15Sespie toupper(char_type *__lo, const char_type* __hi) const 19803a78d15Sespie { return this->do_toupper(__lo, __hi); } 19903a78d15Sespie 20003a78d15Sespie char_type tolower(char_type __c)20103a78d15Sespie tolower(char_type __c) const 20203a78d15Sespie { return this->do_tolower(__c); } 20303a78d15Sespie 20403a78d15Sespie const char_type* tolower(char_type * __lo,const char_type * __hi)20503a78d15Sespie tolower(char_type* __lo, const char_type* __hi) const 20603a78d15Sespie { return this->do_tolower(__lo, __hi); } 20703a78d15Sespie 20803a78d15Sespie char_type widen(char __c)20903a78d15Sespie widen(char __c) const 21003a78d15Sespie { return this->do_widen(__c); } 21103a78d15Sespie 21203a78d15Sespie const char* widen(const char * __lo,const char * __hi,char_type * __to)21303a78d15Sespie widen(const char* __lo, const char* __hi, char_type* __to) const 21403a78d15Sespie { return this->do_widen(__lo, __hi, __to); } 21503a78d15Sespie 21603a78d15Sespie char narrow(char_type __c,char __dfault)21703a78d15Sespie narrow(char_type __c, char __dfault) const 21803a78d15Sespie { return this->do_narrow(__c, __dfault); } 21903a78d15Sespie 22003a78d15Sespie const char_type* narrow(const char_type * __lo,const char_type * __hi,char __dfault,char * __to)22103a78d15Sespie narrow(const char_type* __lo, const char_type* __hi, 22203a78d15Sespie char __dfault, char *__to) const 22303a78d15Sespie { return this->do_narrow(__lo, __hi, __dfault, __to); } 22403a78d15Sespie 22503a78d15Sespie protected: 22603a78d15Sespie explicit facet(__refs)22703a78d15Sespie __ctype_abstract_base(size_t __refs = 0): locale::facet(__refs) { } 22803a78d15Sespie 22903a78d15Sespie virtual ~__ctype_abstract_base()23003a78d15Sespie ~__ctype_abstract_base() { } 23103a78d15Sespie 23203a78d15Sespie virtual bool 23303a78d15Sespie do_is(mask __m, char_type __c) const = 0; 23403a78d15Sespie 23503a78d15Sespie virtual const char_type* 23603a78d15Sespie do_is(const char_type* __lo, const char_type* __hi, 23703a78d15Sespie mask* __vec) const = 0; 23803a78d15Sespie 23903a78d15Sespie virtual const char_type* 24003a78d15Sespie do_scan_is(mask __m, const char_type* __lo, 24103a78d15Sespie const char_type* __hi) const = 0; 24203a78d15Sespie 24303a78d15Sespie virtual const char_type* 24403a78d15Sespie do_scan_not(mask __m, const char_type* __lo, 24503a78d15Sespie const char_type* __hi) const = 0; 24603a78d15Sespie 24703a78d15Sespie virtual char_type 24803a78d15Sespie do_toupper(char_type) const = 0; 24903a78d15Sespie 25003a78d15Sespie virtual const char_type* 25103a78d15Sespie do_toupper(char_type* __lo, const char_type* __hi) const = 0; 25203a78d15Sespie 25303a78d15Sespie virtual char_type 25403a78d15Sespie do_tolower(char_type) const = 0; 25503a78d15Sespie 25603a78d15Sespie virtual const char_type* 25703a78d15Sespie do_tolower(char_type* __lo, const char_type* __hi) const = 0; 25803a78d15Sespie 25903a78d15Sespie virtual char_type 26003a78d15Sespie do_widen(char) const = 0; 26103a78d15Sespie 26203a78d15Sespie virtual const char* 26303a78d15Sespie do_widen(const char* __lo, const char* __hi, 26403a78d15Sespie char_type* __dest) const = 0; 26503a78d15Sespie 26603a78d15Sespie virtual char 26703a78d15Sespie do_narrow(char_type, char __dfault) const = 0; 26803a78d15Sespie 26903a78d15Sespie virtual const char_type* 27003a78d15Sespie do_narrow(const char_type* __lo, const char_type* __hi, 27103a78d15Sespie char __dfault, char* __dest) const = 0; 27203a78d15Sespie }; 27303a78d15Sespie 27403a78d15Sespie // NB: Generic, mostly useless implementation. 27503a78d15Sespie template<typename _CharT> 27603a78d15Sespie class ctype : public __ctype_abstract_base<_CharT> 27703a78d15Sespie { 27803a78d15Sespie public: 27903a78d15Sespie // Types: 28003a78d15Sespie typedef _CharT char_type; 28103a78d15Sespie typedef typename ctype::mask mask; 28203a78d15Sespie 28303a78d15Sespie static locale::id id; 28403a78d15Sespie 28503a78d15Sespie explicit 28603a78d15Sespie ctype(size_t __refs = 0) : __ctype_abstract_base<_CharT>(__refs) { } 28703a78d15Sespie 28803a78d15Sespie protected: 28903a78d15Sespie virtual 29003a78d15Sespie ~ctype(); 29103a78d15Sespie 29203a78d15Sespie virtual bool 29303a78d15Sespie do_is(mask __m, char_type __c) const; 29403a78d15Sespie 29503a78d15Sespie virtual const char_type* 29603a78d15Sespie do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const; 29703a78d15Sespie 29803a78d15Sespie virtual const char_type* 29903a78d15Sespie do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const; 30003a78d15Sespie 30103a78d15Sespie virtual const char_type* 30203a78d15Sespie do_scan_not(mask __m, const char_type* __lo, 30303a78d15Sespie const char_type* __hi) const; 30403a78d15Sespie 30503a78d15Sespie virtual char_type 30603a78d15Sespie do_toupper(char_type __c) const; 30703a78d15Sespie 30803a78d15Sespie virtual const char_type* 30903a78d15Sespie do_toupper(char_type* __lo, const char_type* __hi) const; 31003a78d15Sespie 31103a78d15Sespie virtual char_type 31203a78d15Sespie do_tolower(char_type __c) const; 31303a78d15Sespie 31403a78d15Sespie virtual const char_type* 31503a78d15Sespie do_tolower(char_type* __lo, const char_type* __hi) const; 31603a78d15Sespie 31703a78d15Sespie virtual char_type 31803a78d15Sespie do_widen(char __c) const; 31903a78d15Sespie 32003a78d15Sespie virtual const char* 32103a78d15Sespie do_widen(const char* __lo, const char* __hi, char_type* __dest) const; 32203a78d15Sespie 32303a78d15Sespie virtual char 32403a78d15Sespie do_narrow(char_type, char __dfault) const; 32503a78d15Sespie 32603a78d15Sespie virtual const char_type* 32703a78d15Sespie do_narrow(const char_type* __lo, const char_type* __hi, 32803a78d15Sespie char __dfault, char* __dest) const; 32903a78d15Sespie }; 33003a78d15Sespie 33103a78d15Sespie template<typename _CharT> 33203a78d15Sespie locale::id ctype<_CharT>::id; 33303a78d15Sespie 33403a78d15Sespie // 22.2.1.3 ctype<char> specialization. 33503a78d15Sespie template<> 33603a78d15Sespie class ctype<char> : public __ctype_abstract_base<char> 33703a78d15Sespie { 33803a78d15Sespie public: 33903a78d15Sespie // Types: 34003a78d15Sespie typedef char char_type; 34103a78d15Sespie 34203a78d15Sespie protected: 34303a78d15Sespie // Data Members: 34403a78d15Sespie __c_locale _M_c_locale_ctype; 34503a78d15Sespie bool _M_del; 34603a78d15Sespie __to_type _M_toupper; 34703a78d15Sespie __to_type _M_tolower; 34803a78d15Sespie const mask* _M_table; 34903a78d15Sespie 35003a78d15Sespie public: 35103a78d15Sespie static locale::id id; 35203a78d15Sespie static const size_t table_size = 1 + static_cast<unsigned char>(-1); 35303a78d15Sespie 35403a78d15Sespie explicit 35503a78d15Sespie ctype(const mask* __table = 0, bool __del = false, size_t __refs = 0); 35603a78d15Sespie 35703a78d15Sespie explicit 35803a78d15Sespie ctype(__c_locale __cloc, const mask* __table = 0, bool __del = false, 35903a78d15Sespie size_t __refs = 0); 36003a78d15Sespie 36103a78d15Sespie inline bool 36203a78d15Sespie is(mask __m, char __c) const; 36303a78d15Sespie 36403a78d15Sespie inline const char* 36503a78d15Sespie is(const char* __lo, const char* __hi, mask* __vec) const; 36603a78d15Sespie 36703a78d15Sespie inline const char* 36803a78d15Sespie scan_is(mask __m, const char* __lo, const char* __hi) const; 36903a78d15Sespie 37003a78d15Sespie inline const char* 37103a78d15Sespie scan_not(mask __m, const char* __lo, const char* __hi) const; 37203a78d15Sespie 37303a78d15Sespie protected: 37403a78d15Sespie const mask* table()37503a78d15Sespie table() const throw() 37603a78d15Sespie { return _M_table; } 37703a78d15Sespie 37803a78d15Sespie static const mask* 37903a78d15Sespie classic_table() throw(); 38003a78d15Sespie 38103a78d15Sespie virtual 38203a78d15Sespie ~ctype(); 38303a78d15Sespie 38403a78d15Sespie virtual bool 38503a78d15Sespie do_is(mask __m, char_type __c) const; 38603a78d15Sespie 38703a78d15Sespie virtual const char_type* 38803a78d15Sespie do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const; 38903a78d15Sespie 39003a78d15Sespie virtual const char_type* 39103a78d15Sespie do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const; 39203a78d15Sespie 39303a78d15Sespie virtual const char_type* 39403a78d15Sespie do_scan_not(mask __m, const char_type* __lo, 39503a78d15Sespie const char_type* __hi) const; 39603a78d15Sespie 39703a78d15Sespie virtual char_type 39803a78d15Sespie do_toupper(char_type) const; 39903a78d15Sespie 40003a78d15Sespie virtual const char_type* 40103a78d15Sespie do_toupper(char_type* __lo, const char_type* __hi) const; 40203a78d15Sespie 40303a78d15Sespie virtual char_type 40403a78d15Sespie do_tolower(char_type) const; 40503a78d15Sespie 40603a78d15Sespie virtual const char_type* 40703a78d15Sespie do_tolower(char_type* __lo, const char_type* __hi) const; 40803a78d15Sespie 40903a78d15Sespie virtual char_type 41003a78d15Sespie do_widen(char) const; 41103a78d15Sespie 41203a78d15Sespie virtual const char* 41303a78d15Sespie do_widen(const char* __lo, const char* __hi, char_type* __dest) const; 41403a78d15Sespie 41503a78d15Sespie virtual char 41603a78d15Sespie do_narrow(char_type, char __dfault) const; 41703a78d15Sespie 41803a78d15Sespie virtual const char_type* 41903a78d15Sespie do_narrow(const char_type* __lo, const char_type* __hi, 42003a78d15Sespie char __dfault, char* __dest) const; 42103a78d15Sespie }; 42203a78d15Sespie 42303a78d15Sespie template<> 42403a78d15Sespie const ctype<char>& 42503a78d15Sespie use_facet<ctype<char> >(const locale& __loc); 42603a78d15Sespie 427*c2fb3212Sespie #if defined(_GLIBCPP_USE_WCHAR_T) || defined(_GLIBCPP_USE_TYPE_WCHAR_T) 42803a78d15Sespie // 22.2.1.3 ctype<wchar_t> specialization 42903a78d15Sespie template<> 43003a78d15Sespie class ctype<wchar_t> : public __ctype_abstract_base<wchar_t> 43103a78d15Sespie { 43203a78d15Sespie public: 43303a78d15Sespie // Types: 43403a78d15Sespie typedef wchar_t char_type; 43503a78d15Sespie typedef wctype_t __wmask_type; 43603a78d15Sespie 43703a78d15Sespie protected: 43803a78d15Sespie __c_locale _M_c_locale_ctype; 43903a78d15Sespie 44003a78d15Sespie public: 44103a78d15Sespie // Data Members: 44203a78d15Sespie static locale::id id; 44303a78d15Sespie 44403a78d15Sespie explicit 44503a78d15Sespie ctype(size_t __refs = 0); 44603a78d15Sespie 44703a78d15Sespie explicit 44803a78d15Sespie ctype(__c_locale __cloc, size_t __refs = 0); 44903a78d15Sespie 45003a78d15Sespie protected: 45103a78d15Sespie __wmask_type 45203a78d15Sespie _M_convert_to_wmask(const mask __m) const; 45303a78d15Sespie 45403a78d15Sespie virtual 45503a78d15Sespie ~ctype(); 45603a78d15Sespie 45703a78d15Sespie virtual bool 45803a78d15Sespie do_is(mask __m, char_type __c) const; 45903a78d15Sespie 46003a78d15Sespie virtual const char_type* 46103a78d15Sespie do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const; 46203a78d15Sespie 46303a78d15Sespie virtual const char_type* 46403a78d15Sespie do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const; 46503a78d15Sespie 46603a78d15Sespie virtual const char_type* 46703a78d15Sespie do_scan_not(mask __m, const char_type* __lo, 46803a78d15Sespie const char_type* __hi) const; 46903a78d15Sespie 47003a78d15Sespie virtual char_type 47103a78d15Sespie do_toupper(char_type) const; 47203a78d15Sespie 47303a78d15Sespie virtual const char_type* 47403a78d15Sespie do_toupper(char_type* __lo, const char_type* __hi) const; 47503a78d15Sespie 47603a78d15Sespie virtual char_type 47703a78d15Sespie do_tolower(char_type) const; 47803a78d15Sespie 47903a78d15Sespie virtual const char_type* 48003a78d15Sespie do_tolower(char_type* __lo, const char_type* __hi) const; 48103a78d15Sespie 48203a78d15Sespie virtual char_type 48303a78d15Sespie do_widen(char) const; 48403a78d15Sespie 48503a78d15Sespie virtual const char* 48603a78d15Sespie do_widen(const char* __lo, const char* __hi, char_type* __dest) const; 48703a78d15Sespie 48803a78d15Sespie virtual char 48903a78d15Sespie do_narrow(char_type, char __dfault) const; 49003a78d15Sespie 49103a78d15Sespie virtual const char_type* 49203a78d15Sespie do_narrow(const char_type* __lo, const char_type* __hi, 49303a78d15Sespie char __dfault, char* __dest) const; 49403a78d15Sespie 49503a78d15Sespie }; 49603a78d15Sespie 49703a78d15Sespie template<> 49803a78d15Sespie const ctype<wchar_t>& 49903a78d15Sespie use_facet<ctype<wchar_t> >(const locale& __loc); 50003a78d15Sespie #endif //_GLIBCPP_USE_WCHAR_T 50103a78d15Sespie 50203a78d15Sespie // Include host and configuration specific ctype inlines. 50303a78d15Sespie #include <bits/ctype_inline.h> 50403a78d15Sespie 50503a78d15Sespie // 22.2.1.2 Template class ctype_byname 50603a78d15Sespie template<typename _CharT> 50703a78d15Sespie class ctype_byname : public ctype<_CharT> 50803a78d15Sespie { 50903a78d15Sespie public: 51003a78d15Sespie typedef _CharT char_type; 51103a78d15Sespie 51203a78d15Sespie explicit 51303a78d15Sespie ctype_byname(const char* __s, size_t __refs = 0); 51403a78d15Sespie 51503a78d15Sespie protected: 51603a78d15Sespie virtual ~ctype_byname()51703a78d15Sespie ~ctype_byname() { }; 51803a78d15Sespie }; 51903a78d15Sespie 52003a78d15Sespie // 22.2.1.4 Class ctype_byname specializations. 52103a78d15Sespie template<> 52203a78d15Sespie ctype_byname<char>::ctype_byname(const char*, size_t refs); 52303a78d15Sespie 52403a78d15Sespie template<> 52503a78d15Sespie ctype_byname<wchar_t>::ctype_byname(const char*, size_t refs); 52603a78d15Sespie 52703a78d15Sespie // 22.2.1.5 Template class codecvt 52803a78d15Sespie #include <bits/codecvt.h> 52903a78d15Sespie 53003a78d15Sespie // 22.2.2 The numeric category. 53103a78d15Sespie class __num_base 53203a78d15Sespie { 53303a78d15Sespie public: 53403a78d15Sespie // NB: Code depends on the order of _S_atoms_out elements. 53503a78d15Sespie // Below are the indices into _S_atoms_out. 53603a78d15Sespie enum 53703a78d15Sespie { 53803a78d15Sespie _S_minus, 53903a78d15Sespie _S_plus, 54003a78d15Sespie _S_x, 54103a78d15Sespie _S_X, 54203a78d15Sespie _S_digits, 54303a78d15Sespie _S_digits_end = _S_digits + 16, 54403a78d15Sespie _S_udigits = _S_digits_end, 54503a78d15Sespie _S_udigits_end = _S_udigits + 16, 54603a78d15Sespie _S_e = _S_digits + 14, // For scientific notation, 'e' 54703a78d15Sespie _S_E = _S_udigits + 14, // For scientific notation, 'E' 54803a78d15Sespie _S_end = _S_udigits_end 54903a78d15Sespie }; 55003a78d15Sespie 55103a78d15Sespie // A list of valid numeric literals for output. This array 55203a78d15Sespie // contains chars that will be passed through the current locale's 55303a78d15Sespie // ctype<_CharT>.widen() and then used to render numbers. 55403a78d15Sespie // For the standard "C" locale, this is 55503a78d15Sespie // "-+xX0123456789abcdef0123456789ABCDEF". 55603a78d15Sespie static const char* _S_atoms_out; 55703a78d15Sespie 55803a78d15Sespie protected: 55903a78d15Sespie // String literal of acceptable (narrow) input, for num_get. 56003a78d15Sespie // "0123456789eEabcdfABCDF" 56103a78d15Sespie static const char* _S_atoms_in; 56203a78d15Sespie 56303a78d15Sespie enum 56403a78d15Sespie { 56503a78d15Sespie _M_zero, 56603a78d15Sespie _M_e = _M_zero + 10, 56703a78d15Sespie _M_E = _M_zero + 11, 56803a78d15Sespie _M_size = 21 + 1 56903a78d15Sespie }; 57003a78d15Sespie 57103a78d15Sespie // num_put 57203a78d15Sespie // Construct and return valid scanf format for floating point types. 57303a78d15Sespie static void 57403a78d15Sespie _S_format_float(const ios_base& __io, char* __fptr, char __mod, 57503a78d15Sespie streamsize __prec); 57603a78d15Sespie 57703a78d15Sespie // Construct and return valid scanf format for integer types. 57803a78d15Sespie static void 57903a78d15Sespie _S_format_int(const ios_base& __io, char* __fptr, char __mod, char __modl); 58003a78d15Sespie }; 58103a78d15Sespie 58203a78d15Sespie 58303a78d15Sespie template<typename _CharT> 58403a78d15Sespie class __locale_cache; 58503a78d15Sespie 58603a78d15Sespie template<typename _CharT> 58703a78d15Sespie class numpunct : public locale::facet 58803a78d15Sespie { 58903a78d15Sespie public: 59003a78d15Sespie // Types: 59103a78d15Sespie typedef _CharT char_type; 59203a78d15Sespie typedef basic_string<_CharT> string_type; 59303a78d15Sespie 59403a78d15Sespie friend class __locale_cache<numpunct<_CharT> >; 59503a78d15Sespie 59603a78d15Sespie static locale::id id; 59703a78d15Sespie 59803a78d15Sespie private: 59903a78d15Sespie char_type _M_decimal_point; 60003a78d15Sespie char_type _M_thousands_sep; 60103a78d15Sespie const char* _M_grouping; 60203a78d15Sespie const char_type* _M_truename; 60303a78d15Sespie const char_type* _M_falsename; 60403a78d15Sespie 60503a78d15Sespie public: 60603a78d15Sespie explicit facet(__refs)60703a78d15Sespie numpunct(size_t __refs = 0) : locale::facet(__refs) 60803a78d15Sespie { _M_initialize_numpunct(); } 60903a78d15Sespie 61003a78d15Sespie explicit facet(__refs)61103a78d15Sespie numpunct(__c_locale __cloc, size_t __refs = 0) : locale::facet(__refs) 61203a78d15Sespie { _M_initialize_numpunct(__cloc); } 61303a78d15Sespie 61403a78d15Sespie char_type decimal_point()61503a78d15Sespie decimal_point() const 61603a78d15Sespie { return this->do_decimal_point(); } 61703a78d15Sespie 61803a78d15Sespie char_type thousands_sep()61903a78d15Sespie thousands_sep() const 62003a78d15Sespie { return this->do_thousands_sep(); } 62103a78d15Sespie 62203a78d15Sespie string grouping()62303a78d15Sespie grouping() const 62403a78d15Sespie { return this->do_grouping(); } 62503a78d15Sespie 62603a78d15Sespie string_type truename()62703a78d15Sespie truename() const 62803a78d15Sespie { return this->do_truename(); } 62903a78d15Sespie 63003a78d15Sespie string_type falsename()63103a78d15Sespie falsename() const 63203a78d15Sespie { return this->do_falsename(); } 63303a78d15Sespie 63403a78d15Sespie protected: 63503a78d15Sespie virtual 63603a78d15Sespie ~numpunct(); 63703a78d15Sespie 63803a78d15Sespie virtual char_type do_decimal_point()63903a78d15Sespie do_decimal_point() const 64003a78d15Sespie { return _M_decimal_point; } 64103a78d15Sespie 64203a78d15Sespie virtual char_type do_thousands_sep()64303a78d15Sespie do_thousands_sep() const 64403a78d15Sespie { return _M_thousands_sep; } 64503a78d15Sespie 64603a78d15Sespie virtual string do_grouping()64703a78d15Sespie do_grouping() const 64803a78d15Sespie { return _M_grouping; } 64903a78d15Sespie 65003a78d15Sespie virtual string_type do_truename()65103a78d15Sespie do_truename() const 65203a78d15Sespie { return _M_truename; } 65303a78d15Sespie 65403a78d15Sespie virtual string_type do_falsename()65503a78d15Sespie do_falsename() const 65603a78d15Sespie { return _M_falsename; } 65703a78d15Sespie 65803a78d15Sespie // For use at construction time only. 65903a78d15Sespie void 66003a78d15Sespie _M_initialize_numpunct(__c_locale __cloc = NULL); 66103a78d15Sespie }; 66203a78d15Sespie 66303a78d15Sespie template<typename _CharT> 66403a78d15Sespie locale::id numpunct<_CharT>::id; 66503a78d15Sespie 66603a78d15Sespie template<> 66703a78d15Sespie numpunct<char>::~numpunct(); 66803a78d15Sespie 66903a78d15Sespie template<> 67003a78d15Sespie void 67103a78d15Sespie numpunct<char>::_M_initialize_numpunct(__c_locale __cloc); 67203a78d15Sespie 673*c2fb3212Sespie #if defined(_GLIBCPP_USE_WCHAR_T) || defined(_GLIBCPP_USE_TYPE_WCHAR_T) 67403a78d15Sespie template<> 67503a78d15Sespie numpunct<wchar_t>::~numpunct(); 67603a78d15Sespie 67703a78d15Sespie template<> 67803a78d15Sespie void 67903a78d15Sespie numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc); 68003a78d15Sespie #endif 68103a78d15Sespie 68203a78d15Sespie template<typename _CharT> 68303a78d15Sespie class numpunct_byname : public numpunct<_CharT> 68403a78d15Sespie { 68503a78d15Sespie // Data Member. 68603a78d15Sespie __c_locale _M_c_locale_numpunct; 68703a78d15Sespie 68803a78d15Sespie public: 68903a78d15Sespie typedef _CharT char_type; 69003a78d15Sespie typedef basic_string<_CharT> string_type; 69103a78d15Sespie 69203a78d15Sespie explicit 69303a78d15Sespie numpunct_byname(const char* __s, size_t __refs = 0) 69403a78d15Sespie : numpunct<_CharT>(__refs) 69503a78d15Sespie { 69603a78d15Sespie _S_create_c_locale(_M_c_locale_numpunct, __s); 69703a78d15Sespie _M_initialize_numpunct(_M_c_locale_numpunct); 69803a78d15Sespie } 69903a78d15Sespie 70003a78d15Sespie protected: 70103a78d15Sespie virtual ~numpunct_byname()70203a78d15Sespie ~numpunct_byname() 70303a78d15Sespie { _S_destroy_c_locale(_M_c_locale_numpunct); } 70403a78d15Sespie }; 70503a78d15Sespie 70603a78d15Sespie template<typename _CharT, typename _InIter> 70703a78d15Sespie class num_get : public locale::facet, public __num_base 70803a78d15Sespie { 70903a78d15Sespie public: 71003a78d15Sespie // Types: 71103a78d15Sespie typedef _CharT char_type; 71203a78d15Sespie typedef _InIter iter_type; 71303a78d15Sespie 71403a78d15Sespie static locale::id id; 71503a78d15Sespie 71603a78d15Sespie explicit facet(__refs)71703a78d15Sespie num_get(size_t __refs = 0) : locale::facet(__refs) { } 71803a78d15Sespie 71903a78d15Sespie iter_type get(iter_type __in,iter_type __end,ios_base & __io,ios_base::iostate & __err,bool & __v)72003a78d15Sespie get(iter_type __in, iter_type __end, ios_base& __io, 72103a78d15Sespie ios_base::iostate& __err, bool& __v) const 72203a78d15Sespie { return this->do_get(__in, __end, __io, __err, __v); } 72303a78d15Sespie 72403a78d15Sespie iter_type get(iter_type __in,iter_type __end,ios_base & __io,ios_base::iostate & __err,long & __v)72503a78d15Sespie get(iter_type __in, iter_type __end, ios_base& __io, 72603a78d15Sespie ios_base::iostate& __err, long& __v) const 72703a78d15Sespie { return this->do_get(__in, __end, __io, __err, __v); } 72803a78d15Sespie 72903a78d15Sespie iter_type get(iter_type __in,iter_type __end,ios_base & __io,ios_base::iostate & __err,unsigned short & __v)73003a78d15Sespie get(iter_type __in, iter_type __end, ios_base& __io, 73103a78d15Sespie ios_base::iostate& __err, unsigned short& __v) const 73203a78d15Sespie { return this->do_get(__in, __end, __io, __err, __v); } 73303a78d15Sespie 73403a78d15Sespie iter_type get(iter_type __in,iter_type __end,ios_base & __io,ios_base::iostate & __err,unsigned int & __v)73503a78d15Sespie get(iter_type __in, iter_type __end, ios_base& __io, 73603a78d15Sespie ios_base::iostate& __err, unsigned int& __v) const 73703a78d15Sespie { return this->do_get(__in, __end, __io, __err, __v); } 73803a78d15Sespie 73903a78d15Sespie iter_type get(iter_type __in,iter_type __end,ios_base & __io,ios_base::iostate & __err,unsigned long & __v)74003a78d15Sespie get(iter_type __in, iter_type __end, ios_base& __io, 74103a78d15Sespie ios_base::iostate& __err, unsigned long& __v) const 74203a78d15Sespie { return this->do_get(__in, __end, __io, __err, __v); } 74303a78d15Sespie 74403a78d15Sespie #ifdef _GLIBCPP_USE_LONG_LONG 74503a78d15Sespie iter_type get(iter_type __in,iter_type __end,ios_base & __io,ios_base::iostate & __err,long long & __v)74603a78d15Sespie get(iter_type __in, iter_type __end, ios_base& __io, 74703a78d15Sespie ios_base::iostate& __err, long long& __v) const 74803a78d15Sespie { return this->do_get(__in, __end, __io, __err, __v); } 74903a78d15Sespie 75003a78d15Sespie iter_type get(iter_type __in,iter_type __end,ios_base & __io,ios_base::iostate & __err,unsigned long long & __v)75103a78d15Sespie get(iter_type __in, iter_type __end, ios_base& __io, 75203a78d15Sespie ios_base::iostate& __err, unsigned long long& __v) const 75303a78d15Sespie { return this->do_get(__in, __end, __io, __err, __v); } 75403a78d15Sespie #endif 75503a78d15Sespie 75603a78d15Sespie iter_type get(iter_type __in,iter_type __end,ios_base & __io,ios_base::iostate & __err,float & __v)75703a78d15Sespie get(iter_type __in, iter_type __end, ios_base& __io, 75803a78d15Sespie ios_base::iostate& __err, float& __v) const 75903a78d15Sespie { return this->do_get(__in, __end, __io, __err, __v); } 76003a78d15Sespie 76103a78d15Sespie iter_type get(iter_type __in,iter_type __end,ios_base & __io,ios_base::iostate & __err,double & __v)76203a78d15Sespie get(iter_type __in, iter_type __end, ios_base& __io, 76303a78d15Sespie ios_base::iostate& __err, double& __v) const 76403a78d15Sespie { return this->do_get(__in, __end, __io, __err, __v); } 76503a78d15Sespie 76603a78d15Sespie iter_type get(iter_type __in,iter_type __end,ios_base & __io,ios_base::iostate & __err,long double & __v)76703a78d15Sespie get(iter_type __in, iter_type __end, ios_base& __io, 76803a78d15Sespie ios_base::iostate& __err, long double& __v) const 76903a78d15Sespie { return this->do_get(__in, __end, __io, __err, __v); } 77003a78d15Sespie 77103a78d15Sespie iter_type get(iter_type __in,iter_type __end,ios_base & __io,ios_base::iostate & __err,void * & __v)77203a78d15Sespie get(iter_type __in, iter_type __end, ios_base& __io, 77303a78d15Sespie ios_base::iostate& __err, void*& __v) const 77403a78d15Sespie { return this->do_get(__in, __end, __io, __err, __v); } 77503a78d15Sespie 77603a78d15Sespie protected: ~num_get()77703a78d15Sespie virtual ~num_get() { } 77803a78d15Sespie 77903a78d15Sespie iter_type 78003a78d15Sespie _M_extract_float(iter_type, iter_type, ios_base&, ios_base::iostate&, 78103a78d15Sespie string& __xtrc) const; 78203a78d15Sespie 78303a78d15Sespie iter_type 78403a78d15Sespie _M_extract_int(iter_type, iter_type, ios_base&, ios_base::iostate&, 78503a78d15Sespie string& __xtrc, int& __base) const; 78603a78d15Sespie 78703a78d15Sespie virtual iter_type 78803a78d15Sespie do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, bool&) const; 78903a78d15Sespie 79003a78d15Sespie 79103a78d15Sespie virtual iter_type 79203a78d15Sespie do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, long&) const; 79303a78d15Sespie 79403a78d15Sespie virtual iter_type 79503a78d15Sespie do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err, 79603a78d15Sespie unsigned short&) const; 79703a78d15Sespie 79803a78d15Sespie virtual iter_type 79903a78d15Sespie do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err, 80003a78d15Sespie unsigned int&) const; 80103a78d15Sespie 80203a78d15Sespie virtual iter_type 80303a78d15Sespie do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err, 80403a78d15Sespie unsigned long&) const; 80503a78d15Sespie 80603a78d15Sespie #ifdef _GLIBCPP_USE_LONG_LONG 80703a78d15Sespie virtual iter_type 80803a78d15Sespie do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err, 80903a78d15Sespie long long&) const; 81003a78d15Sespie 81103a78d15Sespie virtual iter_type 81203a78d15Sespie do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err, 81303a78d15Sespie unsigned long long&) const; 81403a78d15Sespie #endif 81503a78d15Sespie 81603a78d15Sespie virtual iter_type 81703a78d15Sespie do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err, 81803a78d15Sespie float&) const; 81903a78d15Sespie 82003a78d15Sespie virtual iter_type 82103a78d15Sespie do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err, 82203a78d15Sespie double&) const; 82303a78d15Sespie 82403a78d15Sespie virtual iter_type 82503a78d15Sespie do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err, 82603a78d15Sespie long double&) const; 82703a78d15Sespie 82803a78d15Sespie virtual iter_type 82903a78d15Sespie do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err, 83003a78d15Sespie void*&) const; 83103a78d15Sespie }; 83203a78d15Sespie 83303a78d15Sespie template<typename _CharT, typename _InIter> 83403a78d15Sespie locale::id num_get<_CharT, _InIter>::id; 83503a78d15Sespie 83603a78d15Sespie #if 0 83703a78d15Sespie // Partial specialization for istreambuf_iterator, so can use traits_type. 83803a78d15Sespie template<typename _CharT> 83903a78d15Sespie class num_get<_CharT, istreambuf_iterator<_CharT> >; 84003a78d15Sespie 84103a78d15Sespie iter_type 84203a78d15Sespie _M_extract_float(iter_type, iter_type, ios_base&, ios_base::iostate&, 84303a78d15Sespie string& __xtrc) const; 84403a78d15Sespie 84503a78d15Sespie iter_type 84603a78d15Sespie _M_extract_int(iter_type, iter_type, ios_base&, ios_base::iostate&, 84703a78d15Sespie string& __xtrc, int& __base) const; 84803a78d15Sespie 84903a78d15Sespie virtual iter_type 85003a78d15Sespie do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, bool&) const; 85103a78d15Sespie #endif 85203a78d15Sespie 85303a78d15Sespie template<typename _CharT, typename _OutIter> 85403a78d15Sespie class num_put : public locale::facet, public __num_base 85503a78d15Sespie { 85603a78d15Sespie public: 85703a78d15Sespie // Types: 85803a78d15Sespie typedef _CharT char_type; 85903a78d15Sespie typedef _OutIter iter_type; 86003a78d15Sespie static locale::id id; 86103a78d15Sespie 86203a78d15Sespie explicit facet(__refs)86303a78d15Sespie num_put(size_t __refs = 0) : locale::facet(__refs) { } 86403a78d15Sespie 86503a78d15Sespie iter_type put(iter_type __s,ios_base & __f,char_type __fill,bool __v)86603a78d15Sespie put(iter_type __s, ios_base& __f, char_type __fill, bool __v) const 86703a78d15Sespie { return this->do_put(__s, __f, __fill, __v); } 86803a78d15Sespie 86903a78d15Sespie iter_type put(iter_type __s,ios_base & __f,char_type __fill,long __v)87003a78d15Sespie put(iter_type __s, ios_base& __f, char_type __fill, long __v) const 87103a78d15Sespie { return this->do_put(__s, __f, __fill, __v); } 87203a78d15Sespie 87303a78d15Sespie iter_type put(iter_type __s,ios_base & __f,char_type __fill,unsigned long __v)87403a78d15Sespie put(iter_type __s, ios_base& __f, char_type __fill, 87503a78d15Sespie unsigned long __v) const 87603a78d15Sespie { return this->do_put(__s, __f, __fill, __v); } 87703a78d15Sespie 87803a78d15Sespie #ifdef _GLIBCPP_USE_LONG_LONG 87903a78d15Sespie iter_type put(iter_type __s,ios_base & __f,char_type __fill,long long __v)88003a78d15Sespie put(iter_type __s, ios_base& __f, char_type __fill, long long __v) const 88103a78d15Sespie { return this->do_put(__s, __f, __fill, __v); } 88203a78d15Sespie 88303a78d15Sespie iter_type put(iter_type __s,ios_base & __f,char_type __fill,unsigned long long __v)88403a78d15Sespie put(iter_type __s, ios_base& __f, char_type __fill, 88503a78d15Sespie unsigned long long __v) const 88603a78d15Sespie { return this->do_put(__s, __f, __fill, __v); } 88703a78d15Sespie #endif 88803a78d15Sespie 88903a78d15Sespie iter_type put(iter_type __s,ios_base & __f,char_type __fill,double __v)89003a78d15Sespie put(iter_type __s, ios_base& __f, char_type __fill, double __v) const 89103a78d15Sespie { return this->do_put(__s, __f, __fill, __v); } 89203a78d15Sespie 89303a78d15Sespie iter_type put(iter_type __s,ios_base & __f,char_type __fill,long double __v)89403a78d15Sespie put(iter_type __s, ios_base& __f, char_type __fill, 89503a78d15Sespie long double __v) const 89603a78d15Sespie { return this->do_put(__s, __f, __fill, __v); } 89703a78d15Sespie 89803a78d15Sespie iter_type put(iter_type __s,ios_base & __f,char_type __fill,const void * __v)89903a78d15Sespie put(iter_type __s, ios_base& __f, char_type __fill, 90003a78d15Sespie const void* __v) const 90103a78d15Sespie { return this->do_put(__s, __f, __fill, __v); } 90203a78d15Sespie 90303a78d15Sespie protected: 90403a78d15Sespie template<typename _ValueT> 90503a78d15Sespie iter_type 90603a78d15Sespie _M_convert_float(iter_type, ios_base& __io, char_type __fill, 90703a78d15Sespie char __mod, _ValueT __v) const; 90803a78d15Sespie 90903a78d15Sespie void 91003a78d15Sespie _M_group_float(const string& __grouping, char_type __sep, 91103a78d15Sespie const char_type* __p, char_type* __new, char_type* __cs, 91203a78d15Sespie int& __len) const; 91303a78d15Sespie 91403a78d15Sespie template<typename _ValueT> 91503a78d15Sespie iter_type 91603a78d15Sespie _M_convert_int(iter_type, ios_base& __io, char_type __fill, 91703a78d15Sespie _ValueT __v) const; 91803a78d15Sespie 91903a78d15Sespie void 92003a78d15Sespie _M_group_int(const string& __grouping, char_type __sep, 92103a78d15Sespie ios_base& __io, char_type* __new, char_type* __cs, 92203a78d15Sespie int& __len) const; 92303a78d15Sespie 92403a78d15Sespie void 92503a78d15Sespie _M_pad(char_type __fill, streamsize __w, ios_base& __io, 92603a78d15Sespie char_type* __new, const char_type* __cs, int& __len) const; 92703a78d15Sespie 92803a78d15Sespie #if 1 92903a78d15Sespie // XXX GLIBCXX_ABI Deprecated, compatibility only. 93003a78d15Sespie template<typename _ValueT> 93103a78d15Sespie iter_type 93203a78d15Sespie _M_convert_int(iter_type, ios_base& __io, char_type __fill, 93303a78d15Sespie char __mod, char __modl, _ValueT __v) const; 93403a78d15Sespie 93503a78d15Sespie iter_type 93603a78d15Sespie _M_widen_float(iter_type, ios_base& __io, char_type __fill, char* __cs, 93703a78d15Sespie int __len) const; 93803a78d15Sespie 93903a78d15Sespie iter_type 94003a78d15Sespie _M_widen_int(iter_type, ios_base& __io, char_type __fill, char* __cs, 94103a78d15Sespie int __len) const; 94203a78d15Sespie 94303a78d15Sespie iter_type 94403a78d15Sespie _M_insert(iter_type, ios_base& __io, char_type __fill, 94503a78d15Sespie const char_type* __ws, int __len) const; 94603a78d15Sespie #endif 94703a78d15Sespie 94803a78d15Sespie virtual ~num_put()94903a78d15Sespie ~num_put() { }; 95003a78d15Sespie 95103a78d15Sespie virtual iter_type 95203a78d15Sespie do_put(iter_type, ios_base&, char_type __fill, bool __v) const; 95303a78d15Sespie 95403a78d15Sespie virtual iter_type 95503a78d15Sespie do_put(iter_type, ios_base&, char_type __fill, long __v) const; 95603a78d15Sespie 95703a78d15Sespie virtual iter_type 95803a78d15Sespie do_put(iter_type, ios_base&, char_type __fill, unsigned long) const; 95903a78d15Sespie 96003a78d15Sespie #ifdef _GLIBCPP_USE_LONG_LONG 96103a78d15Sespie virtual iter_type 96203a78d15Sespie do_put(iter_type, ios_base&, char_type __fill, long long __v) const; 96303a78d15Sespie 96403a78d15Sespie virtual iter_type 96503a78d15Sespie do_put(iter_type, ios_base&, char_type __fill, unsigned long long) const; 96603a78d15Sespie #endif 96703a78d15Sespie 96803a78d15Sespie virtual iter_type 96903a78d15Sespie do_put(iter_type, ios_base&, char_type __fill, double __v) const; 97003a78d15Sespie 97103a78d15Sespie virtual iter_type 97203a78d15Sespie do_put(iter_type, ios_base&, char_type __fill, long double __v) const; 97303a78d15Sespie 97403a78d15Sespie virtual iter_type 97503a78d15Sespie do_put(iter_type, ios_base&, char_type __fill, const void* __v) const; 97603a78d15Sespie }; 97703a78d15Sespie 97803a78d15Sespie template <typename _CharT, typename _OutIter> 97903a78d15Sespie locale::id num_put<_CharT, _OutIter>::id; 98003a78d15Sespie 98103a78d15Sespie 98203a78d15Sespie template<typename _CharT> 98303a78d15Sespie class collate : public locale::facet 98403a78d15Sespie { 98503a78d15Sespie public: 98603a78d15Sespie // Types: 98703a78d15Sespie typedef _CharT char_type; 98803a78d15Sespie typedef basic_string<_CharT> string_type; 98903a78d15Sespie 99003a78d15Sespie protected: 99103a78d15Sespie // Underlying "C" library locale information saved from 99203a78d15Sespie // initialization, needed by collate_byname as well. 99303a78d15Sespie __c_locale _M_c_locale_collate; 99403a78d15Sespie 99503a78d15Sespie public: 99603a78d15Sespie static locale::id id; 99703a78d15Sespie 99803a78d15Sespie explicit 99903a78d15Sespie collate(size_t __refs = 0) facet(__refs)100003a78d15Sespie : locale::facet(__refs) 100103a78d15Sespie { _M_c_locale_collate = _S_c_locale; } 100203a78d15Sespie 100303a78d15Sespie explicit 100403a78d15Sespie collate(__c_locale __cloc, size_t __refs = 0) facet(__refs)100503a78d15Sespie : locale::facet(__refs) 100603a78d15Sespie { _M_c_locale_collate = _S_clone_c_locale(__cloc); } 100703a78d15Sespie 100803a78d15Sespie int compare(const _CharT * __lo1,const _CharT * __hi1,const _CharT * __lo2,const _CharT * __hi2)100903a78d15Sespie compare(const _CharT* __lo1, const _CharT* __hi1, 101003a78d15Sespie const _CharT* __lo2, const _CharT* __hi2) const 101103a78d15Sespie { return this->do_compare(__lo1, __hi1, __lo2, __hi2); } 101203a78d15Sespie 101303a78d15Sespie string_type transform(const _CharT * __lo,const _CharT * __hi)101403a78d15Sespie transform(const _CharT* __lo, const _CharT* __hi) const 101503a78d15Sespie { return this->do_transform(__lo, __hi); } 101603a78d15Sespie 101703a78d15Sespie long hash(const _CharT * __lo,const _CharT * __hi)101803a78d15Sespie hash(const _CharT* __lo, const _CharT* __hi) const 101903a78d15Sespie { return this->do_hash(__lo, __hi); } 102003a78d15Sespie 102103a78d15Sespie // Used to abstract out _CharT bits in virtual member functions, below. 102203a78d15Sespie int 102303a78d15Sespie _M_compare(const _CharT*, const _CharT*) const; 102403a78d15Sespie 102503a78d15Sespie size_t 102603a78d15Sespie _M_transform(_CharT*, const _CharT*, size_t) const; 102703a78d15Sespie 102803a78d15Sespie protected: 102903a78d15Sespie virtual ~collate()103003a78d15Sespie ~collate() 103103a78d15Sespie { _S_destroy_c_locale(_M_c_locale_collate); } 103203a78d15Sespie 103303a78d15Sespie virtual int 103403a78d15Sespie do_compare(const _CharT* __lo1, const _CharT* __hi1, 103503a78d15Sespie const _CharT* __lo2, const _CharT* __hi2) const; 103603a78d15Sespie 103703a78d15Sespie virtual string_type 103803a78d15Sespie do_transform(const _CharT* __lo, const _CharT* __hi) const; 103903a78d15Sespie 104003a78d15Sespie virtual long 104103a78d15Sespie do_hash(const _CharT* __lo, const _CharT* __hi) const; 104203a78d15Sespie }; 104303a78d15Sespie 104403a78d15Sespie template<typename _CharT> 104503a78d15Sespie locale::id collate<_CharT>::id; 104603a78d15Sespie 104703a78d15Sespie // Specializations. 104803a78d15Sespie template<> 104903a78d15Sespie int 105003a78d15Sespie collate<char>::_M_compare(const char*, const char*) const; 105103a78d15Sespie 105203a78d15Sespie template<> 105303a78d15Sespie size_t 105403a78d15Sespie collate<char>::_M_transform(char*, const char*, size_t) const; 105503a78d15Sespie 1056*c2fb3212Sespie #if defined(_GLIBCPP_USE_WCHAR_T) || defined(_GLIBCPP_USE_TYPE_WCHAR_T) 105703a78d15Sespie template<> 105803a78d15Sespie int 105903a78d15Sespie collate<wchar_t>::_M_compare(const wchar_t*, const wchar_t*) const; 106003a78d15Sespie 106103a78d15Sespie template<> 106203a78d15Sespie size_t 106303a78d15Sespie collate<wchar_t>::_M_transform(wchar_t*, const wchar_t*, size_t) const; 106403a78d15Sespie #endif 106503a78d15Sespie 106603a78d15Sespie template<typename _CharT> 106703a78d15Sespie class collate_byname : public collate<_CharT> 106803a78d15Sespie { 106903a78d15Sespie public: 107003a78d15Sespie typedef _CharT char_type; 107103a78d15Sespie typedef basic_string<_CharT> string_type; 107203a78d15Sespie 107303a78d15Sespie explicit 107403a78d15Sespie collate_byname(const char* __s, size_t __refs = 0) 107503a78d15Sespie : collate<_CharT>(__refs) 107603a78d15Sespie { 107703a78d15Sespie _S_destroy_c_locale(_M_c_locale_collate); 107803a78d15Sespie _S_create_c_locale(_M_c_locale_collate, __s); 107903a78d15Sespie } 108003a78d15Sespie 108103a78d15Sespie protected: 108203a78d15Sespie virtual ~collate_byname()108303a78d15Sespie ~collate_byname() { } 108403a78d15Sespie }; 108503a78d15Sespie 108603a78d15Sespie 108703a78d15Sespie class time_base 108803a78d15Sespie { 108903a78d15Sespie public: 109003a78d15Sespie enum dateorder { no_order, dmy, mdy, ymd, ydm }; 109103a78d15Sespie }; 109203a78d15Sespie 109303a78d15Sespie template<typename _CharT> 109403a78d15Sespie class __timepunct : public locale::facet 109503a78d15Sespie { 109603a78d15Sespie public: 109703a78d15Sespie // Types: 109803a78d15Sespie typedef _CharT __char_type; 109903a78d15Sespie typedef basic_string<_CharT> __string_type; 110003a78d15Sespie 110103a78d15Sespie static locale::id id; 110203a78d15Sespie 110303a78d15Sespie // List of all known timezones, with GMT first. 110403a78d15Sespie static const _CharT* _S_timezones[14]; 110503a78d15Sespie 110603a78d15Sespie protected: 110703a78d15Sespie __c_locale _M_c_locale_timepunct; 110803a78d15Sespie char* _M_name_timepunct; 110903a78d15Sespie const _CharT* _M_date_format; 111003a78d15Sespie const _CharT* _M_date_era_format; 111103a78d15Sespie const _CharT* _M_time_format; 111203a78d15Sespie const _CharT* _M_time_era_format; 111303a78d15Sespie const _CharT* _M_date_time_format; 111403a78d15Sespie const _CharT* _M_date_time_era_format; 111503a78d15Sespie const _CharT* _M_am; 111603a78d15Sespie const _CharT* _M_pm; 111703a78d15Sespie const _CharT* _M_am_pm_format; 111803a78d15Sespie 111903a78d15Sespie // Day names, starting with "C"'s Sunday. 112003a78d15Sespie const _CharT* _M_day1; 112103a78d15Sespie const _CharT* _M_day2; 112203a78d15Sespie const _CharT* _M_day3; 112303a78d15Sespie const _CharT* _M_day4; 112403a78d15Sespie const _CharT* _M_day5; 112503a78d15Sespie const _CharT* _M_day6; 112603a78d15Sespie const _CharT* _M_day7; 112703a78d15Sespie 112803a78d15Sespie // Abbreviated day names, starting with "C"'s Sun. 112903a78d15Sespie const _CharT* _M_day_a1; 113003a78d15Sespie const _CharT* _M_day_a2; 113103a78d15Sespie const _CharT* _M_day_a3; 113203a78d15Sespie const _CharT* _M_day_a4; 113303a78d15Sespie const _CharT* _M_day_a5; 113403a78d15Sespie const _CharT* _M_day_a6; 113503a78d15Sespie const _CharT* _M_day_a7; 113603a78d15Sespie 113703a78d15Sespie // Month names, starting with "C"'s January. 113803a78d15Sespie const _CharT* _M_month01; 113903a78d15Sespie const _CharT* _M_month02; 114003a78d15Sespie const _CharT* _M_month03; 114103a78d15Sespie const _CharT* _M_month04; 114203a78d15Sespie const _CharT* _M_month05; 114303a78d15Sespie const _CharT* _M_month06; 114403a78d15Sespie const _CharT* _M_month07; 114503a78d15Sespie const _CharT* _M_month08; 114603a78d15Sespie const _CharT* _M_month09; 114703a78d15Sespie const _CharT* _M_month10; 114803a78d15Sespie const _CharT* _M_month11; 114903a78d15Sespie const _CharT* _M_month12; 115003a78d15Sespie 115103a78d15Sespie // Abbreviated month names, starting with "C"'s Jan. 115203a78d15Sespie const _CharT* _M_month_a01; 115303a78d15Sespie const _CharT* _M_month_a02; 115403a78d15Sespie const _CharT* _M_month_a03; 115503a78d15Sespie const _CharT* _M_month_a04; 115603a78d15Sespie const _CharT* _M_month_a05; 115703a78d15Sespie const _CharT* _M_month_a06; 115803a78d15Sespie const _CharT* _M_month_a07; 115903a78d15Sespie const _CharT* _M_month_a08; 116003a78d15Sespie const _CharT* _M_month_a09; 116103a78d15Sespie const _CharT* _M_month_a10; 116203a78d15Sespie const _CharT* _M_month_a11; 116303a78d15Sespie const _CharT* _M_month_a12; 116403a78d15Sespie 116503a78d15Sespie public: 116603a78d15Sespie explicit 116703a78d15Sespie __timepunct(size_t __refs = 0); 116803a78d15Sespie 116903a78d15Sespie explicit 117003a78d15Sespie __timepunct(__c_locale __cloc, const char* __s, size_t __refs = 0); 117103a78d15Sespie 117203a78d15Sespie void 117303a78d15Sespie _M_put(_CharT* __s, size_t __maxlen, const _CharT* __format, 117403a78d15Sespie const tm* __tm) const; 117503a78d15Sespie 117603a78d15Sespie void _M_date_formats(const _CharT ** __date)117703a78d15Sespie _M_date_formats(const _CharT** __date) const 117803a78d15Sespie { 117903a78d15Sespie // Always have default first. 118003a78d15Sespie __date[0] = _M_date_format; 118103a78d15Sespie __date[1] = _M_date_era_format; 118203a78d15Sespie } 118303a78d15Sespie 118403a78d15Sespie void _M_time_formats(const _CharT ** __time)118503a78d15Sespie _M_time_formats(const _CharT** __time) const 118603a78d15Sespie { 118703a78d15Sespie // Always have default first. 118803a78d15Sespie __time[0] = _M_time_format; 118903a78d15Sespie __time[1] = _M_time_era_format; 119003a78d15Sespie } 119103a78d15Sespie 119203a78d15Sespie void _M_ampm(const _CharT ** __ampm)119303a78d15Sespie _M_ampm(const _CharT** __ampm) const 119403a78d15Sespie { 119503a78d15Sespie __ampm[0] = _M_am; 119603a78d15Sespie __ampm[1] = _M_pm; 119703a78d15Sespie } 119803a78d15Sespie 119903a78d15Sespie void _M_date_time_formats(const _CharT ** __dt)120003a78d15Sespie _M_date_time_formats(const _CharT** __dt) const 120103a78d15Sespie { 120203a78d15Sespie // Always have default first. 120303a78d15Sespie __dt[0] = _M_date_time_format; 120403a78d15Sespie __dt[1] = _M_date_time_era_format; 120503a78d15Sespie } 120603a78d15Sespie 120703a78d15Sespie void _M_days(const _CharT ** __days)120803a78d15Sespie _M_days(const _CharT** __days) const 120903a78d15Sespie { 121003a78d15Sespie __days[0] = _M_day1; 121103a78d15Sespie __days[1] = _M_day2; 121203a78d15Sespie __days[2] = _M_day3; 121303a78d15Sespie __days[3] = _M_day4; 121403a78d15Sespie __days[4] = _M_day5; 121503a78d15Sespie __days[5] = _M_day6; 121603a78d15Sespie __days[6] = _M_day7; 121703a78d15Sespie } 121803a78d15Sespie 121903a78d15Sespie void _M_days_abbreviated(const _CharT ** __days)122003a78d15Sespie _M_days_abbreviated(const _CharT** __days) const 122103a78d15Sespie { 122203a78d15Sespie __days[0] = _M_day_a1; 122303a78d15Sespie __days[1] = _M_day_a2; 122403a78d15Sespie __days[2] = _M_day_a3; 122503a78d15Sespie __days[3] = _M_day_a4; 122603a78d15Sespie __days[4] = _M_day_a5; 122703a78d15Sespie __days[5] = _M_day_a6; 122803a78d15Sespie __days[6] = _M_day_a7; 122903a78d15Sespie } 123003a78d15Sespie 123103a78d15Sespie void _M_months(const _CharT ** __months)123203a78d15Sespie _M_months(const _CharT** __months) const 123303a78d15Sespie { 123403a78d15Sespie __months[0] = _M_month01; 123503a78d15Sespie __months[1] = _M_month02; 123603a78d15Sespie __months[2] = _M_month03; 123703a78d15Sespie __months[3] = _M_month04; 123803a78d15Sespie __months[4] = _M_month05; 123903a78d15Sespie __months[5] = _M_month06; 124003a78d15Sespie __months[6] = _M_month07; 124103a78d15Sespie __months[7] = _M_month08; 124203a78d15Sespie __months[8] = _M_month09; 124303a78d15Sespie __months[9] = _M_month10; 124403a78d15Sespie __months[10] = _M_month11; 124503a78d15Sespie __months[11] = _M_month12; 124603a78d15Sespie } 124703a78d15Sespie 124803a78d15Sespie void _M_months_abbreviated(const _CharT ** __months)124903a78d15Sespie _M_months_abbreviated(const _CharT** __months) const 125003a78d15Sespie { 125103a78d15Sespie __months[0] = _M_month_a01; 125203a78d15Sespie __months[1] = _M_month_a02; 125303a78d15Sespie __months[2] = _M_month_a03; 125403a78d15Sespie __months[3] = _M_month_a04; 125503a78d15Sespie __months[4] = _M_month_a05; 125603a78d15Sespie __months[5] = _M_month_a06; 125703a78d15Sespie __months[6] = _M_month_a07; 125803a78d15Sespie __months[7] = _M_month_a08; 125903a78d15Sespie __months[8] = _M_month_a09; 126003a78d15Sespie __months[9] = _M_month_a10; 126103a78d15Sespie __months[10] = _M_month_a11; 126203a78d15Sespie __months[11] = _M_month_a12; 126303a78d15Sespie } 126403a78d15Sespie 126503a78d15Sespie protected: 126603a78d15Sespie virtual 126703a78d15Sespie ~__timepunct(); 126803a78d15Sespie 126903a78d15Sespie // For use at construction time only. 127003a78d15Sespie void 127103a78d15Sespie _M_initialize_timepunct(__c_locale __cloc = NULL); 127203a78d15Sespie }; 127303a78d15Sespie 127403a78d15Sespie template<typename _CharT> 127503a78d15Sespie locale::id __timepunct<_CharT>::id; 127603a78d15Sespie 127703a78d15Sespie // Specializations. 127803a78d15Sespie template<> 127903a78d15Sespie const char* 128003a78d15Sespie __timepunct<char>::_S_timezones[14]; 128103a78d15Sespie 128203a78d15Sespie template<> 128303a78d15Sespie void 128403a78d15Sespie __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc); 128503a78d15Sespie 128603a78d15Sespie template<> 128703a78d15Sespie void 128803a78d15Sespie __timepunct<char>::_M_put(char*, size_t, const char*, const tm*) const; 128903a78d15Sespie 1290*c2fb3212Sespie #if defined(_GLIBCPP_USE_WCHAR_T) || defined(_GLIBCPP_USE_TYPE_WCHAR_T) 129103a78d15Sespie template<> 129203a78d15Sespie const wchar_t* 129303a78d15Sespie __timepunct<wchar_t>::_S_timezones[14]; 129403a78d15Sespie 129503a78d15Sespie template<> 129603a78d15Sespie void 129703a78d15Sespie __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc); 129803a78d15Sespie 129903a78d15Sespie template<> 130003a78d15Sespie void 130103a78d15Sespie __timepunct<wchar_t>::_M_put(wchar_t*, size_t, const wchar_t*, 130203a78d15Sespie const tm*) const; 130303a78d15Sespie #endif 130403a78d15Sespie 130503a78d15Sespie // Generic. 130603a78d15Sespie template<typename _CharT> 130703a78d15Sespie const _CharT* __timepunct<_CharT>::_S_timezones[14]; 130803a78d15Sespie 130903a78d15Sespie // Include host and configuration specific timepunct functions. 131003a78d15Sespie #include <bits/time_members.h> 131103a78d15Sespie 131203a78d15Sespie template<typename _CharT, typename _InIter> 131303a78d15Sespie class time_get : public locale::facet, public time_base 131403a78d15Sespie { 131503a78d15Sespie public: 131603a78d15Sespie // Types: 131703a78d15Sespie typedef _CharT char_type; 131803a78d15Sespie typedef _InIter iter_type; 131903a78d15Sespie typedef basic_string<_CharT> __string_type; 132003a78d15Sespie 132103a78d15Sespie static locale::id id; 132203a78d15Sespie 132303a78d15Sespie explicit 132403a78d15Sespie time_get(size_t __refs = 0) facet(__refs)132503a78d15Sespie : locale::facet (__refs) { } 132603a78d15Sespie 132703a78d15Sespie dateorder date_order()132803a78d15Sespie date_order() const 132903a78d15Sespie { return this->do_date_order(); } 133003a78d15Sespie 133103a78d15Sespie iter_type get_time(iter_type __beg,iter_type __end,ios_base & __io,ios_base::iostate & __err,tm * __tm)133203a78d15Sespie get_time(iter_type __beg, iter_type __end, ios_base& __io, 133303a78d15Sespie ios_base::iostate& __err, tm* __tm) const 133403a78d15Sespie { return this->do_get_time(__beg, __end, __io, __err, __tm); } 133503a78d15Sespie 133603a78d15Sespie iter_type get_date(iter_type __beg,iter_type __end,ios_base & __io,ios_base::iostate & __err,tm * __tm)133703a78d15Sespie get_date(iter_type __beg, iter_type __end, ios_base& __io, 133803a78d15Sespie ios_base::iostate& __err, tm* __tm) const 133903a78d15Sespie { return this->do_get_date(__beg, __end, __io, __err, __tm); } 134003a78d15Sespie 134103a78d15Sespie iter_type get_weekday(iter_type __beg,iter_type __end,ios_base & __io,ios_base::iostate & __err,tm * __tm)134203a78d15Sespie get_weekday(iter_type __beg, iter_type __end, ios_base& __io, 134303a78d15Sespie ios_base::iostate& __err, tm* __tm) const 134403a78d15Sespie { return this->do_get_weekday(__beg, __end, __io, __err, __tm); } 134503a78d15Sespie 134603a78d15Sespie iter_type get_monthname(iter_type __beg,iter_type __end,ios_base & __io,ios_base::iostate & __err,tm * __tm)134703a78d15Sespie get_monthname(iter_type __beg, iter_type __end, ios_base& __io, 134803a78d15Sespie ios_base::iostate& __err, tm* __tm) const 134903a78d15Sespie { return this->do_get_monthname(__beg, __end, __io, __err, __tm); } 135003a78d15Sespie 135103a78d15Sespie iter_type get_year(iter_type __beg,iter_type __end,ios_base & __io,ios_base::iostate & __err,tm * __tm)135203a78d15Sespie get_year(iter_type __beg, iter_type __end, ios_base& __io, 135303a78d15Sespie ios_base::iostate& __err, tm* __tm) const 135403a78d15Sespie { return this->do_get_year(__beg, __end, __io, __err, __tm); } 135503a78d15Sespie 135603a78d15Sespie protected: 135703a78d15Sespie virtual ~time_get()135803a78d15Sespie ~time_get() { } 135903a78d15Sespie 136003a78d15Sespie virtual dateorder 136103a78d15Sespie do_date_order() const; 136203a78d15Sespie 136303a78d15Sespie virtual iter_type 136403a78d15Sespie do_get_time(iter_type __beg, iter_type __end, ios_base& __io, 136503a78d15Sespie ios_base::iostate& __err, tm* __tm) const; 136603a78d15Sespie 136703a78d15Sespie virtual iter_type 136803a78d15Sespie do_get_date(iter_type __beg, iter_type __end, ios_base& __io, 136903a78d15Sespie ios_base::iostate& __err, tm* __tm) const; 137003a78d15Sespie 137103a78d15Sespie virtual iter_type 137203a78d15Sespie do_get_weekday(iter_type __beg, iter_type __end, ios_base&, 137303a78d15Sespie ios_base::iostate& __err, tm* __tm) const; 137403a78d15Sespie 137503a78d15Sespie virtual iter_type 137603a78d15Sespie do_get_monthname(iter_type __beg, iter_type __end, ios_base&, 137703a78d15Sespie ios_base::iostate& __err, tm* __tm) const; 137803a78d15Sespie 137903a78d15Sespie virtual iter_type 138003a78d15Sespie do_get_year(iter_type __beg, iter_type __end, ios_base& __io, 138103a78d15Sespie ios_base::iostate& __err, tm* __tm) const; 138203a78d15Sespie 138303a78d15Sespie // Extract numeric component of length __len. 138403a78d15Sespie void 138503a78d15Sespie _M_extract_num(iter_type& __beg, iter_type& __end, int& __member, 138603a78d15Sespie int __min, int __max, size_t __len, 138703a78d15Sespie const ctype<_CharT>& __ctype, 138803a78d15Sespie ios_base::iostate& __err) const; 138903a78d15Sespie 139003a78d15Sespie // Extract day or month name, or any unique array of string 139103a78d15Sespie // literals in a const _CharT* array. 139203a78d15Sespie void 139303a78d15Sespie _M_extract_name(iter_type& __beg, iter_type& __end, int& __member, 139403a78d15Sespie const _CharT** __names, size_t __indexlen, 139503a78d15Sespie ios_base::iostate& __err) const; 139603a78d15Sespie 139703a78d15Sespie // Extract on a component-by-component basis, via __format argument. 139803a78d15Sespie void 139903a78d15Sespie _M_extract_via_format(iter_type& __beg, iter_type& __end, ios_base& __io, 140003a78d15Sespie ios_base::iostate& __err, tm* __tm, 140103a78d15Sespie const _CharT* __format) const; 140203a78d15Sespie }; 140303a78d15Sespie 140403a78d15Sespie template<typename _CharT, typename _InIter> 140503a78d15Sespie locale::id time_get<_CharT, _InIter>::id; 140603a78d15Sespie 140703a78d15Sespie template<typename _CharT, typename _InIter> 140803a78d15Sespie class time_get_byname : public time_get<_CharT, _InIter> 140903a78d15Sespie { 141003a78d15Sespie public: 141103a78d15Sespie // Types: 141203a78d15Sespie typedef _CharT char_type; 141303a78d15Sespie typedef _InIter iter_type; 141403a78d15Sespie 141503a78d15Sespie explicit 141603a78d15Sespie time_get_byname(const char*, size_t __refs = 0) 141703a78d15Sespie : time_get<_CharT, _InIter>(__refs) { } 141803a78d15Sespie 141903a78d15Sespie protected: 142003a78d15Sespie virtual ~time_get_byname()142103a78d15Sespie ~time_get_byname() { } 142203a78d15Sespie }; 142303a78d15Sespie 142403a78d15Sespie template<typename _CharT, typename _OutIter> 142503a78d15Sespie class time_put : public locale::facet, public time_base 142603a78d15Sespie { 142703a78d15Sespie public: 142803a78d15Sespie // Types: 142903a78d15Sespie typedef _CharT char_type; 143003a78d15Sespie typedef _OutIter iter_type; 143103a78d15Sespie 143203a78d15Sespie static locale::id id; 143303a78d15Sespie 143403a78d15Sespie explicit 143503a78d15Sespie time_put(size_t __refs = 0) facet(__refs)143603a78d15Sespie : locale::facet(__refs) { } 143703a78d15Sespie 143803a78d15Sespie iter_type 143903a78d15Sespie put(iter_type __s, ios_base& __io, char_type __fill, const tm* __tm, 144003a78d15Sespie const _CharT* __beg, const _CharT* __end) const; 144103a78d15Sespie 144203a78d15Sespie iter_type 144303a78d15Sespie put(iter_type __s, ios_base& __io, char_type __fill, 144403a78d15Sespie const tm* __tm, char __format, char __mod = 0) const 144503a78d15Sespie { return this->do_put(__s, __io, __fill, __tm, __format, __mod); } 144603a78d15Sespie 144703a78d15Sespie protected: 144803a78d15Sespie virtual ~time_put()144903a78d15Sespie ~time_put() 145003a78d15Sespie { } 145103a78d15Sespie 145203a78d15Sespie virtual iter_type 145303a78d15Sespie do_put(iter_type __s, ios_base& __io, char_type __fill, const tm* __tm, 145403a78d15Sespie char __format, char __mod) const; 145503a78d15Sespie }; 145603a78d15Sespie 145703a78d15Sespie template<typename _CharT, typename _OutIter> 145803a78d15Sespie locale::id time_put<_CharT, _OutIter>::id; 145903a78d15Sespie 146003a78d15Sespie template<typename _CharT, typename _OutIter> 146103a78d15Sespie class time_put_byname : public time_put<_CharT, _OutIter> 146203a78d15Sespie { 146303a78d15Sespie public: 146403a78d15Sespie // Types: 146503a78d15Sespie typedef _CharT char_type; 146603a78d15Sespie typedef _OutIter iter_type; 146703a78d15Sespie 146803a78d15Sespie explicit 146903a78d15Sespie time_put_byname(const char* /*__s*/, size_t __refs = 0) 147003a78d15Sespie : time_put<_CharT, _OutIter>(__refs) 147103a78d15Sespie { }; 147203a78d15Sespie 147303a78d15Sespie protected: 147403a78d15Sespie virtual ~time_put_byname()147503a78d15Sespie ~time_put_byname() { } 147603a78d15Sespie }; 147703a78d15Sespie 147803a78d15Sespie 147903a78d15Sespie class money_base 148003a78d15Sespie { 148103a78d15Sespie public: 148203a78d15Sespie enum part { none, space, symbol, sign, value }; 148303a78d15Sespie struct pattern { char field[4]; }; 148403a78d15Sespie 148503a78d15Sespie static const pattern _S_default_pattern; 148603a78d15Sespie 148703a78d15Sespie // Construct and return valid pattern consisting of some combination of: 148803a78d15Sespie // space none symbol sign value 148903a78d15Sespie static pattern 149003a78d15Sespie _S_construct_pattern(char __precedes, char __space, char __posn); 149103a78d15Sespie }; 149203a78d15Sespie 149303a78d15Sespie template<typename _CharT, bool _Intl> 149403a78d15Sespie class moneypunct : public locale::facet, public money_base 149503a78d15Sespie { 149603a78d15Sespie public: 149703a78d15Sespie // Types: 149803a78d15Sespie typedef _CharT char_type; 149903a78d15Sespie typedef basic_string<_CharT> string_type; 150003a78d15Sespie 150103a78d15Sespie static const bool intl = _Intl; 150203a78d15Sespie static locale::id id; 150303a78d15Sespie 150403a78d15Sespie private: 150503a78d15Sespie const char* _M_grouping; 150603a78d15Sespie char_type _M_decimal_point; 150703a78d15Sespie char_type _M_thousands_sep; 150803a78d15Sespie const char_type* _M_curr_symbol; 150903a78d15Sespie const char_type* _M_positive_sign; 151003a78d15Sespie const char_type* _M_negative_sign; 151103a78d15Sespie int _M_frac_digits; 151203a78d15Sespie pattern _M_pos_format; 151303a78d15Sespie pattern _M_neg_format; 151403a78d15Sespie 151503a78d15Sespie public: 151603a78d15Sespie explicit facet(__refs)151703a78d15Sespie moneypunct(size_t __refs = 0) : locale::facet(__refs) 151803a78d15Sespie { _M_initialize_moneypunct(); } 151903a78d15Sespie 152003a78d15Sespie explicit 152103a78d15Sespie moneypunct(__c_locale __cloc, const char* __s, size_t __refs = 0) facet(__refs)152203a78d15Sespie : locale::facet(__refs) 152303a78d15Sespie { _M_initialize_moneypunct(__cloc, __s); } 152403a78d15Sespie 152503a78d15Sespie char_type decimal_point()152603a78d15Sespie decimal_point() const 152703a78d15Sespie { return this->do_decimal_point(); } 152803a78d15Sespie 152903a78d15Sespie char_type thousands_sep()153003a78d15Sespie thousands_sep() const 153103a78d15Sespie { return this->do_thousands_sep(); } 153203a78d15Sespie 153303a78d15Sespie string grouping()153403a78d15Sespie grouping() const 153503a78d15Sespie { return this->do_grouping(); } 153603a78d15Sespie 153703a78d15Sespie string_type curr_symbol()153803a78d15Sespie curr_symbol() const 153903a78d15Sespie { return this->do_curr_symbol(); } 154003a78d15Sespie 154103a78d15Sespie string_type positive_sign()154203a78d15Sespie positive_sign() const 154303a78d15Sespie { return this->do_positive_sign(); } 154403a78d15Sespie 154503a78d15Sespie string_type negative_sign()154603a78d15Sespie negative_sign() const 154703a78d15Sespie { return this->do_negative_sign(); } 154803a78d15Sespie 154903a78d15Sespie int frac_digits()155003a78d15Sespie frac_digits() const 155103a78d15Sespie { return this->do_frac_digits(); } 155203a78d15Sespie 155303a78d15Sespie pattern pos_format()155403a78d15Sespie pos_format() const 155503a78d15Sespie { return this->do_pos_format(); } 155603a78d15Sespie 155703a78d15Sespie pattern neg_format()155803a78d15Sespie neg_format() const 155903a78d15Sespie { return this->do_neg_format(); } 156003a78d15Sespie 156103a78d15Sespie protected: 156203a78d15Sespie virtual 156303a78d15Sespie ~moneypunct(); 156403a78d15Sespie 156503a78d15Sespie virtual char_type do_decimal_point()156603a78d15Sespie do_decimal_point() const 156703a78d15Sespie { return _M_decimal_point; } 156803a78d15Sespie 156903a78d15Sespie virtual char_type do_thousands_sep()157003a78d15Sespie do_thousands_sep() const 157103a78d15Sespie { return _M_thousands_sep; } 157203a78d15Sespie 157303a78d15Sespie virtual string do_grouping()157403a78d15Sespie do_grouping() const 157503a78d15Sespie { return _M_grouping; } 157603a78d15Sespie 157703a78d15Sespie virtual string_type do_curr_symbol()157803a78d15Sespie do_curr_symbol() const 157903a78d15Sespie { return _M_curr_symbol; } 158003a78d15Sespie 158103a78d15Sespie virtual string_type do_positive_sign()158203a78d15Sespie do_positive_sign() const 158303a78d15Sespie { return _M_positive_sign; } 158403a78d15Sespie 158503a78d15Sespie virtual string_type do_negative_sign()158603a78d15Sespie do_negative_sign() const 158703a78d15Sespie { return _M_negative_sign; } 158803a78d15Sespie 158903a78d15Sespie virtual int do_frac_digits()159003a78d15Sespie do_frac_digits() const 159103a78d15Sespie { return _M_frac_digits; } 159203a78d15Sespie 159303a78d15Sespie virtual pattern do_pos_format()159403a78d15Sespie do_pos_format() const 159503a78d15Sespie { return _M_pos_format; } 159603a78d15Sespie 159703a78d15Sespie virtual pattern do_neg_format()159803a78d15Sespie do_neg_format() const 159903a78d15Sespie { return _M_neg_format; } 160003a78d15Sespie 160103a78d15Sespie // For use at construction time only. 160203a78d15Sespie void 160303a78d15Sespie _M_initialize_moneypunct(__c_locale __cloc = NULL, 160403a78d15Sespie const char* __name = NULL); 160503a78d15Sespie }; 160603a78d15Sespie 160703a78d15Sespie template<typename _CharT, bool _Intl> 160803a78d15Sespie locale::id moneypunct<_CharT, _Intl>::id; 160903a78d15Sespie 161003a78d15Sespie template<typename _CharT, bool _Intl> 161103a78d15Sespie const bool moneypunct<_CharT, _Intl>::intl; 161203a78d15Sespie 161303a78d15Sespie template<> 161403a78d15Sespie moneypunct<char, true>::~moneypunct(); 161503a78d15Sespie 161603a78d15Sespie template<> 161703a78d15Sespie moneypunct<char, false>::~moneypunct(); 161803a78d15Sespie 161903a78d15Sespie template<> 162003a78d15Sespie void 162103a78d15Sespie moneypunct<char, true>::_M_initialize_moneypunct(__c_locale, const char*); 162203a78d15Sespie 162303a78d15Sespie template<> 162403a78d15Sespie void 162503a78d15Sespie moneypunct<char, false>::_M_initialize_moneypunct(__c_locale, const char*); 162603a78d15Sespie 1627*c2fb3212Sespie #if defined(_GLIBCPP_USE_WCHAR_T) || defined(_GLIBCPP_USE_TYPE_WCHAR_T) 162803a78d15Sespie template<> 162903a78d15Sespie moneypunct<wchar_t, true>::~moneypunct(); 163003a78d15Sespie 163103a78d15Sespie template<> 163203a78d15Sespie moneypunct<wchar_t, false>::~moneypunct(); 163303a78d15Sespie 163403a78d15Sespie template<> 163503a78d15Sespie void 163603a78d15Sespie moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale, 163703a78d15Sespie const char*); 163803a78d15Sespie 163903a78d15Sespie template<> 164003a78d15Sespie void 164103a78d15Sespie moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale, 164203a78d15Sespie const char*); 164303a78d15Sespie #endif 164403a78d15Sespie 164503a78d15Sespie template<typename _CharT, bool _Intl> 164603a78d15Sespie class moneypunct_byname : public moneypunct<_CharT, _Intl> 164703a78d15Sespie { 164803a78d15Sespie __c_locale _M_c_locale_moneypunct; 164903a78d15Sespie 165003a78d15Sespie public: 165103a78d15Sespie typedef _CharT char_type; 165203a78d15Sespie typedef basic_string<_CharT> string_type; 165303a78d15Sespie 165403a78d15Sespie static const bool intl = _Intl; 165503a78d15Sespie 165603a78d15Sespie explicit 165703a78d15Sespie moneypunct_byname(const char* __s, size_t __refs = 0) 165803a78d15Sespie : moneypunct<_CharT, _Intl>(__refs) 165903a78d15Sespie { 166003a78d15Sespie _S_create_c_locale(_M_c_locale_moneypunct, __s); 166103a78d15Sespie _M_initialize_moneypunct(_M_c_locale_moneypunct); 166203a78d15Sespie } 166303a78d15Sespie 166403a78d15Sespie protected: 166503a78d15Sespie virtual ~moneypunct_byname()166603a78d15Sespie ~moneypunct_byname() 166703a78d15Sespie { _S_destroy_c_locale(_M_c_locale_moneypunct); } 166803a78d15Sespie }; 166903a78d15Sespie 167003a78d15Sespie template<typename _CharT, bool _Intl> 167103a78d15Sespie const bool moneypunct_byname<_CharT, _Intl>::intl; 167203a78d15Sespie 167303a78d15Sespie template<typename _CharT, typename _InIter> 167403a78d15Sespie class money_get : public locale::facet 167503a78d15Sespie { 167603a78d15Sespie public: 167703a78d15Sespie // Types: 167803a78d15Sespie typedef _CharT char_type; 167903a78d15Sespie typedef _InIter iter_type; 168003a78d15Sespie typedef basic_string<_CharT> string_type; 168103a78d15Sespie 168203a78d15Sespie static locale::id id; 168303a78d15Sespie 168403a78d15Sespie explicit facet(__refs)168503a78d15Sespie money_get(size_t __refs = 0) : locale::facet(__refs) { } 168603a78d15Sespie 168703a78d15Sespie iter_type get(iter_type __s,iter_type __end,bool __intl,ios_base & __io,ios_base::iostate & __err,long double & __units)168803a78d15Sespie get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, 168903a78d15Sespie ios_base::iostate& __err, long double& __units) const 169003a78d15Sespie { return this->do_get(__s, __end, __intl, __io, __err, __units); } 169103a78d15Sespie 169203a78d15Sespie iter_type get(iter_type __s,iter_type __end,bool __intl,ios_base & __io,ios_base::iostate & __err,string_type & __digits)169303a78d15Sespie get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, 169403a78d15Sespie ios_base::iostate& __err, string_type& __digits) const 169503a78d15Sespie { return this->do_get(__s, __end, __intl, __io, __err, __digits); } 169603a78d15Sespie 169703a78d15Sespie protected: 169803a78d15Sespie virtual ~money_get()169903a78d15Sespie ~money_get() { } 170003a78d15Sespie 170103a78d15Sespie virtual iter_type 170203a78d15Sespie do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, 170303a78d15Sespie ios_base::iostate& __err, long double& __units) const; 170403a78d15Sespie 170503a78d15Sespie virtual iter_type 170603a78d15Sespie do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, 170703a78d15Sespie ios_base::iostate& __err, string_type& __digits) const; 170803a78d15Sespie }; 170903a78d15Sespie 171003a78d15Sespie template<typename _CharT, typename _InIter> 171103a78d15Sespie locale::id money_get<_CharT, _InIter>::id; 171203a78d15Sespie 171303a78d15Sespie template<typename _CharT, typename _OutIter> 171403a78d15Sespie class money_put : public locale::facet 171503a78d15Sespie { 171603a78d15Sespie public: 171703a78d15Sespie typedef _CharT char_type; 171803a78d15Sespie typedef _OutIter iter_type; 171903a78d15Sespie typedef basic_string<_CharT> string_type; 172003a78d15Sespie 172103a78d15Sespie static locale::id id; 172203a78d15Sespie 172303a78d15Sespie explicit facet(__refs)172403a78d15Sespie money_put(size_t __refs = 0) : locale::facet(__refs) { } 172503a78d15Sespie 172603a78d15Sespie iter_type put(iter_type __s,bool __intl,ios_base & __io,char_type __fill,long double __units)172703a78d15Sespie put(iter_type __s, bool __intl, ios_base& __io, 172803a78d15Sespie char_type __fill, long double __units) const 172903a78d15Sespie { return this->do_put(__s, __intl, __io, __fill, __units); } 173003a78d15Sespie 173103a78d15Sespie iter_type put(iter_type __s,bool __intl,ios_base & __io,char_type __fill,const string_type & __digits)173203a78d15Sespie put(iter_type __s, bool __intl, ios_base& __io, 173303a78d15Sespie char_type __fill, const string_type& __digits) const 173403a78d15Sespie { return this->do_put(__s, __intl, __io, __fill, __digits); } 173503a78d15Sespie 173603a78d15Sespie protected: 173703a78d15Sespie virtual ~money_put()173803a78d15Sespie ~money_put() { } 173903a78d15Sespie 174003a78d15Sespie virtual iter_type 174103a78d15Sespie do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, 174203a78d15Sespie long double __units) const; 174303a78d15Sespie 174403a78d15Sespie virtual iter_type 174503a78d15Sespie do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, 174603a78d15Sespie const string_type& __digits) const; 174703a78d15Sespie }; 174803a78d15Sespie 174903a78d15Sespie template<typename _CharT, typename _OutIter> 175003a78d15Sespie locale::id money_put<_CharT, _OutIter>::id; 175103a78d15Sespie 175203a78d15Sespie 175303a78d15Sespie struct messages_base 175403a78d15Sespie { 175503a78d15Sespie typedef int catalog; 175603a78d15Sespie }; 175703a78d15Sespie 175803a78d15Sespie template<typename _CharT> 175903a78d15Sespie class messages : public locale::facet, public messages_base 176003a78d15Sespie { 176103a78d15Sespie public: 176203a78d15Sespie // Types: 176303a78d15Sespie typedef _CharT char_type; 176403a78d15Sespie typedef basic_string<_CharT> string_type; 176503a78d15Sespie 176603a78d15Sespie protected: 176703a78d15Sespie // Underlying "C" library locale information saved from 176803a78d15Sespie // initialization, needed by messages_byname as well. 176903a78d15Sespie __c_locale _M_c_locale_messages; 177003a78d15Sespie char* _M_name_messages; 177103a78d15Sespie 177203a78d15Sespie public: 177303a78d15Sespie static locale::id id; 177403a78d15Sespie 177503a78d15Sespie explicit 177603a78d15Sespie messages(size_t __refs = 0); 177703a78d15Sespie 177803a78d15Sespie // Non-standard. 177903a78d15Sespie explicit 178003a78d15Sespie messages(__c_locale __cloc, const char* __s, size_t __refs = 0); 178103a78d15Sespie 178203a78d15Sespie catalog open(const basic_string<char> & __s,const locale & __loc)178303a78d15Sespie open(const basic_string<char>& __s, const locale& __loc) const 178403a78d15Sespie { return this->do_open(__s, __loc); } 178503a78d15Sespie 178603a78d15Sespie // Non-standard and unorthodox, yet effective. 178703a78d15Sespie catalog 178803a78d15Sespie open(const basic_string<char>&, const locale&, const char*) const; 178903a78d15Sespie 179003a78d15Sespie string_type get(catalog __c,int __set,int __msgid,const string_type & __s)179103a78d15Sespie get(catalog __c, int __set, int __msgid, const string_type& __s) const 179203a78d15Sespie { return this->do_get(__c, __set, __msgid, __s); } 179303a78d15Sespie 179403a78d15Sespie void close(catalog __c)179503a78d15Sespie close(catalog __c) const 179603a78d15Sespie { return this->do_close(__c); } 179703a78d15Sespie 179803a78d15Sespie protected: 179903a78d15Sespie virtual 180003a78d15Sespie ~messages(); 180103a78d15Sespie 180203a78d15Sespie virtual catalog 180303a78d15Sespie do_open(const basic_string<char>&, const locale&) const; 180403a78d15Sespie 180503a78d15Sespie virtual string_type 180603a78d15Sespie do_get(catalog, int, int, const string_type& __dfault) const; 180703a78d15Sespie 180803a78d15Sespie virtual void 180903a78d15Sespie do_close(catalog) const; 181003a78d15Sespie 181103a78d15Sespie // Returns a locale and codeset-converted string, given a char* message. 181203a78d15Sespie char* _M_convert_to_char(const string_type & __msg)181303a78d15Sespie _M_convert_to_char(const string_type& __msg) const 181403a78d15Sespie { 181503a78d15Sespie // XXX 181603a78d15Sespie return reinterpret_cast<char*>(const_cast<_CharT*>(__msg.c_str())); 181703a78d15Sespie } 181803a78d15Sespie 181903a78d15Sespie // Returns a locale and codeset-converted string, given a char* message. 182003a78d15Sespie string_type _M_convert_from_char(char * __msg)182103a78d15Sespie _M_convert_from_char(char* __msg) const 182203a78d15Sespie { 182303a78d15Sespie // Length of message string without terminating null. 182403a78d15Sespie size_t __len = char_traits<char>::length(__msg) - 1; 182503a78d15Sespie 182603a78d15Sespie // "everybody can easily convert the string using 182703a78d15Sespie // mbsrtowcs/wcsrtombs or with iconv()" 182803a78d15Sespie #if 0 182903a78d15Sespie // Convert char* to _CharT in locale used to open catalog. 183003a78d15Sespie // XXX need additional template parameter on messages class for this.. 183103a78d15Sespie // typedef typename codecvt<char, _CharT, _StateT> __codecvt_type; 183203a78d15Sespie typedef typename codecvt<char, _CharT, mbstate_t> __codecvt_type; 183303a78d15Sespie 183403a78d15Sespie __codecvt_type::state_type __state; 183503a78d15Sespie // XXX may need to initialize state. 183603a78d15Sespie //initialize_state(__state._M_init()); 183703a78d15Sespie 183803a78d15Sespie char* __from_next; 183903a78d15Sespie // XXX what size for this string? 184003a78d15Sespie _CharT* __to = static_cast<_CharT*>(__builtin_alloca(__len + 1)); 184103a78d15Sespie const __codecvt_type& __cvt = use_facet<__codecvt_type>(_M_locale_conv); 184203a78d15Sespie __cvt.out(__state, __msg, __msg + __len, __from_next, 184303a78d15Sespie __to, __to + __len + 1, __to_next); 184403a78d15Sespie return string_type(__to); 184503a78d15Sespie #endif 184603a78d15Sespie #if 0 184703a78d15Sespie typedef ctype<_CharT> __ctype_type; 184803a78d15Sespie // const __ctype_type& __cvt = use_facet<__ctype_type>(_M_locale_msg); 184903a78d15Sespie const __ctype_type& __cvt = use_facet<__ctype_type>(locale()); 185003a78d15Sespie // XXX Again, proper length of converted string an issue here. 185103a78d15Sespie // For now, assume the converted length is not larger. 185203a78d15Sespie _CharT* __dest = static_cast<_CharT*>(__builtin_alloca(__len + 1)); 185303a78d15Sespie __cvt.widen(__msg, __msg + __len, __dest); 185403a78d15Sespie return basic_string<_CharT>(__dest); 185503a78d15Sespie #endif 185603a78d15Sespie return string_type(); 185703a78d15Sespie } 185803a78d15Sespie }; 185903a78d15Sespie 186003a78d15Sespie template<typename _CharT> 186103a78d15Sespie locale::id messages<_CharT>::id; 186203a78d15Sespie 186303a78d15Sespie // Specializations for required instantiations. 186403a78d15Sespie template<> 186503a78d15Sespie string 186603a78d15Sespie messages<char>::do_get(catalog, int, int, const string&) const; 186703a78d15Sespie 1868*c2fb3212Sespie #if defined(_GLIBCPP_USE_WCHAR_T) || defined(_GLIBCPP_USE_TYPE_WCHAR_T) 186903a78d15Sespie template<> 187003a78d15Sespie wstring 187103a78d15Sespie messages<wchar_t>::do_get(catalog, int, int, const wstring&) const; 187203a78d15Sespie #endif 187303a78d15Sespie 187403a78d15Sespie template<typename _CharT> 187503a78d15Sespie class messages_byname : public messages<_CharT> 187603a78d15Sespie { 187703a78d15Sespie public: 187803a78d15Sespie typedef _CharT char_type; 187903a78d15Sespie typedef basic_string<_CharT> string_type; 188003a78d15Sespie 188103a78d15Sespie explicit 188203a78d15Sespie messages_byname(const char* __s, size_t __refs = 0); 188303a78d15Sespie 188403a78d15Sespie protected: 188503a78d15Sespie virtual ~messages_byname()188603a78d15Sespie ~messages_byname() 188703a78d15Sespie { } 188803a78d15Sespie }; 188903a78d15Sespie 189003a78d15Sespie // Include host and configuration specific messages functions. 189103a78d15Sespie #include <bits/messages_members.h> 189203a78d15Sespie 189303a78d15Sespie 189403a78d15Sespie // Subclause convenience interfaces, inlines. 189503a78d15Sespie // NB: These are inline because, when used in a loop, some compilers 189603a78d15Sespie // can hoist the body out of the loop; then it's just as fast as the 189703a78d15Sespie // C is*() function. 189803a78d15Sespie template<typename _CharT> 189903a78d15Sespie inline bool isspace(_CharT __c,const locale & __loc)190003a78d15Sespie isspace(_CharT __c, const locale& __loc) 190103a78d15Sespie { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c); } 190203a78d15Sespie 190303a78d15Sespie template<typename _CharT> 190403a78d15Sespie inline bool isprint(_CharT __c,const locale & __loc)190503a78d15Sespie isprint(_CharT __c, const locale& __loc) 190603a78d15Sespie { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c); } 190703a78d15Sespie 190803a78d15Sespie template<typename _CharT> 190903a78d15Sespie inline bool iscntrl(_CharT __c,const locale & __loc)191003a78d15Sespie iscntrl(_CharT __c, const locale& __loc) 191103a78d15Sespie { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c); } 191203a78d15Sespie 191303a78d15Sespie template<typename _CharT> 191403a78d15Sespie inline bool isupper(_CharT __c,const locale & __loc)191503a78d15Sespie isupper(_CharT __c, const locale& __loc) 191603a78d15Sespie { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c); } 191703a78d15Sespie 191803a78d15Sespie template<typename _CharT> islower(_CharT __c,const locale & __loc)191903a78d15Sespie inline bool islower(_CharT __c, const locale& __loc) 192003a78d15Sespie { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c); } 192103a78d15Sespie 192203a78d15Sespie template<typename _CharT> 192303a78d15Sespie inline bool isalpha(_CharT __c,const locale & __loc)192403a78d15Sespie isalpha(_CharT __c, const locale& __loc) 192503a78d15Sespie { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c); } 192603a78d15Sespie 192703a78d15Sespie template<typename _CharT> 192803a78d15Sespie inline bool isdigit(_CharT __c,const locale & __loc)192903a78d15Sespie isdigit(_CharT __c, const locale& __loc) 193003a78d15Sespie { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c); } 193103a78d15Sespie 193203a78d15Sespie template<typename _CharT> 193303a78d15Sespie inline bool ispunct(_CharT __c,const locale & __loc)193403a78d15Sespie ispunct(_CharT __c, const locale& __loc) 193503a78d15Sespie { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c); } 193603a78d15Sespie 193703a78d15Sespie template<typename _CharT> 193803a78d15Sespie inline bool isxdigit(_CharT __c,const locale & __loc)193903a78d15Sespie isxdigit(_CharT __c, const locale& __loc) 194003a78d15Sespie { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c); } 194103a78d15Sespie 194203a78d15Sespie template<typename _CharT> 194303a78d15Sespie inline bool isalnum(_CharT __c,const locale & __loc)194403a78d15Sespie isalnum(_CharT __c, const locale& __loc) 194503a78d15Sespie { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c); } 194603a78d15Sespie 194703a78d15Sespie template<typename _CharT> 194803a78d15Sespie inline bool isgraph(_CharT __c,const locale & __loc)194903a78d15Sespie isgraph(_CharT __c, const locale& __loc) 195003a78d15Sespie { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c); } 195103a78d15Sespie 195203a78d15Sespie template<typename _CharT> 195303a78d15Sespie inline _CharT toupper(_CharT __c,const locale & __loc)195403a78d15Sespie toupper(_CharT __c, const locale& __loc) 195503a78d15Sespie { return use_facet<ctype<_CharT> >(__loc).toupper(__c); } 195603a78d15Sespie 195703a78d15Sespie template<typename _CharT> 195803a78d15Sespie inline _CharT tolower(_CharT __c,const locale & __loc)195903a78d15Sespie tolower(_CharT __c, const locale& __loc) 196003a78d15Sespie { return use_facet<ctype<_CharT> >(__loc).tolower(__c); } 196103a78d15Sespie 196203a78d15Sespie /** 196303a78d15Sespie * @if maint 196403a78d15Sespie * __locale_cache objects hold information extracted from facets in 196503a78d15Sespie * a form optimized for parsing and formatting. They are stored in 196603a78d15Sespie * a locale's facet array and accessed via __use_cache<_Facet>. 196703a78d15Sespie * 196803a78d15Sespie * The intent twofold: to avoid the costs of creating a locale 196903a78d15Sespie * object and to avoid calling the virtual functions in a locale's 197003a78d15Sespie * facet to look up data. 197103a78d15Sespie * @endif 197203a78d15Sespie */ 197303a78d15Sespie class __locale_cache_base 197403a78d15Sespie { 197503a78d15Sespie friend class std::locale::_Impl; 197603a78d15Sespie friend class locale; 197703a78d15Sespie 197803a78d15Sespie public: 197903a78d15Sespie virtual ~__locale_cache_base()198003a78d15Sespie ~__locale_cache_base() { } 198103a78d15Sespie 198203a78d15Sespie }; 198303a78d15Sespie 198403a78d15Sespie // This template doesn't really get used for anything except a 198503a78d15Sespie // placeholder for specializations 198603a78d15Sespie template<typename _Facet> 198703a78d15Sespie class __locale_cache : public __locale_cache_base 198803a78d15Sespie { 198903a78d15Sespie // ctor __locale_cache(const locale &)199003a78d15Sespie __locale_cache(const locale&) {} 199103a78d15Sespie }; 199203a78d15Sespie 199303a78d15Sespie template<typename _CharT> 199403a78d15Sespie class __locale_cache<numpunct<_CharT> > : public __locale_cache_base 199503a78d15Sespie { 199603a78d15Sespie // Types: 199703a78d15Sespie typedef _CharT char_type; 199803a78d15Sespie typedef char_traits<_CharT> traits_type; 199903a78d15Sespie typedef basic_string<_CharT> string_type; 200003a78d15Sespie 200103a78d15Sespie public: 200203a78d15Sespie // Data Members: 200303a78d15Sespie 200403a78d15Sespie // The sign used to separate decimal values: for standard US 200503a78d15Sespie // locales, this would usually be: "." Abstracted from 200603a78d15Sespie // numpunct::decimal_point(). 200703a78d15Sespie _CharT _M_decimal_point; 200803a78d15Sespie 200903a78d15Sespie // The sign used to separate groups of digits into smaller 201003a78d15Sespie // strings that the eye can parse with less difficulty: for 201103a78d15Sespie // standard US locales, this would usually be: "," Abstracted 201203a78d15Sespie // from numpunct::thousands_sep(). 201303a78d15Sespie _CharT _M_thousands_sep; 201403a78d15Sespie 201503a78d15Sespie // However the US's "false" and "true" are translated. From 201603a78d15Sespie // numpunct::truename() and numpunct::falsename(), respectively. 201703a78d15Sespie const _CharT* _M_truename; 201803a78d15Sespie const _CharT* _M_falsename; 201903a78d15Sespie 202003a78d15Sespie // If we are checking groupings. This should be equivalent to 202103a78d15Sespie // numpunct::groupings().size() != 0 202203a78d15Sespie bool _M_use_grouping; 202303a78d15Sespie 202403a78d15Sespie // If we are using numpunct's groupings, this is the current 202503a78d15Sespie // grouping string in effect (from numpunct::grouping()). 202603a78d15Sespie const char* _M_grouping; 202703a78d15Sespie 202803a78d15Sespie // A list of valid numeric literals: for the standard "C" 202903a78d15Sespie // locale, this is "-+xX0123456789abcdef0123456789ABCDEF". This 203003a78d15Sespie // array contains the chars after having been passed through the 203103a78d15Sespie // current locale's ctype<_CharT>.widen(). 203203a78d15Sespie 203303a78d15Sespie // Copied here from __locale_cache<ctype> to save multiple cache 203403a78d15Sespie // access in num_put functions. 203503a78d15Sespie _CharT _M_atoms_out[__num_base::_S_end]; 203603a78d15Sespie 203703a78d15Sespie // ctor 203803a78d15Sespie __locale_cache(const locale& __loc); 203903a78d15Sespie __locale_cache(const locale& __loc, bool); 204003a78d15Sespie ~__locale_cache()204103a78d15Sespie ~__locale_cache() 204203a78d15Sespie { 204303a78d15Sespie delete [] _M_truename; 204403a78d15Sespie delete [] _M_falsename; 204503a78d15Sespie delete [] _M_grouping; 204603a78d15Sespie } 204703a78d15Sespie }; 204803a78d15Sespie } // namespace std 204903a78d15Sespie 205003a78d15Sespie #endif 2051