tclap 1.4.0
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | 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 ArgContainer & add (Arg &arg)
 Add an argument to this arg group.
 
virtual ArgContainer & add (Arg *arg)
 Add an argument to this arg group.
 
virtual bool validate ()=0
 Validates that the constraints of the ArgGroup are satisfied.
 
virtual bool isRequired () const =0
 Returns true if this argument group is required.
 
virtual bool isExclusive () const =0
 Returns true if this argument group is exclusive.
 
void setParser (CmdLineInterface &parser)
 Used by the parser to connect itself to this arg group.
 
virtual bool showAsGroup () const
 If arguments in this group should show up as grouped in help.
 
const std::string getName () const
 Returns the argument group's name.
 
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
 

Friends

class CmdLine
 
class CmdLineInterface
 

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 47 of file ArgGroup.h.

◆ Container

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

Definition at line 45 of file ArgGroup.h.

◆ iterator

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

Definition at line 46 of file ArgGroup.h.

Constructor & Destructor Documentation

◆ ~ArgGroup()

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

Definition at line 49 of file ArgGroup.h.

◆ ArgGroup()

TCLAP::ArgGroup::ArgGroup ( )
inlineprotected

Definition at line 117 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 52 of file ArgGroup.h.

References add().

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 193 of file ArgGroup.h.

References _args, _parser, TCLAP::CmdLineInterface::addToArgList(), begin(), TCLAP::Arg::conflictsWith(), 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 112 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 113 of file ArgGroup.h.

References _args.

◆ getName()

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

Returns the argument group's name.

Definition at line 233 of file ArgGroup.h.

References begin(), end(), and TCLAP::Arg::getName().

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::ExclusiveArgGroup, and TCLAP::AnyOf.

◆ 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 92 of file ArgGroup.h.

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

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 105 of file ArgGroup.h.

◆ validate()

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

Validates that the constraints of the ArgGroup are satisfied.

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

Friends And Related Symbol Documentation

◆ CmdLine

friend class CmdLine
friend

Definition at line 42 of file ArgGroup.h.

◆ CmdLineInterface

friend class CmdLineInterface
friend

Definition at line 43 of file ArgGroup.h.

Member Data Documentation

◆ _args

Container TCLAP::ArgGroup::_args
protected

Definition at line 125 of file ArgGroup.h.

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

◆ _parser

CmdLineInterface* TCLAP::ArgGroup::_parser
protected

Definition at line 124 of file ArgGroup.h.

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


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