Implementation of the IOptionsParser interface.
More...
#include <OptionsParser.hpp>
|
| Option (const std::string &name, int nbArgs, bool mandatory, const std::string &defaultValue, bool visible, const std::string &help) |
|
virtual | ~Option () |
|
std::string | getDefaultValue () const |
|
void | setDefaultValue (const std::string &value) |
|
bool | isMandatory () const |
|
IOptionsParser * | getParser (const std::string &name) |
|
void | accept (IOptionsParserVisitor &visitor, size_t depth=0) |
|
| OptionsParser (const std::string &name="", const std::string &help="") |
|
virtual | ~OptionsParser () |
|
const std::string & | getName () const |
|
void | setName (const std::string &name) |
|
void | setVisible (bool status) |
|
bool | isVisible () const |
|
const std::string & | getHelp () const |
|
void | setHelp (const std::string &help) |
|
misc::IProperties * | parse (int argc, char **argv) |
|
misc::IProperties * | parseString (const std::string &s) |
|
misc::IProperties * | getProperties () |
|
bool | saw (const std::string &name) const |
|
void | push_back (IOptionsParser *parser, size_t expandDepth=0, bool visibility=true) |
|
void | push_front (IOptionsParser *parser, size_t expandDepth=0, bool visibility=true) |
|
std::list< IOptionsParser * > & | getParsers () |
|
misc::IProperties * | getDefaultProperties () |
|
void | use () |
|
void | forget () |
|
virtual | ~ISmartPointer () |
|
Implementation of the IOptionsParser interface.
This implementation represents the 'leaf' part of the Composite design pattern.
Option |
( |
const std::string & |
name, |
|
|
int |
nbArgs, |
|
|
bool |
mandatory, |
|
|
const std::string & |
defaultValue, |
|
|
bool |
visible, |
|
|
const std::string & |
help |
|
) |
| |
|
inline |
Constructor.
- Parameters
-
[in] | name | : name of the option |
[in] | nbArgs | : number of arguments for this option |
[in] | mandatory | : tells whether this option is mandatory or not |
[in] | defaultValue | : default value for the option |
[in] | visible | : tells whether this option may be shown in help |
[in] | help | : textual help for this option |
std::string getDefaultValue |
( |
| ) |
const |
|
inline |
Get the default value for the option
- Returns
- the default value (may be empty)
size_t getNbArgs |
( |
| ) |
const |
|
inlineprotected |
Gives the number of arguments that must follow the option.
- Returns
- the arguments number.
Get a parser given its name.
- Parameters
-
[in] | name | : name of the parser to be retrieved |
- Returns
- the parser instance if found, 0 otherwise.
Reimplemented from OptionsParser.
bool isMandatory |
( |
| ) |
const |
|
inline |
Tells whether the option is mandatory or not.
- Returns
- the mandatory status.
virtual void proceed |
( |
const std::list< std::string > & |
args, |
|
|
IProperties & |
props |
|
) |
| |
|
protectedpure virtual |
When an option is recognized in the arguments list, we look the number of waited args and put them in a list of string objects. This is this list that is given as argument of the proceed() method that mainly will affect the given args to the variable given to the instantiation of the (derived class) Option.
Implemented in OptionOneParam, and OptionNoParam.
void setDefaultValue |
( |
const std::string & |
value | ) |
|
|
inline |
Set the default value for the option
- Parameters
-
[in] | value | : the default value (may be empty) |
The documentation for this class was generated from the following file:
- /builds/workspace/publish-doc-api-gitlab/gatb-core/src/gatb/tools/misc/impl/OptionsParser.hpp