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

📄 xlocmon

📁 c语言编程软件vc6.0中文绿色版_vc6.0官方下载
💻
📖 第 1 页 / 共 2 页
字号:
// xlocmon internal header (from <locale>)

#if     _MSC_VER > 1000
#pragma once
#endif

#ifndef _XLOCMON_
#define _XLOCMON_
#include <xiosbase>

#ifdef  _MSC_VER
#pragma pack(push,8)
#endif  /* _MSC_VER */
_STD_BEGIN
		// STRUCT money_base
struct _CRTIMP money_base : public locale::facet {
	enum _Part {symbol = '$', sign = '+', space = ' ',
		value = 'v', none = 'x'};
	_BITMASK(_Part, part);
	struct pattern {
		char field[4];
		};
	money_base(size_t _R = 0)
		: locale::facet(_R) {}
	};
_BITMASK_OPS(money_base::_Part);
		// TEMPLATE CLASS _Mpunct
template<class _E>
	class _Mpunct : public money_base {
public:
	typedef _E char_type;
	typedef basic_string<_E, char_traits<_E>, allocator<_E> >
		string_type;
	_E decimal_point() const
		{return (do_decimal_point()); }
	_E 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()); }
	explicit _Mpunct(size_t _R, bool _Intl)
		: money_base(_R), _Ifl(_Intl) {_Init(_Locinfo()); }
	_Mpunct(const _Locinfo& _Lobj, size_t _R, bool _Intl)
		: money_base(_R), _Ifl(_Intl) {_Init(_Lobj); }
	static size_t __cdecl _Getcat()
		{return (_LC_NUMERIC); }
_PROTECTED:
	virtual ~_Mpunct()
		{delete[] _Mgr;
		delete[] _Mcs;
		delete[] _Mps;
		delete[] _Mns; }
protected:
	void _Init(const _Locinfo& _Lobj)
		{const lconv *_P = _Lobj._Getlconv();
		_Mdp = _WIDEN(_E, _P->mon_decimal_point[0]);
		_Mks = _WIDEN(_E, _P->mon_thousands_sep[0]);
		_Mgr = _MAKLOCSTR(char, _P->mon_grouping);
		_Mcs = _MAKLOCSTR(_E, _Ifl ? _P->int_curr_symbol
			: _P->currency_symbol);
		_Mps = _MAKLOCSTR(_E, _P->p_sign_posn < 0
			|| 4 < _P->p_sign_posn
				? "" : _P->positive_sign);
		_Mns = _MAKLOCSTR(_E, _P->n_sign_posn < 0
			|| 4 < _P->n_sign_posn
				? "-" : _P->negative_sign);
		_Mfd = _Ifl ? _P->int_frac_digits
			: _P->frac_digits;
		if (_Mfd < 0 || CHAR_MAX <= _Mfd)
			_Mfd = 0;
		_Makpat(_Mpf, _P->p_sep_by_space,
			_P->p_cs_precedes, _P->p_sign_posn);
		_Makpat(_Mnf, _P->n_sep_by_space,
			_P->n_cs_precedes, _P->n_sign_posn); }
	virtual _E do_decimal_point() const
		{return (_Mdp); }
	virtual _E do_thousands_sep() const
		{return (_Mks); }
	virtual string do_grouping() const
		{return (string(_Mgr)); }
	virtual string_type do_curr_symbol() const
		{return (string_type(_Mcs)); }
	virtual string_type do_positive_sign() const
		{return (string_type(_Mps)); }
	virtual string_type do_negative_sign() const
		{return (string_type(_Mns)); }
	virtual int do_frac_digits() const
		{return (_Mfd); }
	virtual pattern do_pos_format() const
		{return (_Mpf); }
	virtual pattern do_neg_format() const
		{return (_Mnf); }
private:
	void _Makpat(pattern& _Pat, char _Sep, char _Pre, char _Pos)
		{char *_S = _Ifl || (_Sep & ~1) != 0 || (_Pre & ~1) != 0
			|| _Pos < 0 || 4 < _Pos ? "$+vx"
			: "+v$x" "+v$x" "v$+x" "v+$x" "v$+x"
				"+$vx" "+$vx" "$v+x" "+$vx" "$+vx"
				"+v $" "+v $" "v $+" "v+ $" "v $+"
				"+$ v" "+$ v" "$ v+" "+$ v" "$ +v" + (_Pos
				+ (_Pre == 1 ? 20 : 0) + (_Sep == 1 ? 40 : 0));
		memcpy(_Pat.field, _S, 4); }
	char *_Mgr;
	_E _Mdp, _Mks, *_Mcs, *_Mps, *_Mns;
	int _Mfd;
	pattern _Mpf, _Mnf;
	bool _Ifl;
	};
		// TEMPLATE CLASS moneypunct
template<class _E, bool _Intl = false>
	class moneypunct : public _Mpunct<_E> {
public:
	static const bool intl;
	static locale::id id;
	explicit moneypunct(size_t _R = 0)
		: _Mpunct<_E>(_R, _Intl) {}
	moneypunct(const _Locinfo& _Lobj, size_t _R = 0)
		: _Mpunct<_E>(_Lobj, _R, _Intl) {}
	static size_t __cdecl _Getcat()
		{return (_LC_NUMERIC); }
	};
template<class _E, bool _Intl>
	const bool moneypunct<_E, _Intl>::intl = _Intl;
template<class _E, bool _Intl>
	locale::id moneypunct<_E, _Intl>::id;
		// TEMPLATE CLASS moneypunct_byname
template<class _E, bool _Intl = false>
	class moneypunct_byname : public moneypunct<_E, _Intl> {
public:
	explicit moneypunct_byname(const char *_S, size_t _R = 0)
		: moneypunct<_E, _Intl>(_Locinfo(_S), _R) {}
_PROTECTED:
	virtual ~moneypunct_byname()
		{}
	};
		// TEMPLATE CLASS money_get
template<class _E,
	class _II = istreambuf_iterator<_E, char_traits<_E> > >
	class money_get : public locale::facet {
	typedef moneypunct<_E, false> _Mypunct0;
	typedef moneypunct<_E, true> _Mypunct1;
public:
	typedef _E char_type;
	typedef _II iter_type;
	typedef basic_string<_E, char_traits<_E>, allocator<_E> >
		string_type;
	_II get(_II _F, _II _L, bool _Intl, ios_base& _X,
		ios_base::iostate& _St, long double& _V) const
		{return (do_get(_F, _L, _Intl, _X, _St, _V)); }
	_II get(_II _F, _II _L, bool _Intl, ios_base& _X,
		ios_base::iostate& _St, string_type& _D) const
		{return (do_get(_F, _L, _Intl, _X, _St, _D)); }
	static locale::id id;
	explicit money_get(size_t _R = 0)
		: locale::facet(_R) {_Init(_Locinfo()); }
	money_get(const _Locinfo& _Lobj, size_t _R = 0)
		: locale::facet(_R) {_Init(_Lobj); }
	static size_t __cdecl _Getcat()
		{return (_LC_MONETARY); }
_PROTECTED:
	virtual ~money_get()
		{}
protected:
	void _Init(const _Locinfo& _Lobj)
		{}
	virtual _II do_get(_II _F, _II _L, bool _Intl, ios_base& _X,
		ios_base::iostate& _St, long double& _V) const
		{string_type _Str = _Getmfld(_F, _L, _Intl, _X);
		if (_F == _L)
			_St |= ios_base::eofbit;
		if (_Str.size() == 0)
			_St |= ios_base::failbit;
		else
			{string _Str2;
			_Str2.reserve(_Str.size());
			for (size_t _I = 0; _I < _Str.size(); ++_I)
				_Str2 += (char)_NARROW(_E, _Str[_I]);
			const char *_Eb = _Str2.c_str();
			char *_Ep;
			errno = 0;
			const long double _Ans = _Stold(_Eb, &_Ep, 0);
			if (_Ep == _Eb || errno != 0)
				_St |= ios_base::failbit;
			else
				_V = _Ans; }
		return (_F); }
	virtual _II do_get(_II _F, _II _L, bool _Intl, ios_base& _X,
		ios_base::iostate& _St, string_type& _D) const
		{string_type _Str = _Getmfld(_F, _L, _Intl, _X);
		if (_F == _L)
			_St |= ios_base::eofbit;
		if (_Str.size() == 0)
			_St |= ios_base::failbit;
		else
			_D = _Str;
		return (_F); }
private:
	string_type _Getmfld(_II& _F, _II& _L, bool _Intl,
		ios_base& _X) const
		{const _Mpunct<_E> *_Pfac;
		if (_Intl)
			_Pfac = &_USE(_X.getloc(), _Mypunct1);
		else
			_Pfac = &_USE(_X.getloc(), _Mypunct0);
		const ctype<_E>& _Fac2 = _USE(_X.getloc(), ctype<_E>);
		bool _Bad = false, _Neg = false;
		string_type _Sg, _Str;
		const money_base::pattern _Pat = _Pfac->neg_format();
		for (size_t _N = 0; !_Bad && _N < 4; ++_N)
			switch (_Pat.field[_N])
		{case money_base::symbol:
			{string_type _Cs = _Pfac->curr_symbol();
			const _E *_S;
			if (_X.flags() & ios_base::showbase)
				;
			else if (_N == 3 && _Sg.size() == 0
				|| _F == _L || *_F != *_Cs.c_str())
				_Cs.erase();
			for (_S = _Cs.begin(); _F != _L && _S != _Cs.end()
				&& *_F == *_S; ++_S, ++_F)
				;
			if (_S != _Cs.end())
				_Bad = true; }
			break;
		case money_base::sign:
			{if (_F == _L)
				;
			else if (0 < (_Pfac->positive_sign()).size()
				&& _Pfac->positive_sign()[0] == *_F)
				++_F, _Sg = _Pfac->positive_sign();
			else if (0 < (_Pfac->negative_sign()).size()
				&& _Pfac->negative_sign()[0] == *_F)
				++_F, _Sg = _Pfac->negative_sign(), _Neg = true;
			if (_Sg.size() == 1)
				_Sg.erase(); }
			break;
		case money_base::value:
			{int _Nfd = 0;
			int _Fd = _Pfac->frac_digits();
			const string _Gr = _Pfac->grouping();
			if (*_Gr.c_str() <= '\0')
				while (_F != _L

⌨️ 快捷键说明

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