FifeGUI 0.2.0
A C++ GUI library designed for games.
key.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
2// SPDX-FileCopyrightText: 2004 - 2008 Olof Naessén and Per Larsson
3// SPDX-FileCopyrightText: 2013 - 2026 Fifengine contributors
4
5#include "fifechan/key.hpp"
6
7namespace fcn
8{
9 Key::Key(int value) : mValue(value) { }
10
11 bool Key::isCharacter() const
12 {
13 return (mValue >= 32 && mValue <= 126) || (mValue >= 162 && mValue <= 255) || (mValue == 9);
14 }
15
16 bool Key::isNumber() const
17 {
18 return mValue >= 48 && mValue <= 57;
19 }
20
21 bool Key::isLetter() const
22 {
23 return (
24 ((mValue >= 65 && mValue <= 90) || (mValue >= 97 && mValue <= 122) || (mValue >= 192 && mValue <= 255)) &&
25 (mValue != 215) && (mValue != 247));
26 }
27
28 int Key::getValue() const
29 {
30 return mValue;
31 }
32
33 bool Key::operator==(Key const & key) const
34 {
35 return mValue == key.mValue;
36 }
37
38 bool Key::operator!=(Key const & key) const
39 {
40 return (mValue != key.mValue);
41 }
42} // namespace fcn
Key(int value=0)
Constructor.
Definition key.cpp:9
int getValue() const
Gets the value of the key.
Definition key.cpp:28
bool isLetter() const
Checks if a key is a letter.
Definition key.cpp:21
int mValue
Holds the value of the key.
Definition key.hpp:136
bool operator!=(Key const &key) const
Compares two keys.
Definition key.cpp:38
bool isNumber() const
Checks if a key is a number.
Definition key.cpp:16
bool isCharacter() const
Checks if a key is a character.
Definition key.cpp:11
bool operator==(Key const &key) const
Compares two keys.
Definition key.cpp:33