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

📄 eluint.h

📁 3D Game Engine Design Source Code非常棒
💻 H
字号:
#ifndef ELUINT_H
#define ELUINT_H

#include "element.h"

class mgcUint : public mgcElement
{
// object information
public:
	mgcUint () : mgcElement(type,&value)
		{ value = 0; }
	mgcUint (const unsigned int& _value) : mgcElement(type,&value)
		{ value = _value; }
	mgcUint (const mgcElement& element) : mgcElement(type,&value)
		{ *this = element; }

	operator unsigned int () const
		{ return value; }

	mgcUint& operator= (unsigned int _value)
		{ value = _value;  return *this; }
	mgcUint& operator= (const mgcUint& derived)
		{ value = derived.value;  return *this; }
	mgcUint& operator= (const mgcElement& element);

	int operator== (const mgcUint& derived) const
		{ return value == derived.value; }
	int operator!= (const mgcUint& derived) const
		{ return value != derived.value; }

	friend istream& operator>> (istream& istr, mgcUint& derived)
		{ return istr >> derived.value; }
	friend ostream& operator<< (ostream& ostr, const mgcUint& derived)
		{ return ostr << derived.value; }

private:
	unsigned int value;

// class information
public:
	static const char* description;
	static const int type;
	static const int size;

	static int Register ();
	static void ToChar   (int quantity, void* src, void* trg);
	static void ToUchar  (int quantity, void* src, void* trg);
	static void ToShort  (int quantity, void* src, void* trg);
	static void ToUshort (int quantity, void* src, void* trg);
	static void ToInt    (int quantity, void* src, void* trg);
	static void ToUint   (int quantity, void* src, void* trg);
	static void ToLong   (int quantity, void* src, void* trg);
	static void ToUlong  (int quantity, void* src, void* trg);
	static void ToFloat  (int quantity, void* src, void* trg);
	static void ToDouble (int quantity, void* src, void* trg);

	static void Input (istream& istr, void* trg)
		{ istr >> *(unsigned int*)trg; }
	static void Output (ostream& ostr, const void* src)
		{ ostr << *(unsigned int*)src; }

// error handling
public:
	static int verbose;
	static unsigned error;
	static void Report (ostream& ostr);
private:
    static const unsigned registration_failed;
    static const char* message[1];
    static int Number (unsigned single_error);
    static void Report (unsigned single_error);
};

static int mgcUint_key = mgcUint::Register();

#endif

⌨️ 快捷键说明

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