Interface Functions Detail
std::string getArgumentLabel(arg);
Parameters
arg
|
The ArgParseArgument to query. |
Returns
std::string |
The argument label as a STL string. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
std::string getArgumentType(arg);
Return the ArgParseArgument::ArgumentType.
Parameters
arg
|
The ArgParseArgument to query. |
Returns
ArgumentType |
The argument type. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
std::string getArgumentTypeAsString(arg);
Return argument type As a string.
Parameters
arg
|
The ArgParseArgument to query. |
Returns
std::string |
The argument type as a STL string. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
std::string getArgumentValue(arg[, argNo]);
Return the value of the argument.
Parameters
arg
|
The ArgParseArgument to query. |
argNo
|
In case that the ArgParseArgument allowed multiple values, give the index of the argument
that you want to retrieve (unsigned, starts at 0). |
Returns
std::string |
Const-reference to the argument value. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
std::vector<std::string> getArgumentValue(arg);
Return all values of the argument.
Parameters
arg
|
The ArgParseArgument to query. |
Returns
std::vector<std::string> |
Const-reference to the argument values. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
std::string getFileExtension(arg[, pos]);
Returns the file extension for the given file argument.
Parameters
arg
|
The ArgParseArgument to query. |
pos
|
The position of the value to retrieve if multiple values (unsigned). |
Returns
std::string |
The file extension, empty if no extension or not set. |
Only valid when argument is an INPUT_FILE or OUTPUT_FILE.
Halts the program if not an input or output file argument.
Can be overridden with special hidden options.
For arguments, you can pass --arg-<num>-file-ext for argument num.
For parameters, you can pass --<param-name>-file-ext for the option named param-name.
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
bool hasValue(arg[, pos]);
Return whether a value is available.
Parameters
arg
|
The ArgParseArgument to query. |
pos
|
The position of the argument in case of being a list (unsigned, 0-based, default is 0). |
Returns
bool |
true if pos is less than the size and the argument is non-empty. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
bool hasDefault(arg);
Returns whether the argument has a default value.
Parameters
arg
|
The argument to query. |
Returns
bool |
true if the argument has a default value and false if not. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
bool isBooleanArgument(arg);
Returns whether the argument is a bool.
Parameters
arg
|
The ArgParseArgument to query. |
Returns
bool |
true if it is a bool, false otherwise. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
bool isDirectoryArgument(arg);
Returns whether the argument is a directorz argument.
Parameters
arg
|
The ArgParseArgument to query. |
Returns
bool |
true if it is a directory argument, false otherwise. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
bool isDoubleArgument(arg);
Returns whether the argument is a double integer.
Parameters
arg
|
The ArgParseArgument to query. |
Returns
bool |
true if it is a double argument, false otherwise. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
Returns whether the argument is a input file.
Parameters
arg
|
The ArgParseArgument to query. |
Returns
bool |
true if it is a input file argument, false otherwise. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
Returns whether the argument is an input prefix argument.
Parameters
arg
|
The ArgParseArgument to query. |
Returns
bool |
true if it is an input prefix argument, false otherwise. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
bool isInt64Argument(arg);
Returns whether the argument is a 64 bit integer.
Parameters
arg
|
The ArgParseArgument to query. |
Returns
bool |
true if it is a 64 bit integer, false otherwise. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
bool isIntegerArgument(arg);
Returns whether the argument is an integer.
Parameters
arg
|
The ArgParseArgument to query. |
Returns
bool |
true if it is an integer, false otherwise. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
bool isListArgument(arg);
Returns whether the argument can be given more than one time.
Parameters
arg
|
The ArgParseArgument to query. |
Returns
bool |
true if it can be given multiple times, false otherwise. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
bool isOutputFileArgument(arg);
Returns whether the argument is a output file.
Parameters
arg
|
The ArgParseArgument to query. |
Returns
bool |
true if it is a output file argument, false otherwise. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
bool isOutputPrefixArgument(arg);
Returns whether the argument is an output prefix.
Parameters
arg
|
The ArgParseArgument to query. |
Returns
bool |
true if it is an output prefix argument, false otherwise. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
bool isSet(arg):
Returns true if a value was assigned to the argument.
Parameters
arg
|
The ArgParseArgument to query. |
Returns
bool |
true if a value was assigned, false otherwise. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
bool isStringArgument(arg);
Returns whether the argument is a string.
Parameters
arg
|
The ArgParseArgument to query. |
Returns
bool |
true if it is a string, false otherwise. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
unsigned numberOfAllowedValues(arg);
Returns the number of allowed values for this ArgParseArgument.
Parameters
arg
|
The ArgParseArgument to query. |
Returns
unsigned |
The number of allowed values. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
void setHelpText(arg, text);
Set the help text for an ArgParseArgument.
Parameters
arg
|
The ArgParseArgument to set the help text for. |
text
|
The text to display as the description of the argument (std::string). |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
void setMaxValue(arg, maxValue);
Set smallest allowed value for the argument.
Parameters
arg
|
The ArgParseArgument to set the smallest value of. |
maxValue
|
The largest value to set (std::string). |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
void setMinValue(arg, minValue);
Set smallest allowed value for the argument.
Parameters
arg
|
The ArgParseArgument to set the smallest value of. |
minValue
|
The smallest value to set (std::string). |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
void setValidValues(arg, values);
Set list of valid values.
Parameters
arg
|
The ArgParseArgument to set the valid values for. |
values
|
Either a std::string containing all valid entries, separated by spaces or a
std::vector<std::string> with the valid entries. |
If the argument is of type string then the list of valid values is the case-sensitive list of string values
allowed for this argument. If it is an input or output file then the list of valid values is a list of
case-insentive file extensions identifying the allowed types.
Examples
An example of setting allowed values for a string option.
seqan2::ArgParseArgument stringArg(seqan2::ArgParseArgument::STRING);
setValidValues(stringArg, "one two three"); // one of {"one", "two", "three"}
std::vector<std::string> values;
values.push_back("four");
values.push_back("five");
setValidValues(stringArg, values); // one of {"four", "five"}
An example for an input file option. Note that by changing INPUT_FILE to OUTPUT_FILE below,
the example would be the same for output files.
seqan2::ArgParseArgument fileArg(seqan2::ArgParseArgument::INPUT_FILE);
setValidValues(fileArg, "fq fastq"); // file must end in ".fq" or ".fastq"
std::vector<std::string> values;
values.push_back("sam");
values.push_back("bam");
setValidValues(fileArg, values); // file must end in ".sam" or ".bam"
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.