CLI  2.9
Shell Class Reference

Shell management. More...

#include <shell.h>

Inheritance diagram for Shell:

Public Member Functions

 Shell (const Cli &CLI_Cli)
 Top execution context constructor. More...
 
 Shell (ExecutionContext &CLI_ParentContext, const Cli &CLI_Cli)
 Child execution context constructor. More...
 
virtual ~Shell (void)
 Destructor. More...
 
const CliGetCli (void) const
 Cli accessor. More...
 
void SetWelcomeMessage (const ResourceString &CLI_WelcomeMessage)
 Welcome message setting. More...
 
void SetByeMessage (const ResourceString &CLI_ByeMessage)
 Bye message setting. More...
 
void SetPrompt (const ResourceString &CLI_Prompt)
 Prompt message positionning. More...
 
const unsigned int GetHelpMargin (void) const
 Help margin accessor. More...
 
const unsigned int GetHelpOffset (void) const
 Help offset accessor. More...
 
const Menu *const GetCurrentMenu (const int I_MenuIndex) const
 Current menu retrieval. More...
 
void EnterMenu (const Menu &CLI_Menu, const bool B_PromptMenu)
 Enters a menu. More...
 
void ExitMenu (const bool B_PromptMenu)
 Exits the current menu. More...
 
void Quit (void)
 Terminates the shell. More...
 
void DisplayHelp (void)
 Displays help depending on the context of the current line. More...
 
void PrintWorkingMenu (void)
 Prints the working menu. More...
 
void CleanScreen (const bool B_PromptMenu)
 Clean screen shortcut. More...
 
- Public Member Functions inherited from ExecutionContext
virtual ~ExecutionContext (void)
 Destructor. More...
 
ExecutionContextManagerGetContextManager (void)
 Execution context manager accessor. More...
 
const IODeviceGetInput (void) const
 Input stream accessor. More...
 
const OutputDeviceGetStream (const STREAM_TYPE E_StreamType) const
 Output stream accessor. More...
 
const bool SetStream (const STREAM_TYPE E_StreamType, OutputDevice &CLI_Stream)
 Output stream positionning. More...
 
const bool StreamEnabled (const STREAM_TYPE E_StreamType) const
 Enabled/disabled stream accessor. More...
 
const bool EnableStream (const STREAM_TYPE E_StreamType, const bool B_Enable)
 Enable/disable stream. More...
 
void SetLang (const ResourceString::LANG E_Lang)
 Language setting. More...
 
const ResourceString::LANG GetLang (void) const
 Language access. More...
 
void SetBeep (const bool B_Enable)
 Beep configuration setting. More...
 
const bool GetBeep (void) const
 Beep configuration access. More...
 
void Beep (void)
 Sends a beep signal. More...
 
void Run (IODevice &CLI_IODevice)
 Runs the execution context onto the corresponding input/output device. More...
 
void Run (void)
 Runs the execution context as a child context of the parent given by the construction. More...
 
const bool IsRunning (void) const
 Tells whether this execution context is running or not. More...
 
void StopExecution (void)
 Terminates this execution context's execution. More...
 
void StopAllExecutions (void)
 Terminates execution for all execution contexts attached to the same top execution context. More...
 
- Public Member Functions inherited from Object
virtual ~Object (void)=0
 Pure virtual destructor. More...
 

Protected Member Functions

virtual const bool OnStartExecution (void)
 Beginning of execution handler. More...
 
virtual void OnKey (const KEY E_KeyCode)
 Handler called on character input. More...
 
virtual const bool OnStopExecution (void)
 Execution termination handler. More...
 
- Protected Member Functions inherited from ExecutionContext
 ExecutionContext (void)
 Top context constructor. More...
 
 ExecutionContext (ExecutionContext &CLI_ParentContext)
 Child context constructor. More...
 
- Protected Member Functions inherited from Object
 Object (void)
 Default constructor only available to sub-classes. More...
 

Detailed Description

Shell management.

Definition at line 50 of file shell.h.

Constructor & Destructor Documentation

◆ Shell() [1/2]

Shell::Shell ( const Cli CLI_Cli)
explicit

Top execution context constructor.

Parameters
CLI_CliCLI reference.

◆ Shell() [2/2]

Shell::Shell ( ExecutionContext CLI_ParentContext,
const Cli CLI_Cli 
)
explicit

Child execution context constructor.

Parameters
CLI_ParentContextParent execution context.
CLI_CliCLI reference.

◆ ~Shell()

virtual Shell::~Shell ( void  )
virtual

Destructor.

Member Function Documentation

◆ CleanScreen()

void Shell::CleanScreen ( const bool  B_PromptMenu)

Clean screen shortcut.

Parameters
B_PromptMenutrue if the menu should be (re)prompted. Basically false when executed within the context of a command processing, true when executed from other contexts.

◆ DisplayHelp()

void Shell::DisplayHelp ( void  )

Displays help depending on the context of the current line.

◆ EnterMenu()

void Shell::EnterMenu ( const Menu CLI_Menu,
const bool  B_PromptMenu 
)

Enters a menu.

Parameters
CLI_MenuMenu to enter.
B_PromptMenutrue if the menu should be (re)prompted. Basically false when executed within the context of a command processing, true when executed from other contexts.

◆ ExitMenu()

void Shell::ExitMenu ( const bool  B_PromptMenu)

Exits the current menu.

Parameters
B_PromptMenutrue if the menu should be (re)prompted. Basically false when executed within the context of a command processing, true when executed from other contexts.

◆ GetCli()

const Cli& Shell::GetCli ( void  ) const

Cli accessor.

Returns
Cli instance the shell is running onto.

◆ GetCurrentMenu()

const Menu* const Shell::GetCurrentMenu ( const int  I_MenuIndex) const

Current menu retrieval.

Returns
Reference of the current menu. NULL when I_MenuIndex is out of bounds.
Parameters
I_MenuIndexIndex of the menu in the stack. 0: root menu (bottom of the stack). 1: menu stacked over the root menu. 2: menu stacked over again... -1: current menu (top of the stack)

◆ GetHelpMargin()

const unsigned int Shell::GetHelpMargin ( void  ) const

Help margin accessor.

Returns
Number of spaces for the help margin.

◆ GetHelpOffset()

const unsigned int Shell::GetHelpOffset ( void  ) const

Help offset accessor.

Returns
Number of spaces for the help offset.

◆ OnKey()

virtual void Shell::OnKey ( const KEY  E_KeyCode)
protectedvirtual

Handler called on character input.

Parameters
E_KeyCodeInput key.

Implements ExecutionContext.

◆ OnStartExecution()

virtual const bool Shell::OnStartExecution ( void  )
protectedvirtual

Beginning of execution handler.

Returns
true for success, false otherwise.

Implements ExecutionContext.

◆ OnStopExecution()

virtual const bool Shell::OnStopExecution ( void  )
protectedvirtual

Execution termination handler.

Returns
true for success, false otherwise.

Implements ExecutionContext.

◆ PrintWorkingMenu()

void Shell::PrintWorkingMenu ( void  )

Prints the working menu.

◆ Quit()

void Shell::Quit ( void  )

Terminates the shell.

Warning
Not thread safe. Implement a non blocking device if your CLI execution should interact with external events.

◆ SetByeMessage()

void Shell::SetByeMessage ( const ResourceString CLI_ByeMessage)

Bye message setting.

Parameters
CLI_ByeMessageBye message. When an empty string is given, the default bye message is restored.

◆ SetPrompt()

void Shell::SetPrompt ( const ResourceString CLI_Prompt)

Prompt message positionning.

Parameters
CLI_PromptPrompt string. When an empty string is given, the default prompt (depending on the current menu) is restored.

◆ SetWelcomeMessage()

void Shell::SetWelcomeMessage ( const ResourceString CLI_WelcomeMessage)

Welcome message setting.

Parameters
CLI_WelcomeMessageWelcome message. When an empty string is given, the default welcome message is restored.

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