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

📄 locale_facets.h

📁 c++编程宝典源码及Quincy99编译器 是《标准C++编程宝典》电子工业出版社的光盘
💻 H
📖 第 1 页 / 共 4 页
字号:
      virtual const char_type*      do_narrow(const char_type* __low, const char_type* __high,		 char __dfault, char* __dest) const;    };  template<>    inline const ctype<wchar_t>&    use_facet< const ctype<wchar_t> > (const locale& __loc);#endif //_GLIBCPP_USE_WCHAR_T  // 22.2.1.2  Template class ctype_byname  template<typename _CharT>    class ctype_byname : public ctype<_CharT>    {      typedef _CharT char_type;    public:      explicit       ctype_byname(const char*, size_t __refs = 0)      : ctype<_CharT>(__refs) { }    protected:      virtual       ~ctype_byname() { }    };  //  22.2.1.4  Class ctype_byname specializations  template<>    ctype_byname<char>::ctype_byname(const char*, size_t refs);#ifdef _GLIBCPP_USE_WCHAR_T  template<>    ctype_byname<wchar_t>::ctype_byname(const char*, size_t refs);#endif  //  22.2.1.5  Template class codecvt  class codecvt_base  {  public:    enum result    {      ok,      partial,      error,      noconv    };  };  template<typename _InternT, typename _ExternT, typename _StateT>    class _Codecvt : public locale::facet, public codecvt_base    {      // Types:      typedef _InternT intern_type;      typedef _ExternT extern_type;      typedef _StateT  state_type;          protected:      explicit       _Codecvt (size_t __refs = 0) : locale::facet(__refs) { }    public:      result      out(state_type& __state, const intern_type* __from, 	  const intern_type* __from_end, const intern_type* &__from_next,	  extern_type* __to, extern_type* __to_limit, 	  extern_type*& __to_next) const      { 	return do_out(__state, __from, __from_end, __from_next, __to, 		      __to_limit, __to_next);       }      result      unshift(state_type& __state, extern_type* __to, extern_type* __to_limit,	      extern_type*& __to_next) const      { return do_unshift(__state, __to,__to_limit,__to_next); }      result      in(state_type& __state, const extern_type* __from, 	 const extern_type* __from_end, const extern_type*& __from_next,	 intern_type* __to, intern_type* __to_limit,	 intern_type*& __to_next) const      { 	return do_in(__state, __from, __from_end, __from_next,		     __to, __to_limit, __to_next);       }      int       encoding() const throw()      { return do_encoding(); }      bool       always_noconv() const throw()      { return do_always_noconv(); }      int      length(const state_type& __state, const extern_type* __from,	     const extern_type* __end, size_t __max) const      { return do_length(__state, __from, __end, __max); }      int       max_length() const throw()      { return do_max_length(); }    protected:      virtual       ~_Codecvt() { }      virtual result      do_out(state_type& __state,	     const intern_type* __from, const intern_type* __from_end,	     const intern_type*& __from_next,	     extern_type* __to, extern_type* __to_limit,	     extern_type*& __to_next) const = 0;      virtual result      do_unshift(state_type& __state,		 extern_type* __to, extern_type* __to_limit,		 extern_type*& __to_next) const = 0;            virtual result      do_in(state_type& __state,	    const extern_type* __from, const extern_type* __from_end,	    const extern_type*& __from_next,	    intern_type* __to, intern_type* __to_limit,	    intern_type*& __to_next) const = 0;            virtual int       do_encoding() const throw() = 0;      virtual bool       do_always_noconv() const throw() = 0;      virtual int       do_length(const state_type&, const extern_type* __from,		const extern_type* __end, size_t __max) const = 0;      virtual int       do_max_length() const throw() = 0;    };    template<typename _InternT, typename _ExternT, typename _StateT>    class codecvt : public _Codecvt<_InternT,_ExternT,_StateT>    {      // Types:      typedef _InternT intern_type;      typedef _ExternT extern_type;      typedef _StateT state_type;    public:            // Data Members:      static locale::id id;      explicit       codecvt(size_t __refs = 0)       : _Codecvt<_InternT,_ExternT,_StateT> (__refs) { }    protected:      virtual       ~codecvt() { }    };  // codecvt<char,char,mbstate_t> specialization  template<>    class codecvt<char, char, mbstate_t>     : public _Codecvt<char, char, mbstate_t>    {      // Types:      typedef char intern_type;      typedef char extern_type;      typedef mbstate_t state_type;    public:            explicit codecvt (size_t __refs = 0);      static locale::id id;    protected:      virtual ~codecvt();      virtual result      do_out(state_type& __state, const intern_type* __from, 	     const intern_type* __from_end, const intern_type*& __from_next,	     extern_type* __to, extern_type* __to_limit,	     extern_type*& __to_next) const;      virtual result      do_unshift(state_type& __state, extern_type* __to, 		 extern_type* __to_limit, extern_type*& __to_next) const;      virtual result      do_in(state_type& __state, const extern_type* __from, 	    const extern_type* __from_end, const extern_type*& __from_next,	    intern_type* __to, intern_type* __to_limit, 	    intern_type*& __to_next) const;      virtual int do_encoding() const throw();      virtual bool do_always_noconv() const throw();      virtual int do_length(const state_type&, const extern_type* __from,			    const extern_type* __end, size_t __max) const;      virtual int do_max_length() const throw();  };#ifdef _GLIBCPP_USE_WCHAR_T  template<>    class codecvt<wchar_t,char,mbstate_t>     : public _Codecvt<wchar_t,char,mbstate_t>    {      // Types:      typedef wchar_t intern_type;      typedef char extern_type;      typedef mbstate_t state_type;    public:      explicit codecvt(size_t __refs = 0);      static locale::id id;    protected:      virtual ~codecvt();      virtual result      do_out(state_type& __state, const intern_type* __from, 	     const intern_type* __from_end, const intern_type*& __from_next,	     extern_type* __to, extern_type* __to_limit,	     extern_type*& __to_next) const;      virtual result      do_unshift(state_type& __state,		 extern_type* __to, extern_type* __to_limit,		 extern_type*& __to_next) const;      virtual result      do_in(state_type& __state,	     const extern_type* __from, const extern_type* __from_end,	     const extern_type*& __from_next,	     intern_type* __to, intern_type* __to_limit,	     intern_type*& __to_next) const;      virtual int do_encoding() const throw();      virtual bool do_always_noconv() const throw();      virtual int do_length(const state_type&, const extern_type* __from,			    const extern_type* __end, size_t __max) const;      virtual int do_max_length() const throw();    };#endif //_GLIBCPP_USE_WCHAR_T  // 22.2.1.6  Template class codecvt_byname  template<typename _InternT, typename _ExternT, typename _StateT>    class codecvt_byname : public codecvt<_InternT,_ExternT,_StateT>    {    public:      explicit       codecvt_byname(const char*, size_t __refs = 0)       : codecvt<_InternT,_ExternT,_StateT> (__refs) { }    protected:      virtual       ~codecvt_byname() { }    };  template<>    class codecvt_byname<char,char,mbstate_t>    : public codecvt<char,char,mbstate_t>    {    public:      explicit       codecvt_byname(const char*, size_t __refs = 0);    protected:      virtual       ~codecvt_byname();    };  #ifdef _GLIBCPP_USE_WCHAR_T  template<>    class codecvt_byname<wchar_t,char,mbstate_t>      : public codecvt<wchar_t,char,mbstate_t>    {    public:      explicit       codecvt_byname(const char*, size_t __refs = 0);    protected:      virtual       ~codecvt_byname();    };#endif  template<typename _CharT, typename _InIter>    class _Numeric_get;  // forward  // _Format_cache holds the information extracted from the numpunct<>  // and moneypunct<> facets in a form optimized for parsing and  // formatting.  It is stored via a void* pointer in the pword()  // array of an iosbase object passed to the _get and _put facets.  // NB: contains no user-serviceable parts.  template<typename _CharT>    class _Format_cache    {      // Types:      typedef _CharT 			char_type;      typedef char_traits<_CharT> 	traits_type;      typedef basic_string<_CharT>	string_type;      typedef string_type::size_type	size_type;      // Forward decls and Friends:      friend class locale;      template<typename _Char, typename _InIter>        friend class _Numeric_get;      friend class num_get<_CharT>;      friend class num_put<_CharT>;      friend class time_get<_CharT>;      friend class money_get<_CharT>;      friend class time_put<_CharT>;      friend class money_put<_CharT>;    public:       // Data Members:      // ios_base::pword() reserved cell      static int 		_S_pword_ix;       // True iff data members are consistent with the current locale,      // ie imbue sets this to false.      bool 			_M_valid;      // A list of valid numeric literals: for the standard "C" locale,      // this would usually be: "-+xX0123456789abcdef0123456789ABCDEF"      static const char _S_literals[];      // NB: Code depends on the order of definitions of the names      // these are indices into _S_literals, above.      // This string is formatted for putting, not getting. (output, not input)      enum       {  	_S_minus, 	_S_plus, 	_S_ecks, 	_S_Ecks, 	_S_digits,	_S_digits_end = _S_digits + 16,	_S_udigits = _S_digits_end,  	_S_udigits_end = _S_udigits + 16,	_S_ee = _S_digits + 14, // For scientific notation, 'E'	_S_Ee = _S_udigits + 14 // For scientific notation, 'e'      };      // The sign used to separate decimal values: for standard US      // locales, this would usually be: "."      // Abstracted from numpunct::decimal_point().      char_type 		_M_decimal_point;      // The sign used to separate groups of digits into smaller      // strings that the eye can parse with less difficulty: for      // standard US locales, this would usually be: ","      // Abstracted from numpunct::thousands_sep().      char_type			_M_thousands_sep;      // However the US's "false" and "true" are translated.      // From numpunct::truename() and numpunct::falsename(), respectively.      string_type 		_M_truename;      string_type 		_M_falsename;      // If we are checking groupings. This should be equivalent to       // numpunct::groupings().size() != 0      bool 			_M_use_grouping;      // If we are using numpunct's groupings, this is the current      // grouping string in effect (from numpunct::grouping()).      string 			_M_grouping;      _Format_cache();      ~_Format_cache() throw() { }      // Given a member of the ios heirarchy as an argument, extract      // out all the current formatting information into a      // _Format_cache object and return a pointer to it.      static _Format_cache<_CharT>*       _S_get(ios_base& __ios);      void       _M_populate(ios_base&);      static void       _S_callback(ios_base::event __event, ios_base& __ios, int __ix) throw();    };   template<> _Format_cache<char>::_Format_cache();#ifdef _GLIBCPP_USE_WCHAR_T   template<> _Format_cache<wchar_t>::_Format_cache();#endif  // _Numeric_get is used by num_get, money_get, and time_get to help  // in parsing out numbers.  template<typename _CharT, typename _InIter>    class _Numeric_get    {      // Types:      typedef _CharT     char_type;      typedef _InIter    iter_type;      // Forward decls and Friends:      template<typename _Char, typename _InIterT>      friend class num_get;      template<typename _Char, typename _InIterT>      friend class time_get;      template<typename _Char, typename _InIterT>      friend class money_get;      template<typename _Char, typename _InIterT>      friend class num_put;      template<typename _Char, typename _InIterT>      friend class time_put;      template<typename _Char, typename _InIterT>      friend class money_put;    private:      explicit       _Numeric_get() { }      virtual       ~_Numeric_get() { }      iter_type       _M_get_digits(iter_type __in, iter_type __end) const;    };  template<typename _CharT, typename _InIter>    class num_get : public locale::facet    {      // Types:      typedef _CharT   			char_type;      typedef _InIter  			iter_type;      typedef char_traits<_CharT> 	__traits_type;    public:      explicit       num_get(size_t __refs = 0) : locale::facet(__refs) { }      iter_type       get(iter_type __in, iter_type __end, ios_base& __io,	  ios_base::iostate& __err, bool& __v) const      { return do_get(__in, __end, __io, __err, __v); }#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS      iter_type       get(iter_type __in, iter_type __end, ios_base& __io,	  ios_base::iostate& __err, short& __v) const      { return do_get(__in, __end, __io, __err, __v); }      iter_type       get(iter_type __in, iter_type __end, ios_base& __io,	  ios_base::iostate& __err, int& __v)   const      { return do_get(__in, __end, __io, __err, __v); }#endif      iter_type      get(iter_type __in, iter_type __end, ios_base& __io, 	  ios_base::iostate& __err, long& __v) const      { return do_get(__in, __end, __io, __err, __v); }#ifdef _GLIBCPP_USE_LONG_LONG      iter_type       get(iter_type __in, iter_type __end, ios_base& __io,	  ios_base::iostate& __err, long long& __v) const;#endif      iter_type       get(iter_type __in, iter_type __end, ios_base& __io,	  ios_base::iostate& __err, unsigned short& __v) const      { return do_get(__in, __end, __io, __err, __v); }      iter_type       get(iter_type __in, iter_type __end, ios_base& __io,	  ios_base::iostate& __err, unsigned int& __v)   const      { return do_get(__in, __end, __io, __err, __v); }      iter_type       get(iter_type __in, iter_type __end, ios_base& __io,	  ios_base::iostate& __err, unsigned long& __v)  const      { return do_get(__in, __end, __io, __err, __v); }#ifdef _GLIBCPP_USE_LONG_LONG      iter_type       get(iter_type __in, iter_type __end, ios_base& __io,	  ios_base::iostate& __err, unsigned long long& __v)  const      { return do_get(__in, __end, __io, __err, __v); }#endif      iter_type       get(iter_type __in, iter_type __end, ios_base& __io,	  ios_base::iostate& __err, float& __v) const      { return do_get(__in, __end, __io, __err, __v); }      iter_type       get(iter_type __in, iter_type __end, ios_base& __io,

⌨️ 快捷键说明

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