TCLAP::MultiSwitchArg Class Reference

A multiple switch argument. More...

#include <MultiSwitchArg.h>

Inheritance diagram for TCLAP::MultiSwitchArg:

TCLAP::SwitchArg TCLAP::Arg List of all members.

Public Member Functions

 MultiSwitchArg (const std::string &flag, const std::string &name, const std::string &desc, int init=0, Visitor *v=NULL)
 MultiSwitchArg constructor.
 MultiSwitchArg (const std::string &flag, const std::string &name, const std::string &desc, CmdLineInterface &parser, int init=0, Visitor *v=NULL)
 MultiSwitchArg constructor.
virtual bool processArg (int *i, std::vector< std::string > &args)
 Handles the processing of the argument.
int getValue ()
 Returns int, the number of times the switch has been set.
std::string shortID (const std::string &val) const
 Returns the shortID for this Arg.
std::string longID (const std::string &val) const
 Returns the longID for this Arg.

Protected Attributes

int _value
 The value of the switch.

Detailed Description

A multiple switch argument.

If the switch is set on the command line, then the getValue method will return the number of times the switch appears.

Definition at line 39 of file MultiSwitchArg.h.


Constructor & Destructor Documentation

TCLAP::MultiSwitchArg::MultiSwitchArg ( const std::string &  flag,
const std::string &  name,
const std::string &  desc,
int  init = 0,
Visitor v = NULL 
) [inline]

MultiSwitchArg constructor.

Parameters:
flag - The one character flag that identifies this argument on the command line.
name - A one word name for the argument. Can be used as a long flag on the command line.
desc - A description of what the argument is for or does.
init - Optional. The initial/default value of this Arg. Defaults to 0.
v - An optional visitor. You probably should not use this unless you have a very good reason.

Definition at line 122 of file MultiSwitchArg.h.

TCLAP::MultiSwitchArg::MultiSwitchArg ( const std::string &  flag,
const std::string &  name,
const std::string &  desc,
CmdLineInterface parser,
int  init = 0,
Visitor v = NULL 
) [inline]

MultiSwitchArg constructor.

Parameters:
flag - The one character flag that identifies this argument on the command line.
name - A one word name for the argument. Can be used as a long flag on the command line.
desc - A description of what the argument is for or does.
parser - A CmdLine parser object to add this Arg to
init - Optional. The initial/default value of this Arg. Defaults to 0.
v - An optional visitor. You probably should not use this unless you have a very good reason.

Definition at line 131 of file MultiSwitchArg.h.

References TCLAP::CmdLineInterface::add().


Member Function Documentation

bool TCLAP::MultiSwitchArg::processArg ( int *  i,
std::vector< std::string > &  args 
) [inline, virtual]

Handles the processing of the argument.

This re-implements the SwitchArg version of this method to set the _value of the argument appropriately.

Parameters:
i - Pointer the the current argument in the list.
args - Mutable list of strings. Passed in from main().

Reimplemented from TCLAP::SwitchArg.

Definition at line 145 of file MultiSwitchArg.h.

References TCLAP::Arg::_alreadySet, TCLAP::Arg::_checkWithVisitor(), TCLAP::Arg::_ignoreable, _value, TCLAP::Arg::argMatches(), TCLAP::SwitchArg::combinedSwitchesMatch(), and TCLAP::Arg::ignoreRest().

int TCLAP::MultiSwitchArg::getValue (  )  [inline]

Returns int, the number of times the switch has been set.

Reimplemented from TCLAP::SwitchArg.

Definition at line 143 of file MultiSwitchArg.h.

References _value.

std::string TCLAP::MultiSwitchArg::shortID ( const std::string &  val  )  const [virtual]

Returns the shortID for this Arg.

Reimplemented from TCLAP::Arg.

Definition at line 182 of file MultiSwitchArg.h.

References TCLAP::Arg::shortID().

std::string TCLAP::MultiSwitchArg::longID ( const std::string &  val  )  const [virtual]

Returns the longID for this Arg.

Reimplemented from TCLAP::Arg.

Definition at line 189 of file MultiSwitchArg.h.

References TCLAP::Arg::longID().


Member Data Documentation

int TCLAP::MultiSwitchArg::_value [protected]

The value of the switch.

Reimplemented from TCLAP::SwitchArg.

Definition at line 46 of file MultiSwitchArg.h.

Referenced by getValue(), and processArg().


The documentation for this class was generated from the following file:
Generated on Thu Dec 14 23:01:54 2006 for tclap by  doxygen 1.5.1