EHS/src/io/hid/Button.cpp

75 lines
1004 B
C++

#include "ehs/io/hid/Button.h"
namespace ehs
{
Button::Button()
: hash(0)
{
}
Button::Button(Str_8 name)
: hash(name.Hash_32()), name((Str_8 &&)name)
{
}
Button::Button(Button &&key) noexcept
: hash(key.hash), name((Str_8 &&)key.name)
{
key.hash = 0;
}
Button::Button(const Button &key)
: hash(key.hash), name(key.name)
{
}
Button & Button::operator=(Button &&key) noexcept
{
if (this == &key)
return *this;
hash = key.hash;
name = (Str_8 &&)key.name;
key.hash = 0;
return *this;
}
Button &Button::operator=(const Button &key)
{
if (this == &key)
return *this;
hash = key.hash;
name = key.name;
return *this;
}
bool Button::operator==(const Button &key) const
{
return key.hash == hash;
}
bool Button::operator!=(const Button &key) const
{
return key.hash != hash;
}
UInt_32 Button::GetHash() const
{
return hash;
}
Str_8 Button::GetName() const
{
return name;
}
bool Button::IsValid() const
{
return hash;
}
}