locale_facets.h
来自「ARM Linux Tool 各种代码包括MTD」· C头文件 代码 · 共 1,602 行 · 第 1/3 页
H
1,602 行
// 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 { public: // Types: typedef _CharT char_type; typedef _InIter iter_type; typedef char_traits<_CharT> __traits_type; static locale::id id; 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 { 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, 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, ios_base::iostate& __err, double& __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, long double& __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, void*& __v) const { return do_get(__in, __end, __io, __err, __v); } protected: virtual ~num_get() { } // This consolidates the extraction, storage and // error-processing parts of the do_get(...) overloaded member // functions. // NB: This is specialized for char. void _M_extract(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, char* __xtrc, int& __base, bool __fp = true) const; virtual iter_type do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, bool&) const;#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS virtual iter_type do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, short&) const; virtual iter_type do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, int&) const;#endif virtual iter_type do_get (iter_type, iter_type, ios_base&, ios_base::iostate&, long&) const;#ifdef _GLIBCPP_USE_LONG_LONG virtual iter_type do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err, long long&) const;#endif virtual iter_type do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err, unsigned short&) const; virtual iter_type do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err, unsigned int&) const; virtual iter_type do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err, unsigned long&) const;#ifdef _GLIBCPP_USE_LONG_LONG virtual iter_type do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err, unsigned long long&) const;#endif virtual iter_type do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err, float&) const; virtual iter_type do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err, double&) const; virtual iter_type do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err, long double&) const; virtual iter_type do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err, void*&) const; }; template<typename _CharT, typename _InIter> locale::id num_get<_CharT, _InIter>::id; // Declare specialized extraction member function. template<> void num_get<char, istreambuf_iterator<char> >:: _M_extract(istreambuf_iterator<char> __beg, istreambuf_iterator<char> __end, ios_base& __io, ios_base::iostate& __err, char* __xtrc, int& __base, bool __fp) const; // _Numeric_put is used by num_put, money_put, and time_put // to help in formatting out numbers. template<typename _CharT, typename _OutIter> class _Numeric_put { public: typedef _CharT char_type; typedef _OutIter iter_type; protected: explicit _Numeric_put() { } virtual ~_Numeric_put() { } }; template<typename _CharT, typename _OutIter> class num_put : public locale::facet { public: // Types: typedef _CharT char_type; typedef _OutIter iter_type; static locale::id id; explicit num_put(size_t __refs = 0) : locale::facet(__refs) { } iter_type put(iter_type __s, ios_base& __f, char_type __fill, bool __v) const { return do_put(__s, __f, __fill, __v); } iter_type put(iter_type __s, ios_base& __f, char_type __fill, long __v) const { return do_put(__s, __f, __fill, __v); } iter_type put(iter_type __s, ios_base& __f, char_type __fill, unsigned long __v) const { return do_put(__s, __f, __fill, __v); }#ifdef _GLIBCPP_USE_LONG_LONG iter_type put(iter_type __s, ios_base& __f, char_type __fill, long long __v) const { return do_put(__s, __f, __fill, __v); } iter_type put(iter_type __s, ios_base& __f, char_type __fill, unsigned long long __v) const { return do_put(__s, __f, __fill, __v); }#endif iter_type put(iter_type __s, ios_base& __f, char_type __fill, double __v) const { return do_put(__s, __f, __fill, __v); } iter_type put(iter_type __s, ios_base& __f, char_type __fill, long double __v) const { return do_put(__s, __f, __fill, __v); } iter_type put(iter_type __s, ios_base& __f, char_type __fill, const void* __v) const { return do_put(__s, __f, __fill, __v); } protected: virtual ~num_put() { }; virtual iter_type do_put(iter_type, ios_base&, char_type __fill, bool __v) const; virtual iter_type do_put(iter_type, ios_base&, char_type __fill, long __v) const;#ifdef _GLIBCPP_USE_LONG_LONG virtual iter_type do_put(iter_type, ios_base&, char_type __fill, long long __v) const;#endif virtual iter_type do_put(iter_type, ios_base&, char_type __fill, unsigned long) const;#ifdef _GLIBCPP_USE_LONG_LONG virtual iter_type do_put(iter_type, ios_base&, char_type __fill, unsigned long long) const;#endif virtual iter_type do_put(iter_type, ios_base&, char_type __fill, double __v) const; virtual iter_type do_put(iter_type, ios_base&, char_type __fill, long double __v) const; virtual iter_type do_put(iter_type, ios_base&, char_type __fill, const void* __v) const; }; template <typename _CharT, typename _OutIter> locale::id num_put<_CharT, _OutIter>::id; template<typename _CharT> class numpunct : public locale::facet { public: // Types: typedef _CharT char_type; typedef basic_string<_CharT> string_type; static locale::id id; private: char_type _M_decimal_point; char_type _M_thousands_sep; string _M_grouping; string_type _M_truename; string_type _M_falsename; public: explicit numpunct(size_t __refs = 0) : locale::facet(__refs) { _M_initialize_numpunct(); } explicit numpunct(__c_locale __cloc, size_t __refs = 0) : locale::facet(__refs) { _M_initialize_numpunct(__cloc); } char_type decimal_point() const { return do_decimal_point(); } char_type thousands_sep() const { return do_thousands_sep(); } string grouping() const { return do_grouping(); } string_type truename() const { return do_truename(); } string_type falsename() const { return do_falsename(); } protected: virtual ~numpunct() { } virtual char_type do_decimal_point() const { return _M_decimal_point; } virtual char_type do_thousands_sep() const { return _M_thousands_sep; } virtual string do_grouping() const { return _M_grouping; } virtual string_type do_truename() const { return _M_truename; } virtual string_type do_falsename() const { return _M_falsename; } // For use at construction time only. void _M_initialize_numpunct(__c_locale __cloc = NULL); }; template<typename _CharT> locale::id numpunct<_CharT>::id; template<typename _CharT> void numpunct<_CharT>::_M_initialize_numpunct(__c_locale /*__cloc*/) { // NB: Cannot be made generic. } template<> void numpunct<char>::_M_initialize_numpunct(__c_locale __cloc);#ifdef _GLIBCPP_USE_WCHAR_T template<> void numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc);#endif template<typename _CharT> class numpunct_byname : public numpunct<_CharT> { __c_locale _M_c_locale_numpunct; public: typedef _CharT char_type; typedef basic_string<_CharT> string_type; explicit numpunct_byname(const char* __s, size_t __refs = 0) : numpunct<_CharT>(__refs) { _S_create_c_locale(_M_c_locale_numpunct, __s); _M_initialize_numpunct(_M_c_locale_numpunct); } protected: virtual ~numpunct_byname() { _S_destroy_c_locale(_M_c_locale_numpunct); } }; template<typename _CharT> class collate : public locale::facet { public: // Types: typedef _CharT char_type; typedef basic_string<_CharT> string_type; static locale::id id; explicit collate(size_t __refs = 0) : locale::facet(__refs) { } int compare(const _CharT* __lo1, const _CharT* __hi1, const _CharT* __lo2, const _CharT* __hi2) const { return this->do_compare(__lo1, __hi1, __lo2, __hi2); } string_type transform(const _CharT* __lo, const _CharT* __hi) const { return this->do_transform(__lo, __hi); } long hash(const _CharT* __lo, const _CharT* __hi) const { return this->do_hash(__lo, __hi); } protected: ~collate() { } // virtual virtual int do_compare(const _CharT* __lo1, const _CharT* __hi1, const _CharT* __lo2, const _CharT* __hi2) const; virtual string_type do_transform(const _CharT* __lo, const _CharT* __hi) const; virtual long do_hash(const _CharT* __lo, const _CharT* __hi) const; }; template<typename _CharT> locale::id collate<_CharT>::id; // Required specializations. template<> int collate<char>::do_compare(const char* __lo1, const char* __hi1, const char* __lo2, const char* __hi2) const; template<> string collate<char>::do_transform(const char* __lo, const char* __hi) const; template<> long collate<char>::do_hash(const char* __lo, const char* __hi) const;#ifdef _GLIBCPP_USE_WCHAR_T template<> int collate<wchar_t>::do_compare(const wchar_t* __lo1, const wchar_t* __hi1, const wchar_t* __lo2, const wchar_t* __hi2) const; template<> wstring collate<wchar_t>::do_transform(const wchar_t* __lo, const wchar_t* __hi) const; template<> long collate<wchar_t>::do_hash(const wchar_t* __lo, const wchar_t* __hi) const;#endif template<typename _CharT> class collate_byname : public collate<_CharT> { public: // Types: typedef _CharT char_type; typedef basic_string<_CharT> string_type; explicit collate_byname(const char*, size_t __refs = 0); protected: virtual ~collate_byname() { } }; template<> collate_byname<char>::collate_byname(const char*, size_t __refs);#ifdef _GLIBCPP_USE_WCHAR_T template<> collate_byname<wchar_t>::collate_byname(const char*, size_t __refs);#endif class time_base { public: enum dateorder { no_order, dmy, mdy, ymd, ydm }; }; template<typename _CharT, typename _InIter> class time_get : public locale::facet, public time_base { public: // Types: typedef _CharT char_type; typedef _InIter iter_type; static locale::id id; explicit time_get(size_t __refs = 0) : locale::facet (__refs), _M_daynames(0), _M_monthnames(0) { } dateorder date_order() const { return do_date_order(); } iter_type get_time(iter_type __s, iter_type __end, ios_base& __f, ios_base::iostate& __err, tm* __t) const { return do_get_time(__s, __end, __f, __err, __t); } iter_type get_date(iter_type __s, iter_type __end, ios_base& __f, ios_base::iostate& __err, tm* __t) const
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?