An argument that allows multiple values of type T to be specified. More...
#include <MultiArg.h>
Public Member Functions | |
virtual bool | isRequired () const |
Whether the argument is required or not. More... | |
MultiArg (const std::string &flag, const std::string &name, const std::string &desc, bool req, const std::string &typeDesc, unsigned int n=1, bool once=false, TCLAP::Visitor *v=NULL) | |
Constructor. More... | |
MultiArg (const std::string &flag, const std::string &name, const std::string &desc, bool req, const std::string &typeDesc, TCLAP::CmdLineInterface &parser, unsigned int n=1, bool once=false, TCLAP::Visitor *v=NULL) | |
Constructor. More... | |
MultiArg (const std::string &flag, const std::string &name, const std::string &desc, bool req, TCLAP::Constraint< T > *constraint, unsigned int n=1, bool once=false, TCLAP::Visitor *v=NULL) | |
Constructor. More... | |
MultiArg (const std::string &flag, const std::string &name, const std::string &desc, bool req, TCLAP::Constraint< T > *constraint, TCLAP::CmdLineInterface &parser, unsigned int n=1, bool once=false, TCLAP::Visitor *v=NULL) | |
Constructor. More... | |
virtual bool | processArg (int *i, std::vector< std::string > &args) |
Handles the processing of the argument. More... | |
Protected Attributes | |
unsigned int | _numberOfArguments |
Number of values to process each time. More... | |
An argument that allows multiple values of type T to be specified.
Very similar to a TCLAP::ValueArg, except a vector of values will be returned instead of just one. Unlike TCLAP::MultiArg, this argument will each time its option keyword or flag is encountered process N > 0 argument values, where the number N is specified at construction time. Moreover, this argument can be given several times. Hence, the returned vector of values has length N * M, where M is the number of times the argument was given on the command-line.
Copyright (c) 2011 University of Pennsylvania. All rights reserved.
See http://www.rad.upenn.edu/sbia/software/license.html or COPYING file.
Definition at line 47 of file MultiArg.h.
basis::MultiArg< T >::MultiArg | ( | const std::string & | flag, |
const std::string & | name, | ||
const std::string & | desc, | ||
bool | req, | ||
const std::string & | typeDesc, | ||
unsigned int | n = 1 , |
||
bool | once = false , |
||
TCLAP::Visitor * | v = NULL |
||
) |
Constructor.
[in] | flag | The one character flag that identifies this argument on the command line. |
[in] | name | A one word name for the argument. Can be used as a long flag on the command line. |
[in] | desc | A description of what the argument is for or does. |
[in] | req | Whether the argument is required on the command-line. |
[in] | typeDesc | A short, human readable description of the type that this object expects. This is used in the generation of the USAGE statement. The goal is to be helpful to the end user of the program. |
[in] | n | Number of values per argument occurrence. |
[in] | once | Accept argument only once. |
[in] | v | An optional visitor. You probably should not use this unless you have a very good reason. |
Definition at line 207 of file MultiArg.h.
basis::MultiArg< T >::MultiArg | ( | const std::string & | flag, |
const std::string & | name, | ||
const std::string & | desc, | ||
bool | req, | ||
const std::string & | typeDesc, | ||
TCLAP::CmdLineInterface & | parser, | ||
unsigned int | n = 1 , |
||
bool | once = false , |
||
TCLAP::Visitor * | v = NULL |
||
) |
Constructor.
[in] | flag | The one character flag that identifies this argument on the command line. |
[in] | name | A one word name for the argument. Can be used as a long flag on the command line. |
[in] | desc | A description of what the argument is for or does. |
[in] | req | Whether the argument is required on the command-line. |
[in] | typeDesc | A short, human readable description of the type that this object expects. This is used in the generation of the USAGE statement. The goal is to be helpful to the end user of the program. |
[in] | parser | A CmdLine parser object to add this Arg to |
[in] | n | Number of values per argument occurrence. |
[in] | once | Accept argument only once. |
[in] | v | An optional visitor. You probably should not use this unless you have a very good reason. |
Definition at line 224 of file MultiArg.h.
basis::MultiArg< T >::MultiArg | ( | const std::string & | flag, |
const std::string & | name, | ||
const std::string & | desc, | ||
bool | req, | ||
TCLAP::Constraint< T > * | constraint, | ||
unsigned int | n = 1 , |
||
bool | once = false , |
||
TCLAP::Visitor * | v = NULL |
||
) |
Constructor.
[in] | flag | The one character flag that identifies this argument on the command line. |
[in] | name | A one word name for the argument. Can be used as a long flag on the command line. |
[in] | desc | A description of what the argument is for or does. |
[in] | req | Whether the argument is required on the command-line. |
[in] | constraint | A pointer to a Constraint object used to constrain this Arg. |
[in] | n | Number of values per argument occurrence. |
[in] | once | Accept argument only once. |
[in] | v | An optional visitor. You probably should not use this unless you have a very good reason. |
Definition at line 242 of file MultiArg.h.
basis::MultiArg< T >::MultiArg | ( | const std::string & | flag, |
const std::string & | name, | ||
const std::string & | desc, | ||
bool | req, | ||
TCLAP::Constraint< T > * | constraint, | ||
TCLAP::CmdLineInterface & | parser, | ||
unsigned int | n = 1 , |
||
bool | once = false , |
||
TCLAP::Visitor * | v = NULL |
||
) |
Constructor.
[in] | flag | The one character flag that identifies this argument on the command line. |
[in] | name | A one word name for the argument. Can be used as a long flag on the command line. |
[in] | desc | A description of what the argument is for or does. |
[in] | req | Whether the argument is required on the command-line. |
[in] | constraint | A pointer to a Constraint object used to constrain this Arg. |
[in] | parser | A CmdLine parser object to add this Arg to. |
[in] | n | Number of values per argument occurrence. |
[in] | once | Accept argument only once. |
[in] | v | An optional visitor. You probably should not use this unless you have a very good reason. |
Definition at line 259 of file MultiArg.h.
|
virtual |
Whether the argument is required or not.
Once we've matched the first value, then the arg is no longer required, except if the argument is only accepted once with multiple values.
Definition at line 331 of file MultiArg.h.
|
virtual |
Handles the processing of the argument.
This re-implements the TCLAP::MultiArg version of this method to set the _value of the argument appropriately. It knows the difference between labeled and unlabeled.
[in,out] | i | Pointer to the current argument in the list. |
[in,out] | args | Mutable list of strings. Passed from main(). |
Definition at line 277 of file MultiArg.h.
|
protected |
Number of values to process each time.
Definition at line 196 of file MultiArg.h.