Class TermCode

Index Home MAE > MAE Architecture > MAE Data Types > Class Index > Class TermCode

Summary
Public Methods
static bool validTerminalType(terminalType)
static string getCodes(terminalType, keyname)
Private Methods
static string getH19Codes(keyname)
static string getANSICodes(keyname)
static string getXtermCodes(keyname)
static string xtermCompile(shift, shiftPrefix, ctrl, ctrlPrefix, alt, altPrefix, plainPrefix, coreText, postfix)

#include <TermCode.h >

Summary

This class is useful for calculating escape sequences specific to a text-based video terminal.

Specifically, given a user keystroke name, calculate the terminal escape sequence understood by that terminal.

These are the valid keystroke names: space, enter, lf, tab, bs, esc, left, right, up, down, home, end, pgup, pgdn, ins, del.

Public Methods

static bool validTerminalType(terminalType)

const string& terminalType

a valid terminal type, e.g. xterm, vt100, c64, h19, ansi


Returns true if the terminal type is supported

Return value: true if terminaType is supported, false if not supported

static string getCodes(terminalType, keyname)

const string& terminalType

a valid terminal type, e.g. xterm, vt100, c64, h19, ansi

const string& keyname

the keyname, e.g. left, right, up, down, home, end, pgup, pgdn, ins, del, etc.


Given a terminal type and keyname, return the characters for it

Return value: the escape sequence that the terminal accepts to understand the named key

Private Methods

static string getH19Codes(keyname)

string keyname

the keyname, e.g. left, right, up, down, home, end, pgup, pgdn, ins, del, etc.


Given a key name, return the H19 characte(s) for it

Return value: the escape sequence that the terminal accepts to understand the named key

static string getANSICodes(keyname)

string keyname

the keyname, e.g. left, right, up, down, home, end, pgup, pgdn, ins, del, etc.


Given a key name, return the ANSI characte(s) for it

Return value: the escape sequence that the terminal accepts to understand the named key

static string getXtermCodes(keyname)

string keyname

the keyname, e.g. left, right, up, down, home, end, pgup, pgdn, ins, del, etc.


Given a key name, return the xterm characte(s) for it

Return value: the escape sequence that the terminal accepts to understand the named key

static string xtermCompile(shift, shiftPrefix, ctrl, ctrlPrefix, alt, altPrefix, plainPrefix, coreText, postfix)

bool shift

true means use the shiftPrefix + coreText + postfix, false otherwise

const string& shiftPrefix

the start of the shift prefix

bool ctrl

true means use the ctrlPrefix + coreText + postfix, false otherwise

const string& ctrlPrefix

the start of the ctrl prefix

bool alt

true means use the altPrefix + coreText + postfix, false otherwise

const string& altPrefix

the start of the alt prefix

const string& plainPrefix

the start of the plain (non-shift/ctrl/alt) prefix

const string& coreText

the core text of the escape esquence

const string& postfix

the trailing character (the command)

Default value: ""


Compile an escape sequence for xterm by selecting the appropriate prefix.

The result will start with one of shfitPrefix, ctrlPrefix, altPrefix or plainPrefix, which is followed by coreText and postfix.

Return value: an escape sequence