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

📄 xiosbase

📁 C语言库函数的原型,有用的拿去
💻
📖 第 1 页 / 共 2 页
字号:
// xiosbase internal header (from <ios>)
#pragma once
#ifndef _XIOSBASE_
#define _XIOSBASE_
#ifndef RC_INVOKED
#include <xlocale>

 #if _HAS_CPP0X
 #include <system_error>
 #endif /* _HAS_CPP0X */

 #include <share.h>

 #pragma pack(push,_CRT_PACKING)
 #pragma warning(push,3)

 #pragma warning(disable: 4412)

 #define _OPENPROT	_SH_DENYNO

 #pragma push_macro("new")
 #undef new

_STD_BEGIN
 #define _IOSskipws		0x0001
 #define _IOSunitbuf	0x0002
 #define _IOSuppercase	0x0004
 #define _IOSshowbase	0x0008
 #define _IOSshowpoint	0x0010
 #define _IOSshowpos	0x0020
 #define _IOSleft		0x0040
 #define _IOSright		0x0080
 #define _IOSinternal	0x0100
 #define _IOSdec		0x0200
 #define _IOSoct		0x0400
 #define _IOShex		0x0800
 #define _IOSscientific	0x1000
 #define _IOSfixed		0x2000

 #define _IOShexfloat	0x3000	// added with TR1/

 #define _IOSboolalpha	0x4000
 #define _IOS_Stdio		0x8000

 #define _IOS_Nocreate	0x40
 #define _IOS_Noreplace	0x80
 #define _IOSbinary		0x20

		// TEMPLATE CLASS _Iosb
template<class _Dummy>
	class _Iosb
	{	// define templatized bitmask/enumerated types, instantiate on demand
public:
	enum _Dummy_enum {_Dummy_enum_val = 1};	// don't ask
	enum _Fmtflags
		{	// constants for formatting options
		_Fmtmask = 0xffff, _Fmtzero = 0};

	static const _Fmtflags skipws = (_Fmtflags)_IOSskipws;
	static const _Fmtflags unitbuf = (_Fmtflags)_IOSunitbuf;
	static const _Fmtflags uppercase = (_Fmtflags)_IOSuppercase;
	static const _Fmtflags showbase = (_Fmtflags)_IOSshowbase;
	static const _Fmtflags showpoint = (_Fmtflags)_IOSshowpoint;
	static const _Fmtflags showpos = (_Fmtflags)_IOSshowpos;
	static const _Fmtflags left = (_Fmtflags)_IOSleft;
	static const _Fmtflags right = (_Fmtflags)_IOSright;
	static const _Fmtflags internal = (_Fmtflags)_IOSinternal;
	static const _Fmtflags dec = (_Fmtflags)_IOSdec;
	static const _Fmtflags oct = (_Fmtflags)_IOSoct;
	static const _Fmtflags hex = (_Fmtflags)_IOShex;
	static const _Fmtflags scientific = (_Fmtflags)_IOSscientific;
	static const _Fmtflags fixed = (_Fmtflags)_IOSfixed;

	static const _Fmtflags hexfloat =
		(_Fmtflags)_IOShexfloat;	// added with TR1/

	static const _Fmtflags boolalpha = (_Fmtflags)_IOSboolalpha;
	static const _Fmtflags _Stdio = (_Fmtflags)_IOS_Stdio;
	static const _Fmtflags adjustfield = (_Fmtflags)(_IOSleft
		| _IOSright | _IOSinternal);
	static const _Fmtflags basefield = (_Fmtflags)(_IOSdec
		| _IOSoct | _IOShex);
	static const _Fmtflags floatfield = (_Fmtflags)(_IOSscientific
		| _IOSfixed);

	enum _Iostate
		{	// constants for stream states
		_Statmask = 0x17};

	static const _Iostate goodbit = (_Iostate)0x0;
	static const _Iostate eofbit = (_Iostate)0x1;
	static const _Iostate failbit = (_Iostate)0x2;
	static const _Iostate badbit = (_Iostate)0x4;
	static const _Iostate _Hardfail = (_Iostate)0x10;

	enum _Openmode
		{	// constants for file opening options
		_Openmask = 0xff};

	static const _Openmode in = (_Openmode)0x01;
	static const _Openmode out = (_Openmode)0x02;
	static const _Openmode ate = (_Openmode)0x04;
	static const _Openmode app = (_Openmode)0x08;
	static const _Openmode trunc = (_Openmode)0x10;
	static const _Openmode _Nocreate = (_Openmode)_IOS_Nocreate;
	static const _Openmode _Noreplace = (_Openmode)_IOS_Noreplace;
	static const _Openmode binary = (_Openmode)_IOSbinary;

	enum _Seekdir
		{	// constants for file positioning options
		_Seekmask = 0x3};

	static const _Seekdir beg = (_Seekdir)0;
	static const _Seekdir cur = (_Seekdir)1;
	static const _Seekdir end = (_Seekdir)2;

	enum
		{	// constant for default file opening protection
		_Openprot = _OPENPROT};
	};

template<class _Dummy>
	const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::skipws;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::unitbuf;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::uppercase;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::showbase;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::showpoint;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::showpos;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::left;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::right;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::internal;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::dec;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::oct;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::hex;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::scientific;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::fixed;

template<class _Dummy>
	const typename _Iosb<_Dummy>::_Fmtflags
		_Iosb<_Dummy>::hexfloat;	// added with TR1

template<class _Dummy>
	const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::boolalpha;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::_Stdio;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::adjustfield;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::basefield;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::floatfield;

template<class _Dummy>
	const typename _Iosb<_Dummy>::_Iostate _Iosb<_Dummy>::goodbit;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Iostate _Iosb<_Dummy>::eofbit;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Iostate _Iosb<_Dummy>::failbit;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Iostate _Iosb<_Dummy>::badbit;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Iostate _Iosb<_Dummy>::_Hardfail;

template<class _Dummy>
	const typename _Iosb<_Dummy>::_Openmode _Iosb<_Dummy>::in;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Openmode _Iosb<_Dummy>::out;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Openmode _Iosb<_Dummy>::ate;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Openmode _Iosb<_Dummy>::app;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Openmode _Iosb<_Dummy>::trunc;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Openmode _Iosb<_Dummy>::_Nocreate;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Openmode _Iosb<_Dummy>::_Noreplace;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Openmode _Iosb<_Dummy>::binary;

template<class _Dummy>
	const typename _Iosb<_Dummy>::_Seekdir _Iosb<_Dummy>::beg;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Seekdir _Iosb<_Dummy>::cur;
template<class _Dummy>
	const typename _Iosb<_Dummy>::_Seekdir _Iosb<_Dummy>::end;

		// CLASS ios_base
class _CRTIMP2_PURE ios_base
	: public _Iosb<int>
	{	// base class for ios
public:
	_BITMASK(_Fmtflags, fmtflags);
	_BITMASK(_Iostate, iostate);
	_BITMASK(_Openmode, openmode);
	_BITMASK(_Seekdir, seekdir);

	typedef _STD streamoff streamoff;
	typedef _STD streampos streampos;

	enum event
		{	// constants for ios events
		erase_event, imbue_event, copyfmt_event};

	typedef void (__CLRCALL_OR_CDECL *event_callback)(event, ios_base&, int);
	typedef unsigned int io_state, open_mode, seek_dir;

			// CLASS failure
	class failure

 #if _HAS_CPP0X
		: public system_error
		{	// base of all iostreams exceptions
	public:
		explicit failure(const string &_Message,
			const error_code& _Errcode = make_error_code(io_errc::stream))
			: system_error(_Errcode, _Message)
			{	// construct with message
			}

		explicit failure(const char *_Message,
			const error_code& _Errcode = make_error_code(io_errc::stream))
			: system_error(_Errcode, _Message)
			{	// construct with message
			}

 #else /* _HAS_CPP0X */
		: public runtime_error
		{	// base of all iostreams exceptions
	public:
		explicit failure(const string &_Message)
			: runtime_error(_Message)
			{	// construct with message
			}

		explicit failure(const char *_Message)
			: runtime_error(_Message)
			{	// construct with message
			}
 #endif /* _HAS_CPP0X */

 #if _HAS_EXCEPTIONS

 #else /* _HAS_EXCEPTIONS */
	protected:
		virtual void _Doraise() const
			{	// report the exception
			_RAISE(*this);
			}
 #endif /* _HAS_EXCEPTIONS */
		};

			// CLASS Init
	class _CRTIMP2_PURE Init
		{	// controller for standard-stream initialization
	public:
		__CLR_OR_THIS_CALL Init()
			{	// initialize standard streams on first construction
			_Init_ctor(this);
			}

		__CLR_OR_THIS_CALL ~Init()
			{	// flush standard streams on last destruction
			_Init_dtor(this);
			}

	private:
		static _MRTIMP2_NPURE void __cdecl _Init_ctor(Init *);
		static _MRTIMP2_NPURE void __cdecl _Init_dtor(Init *);

		__PURE_APPDOMAIN_GLOBAL static int _Init_cnt;	// net ctor count

		static _MRTIMP2_NPURE int& __cdecl _Init_cnt_func();
		};

	ios_base& __CLR_OR_THIS_CALL operator=(const ios_base& _Right)
		{	// assign state and format stuff from _Right
		if (this != &_Right)
			{	// worth doing
			_Mystate = _Right._Mystate;
			copyfmt(_Right);
			}
		return (*this);
		}

	__CLR_OR_THIS_CALL operator void *() const
		{	// test if any stream operation has failed
		return (fail() ? 0 : (void *)this);
		}

	bool __CLR_OR_THIS_CALL operator!() const
		{	// test if no stream operation has failed
		return (fail());
		}

	void __CLR_OR_THIS_CALL clear(iostate _State, bool _Reraise)
		{	// set state, possibly reraise exception
		_Mystate = (iostate)(_State & _Statmask);
		if ((_Mystate & _Except) == 0)
			;
		else if (_Reraise)
			_RERAISE;
		else if (_Mystate & _Except & badbit)
			_THROW_NCEE(failure, "ios_base::badbit set");
		else if (_Mystate & _Except & failbit)
			_THROW_NCEE(failure, "ios_base::failbit set");
		else
			_THROW_NCEE(failure, "ios_base::eofbit set");
		}

	void __CLR_OR_THIS_CALL clear(iostate _State = goodbit)
		{	// set state to argument
		clear(_State, false);
		}

	void __CLR_OR_THIS_CALL clear(io_state _State)
		{	// set state to argument, old-style
		clear((iostate)_State);
		}

	iostate __CLR_OR_THIS_CALL rdstate() const
		{	// return stream state
		return (_Mystate);
		}

⌨️ 快捷键说明

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