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

📄 vartype.cpp

📁 网络游戏魔域源代码 测试可以完整变异
💻 CPP
字号:
// VarType.cpp: implementation of the VarType class.
//
//////////////////////////////////////////////////////////////////////

#include "VarType.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

VarType& VarType::operator=(const VarType& obj)
{
	if(this==&obj)
		return *this;

	if(obj.m_ptr)
	{
		if(!m_ptr)
			m_ptr=new String;
		*m_ptr=*obj.m_ptr;
	}
	else
	{
		if(m_ptr)
		{
			delete m_ptr;
			m_ptr = NULL;
		}
	}

	m_int		= obj.m_int;
	m_nType		= obj.m_nType;

	return *this;
}

bool VarType::operator==(const VarType& obj) const
{
	if(!IsValid() || !obj.IsValid())
			return false;
	
	if(IsStringType())
	{
		if(obj.IsStringType() && *m_ptr == *obj.m_ptr)
			return true;
	}
	else if(IsIntType())
	{
		if(obj.IsIntType() && m_int == obj.m_int)
			return true;
	}

	return false;
}

⌨️ 快捷键说明

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