CLI  2.9
Cli Class Referenceabstract

CLI definition class. More...

#include <cli.h>

Inheritance diagram for Cli:

Public Types

typedef tk::Queue< const Cli * > List
 CLI list type. More...
 
- Public Types inherited from Element
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...
 
MenuAddMenu (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...
 
ShellGetShell (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...
 
- Public Member Functions inherited from Menu
 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...
 
- Public Member Functions inherited from SyntaxNode
 SyntaxNode (const char *const STR_Keyword, const Help &CLI_Help)
 Constructor. More...
 
virtual ~SyntaxNode (void)
 Destructor. More...
 
ElementAddElement (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...
 
- Public Member Functions inherited from Element
 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 HelpGetHelp (void) const
 Element help accessor. More...
 
CliGetCli (void)
 Read-Write Cli reference accessor. More...
 
const CliGetCli (void) const
 Read-only Cli reference accessor. More...
 
ShellGetShell (void) const
 Shell reference accessor. More...
 
const OutputDeviceGetOutputStream (void) const
 Output stream reference accessor. More...
 
const OutputDeviceGetErrorStream (void) const
 Error stream reference accessor. More...
 
- Public Member Functions inherited from Object
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

- Protected Member Functions inherited from Object
 Object (void)
 Default constructor only available to sub-classes. More...
 

Detailed Description

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.

Definition at line 97 of file cli.h.

Member Typedef Documentation

◆ List

typedef tk::Queue<const Cli*> Cli::List

CLI list type.

Returns
N/A (doxygen warning)

Definition at line 126 of file cli.h.

Constructor & Destructor Documentation

◆ Cli()

Cli::Cli ( const char *const  STR_Name,
const Help CLI_Help 
)
explicit

Constructor.

Could be protected, but kept public for documentation purpose.

Parameters
STR_NameName of the CLI.
CLI_HelpHelp object.

◆ ~Cli()

virtual Cli::~Cli ( void  )
pure virtual

Destructor.

Pure virtual. Cli class is not final.

Member Function Documentation

◆ AddCommentLinePattern()

const bool Cli::AddCommentLinePattern ( const char *const  STR_Start)

Comment line pattern addition.

Returns
true if the comment line pattern has been successfully added, false otherwise.
Parameters
STR_StartComment line starter pattern.

◆ AddMenu()

Menu& Cli::AddMenu ( Menu *const  PCLI_Menu)

Menu addition.

Returns
The menu just added.
Parameters
PCLI_MenuNew menu.

◆ EnableConfigMenu()

const bool Cli::EnableConfigMenu ( const bool  B_Enable)

Configuration menu enabling.

Returns
false if the operation failed.
Parameters
B_Enabletrue for enabling, false otherwise.

◆ ExecuteReserved()

virtual const bool Cli::ExecuteReserved ( const CommandLine CLI_CommandLine) const
virtual

Reserved commands execution.

Parameters
CLI_CommandLineCommand line to execute.
Returns
true if the command has found an execution code, false otherwise.

Reimplemented from Menu.

◆ FindFromName()

static const int Cli::FindFromName ( Cli::List CLI_CliList,
const char *const  STR_RegExp 
)
static

Retrieve CLI references from their names.

Returns
The number of Cli instances found.
Parameters
CLI_CliListOutput list.
STR_RegExpRegular expression matching the searched CLI names.

◆ GetCommentLinePatterns()

const tk::Queue<tk::String>& Cli::GetCommentLinePatterns ( void  ) const

Comment line patterns accessor.

Returns
Comment line patterns.

◆ GetMenu()

const Menu* const Cli::GetMenu ( const char *const  STR_MenuName) const

Menu retrieval.

Returns
The menu identified by the given name, NULL if not found.
Parameters
STR_MenuNameMenu name.

◆ GetShell()

Shell& Cli::GetShell ( void  ) const

Returns the shell reference on execution.

Returns
Shell reference.

◆ IsConfigMenuEnabled()

const bool Cli::IsConfigMenuEnabled ( void  ) const

Determines whether the configuration menu is currently enabled.

Returns
true when the configuration menu is curently enabled, false otherwise.

◆ OnError()

virtual const bool Cli::OnError ( const ResourceString CLI_Location,
const ResourceString CLI_ErrorMessage 
) const
virtual

Handler on error.

Returns
true if the error can be displayed by the shell, false if it should not be displayed.
Parameters
CLI_LocationLocation of the error.
CLI_ErrorMessageMessage of the error.

◆ OnExit()

virtual void Cli::OnExit ( void  ) const
virtual

Handler on menu exit.

Reimplemented from Menu.

◆ RemoveCommentLinePattern()

const bool Cli::RemoveCommentLinePattern ( const char *const  STR_Start)

Comment line pattern removal.

Returns
true if the comment line pattern has been successfully removed, false otherwise.
Parameters
STR_StartComment line starter pattern.

◆ SetCli()

virtual void Cli::SetCli ( Cli CLI_Cli)
virtual

Cli reference setting.

Parameters
CLI_CliCli 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.

◆ SetShell()

void Cli::SetShell ( Shell CLI_Shell) const

Set the shell reference when executing.

Parameters
CLI_ShellShell reference.

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