Parse key escape sequences. More...
#include <senf/Utils/Termlib/Terminfo.hh>
Public Member Functions | |
KeyParser () | |
KeyParser (Terminfo const &ti) | |
Load keymap information from ti. More... | |
void | load (Terminfo const &ti) |
Load keymap information from ti. More... | |
std::pair< keycode_t, size_type > | lookup (std::string const &key) const |
Lookup up string key. More... | |
void | dump (std::ostream &os) const |
Dump keymap for debug purposes. More... | |
Static Public Member Functions | |
static keycode_t | Ctrl (char ch) |
Helper to convert uppercase char to Control key code. More... | |
static std::string | describe (keycode_t key) |
Return descriptive, printable key name. More... | |
Static Public Attributes | |
static char const *const | KeyNames [] |
Special key code names. More... | |
Parse key escape sequences.
The KeyParser will read the relevant properties from a terminfo entry and then provides functions to parser keyboard escape sequences.
All keys are returned as keyboard code's. Values 0 to 255 represent ordinary ASCII characters, larger values are special keys taken from the KeyCode enum
Definition at line 236 of file Terminfo.hh.
typedef wchar_t senf::term::KeyParser::keycode_t |
Key code data type.
Definition at line 263 of file Terminfo.hh.
typedef std::string::size_type senf::term::KeyParser::size_type |
String length type.
Definition at line 264 of file Terminfo.hh.
Special keyboard key codes.
Definition at line 243 of file Terminfo.hh.
senf::term::KeyParser::KeyParser | ( | ) |
Definition at line 501 of file Terminfo.cc.
|
explicit |
Load keymap information from ti.
Definition at line 504 of file Terminfo.cc.
|
inlinestatic |
Helper to convert uppercase char to Control key code.
Definition at line 267 of file Terminfo.hh.
|
static |
Return descriptive, printable key name.
Definition at line 604 of file Terminfo.cc.
void senf::term::KeyParser::dump | ( | std::ostream & | os | ) | const |
Dump keymap for debug purposes.
Definition at line 616 of file Terminfo.cc.
void senf::term::KeyParser::load | ( | Terminfo const & | ti | ) |
Load keymap information from ti.
Definition at line 509 of file Terminfo.cc.
std::pair< senf::term::KeyParser::keycode_t, std::string::size_type > senf::term::KeyParser::lookup | ( | std::string const & | key | ) | const |
Lookup up string key.
This call will look up the string in key in the keymap. The return value is a pair.
If key is not a complete key sequence, the return key code will be the Invalid
value and the returned escape sequence size will be 0.
If key does not start with an escape sequence, the returned key code will be the first character from key and the escape sequence size will be 1.
Otherwise key starts with a complete escape sequence. The returned key code will be a value from the KeyCode enum and the escape sequence size will be returned accordingly.
Definition at line 579 of file Terminfo.cc.
|
static |
Special key code names.
Definition at line 261 of file Terminfo.hh.