/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
* Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a//
* _Qhm`] _f "'c 1!5m
* Visit: http://guichan.darkbits.org )Qk
ws?a-?' ._/L #'
* binary forms, with or without )4d[#7r, . ' )d`)[
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam'
* that the following conditions are met: j<. a J@\
* this list of conditions and the j(]1u= 32 && mValue <= 126)
|| (mValue >= 162 && mValue <= 255)
|| (mValue == 9);
}
bool Key::isNumber() const
{
return mValue >= 48 && mValue <= 57;
}
bool Key::isLetter() const
{
return (((mValue >= 65 && mValue <= 90)
|| (mValue >= 97 && mValue <= 122)
|| (mValue >= 192 && mValue <= 255))
&& (mValue != 215) && (mValue != 247));
}
bool Key::isShiftPressed() const
{
return mShiftPressed;
}
void Key::setShiftPressed(bool pressed)
{
mShiftPressed = pressed;
}
bool Key::isControlPressed() const
{
return mControlPressed;
}
void Key::setControlPressed(bool pressed)
{
mControlPressed = pressed;
}
bool Key::isAltPressed() const
{
return mAltPressed;
}
void Key::setAltPressed(bool pressed)
{
mAltPressed = pressed;
}
bool Key::isMetaPressed() const
{
return mMetaPressed;
}
void Key::setMetaPressed(bool pressed)
{
mMetaPressed = pressed;
}
bool Key::isNumericPad() const
{
return mNumericPad;
}
void Key::setNumericPad(bool numpad)
{
mNumericPad = numpad;
}
void Key::setValue(int value)
{
mValue = value;
}
int Key::getValue() const
{
return mValue;
}
std::string Key::toString() const
{
std::string str;
if (mValue <= 0x007F) {
str.insert(str.end(), mValue);
} else if (mValue <= 0x07FF) {
str.insert(str.end(), 0xC0 | ((mValue >> 6) & 0x1F));
str.insert(str.end(), 0x80 | (mValue & 0x3F));
} else if (mValue <= 0xFFFF) {
str.insert(str.end(), 0xE0 | ((mValue >> 12) & 0x0F));
str.insert(str.end(), 0x80 | ((mValue >> 6) & 0x3F));
str.insert(str.end(), 0x80 | (mValue & 0x3F));
}
return str;
}
}