Class ArgParseArgument
Information for a specific command line argument.

Implements AssignableConcept
All Subcl's ArgParseOption
All Impl'd AssignableConcept
Defined in <seqan/arg_parse.h>
Signature class ArgParseArgument

Member Function Overview

Member Functions Inherited From AssignableConcept

Interface Function Overview

Interface Functions Inherited From AssignableConcept

Member Functions Detail

ArgParseArgument::ArgParseArgument(argumentType[, argumentLabel[, isListArgument[, numberOfArgument]]]);

Constructor

Parameters

argumentType Type of the argument (ArgParseArgument::ArgumentType).
argumentLabel Label for the argument (char const *).
isListArgument Whether or not this argument can be given multiple times (bool).
numberOfArguments Number of times the argument must be given. E.g. set to 2 for the parser to always expect two values (int, default is 1).

Data Races

Thread safety unknown!

Interface Functions Detail

std::string getArgumentLabel(arg);

Return argument label.

Parameters

arg The ArgParseArgument to query.

Returns

std::string The argument label as a STL string.

Data Races

Thread safety unknown!

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

Thread safety unknown!

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

Thread safety unknown!

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

Thread safety unknown!

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

Thread safety unknown!

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

Thread safety unknown!

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

Thread safety unknown!

bool isInputFileArgument(arg);

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

Thread safety unknown!

bool isInputPrefixArgument(arg);

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

Thread safety unknown!

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

Thread safety unknown!

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

Thread safety unknown!

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

Thread safety unknown!

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

Thread safety unknown!

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

Thread safety unknown!

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

Thread safety unknown!

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

Thread safety unknown!

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

Thread safety unknown!

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

Thread safety unknown!

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

Thread safety unknown!

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

Thread safety unknown!

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.

seqan::ArgParseArgument stringArg(seqan::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.

seqan::ArgParseArgument fileArg(seqan::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

Thread safety unknown!