A command line interface template built on top of the termbuffer class. More...
#include <terminal.h>

Classes | |
| class | keyresponse |
| A node in the keyboard response list. More... | |
Public Types | |
| typedef int(ctlclass::* | kmethod )(int, termbuffer &) |
Public Member Functions | |
| terminal (ctlclass *p, file &in, file &out, int _size=4096, int _wsize=0) | |
| ~terminal (void) | |
| void | off (void) |
| void | set (const string &s) |
| void | sendconsole (const string &s) |
| void | addkeyresponse (int key, kmethod pm) |
| string * | readpass (const string &prompt) |
| string * | readline (const string &prompt, bool basicmode=false) |
Public Attributes | |
| termbuffer | termbuf |
Protected Attributes | |
| ctlclass * | ctl |
| keyresponse * | first |
| keyresponse * | last |
A command line interface template built on top of the termbuffer class.
It implements a 'readline' call, that offers standard emacs keybindings for controlling the cursor, with the following keys handled by default:
This is implemented as a template class to allow callbacks to be performed against non-static methods of your class of choice.
Regsiter a new keyresponse.
| key | The key code. | |
| pm | The method to call. |
Referenced by cli< ctlclass >::cli().
Read a password.
Extended keyresponders are not called, only home, end, delte/backspace, clear and return are mapped.
| prompt | The password prompt. |
Send text to the console from another thread.
Console messages are only shown if the keyboard has been idle for at least a second.
| s | The message to send. |
Referenced by cli< ctlclass >::sendconsole().
1.6.1