/*
Copyright (C) 2006 - 2009 Evan Teran
                   eteran@alum.rit.edu

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

#include "Register.h"

//------------------------------------------------------------------------------
// Name: 
// Desc: 
//------------------------------------------------------------------------------
Register::Register() : m_Valid(false), m_Value(0) {
}

//------------------------------------------------------------------------------
// Name: 
// Desc: 
//------------------------------------------------------------------------------
Register::Register(const QString &name, edb::reg_t value, Type type, edb::address_t segmentBase) : m_Valid(true), m_Name(name), m_Value(value), m_Type(type), m_SegmentBase(segmentBase) {
}

//------------------------------------------------------------------------------
// Name: 
// Desc: 
//------------------------------------------------------------------------------
Register::Register(const Register &other) : m_Valid(other.m_Valid), m_Name(other.m_Name), m_Value(other.m_Value), m_Type(other.m_Type), m_SegmentBase(other.m_SegmentBase) {
}

//------------------------------------------------------------------------------
// Name: 
// Desc: 
//------------------------------------------------------------------------------
Register &Register::operator=(const Register &rhs) {
	if(this != &rhs) {
		m_Valid = rhs.m_Valid;
		m_Name = rhs.m_Name;
		m_Value = rhs.m_Value;
		m_Type = rhs.m_Type;
		m_SegmentBase = rhs.m_SegmentBase;
	}
	return *this;
}

//------------------------------------------------------------------------------
// Name: 
// Desc: 
//------------------------------------------------------------------------------
bool Register::operator==(const Register &rhs) const {
	if(!m_Valid && !rhs.m_Valid) {
		return true;
	} else {
		return m_Valid == rhs.m_Valid && m_Name == rhs.m_Name && m_Value == rhs.m_Value && m_Type == rhs.m_Type && m_SegmentBase == rhs.m_SegmentBase;
	}
}

//------------------------------------------------------------------------------
// Name: 
// Desc: 
//------------------------------------------------------------------------------
bool Register::operator!=(const Register &rhs) const {
	return !(*this == rhs);
}
