Optimized Button class. Added IsPressed and GetPressed methods.
This commit is contained in:
@@ -7,44 +7,68 @@ namespace ehs
|
||||
{
|
||||
}
|
||||
|
||||
Button::Button(const Str_8& name)
|
||||
: name(name), hash(name.Hash_32())
|
||||
Button::Button(Str_8 name)
|
||||
: hash(name.Hash_32()), name((Str_8 &&)name)
|
||||
{
|
||||
}
|
||||
|
||||
Button::Button(const Button& key)
|
||||
: name(key.name), hash(key.hash)
|
||||
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=(const Button& key)
|
||||
Button & Button::operator=(Button &&key) noexcept
|
||||
{
|
||||
if (this == &key)
|
||||
return *this;
|
||||
|
||||
name = key.name;
|
||||
hash = key.hash;
|
||||
name = (Str_8 &&)key.name;
|
||||
|
||||
key.hash = 0;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool Button::operator==(const Button& key) const
|
||||
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
|
||||
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;
|
||||
}
|
||||
|
||||
UInt_32 Button::GetHash() const
|
||||
bool Button::IsValid() const
|
||||
{
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user