#include <senf/Utils/Termlib/Terminfo.hh>
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 245 of file Terminfo.hh.
Public Types |
|
enum |
KeyCode { Space = ' ', Tab = '\t', Return = '\r', First = 0xE000, Esc = First, Backspace, Backtab, Begin, CATab, CTab, Cancel, Center, Clear, ClearToEOL, ClearToEOS, Close, Command, Copy, Create, Delete, DeleteLine, Down, DownLeft, DownRight, End, Enter, Exit, F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, F25, F26, F27, F28, F29, F30, F31, F32, F33, F34, F35, F36, F37, F38, F39, F40, F41, F42, F43, F44, F45, F46, F47, F48, F49, F50, F51, F52, F53, F54, F55, F56, F57, F58, F59, F60, F61, F62, F63, Find, Help, Home, Insert, InsertLine, Left, Mark, Message, Mouse, Move, Next, Open, Options, PageDown, PageUp, Previous, Print, Redo, Reference, Refresh, Replace, Restart, Resume, Right, Save, Select, ShiftBegin, ShiftCancel, ShiftCommand, ShiftCopy, ShiftCreate, ShiftDelete, ShiftDeleteLine, ShiftEnd, ShiftClearToEOL, ShiftExit, ShiftFind, ShiftHelp, ShiftHome, ShiftInsert, ShiftLeft, ShiftMessage, ShiftMove, ShiftNext, ShiftOptions, ShiftPrevious, ShiftPrint, ShiftRedo, ShiftReplace, ShiftResume, ShiftRight, ShiftSave, ShiftSuspend, ShiftTab, ShiftUndo, Suspend, Undo, Up, UpLeft, UpRight, Incomplete = 0xE0FF } |
Special keyboard key codes. More... |
|
typedef wchar_t | keycode_t |
Key code data type. |
|
typedef std::string::size_type | size_type |
String length type. |
|
Public Member Functions |
|
KeyParser () | |
KeyParser (Terminfo const &ti) | |
Load keymap information from ti. |
|
void | load (Terminfo const &ti) |
Load keymap information from ti. |
|
std::pair< keycode_t, size_type > | lookup (std::string const &key) const |
Lookup up string key. |
|
void | dump (std::ostream &os) const |
Dump keymap for debug purposes. |
|
Static Public Member Functions |
|
static keycode_t | Ctrl (char ch) |
Helper to convert uppercase char to Control key code. |
|
static std::string | describe (keycode_t key) |
Return descriptive, printable key name. |
|
Static Public Attributes |
|
static char const *const | KeyNames [] |
Special key code names. |
typedef wchar_t senf::term::KeyParser:: | ||||
keycode_t | ||||
Key code data type.
Definition at line 272 of file Terminfo.hh.
typedef std::string::size_type senf::term::KeyParser:: | ||||
size_type | ||||
String length type.
Definition at line 273 of file Terminfo.hh.
enum senf::term::KeyParser:: | ||||
KeyCode | ||||
Special keyboard key codes.
Definition at line 252 of file Terminfo.hh.
senf::term::KeyParser:: | ||||
KeyParser | () | |||
Definition at line 480 of file Terminfo.cc.
senf::term::KeyParser:: | ||||
KeyParser | ( | Terminfo const & | ti | ) |
Load keymap information from ti.
Definition at line 483 of file Terminfo.cc.
static keycode_t senf::term::KeyParser:: | ||||
Ctrl | ( | char | ch | ) |
Helper to convert uppercase char to Control key code.
Definition at line 276 of file Terminfo.hh.
std::string senf::term::KeyParser:: | ||||
describe | ( | keycode_t | key | ) |
Return descriptive, printable key name.
Definition at line 583 of file Terminfo.cc.
void senf::term::KeyParser:: | ||||
dump | ( | std::ostream & | os | ) |
Dump keymap for debug purposes.
Definition at line 595 of file Terminfo.cc.
void senf::term::KeyParser:: | ||||
load | ( | Terminfo const & | ti | ) |
Load keymap information from ti.
Definition at line 488 of file Terminfo.cc.
std::pair< senf::term::KeyParser::keycode_t, std::string::size_type > senf::term::KeyParser:: | ||||
lookup | ( | std::string const & | key | ) |
Lookup up string key.
This call will look up the string in key in the keymap. The return value is a pair.
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 558 of file Terminfo.cc.
char const *const senf::term::KeyParser::KeyNames | ||||
[static] | ||||
Special key code names.
Definition at line 270 of file Terminfo.hh.