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

📄 _money.h

📁 realview22.rar
💻 H
📖 第 1 页 / 共 2 页
字号:


_RWSTD_SPECIALIZED_FUNCTION
inline const __rw_moneypunct_init_data<char>*
__rw_fixup_moneypunct_init (const __rw_moneypunct_init_data<char> *__mp, char*)
{
    return __mp;
}

// ------------------------------------------------------------------
// Implementation class template -- __rw_moneypunct_impl<_CharT, _Intl>.
// ------------------------------------------------------------------

// moneypunct<_CharT, _Intl> derives from this to get the parts of its behavior
// that are specialized for the character type and the _Intl format selection.

template <class _CharT, bool _Intl>
class __rw_moneypunct_impl
    : public __rw_moneypunct_impl_data<_CharT>
{
protected:
    __rw_moneypunct_impl ();
};


_RWSTD_SPECIALIZED_CLASS
class _RWSTD_EXPORT __rw_moneypunct_impl<char, false>
    : public __rw_moneypunct_impl_data<char>
{
    friend class __rw_moneypunct_impl_base;

protected:

    typedef __rw_moneypunct_impl_data<char> parent_type;

    static const __rw_moneypunct_init_data<char> _C_ivals;

    __rw_moneypunct_impl (const __rw_moneypunct_init_data<char> *__mp =
                          &_C_ivals)
        : parent_type (__mp) { }
};


_RWSTD_SPECIALIZED_CLASS
class _RWSTD_EXPORT __rw_moneypunct_impl<char, true>
    : public __rw_moneypunct_impl_data<char>
{
    friend class __rw_moneypunct_impl_base;

protected:

    typedef __rw_moneypunct_impl_data<char> parent_type;

    static const __rw_moneypunct_init_data<char> _C_ivals;

    __rw_moneypunct_impl (const __rw_moneypunct_init_data<char> *__mp =
                          &_C_ivals)
        : parent_type(__mp) { }
};


#ifndef _RWSTD_NO_WCHAR_T
_RWSTD_SPECIALIZED_CLASS
class _RWSTD_EXPORT __rw_moneypunct_impl<wchar_t, false>
    : public __rw_moneypunct_impl_data<wchar_t>
{
protected:
    typedef __rw_moneypunct_impl_data<wchar_t> parent_type;

    static const __rw_moneypunct_init_data<wchar_t> _C_ivals;

    __rw_moneypunct_impl (const __rw_moneypunct_init_data<wchar_t> *__mp =
                          &_C_ivals)
        : parent_type(__mp) { }
};

_RWSTD_SPECIALIZED_CLASS
class _RWSTD_EXPORT __rw_moneypunct_impl<wchar_t, true>
    : public __rw_moneypunct_impl_data<wchar_t>
{
protected:
    typedef __rw_moneypunct_impl_data<wchar_t> parent_type;

    static const __rw_moneypunct_init_data<wchar_t> _C_ivals;

    __rw_moneypunct_impl (const __rw_moneypunct_init_data<wchar_t> *__mp =
                          &_C_ivals)
        : parent_type(__mp) { }
};

#endif // _RWSTD_NO_WCHAR_T


_RWSTD_NAMESPACE_END   // __rw


_RWSTD_NAMESPACE_BEGIN (std)


// ---------------------------------------------------------------
// Standard money parsing facet -- money_get<_CharT, _InputIter>.
// ---------------------------------------------------------------

template <class _CharT,
    class _InputIter _RWSTD_COMPLEX_DEFAULT (istreambuf_iterator<_CharT>) >
class money_get: public locale::facet
{
public:
    typedef _CharT     char_type;
    typedef _InputIter iter_type;
    typedef basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
    string_type;

    _EXPLICIT money_get (size_t __ref=0)
        : locale::facet(__ref, locale::monetary) { }

    iter_type get (iter_type __begin, iter_type __end, bool __intl,
                   ios_base& __flags, ios_base::iostate& __err,
                   long double& __units) const {
        return do_get(__begin, __end, __intl, __flags, __err, __units);
    }

    iter_type get (iter_type __begin, iter_type __end, bool __intl,
                   ios_base& __flags, ios_base::iostate& __err,
                   string_type &__digits) const {
        return do_get (__begin, __end, __intl, __flags, __err, __digits);
    }

    static locale::id id;

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

protected:

    virtual iter_type do_get (iter_type, iter_type,  bool, ios_base&, 
                              ios_base::iostate&, long double&) const;
    virtual iter_type do_get (iter_type, iter_type,  bool, ios_base&, 
                              ios_base::iostate&, string_type&) const;
private:

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

_RWSTD_INSTANTIATE_3 (
    class _RWSTD_EXPORT
    money_get<char, istreambuf_iterator<char, char_traits<char> > >
);

#ifndef _RWSTD_NO_WCHAR_T
_RWSTD_INSTANTIATE_3 (
    class _RWSTD_EXPORT
    money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >
);
#endif   // _RWSTD_NO_WCHAR_T

// -------------------------------------------------------------------
// Standard money formatting facet -- money_put<_CharT, _OutputIter>.
// -------------------------------------------------------------------

template <class _CharT,
    class _OutputIter _RWSTD_COMPLEX_DEFAULT (ostreambuf_iterator<_CharT>) >
class money_put: public locale::facet
{
public:

    typedef _CharT char_type;
    typedef _OutputIter iter_type;
    typedef basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
    string_type;

    _EXPLICIT money_put (size_t __ref=0)
        : locale::facet(__ref, locale::monetary) { }

#ifndef _RWSTD_NO_LONG_DOUBLE
    iter_type put (iter_type __it, bool __intl, ios_base& __flags,
                   char_type __fill, long double __quant) const
#else
        iter_type put (iter_type __it, bool __intl, ios_base& __flags,
                       char_type __fill, double __quant) const
#endif
        { return do_put (__it, __intl, __flags, __fill, __quant); }

    iter_type put (iter_type __it, bool __intl, ios_base& __flags,
                   char_type __fill, const string_type& __digits) const {
        return do_put(__it, __intl, __flags, __fill, __digits);
    }
    
    static locale::id  id;

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

protected:

#ifndef _RWSTD_NO_LONG_DOUBLE
    virtual iter_type do_put (iter_type, bool, ios_base&, 
                              char_type, long double) const __softfp;
#else
    virtual iter_type do_put (iter_type, bool, ios_base&, 
                              char_type, double) const __softfp;
#endif

    virtual iter_type do_put (iter_type, bool, ios_base&, 
                              char_type, const string_type&) const;

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


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

#ifndef _RWSTD_NO_WCHAR_T
_RWSTD_INSTANTIATE_3 (
    class _RWSTD_EXPORT
    money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >
);
#endif   // _RWSTD_NO_WCHAR_T

// -----------------------------------------------------------
// Standard money punctuation facet -- moneypunct<_CharT, bool>.
// -----------------------------------------------------------

template <class _CharT, bool _Intl _RWSTD_SIMPLE_DEFAULT (false)>
class moneypunct: public locale::facet, public money_base, 
                  public _RW::__rw_moneypunct_impl<_CharT, _Intl>
{
public:
    typedef _CharT char_type;
    typedef basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
    string_type;

    _RWSTD_STATIC_CONST (bool, intl = _Intl);

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

    _EXPLICIT moneypunct (size_t __ref = 0, 
                          const _RW::__rw_moneypunct_init_data<_CharT>* =
                          moneypunct::_C_get_ivals());
#else

    _EXPLICIT moneypunct (size_t = 0);

    moneypunct (size_t __ref, const _RW::__rw_moneypunct_init_data<_CharT>*);

#endif   // _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE

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

    static locale::id id;

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

protected:

    virtual char_type    do_decimal_point()  const;
    virtual char_type    do_thousands_sep()  const;
    virtual string       do_grouping()       const;
    virtual string_type  do_curr_symbol()    const;
    virtual string_type  do_positive_sign()  const;
    virtual string_type  do_negative_sign()  const;
    virtual int          do_frac_digits()    const;
    virtual pattern      do_pos_format()     const;
    virtual pattern      do_neg_format()     const;

private:
    virtual void _C_initfacet (const locale&);

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

public:
    static const _RW::__rw_moneypunct_init_data<_CharT> *_C_get_ivals () {
        return &_RW::__rw_moneypunct_impl<_CharT, _Intl>::_C_ivals;
    }
};

#ifndef _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE

template <class _CharT, bool _Intl>
inline moneypunct<_CharT, _Intl>::
moneypunct (size_t __ref, const _RW::__rw_moneypunct_init_data<_CharT> *__mp)
    : locale::facet(__ref, locale::monetary),
      _RW::__rw_moneypunct_impl<_CharT, _Intl>(__mp)
{ }

#else   // if defined (_RWSTD_NO_TEMPLATE_ON_RETURN_TYPE)

template <class _CharT, bool _Intl>
inline moneypunct<_CharT, _Intl>::moneypunct (size_t __ref)
    :  locale::facet(__ref, locale::monetary), 
       _RW::__rw_moneypunct_impl<_CharT, _Intl>
              ((_RW::__rw_moneypunct_init_data<_CharT>*)&_RW::
               __rw_moneypunct_impl<_CharT, _Intl>::_C_ivals)
     { }

template <class _CharT, bool _Intl>
inline moneypunct<_CharT, _Intl>::
moneypunct (size_t __ref, const _RW::__rw_moneypunct_init_data<_CharT> *__mp)
    : locale::facet(__ref, locale::monetary), 
      _RW::__rw_moneypunct_impl<_CharT, _Intl>(__mp)
{ }

#endif   // _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE


_RWSTD_INSTANTIATE_2 (class _RWSTD_EXPORT moneypunct<char, false>);
_RWSTD_INSTANTIATE_2 (class _RWSTD_EXPORT moneypunct<char, true>);

#ifndef _RWSTD_NO_WCHAR_T

_RWSTD_INSTANTIATE_2 (class _RWSTD_EXPORT moneypunct<wchar_t, false>);
_RWSTD_INSTANTIATE_2 (class _RWSTD_EXPORT moneypunct<wchar_t, true>);

#endif   // _RWSTD_NO_WCHAR_T


// --------------------------------------------------------
// Standard derived facet -- moneypunct_byname<_CharT, _Intl>.
// --------------------------------------------------------

template <class _CharT, bool _Intl _RWSTD_SIMPLE_DEFAULT (false)>
class moneypunct_byname: public moneypunct<_CharT, _Intl>
{
    typedef moneypunct<_CharT, _Intl> _Punct;
public:
    _EXPLICIT moneypunct_byname (const char* __name, size_t __ref = 0)
        : moneypunct<_CharT, _Intl>(__ref,
                                    _Punct::_C_get_init_by_name_ (__name,
                                          moneypunct<_CharT, _Intl>::intl))
        { }
};


_RWSTD_NAMESPACE_END   // std


_RWSTD_NAMESPACE_BEGIN (__rw)

_USING (_RWSTD_C::size_t);

#ifndef _RWSTD_NO_FUNC_PARTIAL_SPEC

template <class _CharT, bool _Intl>
inline _STD::moneypunct<_CharT, _Intl>*
__rw_create_named_facet (_STD::moneypunct<_CharT, _Intl>*, 
                         const char *__name, size_t __ref) {

    return new _STD::moneypunct_byname<_CharT, _Intl>(__name, __ref);
}

#else   // if defined (_RWSTD_NO_FUNC_PARTIAL_SPEC)

_RWSTD_SPECIALIZED_FUNCTION
inline _STD::moneypunct<char, false>*
__rw_create_named_facet (_STD::moneypunct<char, false>*, 
                         const char *__name, size_t __ref)
{
    return new _STD::moneypunct_byname<char, false>(__name, __ref);
}

_RWSTD_SPECIALIZED_FUNCTION
inline _STD::moneypunct<char, true>*
__rw_create_named_facet (_STD::moneypunct<char, true>*, 
                         const char *__name, size_t __ref)
{
    return new _STD::moneypunct_byname<char, true>(__name, __ref);
}

#ifndef _RWSTD_NO_WCHAR_T

_RWSTD_SPECIALIZED_FUNCTION
inline _STD::moneypunct<wchar_t, false>*
__rw_create_named_facet (_STD::moneypunct<wchar_t, false>*, 
                         const char *__name, size_t __ref)
{
    return new _STD::moneypunct_byname<wchar_t, false>(__name, __ref);
}

_RWSTD_SPECIALIZED_FUNCTION
inline _STD::moneypunct<wchar_t, true>*
__rw_create_named_facet (_STD::moneypunct<wchar_t, true>*, 
                         const char *__name, size_t __ref)
{
    return new _STD::moneypunct_byname<wchar_t, true>(__name, __ref);
}

#endif   // _RWSTD_NO_WCHAR_T

#endif   // _RWSTD_NO_FUNC_PARTIAL_SPEC


_RWSTD_NAMESPACE_END   // __rw


#if _RWSTD_DEFINE_TEMPLATE (MONEY)
#  include <rw/_money.cc>
#endif


#endif   // _RWSTD_MONEY_H_INCLUDED

⌨️ 快捷键说明

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