LibCppCmd v1.0 Beta 15
C++ Command Line Parsing Library
|
A parameter that stores data from the command line (base class). More...
#include <Param.h>
Classes | |
struct | Definition |
Defines a command line Param. More... | |
class | InvalidDefinition |
An exception thrown for invalid Param definitions. More... | |
Public Member Functions | |
virtual | ~Param ()=default |
Destructs a Param. | |
virtual std::string | Name () const =0 |
Gets the name of the Param. | |
virtual std::string | Description () const =0 |
Getst the description of the Param. | |
virtual std::string | HelpInfo () const =0 |
Gets help info for the Param. | |
virtual bool | IsSpecified () const =0 |
Indicates whether the Param has been specified. | |
virtual bool | IsMandatory () const =0 |
Indicates whether the Param is mandatory. | |
A parameter that stores data from the command line (base class).
A command line Param is a variable that stores data specified at the command line. How this is achieved is defined by the implemntation of each class that inherits from this one. This base class declares the the minimum attributes all types of Param are expected to have: a name, description, help information to print on help and usage screens, whether the Param was specified at the command line, and whether the Param is mandatory.
|
pure virtual |
Getst the description of the Param.
The description of the Param is used for generating help.
Implemented in CmdLine::MultiPosParam, CmdLine::Option, CmdLine::OptionParam, CmdLine::PosParam, and CmdLine::ProgParam.
|
pure virtual |
Gets help info for the Param.
The help info will include the name and description of the Param when generating help.
Implemented in CmdLine::MultiPosParam, CmdLine::Option, CmdLine::OptionParam, CmdLine::PosParam, CmdLine::ProgParam, and CmdLine::ValueOption.
|
pure virtual |
Indicates whether the Param is mandatory.
The command line Parser uses this to determine if a Param must be specified at the command line for parsing to be successful. If a mandatory Param is not specified i.e. the correct command line argument necessary to populate the Param was not supplied, parsing will fail indicating the program was supplied with bad command line arguments.
Implemented in CmdLine::MultiPosParam, CmdLine::Option, CmdLine::OptionParam, CmdLine::PosParam, and CmdLine::ProgParam.
|
pure virtual |
Indicates whether the Param has been specified.
A Param will only indicate it was specified if the it has been successfully populated by data from a command line argument. This is particularly useful to determine if a particular command line Option (also a type of Param) has been specified at the command line, etc. The comand line Parser also uses this to determine if a mandatory parameter has been specified.
Implemented in CmdLine::MultiPosParam, CmdLine::Option, CmdLine::OptionParam, CmdLine::PosParam, and CmdLine::ProgParam.
|
pure virtual |
Gets the name of the Param.
The name of the Param is used for generating usage and help.
Implemented in CmdLine::MultiPosParam, CmdLine::Option, CmdLine::OptionParam, CmdLine::PosParam, and CmdLine::ProgParam.