75 isSearch = !it->parseOption(parser);
100 isSearch = !it->parseOption(parser);
101 }
catch(
const std::runtime_error & e){
102 partialOption = &(*it);
115 std::cout <<
"\tMode '" <<
p_name <<
"' :" << std::endl;
119 it->print(indentation);
179 isArgOk = it->checkArgument();
213 if(it->getLongName() == optionName || it->getShortName() == optionName){
214 return it->isParsed();
229 possibleOption +=
p_name +
" ";
243 possibleOption +=
p_name +
" ";
276 if(it->getLongName() == optionName || it->getShortName() == optionName){
291 it->getPossibleOption(possibleOption, cursorOption);
std::vector< Option > VecOption
Vector of option.
Parse the list of arguments passed to a program.
const PString & getCurrentOption() const
Get the current option.
void getNextOption()
Move to the next option.
bool isEndOfOption() const
Say if is it the end of the options.
PString getRemainingArgument()
Get all remaining arguments of the ArgParser.
Describe a mode in the program arguments.
bool getOption(Option &option, const PString &optionName) const
Get the option with its name.
void setName(const PString &name)
Set the name of the OptionMode.
bool p_isCurrentlyParsed
True if the OptionMode is currently parsed but not totally.
void print() const
Print the option of the mode.
void setVecOption(const VecOption &vecOption)
Set the vector of options of the OptionMode.
OptionMode & operator=(const OptionMode &other)
Definition of equal operator of OptionMode.
void getPossibleOption(PString &possibleOption, const PString &cursorOption) const
Get the possible options for the bash completion.
void iterGetPossibleOption(PString &possibleOption, const PString &cursorOption) const
Iterates over the possible options of the current mode.
void initialisationOptionMode()
Initialisation function of the class OptionMode.
void setEnableHelpOption(bool b)
Set the attribtue which enables help option.
bool isCurrentlyParsed() const
Say if the OptionMode is currently parsed (but maybe not totally)
const PString & getExtraArgument() const
Get Extra argument.
VecOption p_vecOption
Vector of all the options of the OptionMode.
void getPossibleMode(PString &possibleOption, const PString &cursorOption) const
Get the possible mode.
bool isOptionExist(const PString &optionName) const
Say if the given option has been passed to the program.
void addOption(const Option &option)
Add an option into the OptionMode.
void setProgramVersion(const PString &programVersion)
Set the program version.
const VecOption & getVecOption() const
Get the vector of options of the OptionMode.
bool parseOption(ArgParser &parser)
Parse the options in the current OptionMode.
void copyOptionMode(const OptionMode &other)
Copy function of OptionMode.
const PString & getName() const
Get the name of the OptionMode.
bool isParsed() const
Say if the OptionMode contains option which are parsed.
PString p_extraArgument
Extra argument passed to the OptionMode.
bool checkArgument() const
Check the argument of the parser.
virtual ~OptionMode()
Destructeur of OptionMode.
void clearOption()
Remove all the options of the OptionMode.
bool p_isParsed
Say if the mode contains options which are parsed.
bool p_enableHelpOption
True to enable automatically the printing of the help option when the program is called with –help or...
PString p_programVersion
Program version to be printed on –version or -v option.
OptionMode(const PString &name="")
Default constructeur of OptionMode.
PString p_name
name of the OptionMode
Describes an option passed to a program.
bool isSameBegining(const PString &beginStr) const
Say if the current PString has the same begining of beginStr.