⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 locale_facets.h

📁 gcc3.2.1源代码
💻 H
📖 第 1 页 / 共 4 页
字号:
// Locale support -*- C++ -*-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002// Free Software Foundation, Inc.//// This file is part of the GNU ISO C++ Library.  This library is free// software; you can redistribute it and/or modify it under the// terms of the GNU General Public License as published by the// Free Software Foundation; either version 2, or (at your option)// any later version.// This library is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the// GNU General Public License for more details.// You should have received a copy of the GNU General Public License along// with this library; see the file COPYING.  If not, write to the Free// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,// USA.// As a special exception, you may use this file as part of a free software// library without restriction.  Specifically, if other files instantiate// templates or use macros or inline functions from this file, or you compile// this file and link it with other files to produce an executable, this// file does not by itself cause the resulting executable to be covered by// the GNU General Public License.  This exception does not however// invalidate any other reasons why the executable file might be covered by// the GNU General Public License.//// ISO C++ 14882: 22.1  Locales///** @file locale_facets.h *  This is an internal header file, included by other library headers. *  You should not attempt to use it directly. */#ifndef _CPP_BITS_LOCFACETS_H#define _CPP_BITS_LOCFACETS_H	1#pragma GCC system_header#include <ctime>	// For struct tm#include <cwctype>	// For wctype_t#include <ios>		// For ios_basenamespace std{  // NB: Don't instantiate required wchar_t facets if no wchar_t support.#ifdef _GLIBCPP_USE_WCHAR_T# define  _GLIBCPP_NUM_FACETS 28#else# define  _GLIBCPP_NUM_FACETS 14#endif  template<typename _CharT, typename _Traits>    struct __pad;  // 22.2.1.1  Template class ctype  // Include host and configuration specific ctype enums for ctype_base.  #include <bits/ctype_base.h>  // Common base for ctype<_CharT>.    template<typename _CharT>    class __ctype_abstract_base : public locale::facet, public ctype_base    {    public:      // Types:      typedef _CharT char_type;      bool       is(mask __m, char_type __c) const      { return this->do_is(__m, __c); }      const char_type*      is(const char_type *__lo, const char_type *__hi, mask *__vec) const         { return this->do_is(__lo, __hi, __vec); }      const char_type*      scan_is(mask __m, const char_type* __lo, const char_type* __hi) const      { return this->do_scan_is(__m, __lo, __hi); }      const char_type*      scan_not(mask __m, const char_type* __lo, const char_type* __hi) const      { return this->do_scan_not(__m, __lo, __hi); }      char_type       toupper(char_type __c) const      { return this->do_toupper(__c); }      const char_type*      toupper(char_type *__lo, const char_type* __hi) const      { return this->do_toupper(__lo, __hi); }      char_type       tolower(char_type __c) const      { return this->do_tolower(__c); }      const char_type*      tolower(char_type* __lo, const char_type* __hi) const      { return this->do_tolower(__lo, __hi); }      char_type       widen(char __c) const      { return this->do_widen(__c); }      const char*      widen(const char* __lo, const char* __hi, char_type* __to) const      { return this->do_widen(__lo, __hi, __to); }      char       narrow(char_type __c, char __dfault) const      { return this->do_narrow(__c, __dfault); }      const char_type*      narrow(const char_type* __lo, const char_type* __hi,	      char __dfault, char *__to) const      { return this->do_narrow(__lo, __hi, __dfault, __to); }    protected:      explicit       __ctype_abstract_base(size_t __refs = 0): locale::facet(__refs) { }      virtual       ~__ctype_abstract_base() { }            virtual bool       do_is(mask __m, char_type __c) const = 0;      virtual const char_type*      do_is(const char_type* __lo, const char_type* __hi, 	    mask* __vec) const = 0;      virtual const char_type*      do_scan_is(mask __m, const char_type* __lo,		 const char_type* __hi) const = 0;      virtual const char_type*      do_scan_not(mask __m, const char_type* __lo, 		  const char_type* __hi) const = 0;      virtual char_type       do_toupper(char_type) const = 0;      virtual const char_type*      do_toupper(char_type* __lo, const char_type* __hi) const = 0;      virtual char_type       do_tolower(char_type) const = 0;      virtual const char_type*      do_tolower(char_type* __lo, const char_type* __hi) const = 0;            virtual char_type       do_widen(char) const = 0;      virtual const char*      do_widen(const char* __lo, const char* __hi, 	       char_type* __dest) const = 0;      virtual char       do_narrow(char_type, char __dfault) const = 0;      virtual const char_type*      do_narrow(const char_type* __lo, const char_type* __hi,		 char __dfault, char* __dest) const = 0;    };  // NB: Generic, mostly useless implementation.  template<typename _CharT>    class ctype : public __ctype_abstract_base<_CharT>    {    public:      // Types:      typedef _CharT 		  	char_type;      typedef typename ctype::mask 	mask;      static locale::id 	       	id;      explicit       ctype(size_t __refs = 0) : __ctype_abstract_base<_CharT>(__refs) { }   protected:      virtual       ~ctype();      virtual bool       do_is(mask __m, char_type __c) const;      virtual const char_type*      do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const;      virtual const char_type*      do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const;      virtual const char_type*      do_scan_not(mask __m, const char_type* __lo,		  const char_type* __hi) const;      virtual char_type       do_toupper(char_type __c) const;      virtual const char_type*      do_toupper(char_type* __lo, const char_type* __hi) const;      virtual char_type       do_tolower(char_type __c) const;      virtual const char_type*      do_tolower(char_type* __lo, const char_type* __hi) const;      virtual char_type       do_widen(char __c) const;      virtual const char*      do_widen(const char* __lo, const char* __hi, char_type* __dest) const;      virtual char       do_narrow(char_type, char __dfault) const;      virtual const char_type*      do_narrow(const char_type* __lo, const char_type* __hi,		char __dfault, char* __dest) const;    };  template<typename _CharT>    locale::id ctype<_CharT>::id;  // 22.2.1.3  ctype<char> specialization.  template<>    class ctype<char> : public __ctype_abstract_base<char>    {    public:      // Types:      typedef char 	       	char_type;    protected:      // Data Members:      __c_locale		_M_c_locale_ctype;      bool 		       	_M_del;      __to_type 	       	_M_toupper;      __to_type  	       	_M_tolower;      const mask*              	_M_table;          public:      static locale::id        id;      static const size_t      table_size = 1 + static_cast<unsigned char>(-1);      explicit       ctype(const mask* __table = 0, bool __del = false, size_t __refs = 0);      explicit       ctype(__c_locale __cloc, const mask* __table = 0, bool __del = false, 	    size_t __refs = 0);      inline bool       is(mask __m, char __c) const;       inline const char*      is(const char* __lo, const char* __hi, mask* __vec) const;       inline const char*      scan_is(mask __m, const char* __lo, const char* __hi) const;      inline const char*      scan_not(mask __m, const char* __lo, const char* __hi) const;         protected:      const mask*       table() const throw()      { return _M_table; }      static const mask*       classic_table() throw();      virtual       ~ctype();      virtual bool       do_is(mask __m, char_type __c) const;      virtual const char_type*      do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const;      virtual const char_type*      do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const;      virtual const char_type*      do_scan_not(mask __m, const char_type* __lo, 		  const char_type* __hi) const;      virtual char_type       do_toupper(char_type) const;      virtual const char_type*      do_toupper(char_type* __lo, const char_type* __hi) const;      virtual char_type       do_tolower(char_type) const;      virtual const char_type*      do_tolower(char_type* __lo, const char_type* __hi) const;            virtual char_type       do_widen(char) const;      virtual const char*      do_widen(const char* __lo, const char* __hi, char_type* __dest) const;      virtual char       do_narrow(char_type, char __dfault) const;      virtual const char_type*      do_narrow(const char_type* __lo, const char_type* __hi,		char __dfault, char* __dest) const;    };   template<>    const ctype<char>&    use_facet<ctype<char> >(const locale& __loc);#ifdef _GLIBCPP_USE_WCHAR_T  // 22.2.1.3  ctype<wchar_t> specialization  template<>    class ctype<wchar_t> : public __ctype_abstract_base<wchar_t>    {    public:      // Types:      typedef wchar_t 	       	char_type;      typedef wctype_t	       	__wmask_type;    protected:      __c_locale		_M_c_locale_ctype;    public:      // Data Members:      static locale::id        	id;      explicit       ctype(size_t __refs = 0);      explicit       ctype(__c_locale __cloc, size_t __refs = 0);    protected:      __wmask_type      _M_convert_to_wmask(const mask __m) const;      virtual       ~ctype();      virtual bool       do_is(mask __m, char_type __c) const;      virtual const char_type*      do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const;      virtual const char_type*      do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const;      virtual const char_type*      do_scan_not(mask __m, const char_type* __lo, 		  const char_type* __hi) const;      virtual char_type       do_toupper(char_type) const;      virtual const char_type*      do_toupper(char_type* __lo, const char_type* __hi) const;      virtual char_type       do_tolower(char_type) const;      virtual const char_type*      do_tolower(char_type* __lo, const char_type* __hi) const;            virtual char_type       do_widen(char) const;      virtual const char*      do_widen(const char* __lo, const char* __hi, char_type* __dest) const;      virtual char       do_narrow(char_type, char __dfault) const;      virtual const char_type*      do_narrow(const char_type* __lo, const char_type* __hi,		char __dfault, char* __dest) const;    };  template<>    const ctype<wchar_t>&    use_facet<ctype<wchar_t> >(const locale& __loc);#endif //_GLIBCPP_USE_WCHAR_T  // Include host and configuration specific ctype inlines.  #include <bits/ctype_inline.h>  // 22.2.1.2  Template class ctype_byname  template<typename _CharT>    class ctype_byname : public ctype<_CharT>    {    public:      typedef _CharT 		char_type;      explicit       ctype_byname(const char* __s, size_t __refs = 0);    protected:      virtual       ~ctype_byname() { };    };  // 22.2.1.4  Class ctype_byname specializations.  template<>    ctype_byname<char>::ctype_byname(const char*, size_t refs);  template<>    ctype_byname<wchar_t>::ctype_byname(const char*, size_t refs);  // 22.2.1.5  Template class codecvt  #include <bits/codecvt.h>  // 22.2.2  The numeric category.  class __num_base   {  protected:    // String literal of acceptable (narrow) input, for num_get.    // "0123456789eEabcdfABCDF"    static const char _S_atoms[];    enum     {        _M_zero,      _M_e = _M_zero + 10,      _M_E = _M_zero + 11,      _M_size = 21 + 1    };    // num_put    // Construct and return valid scanf format for floating point types.    static bool    _S_format_float(const ios_base& __io, char* __fptr, char __mod, 		    streamsize __prec);        // Construct and return valid scanf format for integer types.    static void    _S_format_int(const ios_base& __io, char* __fptr, char __mod, char __modl);  };  template<typename _CharT>    class numpunct : public locale::facet    {    public:      // Types:      typedef _CharT          		char_type;      typedef basic_string<_CharT> 	string_type;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -