CLI  2.9
CommandLine Class Reference

Command line parsing. More...

#include <command_line.h>

Inheritance diagram for CommandLine:

Public Member Functions

 CommandLine (void)
 Default constructor. More...
 
virtual ~CommandLine (void)
 Destructor. More...
 
const bool Parse (const Menu &CLI_Menu, const tk::String &STR_Line, const bool B_Execution)
 Parse and analysis invocation. More...
 
const ElementGetLastElement (void) const
 Last element accessor. More...
 
const char *const GetLastWord (void) const
 Last word (for completion). More...
 
const int GetNumBackspacesForCompletion (void) const
 Number of backspaces for completion. More...
 
const ResourceStringGetLastError (void) const
 Last error. More...
 
- Public Member Functions inherited from Object
virtual ~Object (void)=0
 Pure virtual destructor. More...
 

Additional Inherited Members

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

Detailed Description

Command line parsing.

Parses a command line in its string form, and returns the command line in its Element collection form after analysis.

Definition at line 52 of file command_line.h.

Constructor & Destructor Documentation

◆ CommandLine()

CommandLine::CommandLine ( void  )
explicit

Default constructor.

◆ ~CommandLine()

virtual CommandLine::~CommandLine ( void  )
virtual

Destructor.

Member Function Documentation

◆ GetLastElement()

const Element& CommandLine::GetLastElement ( void  ) const

Last element accessor.

Returns
Last element reference.

◆ GetLastError()

const ResourceString& CommandLine::GetLastError ( void  ) const

Last error.

Returns
Last error resource string.

This resource is cleared on every parse.

◆ GetLastWord()

const char* const CommandLine::GetLastWord ( void  ) const

Last word (for completion).

Returns
The last word if any, NULL when no last word.
Note
After parsing, the buffer is valid as far as the command line object is valid.

When used for completion, this object does not analyse the last word and just stores it. This method retrieves this last word.

◆ GetNumBackspacesForCompletion()

const int CommandLine::GetNumBackspacesForCompletion ( void  ) const

Number of backspaces for completion.

Returns
Number of backspaces.

Number of backspaces in order to erase the last word of the line.

◆ Parse()

const bool CommandLine::Parse ( const Menu CLI_Menu,
const tk::String &  STR_Line,
const bool  B_Execution 
)

Parse and analysis invocation.

Returns
true for success, false otherwise.

If this method succeeds, the result is stored in the object itself, and can be accessed through the following public methods.

Parameters
CLI_MenuCurrent menu.
STR_LineInput command line in its string form.
B_ExecutionFlag set when parsing is done for execution. Implicitely say completion otherwise.

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