terminal< ctlclass > Class Template Reference

A command line interface template built on top of the termbuffer class. More...

#include <terminal.h>

Collaboration diagram for terminal< ctlclass >:
Collaboration graph
[legend]

List of all members.

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)
stringreadpass (const string &prompt)
stringreadline (const string &prompt, bool basicmode=false)

Public Attributes

termbuffer termbuf

Protected Attributes

ctlclass * ctl
keyresponsefirst
keyresponselast

Detailed Description

template<class ctlclass>
class terminal< ctlclass >

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.


Member Function Documentation

template<class ctlclass>
void terminal< ctlclass >::addkeyresponse ( int  key,
kmethod  pm 
) [inline]

Regsiter a new keyresponse.

Parameters:
key The key code.
pm The method to call.

Referenced by cli< ctlclass >::cli().

template<class ctlclass>
string* terminal< ctlclass >::readline ( const string prompt,
bool  basicmode = false 
) [inline]

Read a line of input.

Parameters:
prompt The input prompt.

Referenced by cli< ctlclass >::run().

template<class ctlclass>
string* terminal< ctlclass >::readpass ( const string prompt  )  [inline]

Read a password.

Extended keyresponders are not called, only home, end, delte/backspace, clear and return are mapped.

Parameters:
prompt The password prompt.
template<class ctlclass>
void terminal< ctlclass >::sendconsole ( const string s  )  [inline]

Send text to the console from another thread.

Console messages are only shown if the keyboard has been idle for at least a second.

Parameters:
s The message to send.

Referenced by cli< ctlclass >::sendconsole().


The documentation for this class was generated from the following file:

Generated on Sun Feb 28 10:36:55 2010 for GRACE by  doxygen 1.6.1