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