CLI
2.9
|
CLI definition class. More...
#include <cli.h>
Public Types | |
typedef tk::Queue< const Cli * > | List |
CLI list type. More... | |
![]() | |
typedef tk::Queue< const Element * > | List |
CLI element list type. More... | |
typedef tk::Map< const tk::String, const Element * > | Map |
CLI element map type. More... | |
Public Member Functions | |
Cli (const char *const STR_Name, const Help &CLI_Help) | |
Constructor. More... | |
virtual | ~Cli (void)=0 |
Destructor. More... | |
Menu & | AddMenu (Menu *const PCLI_Menu) |
Menu addition. More... | |
const Menu *const | GetMenu (const char *const STR_MenuName) const |
Menu retrieval. More... | |
const bool | AddCommentLinePattern (const char *const STR_Start) |
Comment line pattern addition. More... | |
const bool | RemoveCommentLinePattern (const char *const STR_Start) |
Comment line pattern removal. More... | |
const tk::Queue< tk::String > & | GetCommentLinePatterns (void) const |
Comment line patterns accessor. More... | |
void | SetShell (Shell &CLI_Shell) const |
Set the shell reference when executing. More... | |
Shell & | GetShell (void) const |
Returns the shell reference on execution. More... | |
virtual void | SetCli (Cli &CLI_Cli) |
Cli reference setting. More... | |
virtual const bool | ExecuteReserved (const CommandLine &CLI_CommandLine) const |
Reserved commands execution. More... | |
virtual const bool | OnError (const ResourceString &CLI_Location, const ResourceString &CLI_ErrorMessage) const |
Handler on error. More... | |
virtual void | OnExit (void) const |
Handler on menu exit. More... | |
const bool | IsConfigMenuEnabled (void) const |
Determines whether the configuration menu is currently enabled. More... | |
const bool | EnableConfigMenu (const bool B_Enable) |
Configuration menu enabling. More... | |
![]() | |
Menu (const char *const STR_Name, const Help &CLI_Help) | |
Constructor. More... | |
virtual | ~Menu (void) |
Destructor. More... | |
const tk::String | GetName (void) const |
Menu name access. More... | |
virtual const bool | Execute (const CommandLine &CLI_CommandLine) const |
User-defined commands execution. More... | |
virtual const tk::String | OnPrompt (void) const |
Handler on prompt display. More... | |
![]() | |
SyntaxNode (const char *const STR_Keyword, const Help &CLI_Help) | |
Constructor. More... | |
virtual | ~SyntaxNode (void) |
Destructor. More... | |
Element & | AddElement (Element *const PCLI_Element) |
Possible element addition. More... | |
const bool | RemoveElement (const Element *const PCLI_Element, const bool B_AutoDelete) |
Element removal. More... | |
virtual const bool | FindElements (Element::List &CLI_ExactList, Element::List &CLI_NearList, const char *const STR_Keyword) const |
Sub-elements search. More... | |
![]() | |
Element (const char *const STR_Keyword, const Help &STR_Help) | |
Constructor. More... | |
virtual | ~Element (void)=0 |
Destructor. More... | |
virtual const tk::String | GetKeyword (void) const |
String identifier accessor. More... | |
virtual const Help & | GetHelp (void) const |
Element help accessor. More... | |
Cli & | GetCli (void) |
Read-Write Cli reference accessor. More... | |
const Cli & | GetCli (void) const |
Read-only Cli reference accessor. More... | |
Shell & | GetShell (void) const |
Shell reference accessor. More... | |
const OutputDevice & | GetOutputStream (void) const |
Output stream reference accessor. More... | |
const OutputDevice & | GetErrorStream (void) const |
Error stream reference accessor. More... | |
![]() | |
virtual | ~Object (void)=0 |
Pure virtual destructor. More... | |
Static Public Member Functions | |
static const int | FindFromName (Cli::List &CLI_CliList, const char *const STR_RegExp) |
Retrieve CLI references from their names. More... | |
Additional Inherited Members | |
![]() | |
Object (void) | |
Default constructor only available to sub-classes. More... | |
CLI definition class.
An object of this class defines a CLI structure. Since a Cli object defines the main menu, it inherits from Menu. On the other hand, this class owns all sub-menus through the member m_vpcliMenus. Finally, since Menu inherits from SyntaxNode, it also owns a collection of possible Element objects that define the commands you can type in the first place.
Since you should override the execution handler, this class should be inherited. That's the reason why the destructor is pure virtual.
|
explicit |
Constructor.
Could be protected, but kept public for documentation purpose.
STR_Name | Name of the CLI. |
CLI_Help | Help object. |
|
pure virtual |
Destructor.
Pure virtual. Cli class is not final.
const bool Cli::AddCommentLinePattern | ( | const char *const | STR_Start | ) |
Comment line pattern addition.
STR_Start | Comment line starter pattern. |
const bool Cli::EnableConfigMenu | ( | const bool | B_Enable | ) |
Configuration menu enabling.
B_Enable | true for enabling, false otherwise. |
|
virtual |
Reserved commands execution.
CLI_CommandLine | Command line to execute. |
Reimplemented from Menu.
|
static |
Retrieve CLI references from their names.
CLI_CliList | Output list. |
STR_RegExp | Regular expression matching the searched CLI names. |
const tk::Queue<tk::String>& Cli::GetCommentLinePatterns | ( | void | ) | const |
Comment line patterns accessor.
const Menu* const Cli::GetMenu | ( | const char *const | STR_MenuName | ) | const |
Shell& Cli::GetShell | ( | void | ) | const |
Returns the shell reference on execution.
const bool Cli::IsConfigMenuEnabled | ( | void | ) | const |
Determines whether the configuration menu is currently enabled.
|
virtual |
Handler on error.
CLI_Location | Location of the error. |
CLI_ErrorMessage | Message of the error. |
|
virtual |
Handler on menu exit.
Reimplemented from Menu.
const bool Cli::RemoveCommentLinePattern | ( | const char *const | STR_Start | ) |
Comment line pattern removal.
STR_Start | Comment line starter pattern. |
|
virtual |
Cli reference setting.
CLI_Cli | Cli reference. |
The m_pcliCli member should be set for each Element object. However, generally, this method is automaticaly called, as in SyntaxNode::AddElement() for instance.
Reimplemented from Menu.
void Cli::SetShell | ( | Shell & | CLI_Shell | ) | const |
Set the shell reference when executing.
CLI_Shell | Shell reference. |