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

📄 locale_facets.h

📁 c++编程宝典源码及Quincy99编译器 是《标准C++编程宝典》电子工业出版社的光盘
💻 H
📖 第 1 页 / 共 4 页
字号:
      iter_type       get_date(iter_type __s, iter_type __end, ios_base& __f,	       ios_base::iostate& __err, tm* __t)  const      { return do_get_date(__s, __end, __f, __err, __t); }      iter_type       get_weekday(iter_type __s, iter_type __end, ios_base& __f,		  ios_base::iostate& __err, tm* __t) const      { return do_get_weekday(__s,__end,__f,__err,__t); }      iter_type       get_monthname(iter_type __s, iter_type __end, ios_base& __f, 		    ios_base::iostate& __err, tm* __t) const      { return do_get_monthname(__s,__end,__f,__err,__t); }      iter_type       get_year(iter_type __s, iter_type __end, ios_base& __f,	       ios_base::iostate& __err, tm* __t) const      { return do_get_year(__s,__end,__f,__err,__t); }      static locale::id id;    protected:      virtual       ~time_get()       {      	delete [] _M_monthnames; 	delete [] _M_daynames;       }      virtual dateorder       do_date_order()  const      { return time_base::ymd; }      virtual iter_type       do_get_time(iter_type __s, iter_type /*__end*/, ios_base&,		  ios_base::iostate& /*__err*/, tm* /*__t*/) const      { return __s; }      virtual iter_type       do_get_date(iter_type __s, iter_type /*__end*/, ios_base&,		  ios_base::iostate& /*__err*/, tm* /*__t*/) const      { return __s; }      virtual iter_type       do_get_weekday(iter_type __s, iter_type __end, ios_base&,		     ios_base::iostate& __err, tm* __t) const;      virtual iter_type       do_get_monthname(iter_type __s, iter_type __end, ios_base&, 		       ios_base::iostate& __err, tm* __t) const;      virtual iter_type       do_get_year(iter_type __s, iter_type /*__end*/, ios_base&,		   ios_base::iostate& /*__err*/, tm* /*__t*/) const      { return __s; }      mutable basic_string<_CharT>* _M_daynames;      mutable basic_string<_CharT>* _M_monthnames;    };  template<typename _CharT, typename _InIter>    class time_get_byname : public time_get<_CharT, _InIter>    {    public:      typedef _CharT     char_type;      typedef _InIter    iter_type;      explicit       time_get_byname(const char*, size_t __refs = 0)       : time_get<_CharT, _InIter>(__refs) { }    protected:      virtual       ~time_get_byname() { }    };  template<typename _CharT, typename _OutIter>    class time_put : public locale::facet, public time_base    {    public:      typedef _CharT     char_type;      typedef _OutIter   iter_type;      explicit       time_put(size_t __refs = 0) : locale::facet (__refs) { }      // NB: this is a nonvirtual, calls do_put in a loop.      iter_type       put(iter_type __s, ios_base& /*__f*/, char_type /*__fill*/,          const tm* /*__tmb*/, const _CharT* /*__pattern*/,          const _CharT* /*__pat_end*/) const      { return __s; }      iter_type       put(iter_type __s, ios_base& __f, char_type __fill,	  const tm* __tmb, char __format, char __modifier = 0) const      { return do_put(__s, __f, __fill, __tmb, __format, __modifier); }      static locale::id id;    protected:      virtual       ~time_put() { }      virtual iter_type       do_put(iter_type __s, ios_base&, char_type, const tm* /*__t*/, 	     char /*__format*/, char /*__mod*/) const      { return __s; }    };  template<typename _CharT, typename _OutIter>    class time_put_byname : time_put<_CharT, _OutIter>    {      typedef _CharT     char_type;      typedef _OutIter   iter_type;    public:      explicit       time_put_byname(const char*, size_t __refs = 0)       : time_put<_CharT, _OutIter> (__refs) { }    protected:      virtual       ~time_put_byname() { }    };  template<typename _CharT, typename _InIter>    class money_get : public locale::facet    {      typedef _CharT        char_type;      typedef _InIter       iter_type;      typedef basic_string<_CharT> string_type;    public:      explicit       money_get(size_t __refs = 0) : locale::facet(__refs) { }      iter_type       get(iter_type __s, iter_type __end, bool __intl,	  ios_base& __f, ios_base::iostate& __err, long double& __units) const      { return do_get(__s, __end, __intl, __f, __err, __units); }      iter_type       get(iter_type __s, iter_type __end, bool __intl, ios_base& __f, 	   ios_base::iostate& __err, string_type& __digits) const      { return do_get(__s, __end, __intl, __f, __err, __digits); }      static locale::id id;    protected:      virtual       ~money_get() { }      virtual iter_type       do_get(iter_type __s, iter_type /*__end*/, bool /*__intl*/,             ios_base& /*__io*/, ios_base::iostate& /*__err*/,             long double& /*__units*/) const      { return __s; }      virtual iter_type       do_get(iter_type __s, iter_type /*__end*/, bool /*__intl*/,             ios_base& /*__io*/, ios_base::iostate& /*__err*/,             string_type& /*__digits*/) const      { return __s; }    };  template<typename _CharT, typename _OutIter>    class money_put : public locale::facet    {      typedef _CharT              char_type;      typedef _OutIter            iter_type;      typedef basic_string<_CharT> string_type;    public:      explicit       money_put(size_t __refs = 0) : locale::facet(__refs) { }      iter_type       put(iter_type __s, bool __intl, ios_base& __f,	  char_type __fill, long double __units) const      { return do_put(__s, __intl, __f, __fill, __units); }      iter_type       put(iter_type __s, bool __intl, ios_base& __f,	  char_type __fill, const string_type& __digits) const      { return do_put(__s, __intl, __f, __fill, __digits); }      static locale::id id;    protected:      virtual       ~money_put() { }      virtual iter_type      do_put(iter_type __s, bool, ios_base& /*__io*/, char_type /*__fill*/,	     long double /*__units*/) const      { return __s; }      virtual iter_type      do_put(iter_type __s, bool, ios_base& /*__io*/, char_type /*__fill*/,	     const string_type& /*__digits*/) const      { return __s; }    };  struct money_base  {    enum part { none, space, symbol, sign, value };    struct pattern { char field[4]; };  };  template<typename _CharT>    class _Moneypunct : public _Punct<_CharT>, public money_base    {      typedef _CharT char_type;      typedef basic_string<_CharT> string_type;    public:      string_type        curr_symbol()   const      { return do_curr_symbol(); }      string_type        positive_sign() const      { return do_positive_sign(); }      string_type        negative_sign() const      { return do_negative_sign(); }      int                frac_digits()   const      { return do_frac_digits(); }      pattern            pos_format()    const      { return do_pos_format(); }      pattern            neg_format()    const      { return do_neg_format(); }    protected:      explicit       _Moneypunct(size_t __refs = 0) : _Punct<_CharT> (__refs) { }      virtual       ~_Moneypunct() { }      virtual string_type        do_curr_symbol()   const      { return basic_string<_CharT>(); }      virtual string_type        do_positive_sign() const      { return basic_string<_CharT>(); }      virtual string_type        do_negative_sign() const      { return basic_string<_CharT>(); }      virtual int                do_frac_digits() const      { return 0; }      virtual pattern            do_pos_format() const      {	static const money_base::pattern __pat = {{symbol, sign, none, value}};	return __pat;      }      virtual pattern            do_neg_format() const      {	static const money_base::pattern __pat = {{symbol, sign, none, value}};	return __pat;      }    };  template<typename _CharT, bool _Intl>    class moneypunct : public _Moneypunct<_CharT>    {      // Types:      typedef _CharT 			char_type;      typedef basic_string<_CharT> 	string_type;    public:      static const bool intl = _Intl;      static locale::id id;      explicit       moneypunct(size_t __refs = 0) : _Moneypunct<_CharT> (__refs) { }    protected:      virtual       ~moneypunct() { }    };  template<typename _CharT, bool _Intl>    class moneypunct_byname : public moneypunct<_CharT,_Intl>    {    public:      typedef _CharT char_type;      typedef basic_string<_CharT> string_type;      static const bool intl = _Intl;      explicit       moneypunct_byname(const char*, size_t __refs = 0)      : moneypunct<_CharT,_Intl> (__refs) { }    protected:      virtual       ~moneypunct_byname() { }    };  template<>    moneypunct_byname<char, false>::    moneypunct_byname(const char*, size_t __refs);  template<>    moneypunct_byname<char, true>::    moneypunct_byname(const char*, size_t __refs);#ifdef _GLIBCPP_USE_WCHAR_T  template<>    moneypunct_byname<wchar_t,false>::    moneypunct_byname(const char*, size_t __refs);  template<>    moneypunct_byname<wchar_t,true>::    moneypunct_byname (const char*, size_t __refs);#endif  struct messages_base  {    typedef int catalog;  };  template<typename _CharT>    class _Messages : public locale::facet, public messages_base    {      typedef _CharT char_type;      typedef basic_string<_CharT> string_type;    public:      catalog       open(const basic_string<char>& __s, const locale& __loc) const      { return do_open(__s, __loc); }      string_type        get(catalog __c, int __set, int __msgid, const string_type& __s) const      { return do_get(__c,__set,__msgid,__s); }      void       close(catalog __c) const      { return do_close(__c); }    protected:      explicit       _Messages(size_t __refs = 0) : locale::facet(__refs) { }      virtual       ~_Messages() { }      // NB: Probably these should be pure, and implemented only in      //  specializations of messages<>.  But for now...      virtual catalog       do_open(const basic_string<char>&, const locale&) const      { return 0; }      virtual string_type        do_get(catalog, int, int /*__msgid*/, const string_type& __dfault) const      { return __dfault; }      virtual void          do_close (catalog) const { }    };  template<typename _CharT>    class messages : public _Messages<_CharT>    {    public:      typedef _CharT char_type;      typedef basic_string<_CharT> string_type;      static locale::id id;      explicit       messages(size_t __refs = 0) : _Messages<_CharT> (__refs) { }    protected:      virtual       ~messages() { }    };  template<typename _CharT>    class messages_byname : public messages<_CharT>    {    public:      typedef _CharT char_type;      typedef basic_string<_CharT> string_type;      explicit       messages_byname(const char*, size_t __refs = 0)       : messages<_CharT>(__refs) { }    protected:      virtual       ~messages_byname() { }    };  template<>    messages_byname<char>::messages_byname(const char*, size_t __refs);#ifdef _GLIBCPP_USE_WCHAR_T  template<>    messages_byname<wchar_t>::messages_byname(const char*, size_t __refs);#endif  // Subclause convenience interfaces, inlines   // NB: these are inline  // because, when used in a loop, some compilers can hoist the body  // out of the loop; then it's just as fast as the C is*() function.  template<typename _CharT>    inline bool     isspace(_CharT __c, const locale& __loc)    { return use_facet<ctype<_CharT> > (__loc).is(ctype_base::space, __c); }  template<typename _CharT>    inline bool     isprint(_CharT __c, const locale& __loc)    { return use_facet<ctype<_CharT> > (__loc).is(ctype_base::print, __c); }  template<typename _CharT>    inline bool     iscntrl(_CharT __c, const locale& __loc)    { return use_facet<ctype<_CharT> > (__loc).is(ctype_base::cntrl, __c); }  template<typename _CharT>    inline bool     isupper(_CharT __c, const locale& __loc)    { return use_facet<ctype<_CharT> > (__loc).is(ctype_base::upper, __c); }  template<typename _CharT>    inline bool islower(_CharT __c, const locale& __loc)    { return use_facet<ctype<_CharT> > (__loc).is(ctype_base::lower, __c); }  template<typename _CharT>    inline bool     isalpha(_CharT __c, const locale& __loc)    { return use_facet<ctype<_CharT> > (__loc).is(ctype_base::alpha, __c); }  template<typename _CharT>    inline bool     isdigit(_CharT __c, const locale& __loc)    { return use_facet<ctype<_CharT> > (__loc).is(ctype_base::digit, __c); }  template<typename _CharT>    inline bool     ispunct(_CharT __c, const locale& __loc)    { return use_facet<ctype<_CharT> > (__loc).is(ctype_base::punct, __c); }  template<typename _CharT>    inline bool     isxdigit(_CharT __c, const locale& __loc)    { return use_facet<ctype<_CharT> > (__loc).is(ctype_base::xdigit, __c); }  template<typename _CharT>    inline bool     isalnum(_CharT __c, const locale& __loc)    { return use_facet<ctype<_CharT> > (__loc).is(ctype_base::alnum, __c); }  template<typename _CharT>    inline bool     isgraph(_CharT __c, const locale& __loc)    { return use_facet<ctype<_CharT> > (__loc).is(ctype_base::graph, __c); }  template<typename _CharT>    inline _CharT     toupper(_CharT __c, const locale& __loc)    { return use_facet<ctype<_CharT> > (__loc).toupper(__c); }  template<typename _CharT>    inline _CharT     tolower(_CharT __c, const locale& __loc)    { return use_facet<ctype<_CharT> > (__loc).tolower(__c); }} // namespace std#endif	/* _CPP_BITS_LOCFACETS_H */// Local Variables:// mode:c++// End:

⌨️ 快捷键说明

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