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

📄 _numeric.h

📁 realview22.rar
💻 H
📖 第 1 页 / 共 2 页
字号:
{
public:
    typedef _CharT          char_type;
    typedef _OutputIterator iter_type;

    _EXPLICIT num_put (size_t __refs = 0)
        : locale::facet (__refs, locale::numeric) { }

#ifndef _RWSTD_NO_BOOL
    iter_type put (iter_type __it, ios_base& __flags, char_type __fill,
                   bool __val) const {
        return do_put(__it, __flags, __fill, __val);
    }
#endif

    iter_type put (iter_type __it, ios_base& __flags, char_type __fill,
                   long __val) const {
        return do_put (__it, __flags, __fill, __val);
    }

    iter_type put (iter_type __it, ios_base& __flags, char_type __fill,
                   unsigned long __val) const {
        return do_put (__it, __flags, __fill, __val);
    }

    iter_type put (iter_type __it, ios_base& __flags, char_type __fill,
                   double __val) const {
        return do_put (__it, __flags, __fill, __val);
    }

    iter_type put (iter_type __it, ios_base& __flags, char_type __fill,
                   long double __val) const {
        return do_put(__it, __flags, __fill, __val);
    }

    iter_type put (iter_type __it, ios_base& __flags, char_type __fill,
                   const void* __val) const {
        return do_put(__it, __flags, __fill, __val);
    }

    // extensions

    iter_type put (iter_type __it, ios_base& __flags, char_type __fill,
                   short __val) const {
        return do_put(__it, __flags, __fill, __val);
    }

    iter_type put (iter_type __it, ios_base& __flags, char_type __fill,
                   unsigned short __val) const {
        return do_put(__it, __flags, __fill, __val);
    }

    iter_type put (iter_type __it, ios_base& __flags, char_type __fill,
                   int __val) const {
        return do_put(__it, __flags, __fill, __val);
    }

    iter_type put (iter_type __it, ios_base& __flags, char_type __fill,
                   unsigned int __val) const {
        return do_put(__it, __flags, __fill, __val);
    }

#ifdef _RWSTD_LONG_LONG

    iter_type put (iter_type __it, ios_base& __flags, char_type __fill,
                   _RWSTD_LONG_LONG __val) const {
        return do_put(__it, __flags, __fill, __val);
    }

    iter_type put (iter_type __it, ios_base& __flags, char_type __fill,
                   unsigned _RWSTD_LONG_LONG __val) const {
        return do_put(__it, __flags, __fill, __val);
    }

#endif   // _RWSTD_LONG_LONG

    static locale::id id;

  // Implementation:
    enum { _C_facet_cat = locale::numeric, _C_ok_implicit = 1 };

protected:

#ifndef _RWSTD_NO_BOOL
    virtual iter_type do_put (iter_type, ios_base&, char_type, bool) const;
#endif
    virtual iter_type do_put (iter_type, ios_base&, char_type, long) const;
    virtual iter_type do_put (iter_type, ios_base&, char_type,
                              unsigned long) const;
    virtual iter_type do_put (iter_type, ios_base&, char_type, 
                              double) const __softfp;
    virtual iter_type do_put (iter_type, ios_base&, char_type,
                              long double) const __softfp;
    virtual iter_type do_put (iter_type, ios_base&, char_type,
                              const void*) const;

    // extensions
    virtual iter_type do_put (iter_type, ios_base&, char_type, short) const;
    virtual iter_type do_put (iter_type, ios_base&, char_type,
                              unsigned short) const;
    virtual iter_type do_put (iter_type, ios_base&, char_type, int) const;
    virtual iter_type do_put (iter_type, ios_base&, char_type,
                              unsigned int) const;

#ifdef _RWSTD_LONG_LONG

    virtual iter_type do_put (iter_type, ios_base&, char_type, 
                              _RWSTD_LONG_LONG) const;

    virtual iter_type do_put (iter_type, ios_base&, char_type, 
                              unsigned _RWSTD_LONG_LONG) const;

#endif   // _RWSTD_LONG_LONG

private:

#ifdef _RWSTD_NO_MEMBER_TEMPLATES
    locale::id &_C_get_id (void) const { return id; }
#endif

};


_RWSTD_INSTANTIATE_3 (class _RWSTD_EXPORT
                      num_put<char,
                      ostreambuf_iterator<char, char_traits<char> > >);

#ifndef _RWSTD_NO_WCHAR_T

_RWSTD_INSTANTIATE_3 (class _RWSTD_EXPORT
                      num_put<wchar_t,
                      ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >);

#endif   // _RWSTD_NO_WCHAR_T


// 22.2.3.1
template <class _CharT>
class numpunct: public locale::facet, 
                public _RW::__rw_numpunct_impl<_CharT>
{
public:
    typedef _CharT char_type;
    typedef basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
    string_type;

    // The second parameter (i) to the constructor is implementation specific.
    // For portable code, always let it default as shown.

#ifndef _MSC_VER
    _EXPLICIT numpunct (size_t __refs = 0, 
                        const _RW::__rw_numpunct_init_data<_CharT>* =
                        _RW::__rw_numpunct_impl<_CharT>::_C_get_ivals ());

#else
    _EXPLICIT numpunct (size_t __refs = 0, 
                        const _RW::__rw_numpunct_init_data<_CharT>* =
                        _C_get_ivals ());
#endif   // _MSC_VER

    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();
    }

    static locale::id id;

    // Implementation:
    enum { _C_facet_cat = locale::numeric, _C_ok_implicit = 1 };

protected:

    virtual char_type do_decimal_point () const {
        return this->_C_dp;
    }

    virtual char_type do_thousands_sep () const {
        return this->_C_ts;
    }

    virtual string do_grouping () const {
        return this->_C_gr;
    }

    virtual string_type do_truename () const {
        return this->_C_tn;
    }

    virtual string_type do_falsename () const {
        return this->_C_fn;
    }

  // Implementation:

private:
    virtual void _C_initfacet (const locale&);

#ifdef _RWSTD_NO_MEMBER_TEMPLATES
    locale::id &_C_get_id (void) const { return id; }
#endif

};

template <class _CharT>
inline numpunct<_CharT>::
numpunct (size_t __ref, const _RW::__rw_numpunct_init_data<_CharT> *__np)
    : locale::facet(__ref, locale::numeric), 
      _RW::__rw_numpunct_impl<_CharT>(__np)
{ }


_RWSTD_INSTANTIATE_1 (class _RWSTD_EXPORT numpunct<char>);

#ifndef _RWSTD_NO_WCHAR_T

_RWSTD_INSTANTIATE_1 (class _RWSTD_EXPORT numpunct<wchar_t>);

#endif   // _RWSTD_NO_WCHAR_T


// 22.2.3.2
template <class _CharT>
class numpunct_byname: public numpunct<_CharT>
{
public:

    _EXPLICIT numpunct_byname (const char *__name, size_t __refs = 0) :
#if defined (_MSC_VER) && !defined (__BORLANDC__)
        numpunct<_CharT>(__refs, _C_get_init_by_name_(__name))
#else
        numpunct<_CharT>(__refs,
                         _RW::__rw_numpunct_impl_data<_CharT>::_C_get_init_by_name_(__name))
#endif // _MSC_VER
        { }
};


_RWSTD_NAMESPACE_END   // std


_RWSTD_NAMESPACE_BEGIN (__rw)


_RWSTD_SPECIALIZED_FUNCTION
inline _STD::numpunct<char>*
__rw_create_native_facet (_STD::numpunct<char>*)
{
    return new _STD::numpunct_byname<char>("", 1);
}


#ifndef _RWSTD_NO_FUNC_PARTIAL_SPEC

template <class _CharT>
inline _STD::numpunct<_CharT>*
__rw_create_named_facet (_STD::numpunct<_CharT>*, const char *__name,
                         _RWSTD_C::size_t __ref)
{
    return new _STD::numpunct_byname<_CharT>(__name, __ref);
}

#else   // if defined (_RWSTD_NO_FUNC_PARTIAL_SPEC)

_RWSTD_SPECIALIZED_FUNCTION
inline numpunct<char>*
__rw_create_named_facet (_STD::numpunct<char>*, const char *__name,
                         _RWSTD_C::size_t __ref)
{
    return new _STD::numpunct_byname<char>(__name, __ref);
}


#ifndef _RWSTD_NO_WCHAR_T

_RWSTD_SPECIALIZED_FUNCTION
inline _STD::numpunct<wchar_t>*
__rw_create_named_facet (_STD::numpunct<wchar_t>*, const char *__name,
                         _RWSTD_C::size_t __ref)
{
    return new _STD::numpunct_byname<wchar_t>(__name, __ref);
}

#endif   // _RWSTD_NO_WCHAR_T
#endif   // _RWSTD_NO_FUNC_PARTIAL_SPEC


_RWSTD_NAMESPACE_END   // __rw


#if _RWSTD_DEFINE_TEMPLATE (NUMERIC)
#  include <rw/_numeric.cc>
#endif


#endif   // _RWSTD_NUMERIC_H_INCLUDED

⌨️ 快捷键说明

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