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

📄 _iosbase.h

📁 realview22.rar
💻 H
📖 第 1 页 / 共 2 页
字号:
    
    static bool _C_is_sync () {
        return _C_sync_with_stdio;
    }

    // 27.4.2.4, p1
    static bool sync_with_stdio (bool __sync = true) {
        // always atomic in MT environments since _C_sync is static
        return _RWSTD_ATOMIC_SWAP (_C_sync_with_stdio, __sync, false);
    }

    // 27.5.2.7, p2
    virtual ~ios_base ();    

    // returns a numeric base as per 22.2.2.1.2, p 4
    int _C_base () const {
        fmtflags __flags = flags () & basefield;
        return   oct == __flags ?  8
               : dec == __flags ? 10
               : hex == __flags ? 16

#ifndef _RWSTD_NO_EXT_BIN_IO

               : bin == __flags ?  2    // extension

#endif   // _RWSTD_NO_EXT_BIN_IO

               : 0;                     // anything else...
    }

protected:

    // will be reentrant if __reentrant is true, non-reentrant otherwise
    void _C_fire_event (event, bool __reentrant);

    // unsafe members - not synchronized in MT environments
    void _C_copyfmt (const ios_base&);

    // may throw (second argument is a bitmap of exceptions considered)
    // returns exceptions that would have been thrown had they not been masked
    iostate _C_unsafe_clear (iostate = goodbit, iostate = ~0);

    // called from basic_ios<>::imbue ()
    locale _C_unsafe_imbue (const locale&);

    // 27.5.2.7, p1
    ios_base ();

    fmtflags    _C_fmtfl;   // formatting flags
    streamsize  _C_prec;    // current precision
    streamsize  _C_wide;    // current width
    iostate     _C_state;   // stream state
    iostate     _C_except;  // active exceptions
    
private:

    ios_base (const ios_base&);            //not defined
    ios_base& operator= (const ios_base&); //not defined

    struct _C_event_cb {
        int             _C_index;
        event_callback  _C_fn;
    };

    locale       _C_loc;      // locale associated with stream

    long        *_C_iarray;   // user long data
    void*       *_C_parray;   // user void* data

    size_t       _C_isize;    // size of _C_iarray in elements
    size_t       _C_psize;    // size of _C_parray in elements

    _C_event_cb *_C_cbarray;  // array of user-registered callbacks
    size_t       _C_cbsize;   // size of _C_cbarray in elems

    static int   _C_index;    // used by xalloc to obtain a unique index
    static bool  _C_sync_with_stdio;
};


inline ios_base::ios_base ()
    : _C_iarray (0),
      _C_parray (0),
      _C_isize (0),
      _C_psize (0),
      _C_cbarray (0),
      _C_cbsize (0)
{
}


inline ios_base::~ios_base()
{
    // MT guard or reentrancy not necessary in a dtor
    _C_fire_event (erase_event, false /* not reentrant */);

    delete [] _C_iarray;
    delete [] _C_parray;
    delete [] _C_cbarray;
}


inline locale ios_base::_C_unsafe_imbue (const locale& __loc)
{
    locale __tmp = _C_loc;
    _C_loc = __loc;

    _C_fire_event (imbue_event, true /* reentrant */);

    return __tmp;  
}


inline locale ios_base::imbue (const locale& __loc)
{
    _RWSTD_MT_GUARD (flags () & _RWSTD_IOS_NOLOCK ? 0 : &_C_mutex);

    return _C_unsafe_imbue (__loc);
}


// 27.4.5.1 - fmtflags manipulators

// 27.4.5.1, p25
inline ios_base& unitbuf (ios_base& __strm)
{
    __strm.setf (ios_base::unitbuf);
    return __strm;
}


// 27.4.5.1, p27
inline ios_base& nounitbuf (ios_base& __strm)
{
    __strm.unsetf (ios_base::unitbuf);
    return __strm;
}


// 27.4.5.1, p1
inline ios_base& boolalpha (ios_base& __strm)
{
    __strm.setf (ios_base::boolalpha);
    return __strm;
}


// 27.4.5.1, p3
inline ios_base& noboolalpha (ios_base& __strm)
{
    __strm.unsetf (ios_base::boolalpha);
    return __strm;
}


// 27.4.5.1, p5
inline ios_base& showbase (ios_base& __strm)
{
    __strm.setf (ios_base::showbase);
    return __strm;
}


// 27.4.5.1, p7
inline ios_base& noshowbase (ios_base& __strm)
{
    __strm.unsetf (ios_base::showbase);
    return __strm;
}


// 27.4.5.1, p9
inline ios_base& showpoint (ios_base& __strm)
{ 
    __strm.setf (ios_base::showpoint);
    return __strm;
}


// 27.4.5.1, p11
inline ios_base& noshowpoint (ios_base& __strm)
{
    __strm.unsetf (ios_base::showpoint);
    return __strm;
}


// 27.4.5.1, p13
inline ios_base& showpos (ios_base& __strm)
{
    __strm.setf (ios_base::showpos);
    return __strm;
}


// 27.4.5.1, p15
inline ios_base& noshowpos (ios_base& __strm)
{
    __strm.unsetf (ios_base::showpos);
    return __strm;
}


// 27.4.5.1, p17
inline ios_base& skipws (ios_base& __strm)
{
    __strm.setf (ios_base::skipws);
    return __strm;
}


// 27.4.5.1, p19
inline ios_base& noskipws (ios_base& __strm)
{
    __strm.unsetf (ios_base::skipws);
    return __strm;
}


// 27.4.5.1, p21
inline ios_base& uppercase (ios_base& __strm)
{
    __strm.setf (ios_base::uppercase);
    return __strm;
}


// 27.4.5.1, p23
inline ios_base& nouppercase (ios_base& __strm)
{
    __strm.unsetf (ios_base::uppercase);
    return __strm;
}


// 27.4.5.2 - adjustfield manipulators

// 27.4.5.2, p1
inline ios_base& internal (ios_base& __strm)
{
    __strm.setf (ios_base::internal, ios_base::adjustfield);
    return __strm;
}


// 27.4.5.2, p3
inline ios_base& left (ios_base& __strm)
{
    __strm.setf (ios_base::left, ios_base::adjustfield);
    return __strm;
}


// 27.4.5.2, p5
inline ios_base& right (ios_base& __strm)
{
    __strm.setf (ios_base::right, ios_base::adjustfield);
    return __strm;
}


// 27.4.5.3 - basefield manipulators

// 27.4.5.3, p1
inline ios_base& dec (ios_base& __strm)
{
    __strm.setf (ios_base::dec, ios_base::basefield);
    return __strm;
}


// 27.4.5.3, p3
inline ios_base& hex (ios_base& __strm)
{
    __strm.setf (ios_base::hex, ios_base::basefield);
    return __strm;
}


// 27.4.5.3, p5
inline ios_base& oct (ios_base& __strm)
{
    __strm.setf (ios_base::oct, ios_base::basefield);
    return __strm;
}


#ifndef _RWSTD_NO_EXT_BIN_IO

// extension
inline ios_base& bin (ios_base& __strm)
{
    __strm.setf (ios_base::bin, ios_base::basefield);
    return __strm;
}

#endif   // _RWSTD_NO_EXT_BIN_IO


// 27.4.5.4 - floatfield manipulators

// 27.4.5.4, p1
inline ios_base& fixed (ios_base& __strm)
{
    __strm.setf (ios_base::fixed, ios_base::floatfield);
    return __strm;
}


// 27.4.5.4, p3
inline ios_base& scientific (ios_base& __strm)
{
    __strm.setf (ios_base::scientific, ios_base::floatfield);
    return __strm;
}


_RWSTD_NAMESPACE_END   // std


#endif   // _RWSTD_IOSBASE_H_INCLUDED

⌨️ 快捷键说明

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