Robot Devastation
Key.hpp
1 // Authors: see AUTHORS.md at project root.
2 // CopyPolicy: released under the terms of the LGPLv2.1, see LICENSE at project root.
3 // URL: https://github.com/asrob-uc3m/robotDevastation
4 
5 #ifndef __RD_KEY_HPP__
6 #define __RD_KEY_HPP__
7 
8 namespace rd{
9 
23 class Key
24 {
25  public:
26  Key(char printable_character);
27  Key(int control_key);
28 
29  bool isControlKey() const;
30  bool isPrintable() const;
31 
32  char getChar() const;
33  int getValue() const;
34 
35  //-- Constants for control keys (non-printable)
37  static const int KEY_UNKNOWN;
39  static const int KEY_PRINTABLE;
40  static const int KEY_SPACE;
41  static const int KEY_ESCAPE;
42  static const int KEY_BACKSPACE;
43  static const int KEY_ARROW_UP;
44  static const int KEY_ARROW_DOWN;
45  static const int KEY_ARROW_LEFT;
46  static const int KEY_ARROW_RIGHT;
47  static const int KEY_ENTER;
48 
49  bool operator==(Key const& k) const;
50 
51  protected:
53  char char_value;
55  int key_value;
56 
58  bool printable;
60  bool control;
61 };
62 
63 }
64 
65 #endif //-- __RD_KEY_HPP__
rd::Key::char_value
char char_value
Stores the char representation of a key.
Definition: Key.hpp:53
rd
The main, catch-all namespace for Robot Devastation.
Definition: groups.dox:4
rd::Key::KEY_UNKNOWN
static const int KEY_UNKNOWN
Constant representing a non-supported / unknown key.
Definition: Key.hpp:37
rd::Key::control
bool control
Stores whether the key is a control key or not.
Definition: Key.hpp:60
rd::Key::printable
bool printable
Stores whether the key is printable or not.
Definition: Key.hpp:58
rd::Key::key_value
int key_value
Stores the control key value of a key.
Definition: Key.hpp:55
rd::Key
Class that represents a keyboard key.
Definition: Key.hpp:23
rd::Key::KEY_PRINTABLE
static const int KEY_PRINTABLE
Constant representing any printable key.
Definition: Key.hpp:39