![]() |
PhoenixMock
1.8.7
Tools to split/merge/print mock used in Phoenix
|
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... | |
std::string & | getName () |
const std::string & | getName () const |
Get the name of the OptionMode. More... | |
void | getPossibleMode (std::string &possibleOption, const std::string &cursorOption) const |
Get the possible mode. More... | |
void | getPossibleOption (std::string &possibleOption, const std::string &cursorOption) const |
Get the possible options for the bash completion. More... | |
template<typename T > | |
bool | getValue (T &value, const std::string &optionName) const |
Get the value of the option. More... | |
VecOption & | getVecOption () |
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 std::string &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 std::string &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 std::string &name) |
Set the name of the OptionMode. More... | |
void | setProgramVersion (const std::string &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 std::string &optionName) const |
Get the option with its name. More... | |
void | initialisationOptionMode () |
Initialisation function of the class OptionMode. More... | |
void | iterGetPossibleOption (std::string &possibleOption, const std::string &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... | |
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... | |
std::string | p_name |
name of the OptionMode More... | |
std::string | 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 std::string & | name = "" | ) |
Default constructeur of OptionMode.
name | : name of the mode |
Definition at line 15 of file OptionMode.cpp.
References initialisationOptionMode().
OptionMode::OptionMode | ( | const OptionMode & | other | ) |
Copy constructor of OptionMode.
other | : class to copy |
Definition at line 24 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 128 of file OptionMode.cpp.
References p_vecOption.
bool OptionMode::checkArgument | ( | ) | const |
Check the argument of the parser.
Definition at line 166 of file OptionMode.cpp.
References p_isParsed, and p_vecOption.
void OptionMode::clearOption | ( | ) |
Remove all the options of the OptionMode.
Definition at line 131 of file OptionMode.cpp.
References p_vecOption.
|
protected |
Copy function of OptionMode.
other | : class to copy |
Definition at line 236 of file OptionMode.cpp.
References p_enableHelpOption, p_isCurrentlyParsed, p_isParsed, p_name, p_programVersion, and p_vecOption.
Referenced by operator=(), and OptionMode().
std::string& OptionMode::getName | ( | ) |
std::string & OptionMode::getName | ( | ) | const |
Get the name of the OptionMode.
Definition at line 146 of file OptionMode.cpp.
References p_name.
Referenced by OptionParser::parseArgumentNormalUse().
|
private |
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 257 of file OptionMode.cpp.
References p_vecOption.
Referenced by getValue().
void OptionMode::getPossibleMode | ( | std::string & | possibleOption, |
const std::string & | cursorOption | ||
) | const |
Get the possible mode.
[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 isSameBegining(), and p_name.
void OptionMode::getPossibleOption | ( | std::string & | possibleOption, |
const std::string & | cursorOption | ||
) | const |
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 210 of file OptionMode.cpp.
References isSameBegining(), iterGetPossibleOption(), p_isCurrentlyParsed, and p_name.
Referenced by OptionParser::getPossibleOption().
bool OptionMode::getValue | ( | T & | value, |
const std::string & | 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(), OptionValue::getValue(), Option::getValue(), Option::isParsed(), and Option::isRequired().
Referenced by main().
VecOption& OptionMode::getVecOption | ( | ) |
VecOption & OptionMode::getVecOption | ( | ) | const |
Get the vector of options of the OptionMode.
Definition at line 156 of file OptionMode.cpp.
References p_vecOption.
|
private |
Initialisation function of the class OptionMode.
Definition at line 246 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 180 of file OptionMode.cpp.
References p_isCurrentlyParsed.
bool OptionMode::isOptionExist | ( | const std::string & | 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 195 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 187 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 273 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 37 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 47 of file OptionMode.cpp.
References p_enableHelpOption, p_isCurrentlyParsed, p_isParsed, p_programVersion, p_vecOption, createReleaseCurl::parser, 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 79 of file OptionMode.cpp.
References p_isCurrentlyParsed, p_isParsed, p_name, p_vecOption, and createReleaseCurl::parser.
void OptionMode::print | ( | ) | const |
Print the option of the mode.
Definition at line 104 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 136 of file OptionMode.cpp.
References p_enableHelpOption.
Referenced by OptionParser::addMode().
void OptionMode::setName | ( | const std::string & | name | ) |
Set the name of the OptionMode.
name | : name of the OptionMode |
Definition at line 118 of file OptionMode.cpp.
References p_name.
void OptionMode::setProgramVersion | ( | const std::string & | programVersion | ) |
Set the program version.
programVersion | : version of the program |
Definition at line 141 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 123 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 71 of file OptionMode.h.
Referenced by copyOptionMode(), initialisationOptionMode(), parseOption(), and setEnableHelpOption().
|
private |
True if the OptionMode is currently parsed but not totally.
Definition at line 67 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 69 of file OptionMode.h.
Referenced by checkArgument(), copyOptionMode(), initialisationOptionMode(), isParsed(), and parseOption().
|
private |
name of the OptionMode
Definition at line 63 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 73 of file OptionMode.h.
Referenced by copyOptionMode(), parseOption(), and setProgramVersion().
|
private |
Vector of all the options of the OptionMode.
Definition at line 65 of file OptionMode.h.
Referenced by addOption(), checkArgument(), clearOption(), copyOptionMode(), getOption(), getVecOption(), isOptionExist(), iterGetPossibleOption(), parseOption(), print(), and setVecOption().