7 #ifndef __POPTIONPARSER_H__
8 #define __POPTIONPARSER_H__
29 bool isRequired,
const PString & docString);
31 bool isRequired,
bool isAllowEmpty,
const PString & docString);
33 bool isRequired,
bool isAllowEmpty,
const PVecString & vecPossibleValue,
const PString & docString);
std::vector< OptionMode > VecMode
Vector of mode.
std::vector< PString > PVecString
Parse the list of arguments passed to a program.
Describe a mode in the program arguments.
Parse the options passed to a program.
void parseArgument(int argc, char **argv)
Parse the arguments passed to the program.
void addOption(const PString &longOption, const PString &shortOption, OptionType::OptionType optionType, bool isRequired, const PString &docString)
Add an option in the OptionParser.
PString p_exempleLongOption
Usage example with long options.
const Option * getSplitOptionValue(PString &valueToBeCompleted, const PString &cursorOption, const PString &prevCursorOption) const
Get the split option (without =) value to be completed.
OptionParser & operator=(const OptionParser &other)
Definition of equal operator of OptionParser.
bool p_enableHelpOption
True to enable automatically the printing of the help option when the program is called with –help or...
const OptionMode & getMode(const PString &name) const
Get mode by name.
void setExampleShortOption(const PString &example)
Set the example usage of the program.
void closeMode()
Close the current mode and go back to be default one.
void addMode(const PString &modeName)
Add a mode in the option.
void print() const
Print all the options.
virtual ~OptionParser()
Destructeur of OptionParser.
bool isModeExist(const PString &name) const
Check if the given mode name does exist.
VecMode p_vecMode
Vector of all the defined mode in the OptionParser.
void copyOptionParser(const OptionParser &other)
Copy function of OptionParser.
bool completeOptionValue(PString &possibleValue, const PString &cursorOption, const PString &prevCursorOption) const
Complete the possible value of an option (FILENAME, DIRECTORY, FILE_OR_DIR)
bool checkArgument() const
Check the argument of the parser.
void getPossibleOtherOption(PString &possibleOption, const PString &cursorOption) const
Get the possible other options which can be used.
size_t p_currentMode
Index of the current mode in the OptionParser.
void getPossibleOption(PString &possibleOption, const PString &cursorOption) const
Get the possible options which can be used.
OptionMode & getParserMode(ArgParser &parser)
Get a mode if it exist.
void initialisationOptionParser()
Initialisation function of the class OptionParser.
OptionMode * p_currentParserMode
Current mode parsed.
const Option * getLongOptionValue(PString &valueToBeCompleted, const PString &cursorOption) const
Get the long option value to be completed.
OptionParser(bool enableHelpOption=true, const PString &programVersion="")
Default constructeur of OptionParser.
void checkOptionType(OptionType::OptionType optionType)
Check the given option type.
const OptionMode * getCurrentlyParsedMode() const
Get the currently parsed OptionMode.
void setExampleLongOption(const PString &example)
Set the example usage of the program.
PString p_programVersion
Program version to be printed on –version or -v option.
PString p_exempleShortOption
Usage example with short options.
void parseArgumentNormalUse(ArgParser &parser)
Classical argument parsing mode.
const OptionMode & getDefaultMode() const
Get default mode.
void parseArgumentBashCompletion(ArgParser &parser)
Bash completion argument parsing mode.
Describes an option passed to a program.