PTLib
Version 2.10.4
|
Command Line Interpreter over standard input/output. More...
#include <cli.h>
Public Member Functions | |
PCLI::Context * | StartForeground () |
Initialise a foreground context and return it. | |
Construction | |
PCLIStandard (const char *prompt=NULL) | |
Create new command line interpreter for standard I/O. | |
Overrides from PCLI | |
virtual bool | Start (bool runInBackground=true) |
Start a command line interpreter. | |
![]() | |
virtual bool | RunContext (Context *context) |
Run a context. | |
PCLI (const char *prompt=NULL) | |
Contracut a new command line interpreter. | |
virtual | ~PCLI () |
Destroy the command line interpreter. | |
virtual void | Stop () |
Stop and clean up command line interpreters. | |
bool | StartContext (PChannel *channel, bool autoDelete=true, bool runInBackground=true) |
Open a command line interpreter context. | |
bool | StartContext (PChannel *readChannel, PChannel *writeChannel, bool autoDeleteRead=true, bool autoDeleteWrite=true, bool runInBackground=true) |
virtual Context * | CreateContext () |
Create a new context. | |
virtual Context * | AddContext (Context *context=NULL) |
Add a command line interpreter context to the system. | |
virtual void | RemoveContext (Context *context) |
Remove the command line interpreter context. | |
virtual void | GarbageCollection () |
Remove any closed command line interpreter contexts. | |
virtual void | OnReceivedLine (Arguments &line) |
Received a completed command line. | |
virtual bool | OnLogIn (const PString &username, const PString &password) |
Received a login name/pasword to be verified. | |
void | Broadcast (const PString &message) const |
Set a string to all command line interpreter contexts. | |
bool | SetCommand (const char *command, const PNotifier ¬ifier, const char *help=NULL, const char *usage=NULL) |
Register a new command to be interpreted. | |
void | ShowHelp (Context &context) |
Show help for registered commands to the context. | |
const PString & | GetNewLine () const |
Get new line string output at the end of every line. | |
void | SetNewLine (const PString &newLine) |
Set new line string output at the end of every line. | |
bool | GetRequireEcho () const |
Get flag for echo is required for entered characters. | |
void | SetRequireEcho (bool requireEcho) |
Set flag for echo is required for entered characters. | |
const PString & | GetEditCharacters () const |
Get characters used for editing (backspace/delete) command lines. | |
void | SetEditCharacters (const PString &editCharacters) |
Set characters used for editing (backspace/delete) command lines. | |
const PString & | GetPrompt () const |
Get prompt used for command line interpreter. | |
void | SetPrompt (const PString &prompt) |
Set prompt used for command line interpreter. | |
const PString & | GetUsernamePrompt () const |
Get prompt used for login (if enabled). | |
void | SetUsernamePrompt (const PString &prompt) |
Set prompt used for login (if enabled). | |
const PString & | GetPasswordPrompt () const |
Get prompt used for password (if enabled). | |
void | SetPasswordPrompt (const PString &prompt) |
Set prompt used for password (if enabled). | |
const PString & | GetUsername () const |
Get username for log in validation. | |
void | SetUsername (const PString &username) |
Set username for log in validation. | |
const PString & | GetPassword () const |
Get password for log in validation. | |
void | SetPassword (const PString &password) |
Set password for log in validation. | |
const PCaselessString & | GetExitCommand () const |
Get command to be used to exit session. | |
void | SetExitCommand (const PCaselessString &exitCommand) |
Set command to be used to exit session. | |
const PCaselessString & | GetHelpCommand () const |
Get command to be used to display help. | |
void | SetHelpCommand (const PCaselessString &helpCommand) |
Set command to be used to display help. | |
const PString & | GetHelpOnHelp () const |
Get help on help. | |
void | SetHelpOnHelp (const PCaselessString &helpOnHelp) |
Set help on help. | |
const PCaselessString & | GetRepeatCommand () const |
Get the command to be used to repeat the last executed command. | |
void | SetRepeatCommand (const PCaselessString &repeatCommand) |
Set the command to be used to repeat the last executed command. | |
const PCaselessString & | GetHistoryCommand () const |
Get command that will list/execute command history. | |
void | SetHistoryCommand (const PCaselessString &historyCommand) |
Set command that will list/execute command history. | |
const PString & | GetNoHistoryError () const |
Get error message for if there is no history. | |
void | SetNoHistoryError (const PString &noHistoryError) |
Set error message for if there is no history. | |
const PString & | GetCommandUsagePrefix () const |
Get usage prefix for if Arguments::WriteUsage() called. | |
void | SetCommandUsagePrefix (const PString &commandUsagePrefix) |
Set usage prefix for if Arguments::WriteUsage() called. | |
const PString & | GetCommandErrorPrefix () const |
Get error prefix for if Arguments::WriteError() called. | |
void | SetCommandErrorPrefix (const PString &commandErrorPrefix) |
Set error prefix for if Arguments::WriteError() called. | |
const PString & | GetUnknownCommandError () const |
Get error message for if unknown command is entered. | |
void | SetUnknownCommandError (const PString &unknownCommandError) |
Set error message for if unknown command is entered. | |
![]() | |
virtual | ~PObject () |
virtual PObject * | Clone () const |
Create a copy of the class on the heap. | |
virtual PINDEX | HashFunction () const |
This function yields a hash value required by the PDictionary class. | |
virtual Comparison | Compare (const PObject &obj) const |
Compare the two objects and return their relative rank. | |
virtual Comparison | CompareObjectMemoryDirect (const PObject &obj) const |
Determine the byte wise comparison of two objects. | |
bool | operator== (const PObject &obj) const |
Compare the two objects. | |
bool | operator!= (const PObject &obj) const |
Compare the two objects. | |
bool | operator< (const PObject &obj) const |
Compare the two objects. | |
bool | operator> (const PObject &obj) const |
Compare the two objects. | |
bool | operator<= (const PObject &obj) const |
Compare the two objects. | |
bool | operator>= (const PObject &obj) const |
Compare the two objects. | |
virtual const char * | GetClass (unsigned ancestor=0) const |
Get the current dynamic type of the object instance. | |
PBoolean | IsClass (const char *cls) const |
virtual PBoolean | InternalIsDescendant (const char *clsName) const |
Determine if the dynamic type of the current instance is a descendent of the specified class. | |
virtual void | PrintOn (ostream &strm) const |
Output the contents of the object to the stream. | |
virtual void | ReadFrom (istream &strm) |
Input the contents of the object from the stream. |
Command Line Interpreter over standard input/output.
PCLIStandard::PCLIStandard | ( | const char * | prompt = NULL | ) |
Create new command line interpreter for standard I/O.
|
virtual |
Start a command line interpreter.
As for ancestor function, however if no contexts have been added, then on that takes a PConsoleChannel is automatically added.
runInBackground | Spawn a thread to read and interpret commands |
Reimplemented from PCLI.
|
virtual |
Initialise a foreground context and return it.
Reimplemented from PCLI.