![]() |
PhoenixPresentation
2.0.0
Set of cmake function to automate presentation generation
|
Describe a mode in the program arguments. More...
#include <OptionMode.h>
Public Member Functions | |
void | addOption (const Option &option) |
Add an option into the OptionMode. More... | |
bool | checkArgument () const |
Check the argument of the parser. More... | |
void | clearOption () |
Remove all the options of the OptionMode. More... | |
const PString & | getExtraArgument () const |
Get Extra argument. More... | |
PString & | getName () |
Get the name of the OptionMode. More... | |
const PString & | getName () const |
Get the name of the OptionMode. More... | |
void | getPossibleMode (PString &possibleOption, const PString &cursorOption) const |
Get the possible mode. More... | |
void | getPossibleOption (PString &possibleOption, const PString &cursorOption) const |
Get the possible options for the bash completion. More... | |
template<typename T > | |
bool | getValue (T &value, const PString &optionName) const |
Get the value of the option. More... | |
VecOption & | getVecOption () |
Get the vector of options of the OptionMode. More... | |
const VecOption & | getVecOption () const |
Get the vector of options of the OptionMode. More... | |
bool | isCurrentlyParsed () const |
Say if the OptionMode is currently parsed (but maybe not totally) More... | |
bool | isOptionExist (const PString &optionName) const |
Say if the given option has been passed to the program. More... | |
bool | isParsed () const |
Say if the OptionMode contains option which are parsed. More... | |
OptionMode & | operator= (const OptionMode &other) |
Definition of equal operator of OptionMode. More... | |
OptionMode (const OptionMode &other) | |
Copy constructor of OptionMode. More... | |
OptionMode (const PString &name="") | |
Default constructeur of OptionMode. More... | |
bool | parseOption (ArgParser &parser) |
Parse the options in the current OptionMode. More... | |
bool | parseOption (ArgParser &parser, Option *&partialOption) |
Parse the options in the current OptionMode. More... | |
void | print () const |
Print the option of the mode. More... | |
void | setEnableHelpOption (bool b) |
Set the attribtue which enables help option. More... | |
void | setName (const PString &name) |
Set the name of the OptionMode. More... | |
void | setProgramVersion (const PString &programVersion) |
Set the program version. More... | |
void | setVecOption (const VecOption &vecOption) |
Set the vector of options of the OptionMode. More... | |
virtual | ~OptionMode () |
Destructeur of OptionMode. More... | |
Protected Member Functions | |
void | copyOptionMode (const OptionMode &other) |
Copy function of OptionMode. More... | |
Private Member Functions | |
bool | getOption (Option &option, const PString &optionName) const |
Get the option with its name. More... | |
void | initialisationOptionMode () |
Initialisation function of the class OptionMode. More... | |
void | iterGetPossibleOption (PString &possibleOption, const PString &cursorOption) const |
Iterates over the possible options of the current mode. More... | |
Private Attributes | |
bool | p_enableHelpOption |
True to enable automatically the printing of the help option when the program is called with –help or -h. More... | |
PString | p_extraArgument |
Extra argument passed to the OptionMode. More... | |
bool | p_isCurrentlyParsed |
True if the OptionMode is currently parsed but not totally. More... | |
bool | p_isParsed |
Say if the mode contains options which are parsed. More... | |
PString | p_name |
name of the OptionMode More... | |
PString | p_programVersion |
Program version to be printed on –version or -v option. More... | |
VecOption | p_vecOption |
Vector of all the options of the OptionMode. More... | |
Describe a mode in the program arguments.
Definition at line 13 of file OptionMode.h.
OptionMode::OptionMode | ( | const PString & | name = "" | ) |
Default constructeur of OptionMode.
name | : name of the mode |
Definition at line 12 of file OptionMode.cpp.
References initialisationOptionMode().
OptionMode::OptionMode | ( | const OptionMode & | other | ) |
Copy constructor of OptionMode.
other | : class to copy |
Definition at line 21 of file OptionMode.cpp.
References copyOptionMode().
|
virtual |
void OptionMode::addOption | ( | const Option & | option | ) |
Add an option into the OptionMode.
option | option to be added into the OptionMode |
Definition at line 136 of file OptionMode.cpp.
References p_vecOption.
bool OptionMode::checkArgument | ( | ) | const |
Check the argument of the parser.
Definition at line 174 of file OptionMode.cpp.
References p_isParsed, and p_vecOption.
void OptionMode::clearOption | ( | ) |
Remove all the options of the OptionMode.
Definition at line 139 of file OptionMode.cpp.
References p_vecOption.
|
protected |
Copy function of OptionMode.
other | : class to copy |
Definition at line 251 of file OptionMode.cpp.
References p_enableHelpOption, p_extraArgument, p_isCurrentlyParsed, p_isParsed, p_name, p_programVersion, and p_vecOption.
Referenced by operator=(), and OptionMode().
const PString & OptionMode::getExtraArgument | ( | ) | const |
Get Extra argument.
Definition at line 202 of file OptionMode.cpp.
References p_extraArgument.
PString & OptionMode::getName | ( | ) |
Get the name of the OptionMode.
Definition at line 159 of file OptionMode.cpp.
References p_name.
const PString & OptionMode::getName | ( | ) | const |
Get the name of the OptionMode.
Definition at line 154 of file OptionMode.cpp.
References p_name.
Referenced by OptionParser::parseArgumentNormalUse().
Get the option with its name.
[out] | option | : option if it has been found |
optionName | : name of the option to be searched |
Definition at line 273 of file OptionMode.cpp.
References p_vecOption.
Referenced by getValue().
Get the possible mode.
[out] | possibleOption | : possible options for the bash completion |
cursorOption | : option of the cursor which is currently completed |
Definition at line 240 of file OptionMode.cpp.
References PString::isSameBegining(), and p_name.
Get the possible options for the bash completion.
[out] | possibleOption | : possible options for the bash completion |
cursorOption | : option of the cursor which is currently completed |
Definition at line 225 of file OptionMode.cpp.
References PString::isSameBegining(), iterGetPossibleOption(), p_isCurrentlyParsed, and p_name.
Referenced by OptionParser::getPossibleOption().
bool OptionMode::getValue | ( | T & | value, |
const PString & | optionName | ||
) | const |
Get the value of the option.
[out] | value | : value of the option |
optionName | : name of option to get the option |
Definition at line 18 of file OptionMode_impl.h.
References getOption(), Option::getValue(), OptionValue::getValue(), Option::isParsed(), and Option::isRequired().
Referenced by main().
VecOption & OptionMode::getVecOption | ( | ) |
Get the vector of options of the OptionMode.
Definition at line 169 of file OptionMode.cpp.
References p_vecOption.
const VecOption & OptionMode::getVecOption | ( | ) | const |
Get the vector of options of the OptionMode.
Definition at line 164 of file OptionMode.cpp.
References p_vecOption.
|
private |
Initialisation function of the class OptionMode.
Definition at line 262 of file OptionMode.cpp.
References p_enableHelpOption, p_isCurrentlyParsed, and p_isParsed.
Referenced by OptionMode().
bool OptionMode::isCurrentlyParsed | ( | ) | const |
Say if the OptionMode is currently parsed (but maybe not totally)
Definition at line 188 of file OptionMode.cpp.
References p_isCurrentlyParsed.
bool OptionMode::isOptionExist | ( | const PString & | optionName | ) | const |
Say if the given option has been passed to the program.
[out] | optionName | : name of the option to be checked |
Definition at line 210 of file OptionMode.cpp.
References p_vecOption.
Referenced by main().
bool OptionMode::isParsed | ( | ) | const |
Say if the OptionMode contains option which are parsed.
Definition at line 195 of file OptionMode.cpp.
References p_isParsed.
Referenced by main().
|
private |
Iterates over the possible options of the current mode.
[out] | possibleOption | : possible options for the bash completion |
cursorOption | : option of the cursor which is currently completed |
Definition at line 289 of file OptionMode.cpp.
References p_vecOption.
Referenced by getPossibleOption().
OptionMode & OptionMode::operator= | ( | const OptionMode & | other | ) |
Definition of equal operator of OptionMode.
other | : class to copy |
Definition at line 34 of file OptionMode.cpp.
References copyOptionMode().
bool OptionMode::parseOption | ( | ArgParser & | parser | ) |
Parse the options in the current OptionMode.
[out] | parser | : parser of option to be used |
Definition at line 44 of file OptionMode.cpp.
References ArgParser::getCurrentOption(), ArgParser::getNextOption(), ArgParser::getRemainingArgument(), ArgParser::isEndOfOption(), p_enableHelpOption, p_extraArgument, p_isCurrentlyParsed, p_isParsed, p_programVersion, p_vecOption, and print().
Referenced by OptionParser::parseArgumentNormalUse().
Parse the options in the current OptionMode.
[out] | parser | : parser of option to be used |
[out] | partialOption | : pointer to an option partially parsed |
Definition at line 87 of file OptionMode.cpp.
References ArgParser::getCurrentOption(), ArgParser::getNextOption(), ArgParser::isEndOfOption(), p_isCurrentlyParsed, p_isParsed, p_name, and p_vecOption.
void OptionMode::print | ( | ) | const |
Print the option of the mode.
Definition at line 112 of file OptionMode.cpp.
References p_name, and p_vecOption.
Referenced by main(), parseOption(), and printConstParser().
void OptionMode::setEnableHelpOption | ( | bool | b | ) |
Set the attribtue which enables help option.
b | : true to enable help option, false otherwise |
Definition at line 144 of file OptionMode.cpp.
References p_enableHelpOption.
Referenced by OptionParser::addMode().
void OptionMode::setName | ( | const PString & | name | ) |
Set the name of the OptionMode.
name | : name of the OptionMode |
Definition at line 126 of file OptionMode.cpp.
References p_name.
void OptionMode::setProgramVersion | ( | const PString & | programVersion | ) |
Set the program version.
programVersion | : version of the program |
Definition at line 149 of file OptionMode.cpp.
References p_programVersion.
Referenced by OptionParser::addMode().
void OptionMode::setVecOption | ( | const VecOption & | vecOption | ) |
Set the vector of options of the OptionMode.
vecOption | : vector of options of the OptionMode |
Definition at line 131 of file OptionMode.cpp.
References p_vecOption.
|
private |
True to enable automatically the printing of the help option when the program is called with –help or -h.
Definition at line 68 of file OptionMode.h.
Referenced by copyOptionMode(), initialisationOptionMode(), parseOption(), and setEnableHelpOption().
|
private |
Extra argument passed to the OptionMode.
Definition at line 72 of file OptionMode.h.
Referenced by copyOptionMode(), getExtraArgument(), and parseOption().
|
private |
True if the OptionMode is currently parsed but not totally.
Definition at line 64 of file OptionMode.h.
Referenced by copyOptionMode(), getPossibleOption(), initialisationOptionMode(), isCurrentlyParsed(), and parseOption().
|
private |
Say if the mode contains options which are parsed.
Definition at line 66 of file OptionMode.h.
Referenced by checkArgument(), copyOptionMode(), initialisationOptionMode(), isParsed(), and parseOption().
|
private |
name of the OptionMode
Definition at line 60 of file OptionMode.h.
Referenced by copyOptionMode(), getName(), getPossibleMode(), getPossibleOption(), parseOption(), print(), and setName().
|
private |
Program version to be printed on –version or -v option.
Definition at line 70 of file OptionMode.h.
Referenced by copyOptionMode(), parseOption(), and setProgramVersion().
|
private |
Vector of all the options of the OptionMode.
Definition at line 62 of file OptionMode.h.
Referenced by addOption(), checkArgument(), clearOption(), copyOptionMode(), getOption(), getVecOption(), isOptionExist(), iterGetPossibleOption(), parseOption(), print(), and setVecOption().