ALib C++ Framework
by
Library Version: 2511 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::cli::CommandDecl Class Reference

Description:

A declaration for a Command.

Construction is done by passing a custom enum element of an enum type equipped with ALib Enum Records of type ERCommandDecl.

When bootstrapping ALib CLI, method void DefineCommands()  has to be invoked for (each) enum type.

Definition at line 402 of file arguments.inl.

Public Field Index:

CommandLineCmdLine
 The command-line instance we belong to.
ListMA< ParameterDecl * > Parameters
 Command parameters.

Public Method Index:

template<typename TEnum>
 CommandDecl (TEnum element, CommandLine &cmdLine)
const EnumElement () const
ParameterDeclGetParameterDecl (const String &name)
const StringHelpTextLong ()
const StringHelpTextShort ()
const StringIdentifier ()
int MinimumRecognitionLength ()

Protected Field Index:

Enum declElement
 The enumeration element given with construction.
ERCommandDecl record
 A copy (!) of the enum record.
ResourceInfo resourceInfo
 The resource information of the enumeration type given with construction.

Protected Method Index:

void addParamDecls ()

Field Details:

◆ CmdLine

CommandLine& alib::cli::CommandDecl::CmdLine

The command-line instance we belong to.

Definition at line 416 of file arguments.inl.

◆ declElement

Enum alib::cli::CommandDecl::declElement
protected

The enumeration element given with construction.

Definition at line 406 of file arguments.inl.

◆ Parameters

ListMA<ParameterDecl*> alib::cli::CommandDecl::Parameters

Command parameters.

Definition at line 419 of file arguments.inl.

◆ record

ERCommandDecl alib::cli::CommandDecl::record
protected

A copy (!) of the enum record.

Definition at line 409 of file arguments.inl.

◆ resourceInfo

ResourceInfo alib::cli::CommandDecl::resourceInfo
protected

The resource information of the enumeration type given with construction.

Definition at line 412 of file arguments.inl.

Constructor(s) / Destructor Details:

◆ CommandDecl()

template<typename TEnum>
alib::cli::CommandDecl::CommandDecl ( TEnum element,
CommandLine & cmdLine )
inline

Templated constructor which takes an enum element of a custom type equipped with ALib Enum Records of type ERCommandDecl.

Field Parameters is filled as specified in the enum record.

Template Parameters
TEnumC++ enum type equipped with corresponding ALib Enum Records.
Parameters
elementThe enum element
cmdLineThe command-line object. Will be stored.

Definition at line 513 of file commandline.inl.

Method Details:

◆ addParamDecls()

void alib::cli::CommandDecl::addParamDecls ( )
protected

Called from the constructor. Parses field String parameters of the enum record, and loads the corresponding parameters.

Definition at line 38 of file arguments.cpp.

◆ Element()

const Enum & alib::cli::CommandDecl::Element ( ) const
inline

Returns the type and integral value of the enumeration element used with construction.

Returns
The enumeration element used with construction.

Definition at line 435 of file arguments.inl.

◆ GetParameterDecl()

ParameterDecl * alib::cli::CommandDecl::GetParameterDecl ( const String & name)

Searches in Parameters for the declaration of parameter name.

Parameters
nameThe declaration name of the parameter.
Returns
A pointer to the parameter's declaration, nullptr if parameter was not declared.

Definition at line 55 of file arguments.cpp.

◆ HelpTextLong()

const String & alib::cli::CommandDecl::HelpTextLong ( )
inline

Returns the long version of the help text. Loads the string from resourceInfo using resource name "THlpCmdLngNN", where NN is the enum element's integral value.

Returns
The help text.

Definition at line 456 of file arguments.inl.

◆ HelpTextShort()

const String & alib::cli::CommandDecl::HelpTextShort ( )
inline

Returns the short version of the help text. Loads the string from resourceInfo using resource name "THlpCmdShtNN", where NN is the enum element's integral value.

Returns
The help text.

Definition at line 449 of file arguments.inl.

◆ Identifier()

const String & alib::cli::CommandDecl::Identifier ( )
inline

Returns the identifier (name) of the command

Returns
The command identifier.

Definition at line 439 of file arguments.inl.

◆ MinimumRecognitionLength()

int alib::cli::CommandDecl::MinimumRecognitionLength ( )
inline

Returns the minimum parse length of the identifier.

Returns
The minimum characters to satisfy the command to be parsed.

Definition at line 443 of file arguments.inl.


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