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. | |
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. | |
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. | |
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. | |
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. | |
virtual bool | processArg (int *i, std::vector< std::string > &args) |
Handles the processing of the argument. | |
Protected Attributes | |
unsigned int | _numberOfArguments |
Number of values to process each time. |
Detailed Description
template<class T>
class basis::MultiArg< T >
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 https://www.cbica.upenn.edu/sbia/software/license.html or COPYING file.
Definition at line 43 of file MultiArg.h.
Constructor & Destructor Documentation
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.
- Parameters:
-
[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 203 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.
- Parameters:
-
[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 220 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.
- Parameters:
-
[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 238 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.
- Parameters:
-
[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 255 of file MultiArg.h.
Member Function Documentation
bool basis::MultiArg< T >::isRequired | ( | ) | const [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 327 of file MultiArg.h.
bool basis::MultiArg< T >::processArg | ( | int * | i, |
std::vector< std::string > & | args | ||
) | [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.
- Parameters:
-
[in,out] i Pointer to the current argument in the list. [in,out] args Mutable list of strings. Passed from main().
Definition at line 273 of file MultiArg.h.
Member Data Documentation
unsigned int basis::MultiArg< T >::_numberOfArguments [protected] |
Number of values to process each time.
Definition at line 192 of file MultiArg.h.
The documentation for this class was generated from the following file: