EHS/src/Type.cpp
2023-12-17 15:00:08 -08:00

94 lines
1.5 KiB
C++

#include "Type.h"
namespace lwe
{
Type::Type()
: hashId(0)
{
}
Type::Type(Str_8 id)
: hashId(id.Hash_64()), id(std::move(id))
{
}
Type::Type(Type&& type) noexcept
: hashId(type.hashId), id(std::move(type.id))
{
type.hashId = 0;
}
Type& Type::operator=(const Type& type)
{
if (this == &type)
return *this;
hashId = type.hashId;
id = type.id;
return *this;
}
Type& Type::operator=(Type&& type) noexcept
{
if (this == &type)
return *this;
hashId = type.hashId;
id = std::move(type.id);
type.hashId = 0;
return *this;
}
bool Type::operator!() const
{
return IsValid();
}
bool Type::operator==(const Type& type) const
{
return hashId == type.hashId;
}
bool Type::operator!=(const Type& type) const
{
return hashId != type.hashId;
}
bool Type::operator==(const UInt_64 hashId) const
{
return this->hashId == hashId;
}
bool Type::operator!=(const UInt_64 hashId) const
{
return this->hashId == hashId;
}
bool Type::operator==(const Str_8& type) const
{
return id == type;
}
bool Type::operator!=(const Str_8& type) const
{
return id != type;
}
UInt_64 Type::GetHashId() const
{
return hashId;
}
Str_8 Type::GetId() const
{
return id;
}
bool Type::IsValid() const
{
return hashId;
}
}