tclap  1.4.0
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TCLAP::ArgGroup Class Referenceabstract

ArgGroup is the base class for implementing groups of arguments that are mutually exclusive (it replaces the deprecated xor handler). More...

#include <ArgGroup.h>

Inheritance diagram for TCLAP::ArgGroup:
Inheritance graph
[legend]
Collaboration diagram for TCLAP::ArgGroup:
Collaboration graph
[legend]

Public Types

typedef std::list< Arg * > Container
 
typedef Container::iterator iterator
 
typedef Container::const_iterator const_iterator
 

Public Member Functions

virtual ~ArgGroup ()
 
virtual ArgContaineradd (Arg &arg)
 Add an argument to this arg group. More...
 
virtual ArgContaineradd (Arg *arg)
 Add an argument to this arg group. More...
 
virtual bool validate ()=0
 Validates that the constraints of the ArgGroup are satisfied. More...
 
virtual bool isRequired () const =0
 Returns true if this argument group is required. More...
 
virtual bool isExclusive () const =0
 Returns true if this argument group is exclusive. More...
 
void setParser (CmdLineInterface &parser)
 Used by the parser to connect itself to this arg group. More...
 
virtual bool showAsGroup () const
 If arguments in this group should show up as grouped in help. More...
 
const std::string getName () const
 Returns the argument group's name. More...
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
- Public Member Functions inherited from TCLAP::ArgContainer
virtual ~ArgContainer ()
 

Protected Member Functions

 ArgGroup ()
 

Protected Attributes

CmdLineInterface_parser
 
Container _args
 

Detailed Description

ArgGroup is the base class for implementing groups of arguments that are mutually exclusive (it replaces the deprecated xor handler).

It is not expected to be used directly, rather one of the EitherOf or OneOf derived classes are used.

Definition at line 41 of file ArgGroup.h.

Member Typedef Documentation

◆ const_iterator

typedef Container::const_iterator TCLAP::ArgGroup::const_iterator

Definition at line 45 of file ArgGroup.h.

◆ Container

typedef std::list<Arg *> TCLAP::ArgGroup::Container

Definition at line 43 of file ArgGroup.h.

◆ iterator

typedef Container::iterator TCLAP::ArgGroup::iterator

Definition at line 44 of file ArgGroup.h.

Constructor & Destructor Documentation

◆ ~ArgGroup()

virtual TCLAP::ArgGroup::~ArgGroup ( )
inlinevirtual

Definition at line 47 of file ArgGroup.h.

◆ ArgGroup()

TCLAP::ArgGroup::ArgGroup ( )
inlineprotected

Definition at line 116 of file ArgGroup.h.

Member Function Documentation

◆ add() [1/2]

virtual ArgContainer& TCLAP::ArgGroup::add ( Arg arg)
inlinevirtual

Add an argument to this arg group.

Implements TCLAP::ArgContainer.

Reimplemented in TCLAP::ExclusiveArgGroup.

Definition at line 50 of file ArgGroup.h.

References add(), isExclusive(), isRequired(), and validate().

Referenced by add(), and TCLAP::ExclusiveArgGroup::add().

Here is the call graph for this function:

◆ add() [2/2]

ArgContainer & TCLAP::ArgGroup::add ( Arg arg)
inlinevirtual

Add an argument to this arg group.

Implements TCLAP::ArgContainer.

Reimplemented in TCLAP::ExclusiveArgGroup, and TCLAP::StandaloneArgs.

Definition at line 192 of file ArgGroup.h.

References _args, _parser, TCLAP::CmdLineInterface::addToArgList(), begin(), end(), and TCLAP::Arg::longID().

Here is the call graph for this function:

◆ begin() [1/2]

iterator TCLAP::ArgGroup::begin ( )
inline

◆ begin() [2/2]

const_iterator TCLAP::ArgGroup::begin ( ) const
inline

Definition at line 111 of file ArgGroup.h.

References _args.

◆ end() [1/2]

iterator TCLAP::ArgGroup::end ( )
inline

◆ end() [2/2]

const_iterator TCLAP::ArgGroup::end ( ) const
inline

Definition at line 112 of file ArgGroup.h.

References _args.

◆ getName()

const std::string TCLAP::ArgGroup::getName ( ) const
inline

Returns the argument group's name.

Definition at line 230 of file ArgGroup.h.

References begin(), and end().

Referenced by showAsGroup().

Here is the call graph for this function:

◆ isExclusive()

virtual bool TCLAP::ArgGroup::isExclusive ( ) const
pure virtual

Returns true if this argument group is exclusive.

Implemented in TCLAP::AnyOf, and TCLAP::ExclusiveArgGroup.

Referenced by TCLAP::StdOutput::_longUsage(), and add().

◆ isRequired()

virtual bool TCLAP::ArgGroup::isRequired ( ) const
pure virtual

◆ setParser()

void TCLAP::ArgGroup::setParser ( CmdLineInterface parser)
inline

Used by the parser to connect itself to this arg group.

Definition at line 90 of file ArgGroup.h.

References _parser, TCLAP::CmdLineInterface::addToArgList(), begin(), and end().

Referenced by TCLAP::CmdLine::add(), and TCLAP::CmdLine::CmdLine().

Here is the call graph for this function:

◆ showAsGroup()

virtual bool TCLAP::ArgGroup::showAsGroup ( ) const
inlinevirtual

If arguments in this group should show up as grouped in help.

Reimplemented in TCLAP::StandaloneArgs.

Definition at line 104 of file ArgGroup.h.

References getName().

Referenced by TCLAP::internal::GroupChoice().

Here is the call graph for this function:

◆ validate()

virtual bool TCLAP::ArgGroup::validate ( )
pure virtual

Validates that the constraints of the ArgGroup are satisfied.

Implemented in TCLAP::AnyOf, and TCLAP::ExclusiveArgGroup.

Referenced by add().

Member Data Documentation

◆ _args

Container TCLAP::ArgGroup::_args
protected

Definition at line 124 of file ArgGroup.h.

Referenced by add(), TCLAP::StandaloneArgs::add(), begin(), and end().

◆ _parser

CmdLineInterface* TCLAP::ArgGroup::_parser
protected

Definition at line 123 of file ArgGroup.h.

Referenced by add(), and setParser().


The documentation for this class was generated from the following file: