Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

locale_facets.h

Go to the documentation of this file.
00001 // Locale support -*- C++ -*-
00002 
00003 // Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
00004 //
00005 // This file is part of the GNU ISO C++ Library.  This library is free
00006 // software; you can redistribute it and/or modify it under the
00007 // terms of the GNU General Public License as published by the
00008 // Free Software Foundation; either version 2, or (at your option)
00009 // any later version.
00010 
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU General Public License for more details.
00015 
00016 // You should have received a copy of the GNU General Public License along
00017 // with this library; see the file COPYING.  If not, write to the Free
00018 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
00019 // USA.
00020 
00021 // As a special exception, you may use this file as part of a free software
00022 // library without restriction.  Specifically, if other files instantiate
00023 // templates or use macros or inline functions from this file, or you compile
00024 // this file and link it with other files to produce an executable, this
00025 // file does not by itself cause the resulting executable to be covered by
00026 // the GNU General Public License.  This exception does not however
00027 // invalidate any other reasons why the executable file might be covered by
00028 // the GNU General Public License.
00029 
00030 //
00031 // ISO C++ 14882: 22.1  Locales
00032 //
00033 
00034 // Warning: this file is not meant for user inclusion.  Use <locale>.
00035 
00036 #ifndef _CPP_BITS_LOCFACETS_H
00037 #define _CPP_BITS_LOCFACETS_H   1
00038 
00039 #pragma GCC system_header
00040 
00041 #include <bits/std_ctime.h> // For struct tm
00042 #include <bits/std_ios.h>   // For ios_base
00043 #ifdef _GLIBCPP_USE_WCHAR_T
00044 # include <langinfo.h>      // For codecvt
00045 # include <bits/std_cwctype.h>  // For wctype_t
00046 # include <iconv.h>     // For codecvt using iconv, iconv_t
00047 #endif 
00048 
00049 namespace std
00050 {
00051   // 22.2.1.1  Template class ctype
00052   // Include host-specific ctype enums for ctype_base.
00053   #include <bits/ctype_base.h>
00054 
00055   // __ctype_abstract_base is the common base for ctype<_CharT>.  
00056   template<typename _CharT>
00057     class __ctype_abstract_base : public locale::facet, public ctype_base
00058     {
00059     public:
00060       // Types:
00061       typedef _CharT char_type;
00062 
00063       bool 
00064       is(mask __m, char_type __c) const
00065       { return this->do_is(__m, __c); }
00066 
00067       const char_type*
00068       is(const char_type *__lo, const char_type *__hi, mask *__vec) const   
00069       { return this->do_is(__lo, __hi, __vec); }
00070 
00071       const char_type*
00072       scan_is(mask __m, const char_type* __lo, const char_type* __hi) const
00073       { return this->do_scan_is(__m, __lo, __hi); }
00074 
00075       const char_type*
00076       scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
00077       { return this->do_scan_not(__m, __lo, __hi); }
00078 
00079       char_type 
00080       toupper(char_type __c) const
00081       { return this->do_toupper(__c); }
00082 
00083       const char_type*
00084       toupper(char_type *__low, const char_type* __high) const
00085       { return this->do_toupper(__low, __high); }
00086 
00087       char_type 
00088       tolower(char_type __c) const
00089       { return this->do_tolower(__c); }
00090 
00091       const char_type*
00092       tolower(char_type* __low, const char_type* __high) const
00093       { return this->do_tolower(__low, __high); }
00094 
00095       char_type 
00096       widen(char __c) const
00097       { return this->do_widen(__c); }
00098 
00099       const char*
00100       widen(const char* __low, const char* __high, char_type* __to) const
00101       { return this->do_widen(__low, __high, __to); }
00102 
00103       char 
00104       narrow(char_type __c, char __dfault) const
00105       { return this->do_narrow(__c, __dfault); }
00106 
00107       const char_type*
00108       narrow(const char_type* __low, const char_type* __high,
00109           char __dfault, char *__to) const
00110       { return this->do_narrow(__low, __high, __dfault, __to); }
00111 
00112     protected:
00113       explicit 
00114       __ctype_abstract_base(size_t __refs = 0): locale::facet(__refs) { }
00115 
00116       virtual 
00117       ~__ctype_abstract_base() { }
00118       
00119       virtual bool 
00120       do_is(mask __m, char_type __c) const = 0;
00121 
00122       virtual const char_type*
00123       do_is(const char_type* __lo, const char_type* __hi, 
00124         mask* __vec) const = 0;
00125 
00126       virtual const char_type*
00127       do_scan_is(mask __m, const char_type* __lo, 
00128          const char_type* __hi) const = 0;
00129 
00130       virtual const char_type*
00131       do_scan_not(mask __m, const char_type* __lo, 
00132           const char_type* __hi) const = 0;
00133 
00134       virtual char_type 
00135       do_toupper(char_type) const = 0;
00136 
00137       virtual const char_type*
00138       do_toupper(char_type* __low, const char_type* __high) const = 0;
00139 
00140       virtual char_type 
00141       do_tolower(char_type) const = 0;
00142 
00143       virtual const char_type*
00144       do_tolower(char_type* __low, const char_type* __high) const = 0;
00145       
00146       virtual char_type 
00147       do_widen(char) const = 0;
00148 
00149       virtual const char*
00150       do_widen(const char* __low, const char* __high,
00151            char_type* __dest) const = 0;
00152 
00153       virtual char 
00154       do_narrow(char_type, char __dfault) const = 0;
00155 
00156       virtual const char_type*
00157       do_narrow(const char_type* __low, const char_type* __high,
00158          char __dfault, char* __dest) const = 0;
00159     };
00160 
00161   // NB: Generic, mostly useless implementation.
00162   template<typename _CharT>
00163     class ctype : public __ctype_abstract_base<_CharT>
00164     {
00165     public:
00166       // Types:
00167       typedef _CharT            char_type;
00168       typedef typename ctype::mask  mask;
00169 
00170       explicit 
00171       ctype(size_t __refs = 0) : __ctype_abstract_base<_CharT>(__refs) { }
00172 
00173       static locale::id id;
00174 
00175    protected:
00176       virtual 
00177       ~ctype() { }
00178     };
00179 
00180   template<typename _CharT>
00181     locale::id ctype<_CharT>::id;
00182 
00183   // 22.2.1.3  ctype specializations
00184   template<>
00185     class ctype<char> : public __ctype_abstract_base<char>
00186     {
00187     public:
00188       // Types:
00189       typedef char         char_type;
00190 
00191     private:
00192       // Data Members:
00193       bool             _M_del;
00194       __to_type const&         _M_toupper;
00195       __to_type const&         _M_tolower;
00196       const mask* const&       _M_ctable;
00197       const mask*              _M_table;
00198       
00199     public:
00200       static locale::id        id;
00201       static const size_t      table_size = 1 + static_cast<unsigned char>(-1);
00202 
00203       explicit 
00204       ctype(const mask* __table = 0, bool __del = false, size_t __refs = 0);
00205 
00206       inline bool 
00207       is(mask __m, char __c) const;
00208  
00209       inline const char*
00210       is(const char* __low, const char* __high, mask* __vec) const;
00211  
00212       inline const char*
00213       scan_is(mask __m, const char* __low, const char* __high) const;
00214 
00215       inline const char*
00216       scan_not(mask __m, const char* __low, const char* __high) const;
00217      
00218     protected:
00219       virtual 
00220       ~ctype();
00221 
00222       const mask* 
00223       table() const throw()
00224       { return _M_table; }
00225 
00226       const mask* 
00227       classic_table() throw()
00228       { return _M_ctable; }
00229 
00230       virtual bool 
00231       do_is(mask __m, char_type __c) const;
00232 
00233       virtual const char_type*
00234       do_is(const char_type* __lo, const char_type* __hi, 
00235         mask* __vec) const;
00236 
00237       virtual const char_type*
00238       do_scan_is(mask __m, const char_type* __lo, 
00239          const char_type* __hi) const;
00240 
00241       virtual const char_type*
00242       do_scan_not(mask __m, const char_type* __lo, 
00243           const char_type* __hi) const;
00244 
00245       virtual char_type 
00246       do_toupper(char_type) const;
00247 
00248       virtual const char_type*
00249       do_toupper(char_type* __low, const char_type* __high) const;
00250 
00251       virtual char_type 
00252       do_tolower(char_type) const;
00253 
00254       virtual const char_type*
00255       do_tolower(char_type* __low, const char_type* __high) const;
00256       
00257       virtual char_type 
00258       do_widen(char) const;
00259 
00260       virtual const char*
00261       do_widen(const char* __low, const char* __high,
00262            char_type* __dest) const;
00263 
00264       virtual char 
00265       do_narrow(char_type, char __dfault) const;
00266 
00267       virtual const char_type*
00268       do_narrow(const char_type* __low, const char_type* __high,
00269          char __dfault, char* __dest) const;
00270     };
00271  
00272   template<>
00273     const ctype<char>&
00274     use_facet<ctype<char> >(const locale& __loc);
00275 
00276 #ifdef _GLIBCPP_USE_WCHAR_T
00277   // ctype<wchar_t> specialization
00278   template<>
00279     class ctype<wchar_t> : public __ctype_abstract_base<wchar_t>
00280     {
00281     public:
00282       // Types:
00283       typedef wchar_t          char_type;
00284       typedef wctype_t         __wmask_type;
00285 
00286       // Data Members:
00287       static locale::id        id;
00288 
00289       explicit 
00290       ctype(size_t __refs = 0);
00291 
00292     protected:
00293       __wmask_type
00294       _M_convert_to_wmask(const mask __m) const;
00295 
00296       virtual 
00297       ~ctype();
00298 
00299       virtual bool 
00300       do_is(mask __m, char_type __c) const;
00301 
00302       virtual const char_type*
00303       do_is(const char_type* __lo, const char_type* __hi, 
00304         mask* __vec) const;
00305 
00306       virtual const char_type*
00307       do_scan_is(mask __m, const char_type* __lo, 
00308          const char_type* __hi) const;
00309 
00310       virtual const char_type*
00311       do_scan_not(mask __m, const char_type* __lo, 
00312           const char_type* __hi) const;
00313 
00314       virtual char_type 
00315       do_toupper(char_type) const;
00316 
00317       virtual const char_type*
00318       do_toupper(char_type* __low, const char_type* __high) const;
00319 
00320       virtual char_type 
00321       do_tolower(char_type) const;
00322 
00323       virtual const char_type*
00324       do_tolower(char_type* __low, const char_type* __high) const;
00325       
00326       virtual char_type 
00327       do_widen(char) const;
00328 
00329       virtual const char*
00330       do_widen(const char* __low, const char* __high,
00331            char_type* __dest) const;
00332 
00333       virtual char 
00334       do_narrow(char_type, char __dfault) const;
00335 
00336       virtual const char_type*
00337       do_narrow(const char_type* __low, const char_type* __high,
00338          char __dfault, char* __dest) const;
00339 
00340     };
00341 
00342   template<>
00343     const ctype<wchar_t>&
00344     use_facet<ctype<wchar_t> >(const locale& __loc);
00345 #endif //_GLIBCPP_USE_WCHAR_T
00346 
00347   // Include host-specific ctype inlines.
00348   #include <bits/ctype_inline.h>
00349 
00350   // 22.2.1.2  Template class ctype_byname
00351   template<typename _CharT>
00352     class ctype_byname : public ctype<_CharT>
00353     {
00354     public:
00355       typedef _CharT        char_type;
00356 
00357       explicit 
00358       ctype_byname(const char*, size_t __refs = 0);
00359 
00360     protected:
00361       virtual 
00362       ~ctype_byname() { }
00363     };
00364 
00365   // 22.2.1.4  Class ctype_byname specialization
00366   template<>
00367     ctype_byname<char>::ctype_byname(const char*, size_t refs);
00368 
00369 
00370   // 22.2.1.5  Template class codecvt
00371   #include <bits/codecvt.h>
00372 
00373   template<typename _CharT, typename _InIter>
00374     class _Numeric_get;  // forward
00375 
00376   // _Format_cache holds the information extracted from the numpunct<>
00377   // and moneypunct<> facets in a form optimized for parsing and
00378   // formatting.  It is stored via a void* pointer in the pword()
00379   // array of an iosbase object passed to the _get and _put facets.
00380   // NB: contains no user-serviceable parts.
00381   template<typename _CharT>
00382     class _Format_cache
00383     {
00384     public: 
00385       // Types:
00386       typedef _CharT                char_type;
00387       typedef char_traits<_CharT>       traits_type;
00388       typedef basic_string<_CharT>      string_type;
00389       typedef typename string_type::size_type   size_type;
00390 
00391       // Forward decls and Friends:
00392       friend class locale;
00393       template<typename _Char, typename _InIter>
00394         friend class _Numeric_get;
00395       friend class num_get<_CharT>;
00396       friend class num_put<_CharT>;
00397       friend class time_get<_CharT>;
00398       friend class money_get<_CharT>;
00399       friend class time_put<_CharT>;
00400       friend class money_put<_CharT>;
00401 
00402       // Data Members:
00403 
00404       // ios_base::pword() reserved cell
00405       static int        _S_pword_ix; 
00406 
00407       // True iff data members are consistent with the current locale,
00408       // ie imbue sets this to false.
00409       bool          _M_valid;
00410 
00411       // A list of valid numeric literals: for the standard "C" locale,
00412       // this would usually be: "-+xX0123456789abcdef0123456789ABCDEF"
00413       static const char     _S_literals[];
00414 
00415       // NB: Code depends on the order of definitions of the names
00416       // these are indices into _S_literals, above.
00417       // This string is formatted for putting, not getting. (output, not input)
00418       enum 
00419       {  
00420     _S_minus, 
00421     _S_plus, 
00422     _S_x, 
00423     _S_X, 
00424     _S_digits,
00425     _S_digits_end = _S_digits + 16,
00426     _S_udigits = _S_digits_end,  
00427     _S_udigits_end = _S_udigits + 16,
00428     _S_ee = _S_digits + 14, // For scientific notation, 'E'
00429     _S_Ee = _S_udigits + 14 // For scientific notation, 'e'
00430       };
00431 
00432       // The sign used to separate decimal values: for standard US
00433       // locales, this would usually be: "."
00434       // Abstracted from numpunct::decimal_point().
00435       char_type         _M_decimal_point;
00436 
00437       // The sign used to separate groups of digits into smaller
00438       // strings that the eye can parse with less difficulty: for
00439       // standard US locales, this would usually be: ","
00440       // Abstracted from numpunct::thousands_sep().
00441       char_type         _M_thousands_sep;
00442 
00443       // However the US's "false" and "true" are translated.
00444       // From numpunct::truename() and numpunct::falsename(), respectively.
00445       string_type       _M_truename;
00446       string_type       _M_falsename;
00447 
00448       // If we are checking groupings. This should be equivalent to 
00449       // numpunct::groupings().size() != 0
00450       bool          _M_use_grouping;
00451 
00452       // If we are using numpunct's groupings, this is the current
00453       // grouping string in effect (from numpunct::grouping()).
00454       string            _M_grouping;
00455 
00456       _Format_cache();
00457 
00458       ~_Format_cache() throw() { }
00459 
00460       // Given a member of the ios heirarchy as an argument, extract
00461       // out all the current formatting information into a
00462       // _Format_cache object and return a pointer to it.
00463       static _Format_cache<_CharT>* 
00464       _S_get(ios_base& __ios);
00465 
00466       void 
00467       _M_populate(ios_base&);
00468 
00469       static void 
00470       _S_callback(ios_base::event __event, ios_base& __ios, int __ix) throw();
00471     };
00472 
00473   template<typename _CharT>
00474     int _Format_cache<_CharT>::_S_pword_ix;
00475 
00476   template<typename _CharT>
00477     const char _Format_cache<_CharT>::
00478     _S_literals[] = "-+xX0123456789abcdef0123456789ABCDEF";
00479 
00480    template<> _Format_cache<char>::_Format_cache();
00481 #ifdef _GLIBCPP_USE_WCHAR_T
00482    template<> _Format_cache<wchar_t>::_Format_cache();
00483 #endif
00484 
00485   // _Numeric_get is used by num_get, money_get, and time_get to help
00486   // in parsing out numbers.
00487   template<typename _CharT, typename _InIter>
00488     class _Numeric_get
00489     {
00490     public:
00491       // Types:
00492       typedef _CharT     char_type;
00493       typedef _InIter    iter_type;
00494 
00495       // Forward decls and Friends:
00496       template<typename _Char, typename _InIterT>
00497       friend class num_get;
00498       template<typename _Char, typename _InIterT>
00499       friend class time_get;
00500       template<typename _Char, typename _InIterT>
00501       friend class money_get;
00502       template<typename _Char, typename _InIterT>
00503       friend class num_put;
00504       template<typename _Char, typename _InIterT>
00505       friend class time_put;
00506       template<typename _Char, typename _InIterT>
00507       friend class money_put;
00508 
00509     private:
00510       explicit 
00511       _Numeric_get() { }
00512 
00513       virtual 
00514       ~_Numeric_get() { }
00515 
00516       iter_type 
00517       _M_get_digits(iter_type __in, iter_type __end) const;
00518     };
00519 
00520   template<typename _CharT, typename _InIter>
00521     class num_get : public locale::facet
00522     {
00523     public:
00524       // Types:
00525       typedef _CharT            char_type;
00526       typedef _InIter           iter_type;
00527       typedef char_traits<_CharT>   __traits_type;
00528 
00529       static locale::id id;
00530 
00531       explicit 
00532       num_get(size_t __refs = 0) : locale::facet(__refs) { }
00533 
00534       iter_type 
00535       get(iter_type __in, iter_type __end, ios_base& __io,
00536       ios_base::iostate& __err, bool& __v) const
00537       { return do_get(__in, __end, __io, __err, __v); }
00538 
00539 #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
00540       iter_type 
00541       get(iter_type __in, iter_type __end, ios_base& __io,
00542       ios_base::iostate& __err, short& __v) const
00543       { return do_get(__in, __end, __io, __err, __v); }
00544 
00545       iter_type 
00546       get(iter_type __in, iter_type __end, ios_base& __io,
00547       ios_base::iostate& __err, int& __v)   const
00548       { return do_get(__in, __end, __io, __err, __v); }
00549 #endif
00550 
00551       iter_type
00552       get(iter_type __in, iter_type __end, ios_base& __io, 
00553       ios_base::iostate& __err, long& __v) const
00554       { return do_get(__in, __end, __io, __err, __v); }
00555 
00556 #ifdef _GLIBCPP_USE_LONG_LONG
00557       iter_type 
00558       get(iter_type __in, iter_type __end, ios_base& __io,
00559       ios_base::iostate& __err, long long& __v) const
00560       { return do_get(__in, __end, __io, __err, __v); }
00561 #endif
00562 
00563       iter_type 
00564       get(iter_type __in, iter_type __end, ios_base& __io,
00565       ios_base::iostate& __err, unsigned short& __v) const
00566       { return do_get(__in, __end, __io, __err, __v); }
00567 
00568       iter_type 
00569       get(iter_type __in, iter_type __end, ios_base& __io,
00570       ios_base::iostate& __err, unsigned int& __v)   const
00571       { return do_get(__in, __end, __io, __err, __v); }
00572 
00573       iter_type 
00574       get(iter_type __in, iter_type __end, ios_base& __io,
00575       ios_base::iostate& __err, unsigned long& __v)  const
00576       { return do_get(__in, __end, __io, __err, __v); }
00577 
00578 #ifdef _GLIBCPP_USE_LONG_LONG
00579       iter_type 
00580       get(iter_type __in, iter_type __end, ios_base& __io,
00581       ios_base::iostate& __err, unsigned long long& __v)  const
00582       { return do_get(__in, __end, __io, __err, __v); }
00583 #endif
00584 
00585       iter_type 
00586       get(iter_type __in, iter_type __end, ios_base& __io,
00587       ios_base::iostate& __err, float& __v) const
00588       { return do_get(__in, __end, __io, __err, __v); }
00589 
00590       iter_type 
00591       get(iter_type __in, iter_type __end, ios_base& __io,
00592       ios_base::iostate& __err, double& __v) const
00593       { return do_get(__in, __end, __io, __err, __v); }
00594 
00595       iter_type 
00596       get(iter_type __in, iter_type __end, ios_base& __io,
00597       ios_base::iostate& __err, long double& __v) const
00598       { return do_get(__in, __end, __io, __err, __v); }
00599 
00600       iter_type 
00601       get(iter_type __in, iter_type __end, ios_base& __io,
00602       ios_base::iostate& __err, void*& __v) const
00603       { return do_get(__in, __end, __io, __err, __v); }      
00604 
00605     protected:
00606       virtual ~num_get() { }
00607 
00608       // This consolidates the extraction, storage and
00609       // error-processing parts of the do_get(...) overloaded member
00610       // functions. 
00611       // NB: This is specialized for char.
00612       void 
00613       _M_extract(iter_type __beg, iter_type __end, ios_base& __io, 
00614          ios_base::iostate& __err, char* __xtrc, 
00615          int& __base, bool __fp = true) const;
00616 
00617       virtual iter_type 
00618       do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, bool&) const;
00619 
00620 #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
00621       virtual iter_type 
00622       do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, short&) const;
00623       virtual iter_type 
00624       do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, int&) const;
00625 #endif
00626       virtual iter_type 
00627       do_get (iter_type, iter_type, ios_base&, ios_base::iostate&, long&) const;
00628 #ifdef _GLIBCPP_USE_LONG_LONG 
00629       virtual iter_type 
00630       do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err, 
00631          long long&) const;
00632 #endif
00633       virtual iter_type 
00634       do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err, 
00635           unsigned short&) const;
00636       virtual iter_type 
00637       do_get(iter_type, iter_type, ios_base&,
00638           ios_base::iostate& __err, unsigned int&) const;
00639       virtual iter_type 
00640       do_get(iter_type, iter_type, ios_base&,
00641           ios_base::iostate& __err, unsigned long&) const;
00642 #ifdef _GLIBCPP_USE_LONG_LONG 
00643       virtual iter_type 
00644       do_get(iter_type, iter_type, ios_base&,
00645          ios_base::iostate& __err, unsigned long long&) const;
00646 #endif
00647       virtual iter_type 
00648       do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err, 
00649          float&) const;
00650 
00651       virtual iter_type 
00652       do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err, 
00653          double&) const;
00654 
00655       virtual iter_type 
00656       do_get(iter_type, iter_type, ios_base&, 
00657          ios_base::iostate& __err, long double&) const;
00658 
00659       virtual iter_type 
00660       do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err, 
00661          void*&) const;
00662     };
00663 
00664   template<typename _CharT, typename _InIter>
00665     locale::id num_get<_CharT, _InIter>::id;
00666 
00667   // Declare specialized extraction member function.
00668   template<>
00669     void
00670     num_get<char, istreambuf_iterator<char> >::    
00671     _M_extract(istreambuf_iterator<char> __beg, 
00672            istreambuf_iterator<char> __end, ios_base& __io, 
00673            ios_base::iostate& __err, char* __xtrc, 
00674            int& __base, bool __fp) const;
00675 
00676   // _Numeric_put is used by num_put, money_put, and time_put
00677   //   to help in formatting out numbers.
00678   template<typename _CharT, typename _OutIter>
00679     class _Numeric_put
00680     {
00681     public:
00682       typedef _CharT      char_type;
00683       typedef _OutIter    iter_type;
00684     protected:
00685       explicit 
00686       _Numeric_put() { }
00687 
00688       virtual 
00689       ~_Numeric_put() { }
00690     };
00691 
00692   template<typename _CharT, typename _OutIter>
00693     class num_put : public locale::facet
00694     {
00695     public:
00696       // Types:
00697       typedef _CharT       char_type;
00698       typedef _OutIter     iter_type;
00699 
00700       static locale::id id;
00701 
00702       explicit 
00703       num_put(size_t __refs = 0) : locale::facet(__refs) { }
00704 
00705       iter_type 
00706       put(iter_type __s, ios_base& __f, char_type __fill, bool __v) const
00707       { return do_put(__s, __f, __fill, __v); }
00708 
00709       iter_type 
00710       put(iter_type __s, ios_base& __f, char_type __fill, long __v) const
00711       { return do_put(__s, __f, __fill, __v); }
00712 
00713       iter_type 
00714       put(iter_type __s, ios_base& __f, char_type __fill, 
00715       unsigned long __v) const
00716       { return do_put(__s, __f, __fill, __v); }
00717 
00718 #ifdef _GLIBCPP_USE_LONG_LONG 
00719       iter_type 
00720       put(iter_type __s, ios_base& __f, char_type __fill, long long __v) const
00721       { return do_put(__s, __f, __fill, __v); }
00722 
00723       iter_type 
00724       put(iter_type __s, ios_base& __f, char_type __fill, 
00725       unsigned long long __v) const
00726       { return do_put(__s, __f, __fill, __v); }
00727 #endif
00728 
00729       iter_type 
00730       put(iter_type __s, ios_base& __f, char_type __fill, double __v) const
00731       { return do_put(__s, __f, __fill, __v); }
00732 
00733       iter_type 
00734       put(iter_type __s, ios_base& __f, char_type __fill, 
00735       long double __v) const
00736       { return do_put(__s, __f, __fill, __v); }
00737 
00738       iter_type 
00739       put(iter_type __s, ios_base& __f, char_type __fill, 
00740       const void* __v) const
00741       { return do_put(__s, __f, __fill, __v); }
00742 
00743     protected:
00744       virtual 
00745       ~num_put() { };
00746 
00747       virtual iter_type 
00748       do_put(iter_type, ios_base&, char_type __fill, bool __v) const;
00749 
00750       virtual iter_type 
00751       do_put(iter_type, ios_base&, char_type __fill, long __v) const;
00752 
00753 #ifdef _GLIBCPP_USE_LONG_LONG 
00754       virtual iter_type 
00755       do_put(iter_type, ios_base&, char_type __fill, long long __v) const;
00756 #endif
00757 
00758       virtual iter_type 
00759       do_put(iter_type, ios_base&, char_type __fill, unsigned long) const;
00760 
00761 #ifdef _GLIBCPP_USE_LONG_LONG
00762       virtual iter_type
00763       do_put(iter_type, ios_base&, char_type __fill, unsigned long long) const;
00764 #endif
00765 
00766       virtual iter_type 
00767       do_put(iter_type, ios_base&, char_type __fill, double __v) const;
00768 
00769       virtual iter_type 
00770       do_put(iter_type, ios_base&, char_type __fill, long double __v) const;
00771 
00772       virtual iter_type 
00773       do_put(iter_type, ios_base&, char_type __fill, const void* __v) const;
00774     };
00775 
00776   template <typename _CharT, typename _OutIter>
00777     locale::id num_put<_CharT, _OutIter>::id;
00778 
00779   template<typename _CharT>
00780     class numpunct : public locale::facet
00781     {
00782     public:
00783       // Types:
00784       typedef _CharT                char_type;
00785       typedef basic_string<_CharT>  string_type;
00786 
00787       static locale::id id;
00788 
00789     private:
00790       char_type     _M_decimal_point;
00791       char_type     _M_thousands_sep;
00792       string        _M_grouping;
00793       string_type   _M_truename;
00794       string_type   _M_falsename;
00795 
00796     public:
00797       explicit 
00798       numpunct(size_t __refs = 0) : locale::facet(__refs) 
00799       { _M_initialize_numpunct(); }
00800 
00801       explicit 
00802       numpunct(__c_locale __cloc, size_t __refs = 0) : locale::facet(__refs) 
00803       { _M_initialize_numpunct(__cloc); }
00804 
00805       char_type    
00806       decimal_point() const
00807       { return do_decimal_point(); }
00808 
00809       char_type    
00810       thousands_sep() const
00811       { return do_thousands_sep(); }
00812 
00813       string       
00814       grouping() const
00815       { return do_grouping(); }
00816 
00817       string_type  
00818       truename() const
00819       { return do_truename(); }
00820 
00821       string_type  
00822       falsename() const
00823       { return do_falsename(); }
00824 
00825     protected:
00826       virtual 
00827       ~numpunct() { }
00828 
00829       virtual char_type    
00830       do_decimal_point() const
00831       { return _M_decimal_point; }
00832 
00833       virtual char_type    
00834       do_thousands_sep() const
00835       { return _M_thousands_sep; }
00836 
00837       virtual string
00838       do_grouping() const
00839       { return _M_grouping; }
00840 
00841       virtual string_type  
00842       do_truename() const
00843       { return _M_truename; }
00844 
00845       virtual string_type  
00846       do_falsename() const
00847       { return _M_falsename; }
00848 
00849       // For use at construction time only.
00850       void 
00851       _M_initialize_numpunct(__c_locale __cloc = NULL);
00852     };
00853 
00854   template<typename _CharT>
00855     locale::id numpunct<_CharT>::id;
00856 
00857   template<typename _CharT>
00858     void
00859     numpunct<_CharT>::_M_initialize_numpunct(__c_locale /*__cloc*/)
00860     { 
00861       // NB: Cannot be made generic. 
00862     }
00863 
00864   template<> 
00865     void
00866     numpunct<char>::_M_initialize_numpunct(__c_locale __cloc);
00867 #ifdef _GLIBCPP_USE_WCHAR_T
00868   template<> 
00869     void
00870     numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc);
00871 #endif
00872 
00873 
00874   template<typename _CharT>
00875     class numpunct_byname : public numpunct<_CharT>
00876     {
00877       __c_locale            _M_c_locale_numpunct;
00878     public:
00879       typedef _CharT                char_type;
00880       typedef basic_string<_CharT>  string_type;
00881 
00882       explicit 
00883       numpunct_byname(const char* __s, size_t __refs = 0)
00884       : numpunct<_CharT>(__refs)
00885       {
00886     _S_create_c_locale(_M_c_locale_numpunct, __s);
00887     _M_initialize_numpunct(_M_c_locale_numpunct);   
00888       }
00889 
00890     protected:
00891       virtual 
00892       ~numpunct_byname() 
00893       { _S_destroy_c_locale(_M_c_locale_numpunct); }
00894     };
00895 
00896 
00897   template<typename _CharT>
00898     class collate : public locale::facet
00899     {
00900     public:
00901       // Types:
00902       typedef _CharT               char_type;
00903       typedef basic_string<_CharT> string_type;
00904 
00905       static locale::id id;
00906 
00907       explicit 
00908       collate(size_t __refs = 0) : locale::facet(__refs) { }
00909 
00910       int 
00911       compare(const _CharT* __lo1, const _CharT* __hi1,
00912           const _CharT* __lo2, const _CharT* __hi2) const
00913       { return this->do_compare(__lo1, __hi1, __lo2, __hi2); }
00914 
00915       string_type 
00916       transform(const _CharT* __lo, const _CharT* __hi) const
00917       { return this->do_transform(__lo, __hi); }
00918 
00919       long 
00920       hash(const _CharT* __lo, const _CharT* __hi) const
00921       { return this->do_hash(__lo, __hi); }
00922       
00923   protected:
00924       ~collate() { } // virtual
00925 
00926       virtual int  
00927       do_compare(const _CharT* __lo1, const _CharT* __hi1,
00928          const _CharT* __lo2, const _CharT* __hi2) const;
00929 
00930       virtual string_type 
00931       do_transform(const _CharT* __lo, const _CharT* __hi) const;
00932 
00933       virtual long   
00934       do_hash(const _CharT* __lo, const _CharT* __hi) const;
00935     };
00936 
00937   template<typename _CharT>
00938     locale::id collate<_CharT>::id;
00939 
00940   // Required specializations.
00941   template<>
00942     int 
00943     collate<char>::do_compare(const char* __lo1, const char* __hi1, 
00944                   const char* __lo2, const char* __hi2) const;
00945 
00946   template<>
00947     string
00948     collate<char>::do_transform(const char* __lo, const char* __hi) const;
00949 
00950   template<>
00951     long
00952     collate<char>::do_hash(const char* __lo, const char* __hi) const;
00953 #ifdef _GLIBCPP_USE_WCHAR_T
00954   template<>
00955     int 
00956     collate<wchar_t>::do_compare(const wchar_t* __lo1, const wchar_t* __hi1, 
00957                  const wchar_t* __lo2, 
00958                  const wchar_t* __hi2) const;
00959 
00960   template<>
00961     wstring
00962     collate<wchar_t>::do_transform(const wchar_t* __lo, 
00963                    const wchar_t* __hi) const;
00964 
00965   template<>
00966     long
00967     collate<wchar_t>::do_hash(const wchar_t* __lo, const wchar_t* __hi) const;
00968 #endif
00969 
00970   template<typename _CharT>
00971     class collate_byname : public collate<_CharT>
00972     {
00973     public:
00974       // Types:
00975       typedef _CharT               char_type;
00976       typedef basic_string<_CharT> string_type;
00977 
00978       explicit 
00979       collate_byname(const char*, size_t __refs = 0);
00980 
00981     protected:
00982       virtual 
00983       ~collate_byname() { }
00984     };
00985 
00986   template<>
00987     collate_byname<char>::collate_byname(const char*, size_t __refs);
00988 #ifdef _GLIBCPP_USE_WCHAR_T
00989   template<>
00990     collate_byname<wchar_t>::collate_byname(const char*, size_t __refs);
00991 #endif
00992 
00993   class time_base
00994   {
00995   public:
00996     enum dateorder { no_order, dmy, mdy, ymd, ydm };
00997   };
00998 
00999   template<typename _CharT, typename _InIter>
01000     class time_get : public locale::facet, public time_base
01001     {
01002     public:
01003       // Types:
01004       typedef _CharT     char_type;
01005       typedef _InIter    iter_type;
01006 
01007       static locale::id id;
01008 
01009       explicit 
01010       time_get(size_t __refs = 0) 
01011       : locale::facet (__refs), _M_daynames(0), _M_monthnames(0) { }
01012 
01013       dateorder 
01014       date_order()  const
01015       { return do_date_order(); }
01016 
01017       iter_type 
01018       get_time(iter_type __s, iter_type __end, ios_base& __f, 
01019            ios_base::iostate& __err, tm* __t)  const
01020       { return do_get_time(__s, __end, __f, __err, __t); }
01021 
01022       iter_type 
01023       get_date(iter_type __s, iter_type __end, ios_base& __f,
01024            ios_base::iostate& __err, tm* __t)  const
01025       { return do_get_date(__s, __end, __f, __err, __t); }
01026 
01027       iter_type 
01028       get_weekday(iter_type __s, iter_type __end, ios_base& __f,
01029           ios_base::iostate& __err, tm* __t) const
01030       { return do_get_weekday(__s,__end,__f,__err,__t); }
01031 
01032       iter_type 
01033       get_monthname(iter_type __s, iter_type __end, ios_base& __f, 
01034             ios_base::iostate& __err, tm* __t) const
01035       { return do_get_monthname(__s,__end,__f,__err,__t); }
01036 
01037       iter_type 
01038       get_year(iter_type __s, iter_type __end, ios_base& __f,
01039            ios_base::iostate& __err, tm* __t) const
01040       { return do_get_year(__s,__end,__f,__err,__t); }
01041 
01042     protected:
01043       virtual 
01044       ~time_get() 
01045       {      
01046     delete [] _M_monthnames; 
01047     delete [] _M_daynames; 
01048       }
01049 
01050       virtual dateorder 
01051       do_date_order()  const
01052       { return time_base::ymd; }
01053 
01054       virtual iter_type 
01055       do_get_time(iter_type __s, iter_type /*__end*/, ios_base&,
01056           ios_base::iostate& /*__err*/, tm* /*__t*/) const
01057       { return __s; }
01058 
01059       virtual iter_type 
01060       do_get_date(iter_type __s, iter_type /*__end*/, ios_base&,
01061           ios_base::iostate& /*__err*/, tm* /*__t*/) const
01062       { return __s; }
01063 
01064       virtual iter_type 
01065       do_get_weekday(iter_type __s, iter_type __end, ios_base&,
01066              ios_base::iostate& __err, tm* __t) const;
01067 
01068       virtual iter_type 
01069       do_get_monthname(iter_type __s, iter_type __end, ios_base&, 
01070                ios_base::iostate& __err, tm* __t) const;
01071 
01072       virtual iter_type 
01073       do_get_year(iter_type __s, iter_type /*__end*/, ios_base&,
01074            ios_base::iostate& /*__err*/, tm* /*__t*/) const
01075       { return __s; }
01076 
01077       mutable basic_string<_CharT>* _M_daynames;
01078       mutable basic_string<_CharT>* _M_monthnames;
01079     };
01080 
01081   template<typename _CharT, typename _InIter>
01082     locale::id time_get<_CharT, _InIter>::id;
01083 
01084   template<typename _CharT, typename _InIter>
01085     class time_get_byname : public time_get<_CharT, _InIter>
01086     {
01087     public:
01088       typedef _CharT     char_type;
01089       typedef _InIter    iter_type;
01090 
01091       explicit 
01092       time_get_byname(const char*, size_t __refs = 0) 
01093       : time_get<_CharT, _InIter>(__refs) { }
01094     protected:
01095       virtual 
01096       ~time_get_byname() { }
01097     };
01098 
01099   template<typename _CharT, typename _OutIter>
01100     class time_put : public locale::facet, public time_base
01101     {
01102     public:
01103       typedef _CharT     char_type;
01104       typedef _OutIter   iter_type;
01105 
01106       static locale::id id;
01107 
01108       explicit 
01109       time_put(size_t __refs = 0) : locale::facet (__refs) { }
01110 
01111       // NB: this is a nonvirtual, calls do_put in a loop.
01112       iter_type 
01113       put(iter_type __s, ios_base& /*__f*/, char_type /*__fill*/,
01114           const tm* /*__tmb*/, const _CharT* /*__pattern*/,
01115           const _CharT* /*__pat_end*/) const
01116       { return __s; }
01117 
01118       iter_type 
01119       put(iter_type __s, ios_base& __f, char_type __fill,
01120       const tm* __tmb, char __format, char __modifier = 0) const
01121       { return do_put(__s, __f, __fill, __tmb, __format, __modifier); }
01122 
01123     protected:
01124       virtual 
01125       ~time_put() { }
01126 
01127       virtual iter_type 
01128       do_put(iter_type __s, ios_base&, char_type, const tm* /*__t*/, 
01129          char /*__format*/, char /*__mod*/) const
01130       { return __s; }
01131     };
01132 
01133   template<typename _CharT, typename _OutIter>
01134     locale::id time_put<_CharT, _OutIter>::id;
01135 
01136   template<typename _CharT, typename _OutIter>
01137     class time_put_byname : public time_put<_CharT, _OutIter>
01138     {
01139     public:
01140       typedef _CharT     char_type;
01141       typedef _OutIter   iter_type;
01142 
01143       explicit 
01144       time_put_byname(const char*, size_t __refs = 0) 
01145       : time_put<_CharT, _OutIter> (__refs) { }
01146 
01147     protected:
01148       virtual 
01149       ~time_put_byname() { }
01150     };
01151 
01152 
01153   template<typename _CharT, typename _InIter>
01154     class money_get : public locale::facet
01155     {
01156     public:
01157       typedef _CharT        char_type;
01158       typedef _InIter       iter_type;
01159       typedef basic_string<_CharT> string_type;
01160 
01161       static locale::id id;
01162 
01163       explicit 
01164       money_get(size_t __refs = 0) : locale::facet(__refs) { }
01165 
01166       iter_type 
01167       get(iter_type __s, iter_type __end, bool __intl,
01168       ios_base& __f, ios_base::iostate& __err, long double& __units) const
01169       { return do_get(__s, __end, __intl, __f, __err, __units); }
01170 
01171       iter_type 
01172       get(iter_type __s, iter_type __end, bool __intl, ios_base& __f, 
01173        ios_base::iostate& __err, string_type& __digits) const
01174       { return do_get(__s, __end, __intl, __f, __err, __digits); }
01175 
01176     protected:
01177       virtual 
01178       ~money_get() { }
01179 
01180       virtual iter_type 
01181       do_get(iter_type __s, iter_type /*__end*/, bool /*__intl*/,
01182              ios_base& /*__io*/, ios_base::iostate& /*__err*/,
01183              long double& /*__units*/) const
01184       { return __s; }
01185 
01186       virtual iter_type 
01187       do_get(iter_type __s, iter_type /*__end*/, bool /*__intl*/,
01188              ios_base& /*__io*/, ios_base::iostate& /*__err*/,
01189              string_type& /*__digits*/) const
01190       { return __s; }
01191     };
01192 
01193   template<typename _CharT, typename _InIter>
01194     locale::id money_get<_CharT, _InIter>::id;
01195 
01196   template<typename _CharT, typename _OutIter>
01197     class money_put : public locale::facet
01198     {
01199     public:
01200       typedef _CharT              char_type;
01201       typedef _OutIter            iter_type;
01202       typedef basic_string<_CharT> string_type;
01203 
01204       static locale::id id;
01205 
01206       explicit 
01207       money_put(size_t __refs = 0) : locale::facet(__refs) { }
01208 
01209       iter_type 
01210       put(iter_type __s, bool __intl, ios_base& __f,
01211       char_type __fill, long double __units) const
01212       { return do_put(__s, __intl, __f, __fill, __units); }
01213 
01214       iter_type 
01215       put(iter_type __s, bool __intl, ios_base& __f,
01216       char_type __fill, const string_type& __digits) const
01217       { return do_put(__s, __intl, __f, __fill, __digits); }
01218 
01219     protected:
01220       virtual 
01221       ~money_put() { }
01222 
01223       virtual iter_type
01224       do_put(iter_type __s, bool, ios_base& /*__io*/, char_type /*__fill*/,
01225          long double /*__units*/) const
01226       { return __s; }
01227 
01228       virtual iter_type
01229       do_put(iter_type __s, bool, ios_base& /*__io*/, char_type /*__fill*/,
01230          const string_type& /*__digits*/) const
01231       { return __s; }
01232     };
01233 
01234   template<typename _CharT, typename _OutIter>
01235     locale::id money_put<_CharT, _OutIter>::id;
01236 
01237   struct money_base
01238   {
01239     enum part { none, space, symbol, sign, value };
01240     struct pattern { char field[4]; };
01241 
01242     static const pattern _S_default_pattern;
01243 
01244     // Construct and return valid pattern consisting of some combination of:
01245     // space none symbol sign value
01246     static pattern 
01247     _S_construct_pattern(char __preceeds, char __space, char __posn);
01248   };
01249 
01250   template<typename _CharT, bool _Intl>
01251     class moneypunct : public locale::facet, public money_base
01252     {
01253     public:
01254       // Types:
01255       typedef _CharT            char_type;
01256       typedef basic_string<_CharT>  string_type;
01257 
01258       static const bool intl = _Intl;
01259       static locale::id id;
01260 
01261     private:
01262       char_type     _M_decimal_point;
01263       char_type     _M_thousands_sep;
01264       string        _M_grouping;
01265       string_type   _M_curr_symbol;
01266       string_type   _M_positive_sign;
01267       string_type   _M_negative_sign;
01268       int       _M_frac_digits;
01269       pattern       _M_pos_format;
01270       pattern       _M_neg_format;
01271 
01272     public:
01273       explicit 
01274       moneypunct(size_t __refs = 0) : locale::facet(__refs)
01275       { _M_initialize_moneypunct(); }
01276 
01277       explicit 
01278       moneypunct(__c_locale __cloc, size_t __refs = 0) : locale::facet(__refs)
01279       { _M_initialize_moneypunct(__cloc); }
01280 
01281       char_type
01282       decimal_point() const
01283       { return this->do_decimal_point(); }
01284       
01285       char_type
01286       thousands_sep() const
01287       { return this->do_thousands_sep(); }
01288       
01289       string 
01290       grouping() const
01291       { return this->do_grouping(); }
01292 
01293       string_type  
01294       curr_symbol() const
01295       { return this->do_curr_symbol(); }
01296 
01297       string_type  
01298       positive_sign() const
01299       { return this->do_positive_sign(); }
01300 
01301       string_type  
01302       negative_sign() const
01303       { return this->do_negative_sign(); }
01304 
01305       int          
01306       frac_digits() const
01307       { return this->do_frac_digits(); }
01308 
01309       pattern      
01310       pos_format() const
01311       { return this->do_pos_format(); }
01312 
01313       pattern      
01314       neg_format() const
01315       { return this->do_neg_format(); }
01316 
01317     protected:
01318       virtual 
01319       ~moneypunct() { }
01320 
01321       virtual char_type
01322       do_decimal_point() const
01323       { return _M_decimal_point; }
01324       
01325       virtual char_type
01326       do_thousands_sep() const
01327       { return _M_thousands_sep; }
01328       
01329       virtual string 
01330       do_grouping() const
01331       { return _M_grouping; }
01332 
01333       virtual string_type  
01334       do_curr_symbol()   const
01335       { return _M_curr_symbol; }
01336 
01337       virtual string_type  
01338       do_positive_sign() const
01339       { return _M_positive_sign; }
01340 
01341       virtual string_type  
01342       do_negative_sign() const
01343       { return _M_negative_sign; }
01344 
01345       virtual int          
01346       do_frac_digits() const
01347       { return _M_frac_digits; }
01348 
01349       virtual pattern      
01350       do_pos_format() const
01351       { return _M_pos_format; }
01352 
01353       virtual pattern      
01354       do_neg_format() const
01355       { return _M_neg_format; }
01356 
01357       // For use at construction time only.
01358       void 
01359       _M_initialize_moneypunct(__c_locale __cloc = NULL);
01360     };
01361 
01362   template<typename _CharT, bool _Intl>
01363     locale::id moneypunct<_CharT, _Intl>::id;
01364 
01365   template<typename _CharT, bool _Intl>
01366     const bool moneypunct<_CharT, _Intl>::intl;
01367 
01368   template<typename _CharT, bool _Intl>
01369     void
01370     moneypunct<_CharT, _Intl>::_M_initialize_moneypunct(__c_locale /*__cloc*/)
01371     { 
01372       // NB: Cannot be made generic. 
01373     }
01374 
01375   template<> 
01376     void
01377     moneypunct<char>::_M_initialize_moneypunct(__c_locale __cloc);
01378 #ifdef _GLIBCPP_USE_WCHAR_T
01379   template<> 
01380     void
01381     moneypunct<wchar_t>::_M_initialize_moneypunct(__c_locale __cloc);
01382 #endif
01383 
01384   template<typename _CharT, bool _Intl>
01385     class moneypunct_byname : public moneypunct<_CharT, _Intl>
01386     {
01387       __c_locale            _M_c_locale_moneypunct;
01388     public:
01389       typedef _CharT            char_type;
01390       typedef basic_string<_CharT>  string_type;
01391 
01392       static const bool intl = _Intl;
01393 
01394       explicit 
01395       moneypunct_byname(const char* __s, size_t __refs = 0)
01396       : moneypunct<_CharT, _Intl>(__refs)
01397       {
01398     _S_create_c_locale(_M_c_locale_moneypunct, __s);
01399     _M_initialize_moneypunct(_M_c_locale_moneypunct);   
01400       }
01401 
01402     protected:
01403       virtual 
01404       ~moneypunct_byname() 
01405       { _S_destroy_c_locale(_M_c_locale_moneypunct); }
01406     };
01407 
01408   template<typename _CharT, bool _Intl>
01409     const bool moneypunct_byname<_CharT, _Intl>::intl;
01410 
01411 
01412   struct messages_base
01413   {
01414     typedef int catalog;
01415   };
01416 
01417   template<typename _CharT>
01418     class messages : public locale::facet, public messages_base
01419     {
01420     public:
01421       typedef _CharT            char_type;
01422       typedef basic_string<_CharT>  string_type;
01423 
01424       static locale::id id;
01425 
01426       explicit 
01427       messages(size_t __refs = 0) : locale::facet(__refs) { }
01428 
01429       catalog 
01430       open(const basic_string<char>& __s, const locale& __loc) const
01431       { return do_open(__s, __loc); }
01432 
01433       string_type  
01434       get(catalog __c, int __set, int __msgid, const string_type& __s) const
01435       { return do_get(__c,__set,__msgid,__s); }
01436 
01437       void 
01438       close(catalog __c) const
01439       { return do_close(__c); }
01440 
01441     protected:
01442       virtual 
01443       ~messages() { }
01444 
01445       // NB: Probably these should be pure, and implemented only in
01446       //  specializations of messages<>.  But for now...
01447       virtual catalog 
01448       do_open(const basic_string<char>&, const locale&) const
01449       { return 0; }
01450 
01451       virtual string_type  
01452       do_get(catalog, int, int /*__msgid*/, const string_type& __dfault) const
01453       { return __dfault; }
01454 
01455       virtual void    
01456       do_close(catalog) const { }
01457     };
01458 
01459   template<typename _CharT>
01460     locale::id messages<_CharT>::id;
01461 
01462   template<typename _CharT>
01463     class messages_byname : public messages<_CharT>
01464     {
01465     public:
01466       typedef _CharT char_type;
01467       typedef basic_string<_CharT> string_type;
01468 
01469       explicit 
01470       messages_byname(const char*, size_t __refs = 0);
01471 
01472     protected:
01473       virtual 
01474       ~messages_byname() { }
01475     };
01476 
01477   template<>
01478     messages_byname<char>::messages_byname(const char*, size_t __refs);
01479 #ifdef _GLIBCPP_USE_WCHAR_T
01480   template<>
01481     messages_byname<wchar_t>::messages_byname(const char*, size_t __refs);
01482 #endif
01483 
01484   // Subclause convenience interfaces, inlines 
01485   // NB: these are inline
01486   // because, when used in a loop, some compilers can hoist the body
01487   // out of the loop; then it's just as fast as the C is*() function.
01488   template<typename _CharT>
01489     inline bool 
01490     isspace(_CharT __c, const locale& __loc)
01491     { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c); }
01492 
01493   template<typename _CharT>
01494     inline bool 
01495     isprint(_CharT __c, const locale& __loc)
01496     { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c); }
01497 
01498   template<typename _CharT>
01499     inline bool 
01500     iscntrl(_CharT __c, const locale& __loc)
01501     { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c); }
01502 
01503   template<typename _CharT>
01504     inline bool 
01505     isupper(_CharT __c, const locale& __loc)
01506     { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c); }
01507 
01508   template<typename _CharT>
01509     inline bool islower(_CharT __c, const locale& __loc)
01510     { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c); }
01511 
01512   template<typename _CharT>
01513     inline bool 
01514     isalpha(_CharT __c, const locale& __loc)
01515     { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c); }
01516 
01517   template<typename _CharT>
01518     inline bool 
01519     isdigit(_CharT __c, const locale& __loc)
01520     { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c); }
01521 
01522   template<typename _CharT>
01523     inline bool 
01524     ispunct(_CharT __c, const locale& __loc)
01525     { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c); }
01526 
01527   template<typename _CharT>
01528     inline bool 
01529     isxdigit(_CharT __c, const locale& __loc)
01530     { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c); }
01531 
01532   template<typename _CharT>
01533     inline bool 
01534     isalnum(_CharT __c, const locale& __loc)
01535     { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c); }
01536 
01537   template<typename _CharT>
01538     inline bool 
01539     isgraph(_CharT __c, const locale& __loc)
01540     { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c); }
01541 
01542   template<typename _CharT>
01543     inline _CharT 
01544     toupper(_CharT __c, const locale& __loc)
01545     { return use_facet<ctype<_CharT> >(__loc).toupper(__c); }
01546 
01547   template<typename _CharT>
01548     inline _CharT 
01549     tolower(_CharT __c, const locale& __loc)
01550     { return use_facet<ctype<_CharT> >(__loc).tolower(__c); }
01551 } // namespace std
01552 
01553 #endif  /* _CPP_BITS_LOCFACETS_H */
01554 
01555 // Local Variables:
01556 // mode:c++
01557 // End:

Generated at Tue May 1 16:28:38 2001 for libstdc++-v3 by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001