TAP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | Protected Attributes | List of all members
TAP::ArgumentSet Class Reference

Simple set of arguments. More...

#include <ArgumentConstraint.hpp>

Inheritance diagram for TAP::ArgumentSet:
TAP::ArgumentConstraint< ConstraintType::Any > TAP::BaseArgument

Public Member Functions

template<typename... A>
 ArgumentSet (const std::string &name, A &&...args)
 Create a new named ArgumentSet. More...
 
 ArgumentSet (const ArgumentSet &)=default
 ArgumentSet copy constructor.
 
 ArgumentSet (ArgumentSet &&)=default
 ArgumentSet move constructor.
 
virtual ~ArgumentSet ()
 ArgumentSet destructor.
 
ArgumentSetoperator= (const ArgumentSet &)=default
 ArgumentSet assignment.
 
ArgumentSetoperator= (ArgumentSet &&)=default
 ArgumentSet move assignment.
 
const std::string & name () const
 Get the name of this ArgumentSet. More...
 
const std::vector< const
Argument * > & 
args () const
 Get the Arguments contained in this ArgumentSet. More...
 
template<typename Arg >
ArgumentSetadd (Arg &&arg)
 Add an argument to the set. More...
 
std::unique_ptr< BaseArgumentclone () const &override
 See BaseArgument::clone().
 
std::unique_ptr< BaseArgumentclone ()&&override
 See BaseArgument::clone().
 
- Public Member Functions inherited from TAP::ArgumentConstraint< ConstraintType::Any >
 ArgumentConstraint (A &&...args)
 Construct a ArgumentConstraint with the (possibly empty) given list of arguments. More...
 
 ArgumentConstraint (const ArgumentConstraint &other)
 ArgumentConstraint copy constructor.
 
 ArgumentConstraint (ArgumentConstraint &&)=default
 ArgumentConstraint move constructor.
 
virtual ~ArgumentConstraint ()
 ArgumentConstraint destructor.
 
ArgumentConstraintoperator= (ArgumentConstraint other)
 ArgumentConstraint assignment operator.
 
ArgumentConstraintoperator= (ArgumentConstraint &&)=default
 ArgumentConstraint move assignment operator.
 
ArgumentConstraintoperator+= (Argument &arg)
 Appends the given argument to the constraint. More...
 
size_t size () const
 Returns the number of contained sub-arguments. More...
 
void find_all_arguments (std::vector< const Argument * > &collector) const override
 See BaseArgument::find_all_arguments()
 
void check_valid () const override
 See BaseArgument::set()
 
std::string usage () const override
 See BaseArgument::usage()
 
std::unique_ptr< BaseArgumentclone () const &override
 See BaseArgument::clone().
 
std::unique_ptr< BaseArgumentclone ()&&override
 See BaseArgument::clone().
 
- Public Member Functions inherited from TAP::BaseArgument
 BaseArgument ()
 Base constructor.
 
 BaseArgument (const BaseArgument &)=default
 BaseArgument copy constructor.
 
 BaseArgument (BaseArgument &&)=default
 BaseArgument move constructor.
 
virtual ~BaseArgument ()
 BaseArgument destructor.
 
BaseArgumentoperator= (const BaseArgument &)=default
 BaseArgument assignment operator.
 
BaseArgumentoperator= (BaseArgument &&)=default
 BaseArgument move assignment operator.
 
 operator bool () const
 Boolean conversion operator (so you can do things like if (arg) { ... More...
 
BaseArgumentset_required (bool required=true)
 Mark the argument as required or not. More...
 
bool required () const
 Returns whether the argument is required. More...
 

Protected Attributes

std::string m_name
 The name of this ArgumentSet.
 
std::vector< const Argument * > m_args
 Cached arguments.
 
bool m_updateArgs = true
 If true updates list of known arguments when retrieving them.
 
- Protected Attributes inherited from TAP::ArgumentConstraint< ConstraintType::Any >
std::vector< std::unique_ptr
< BaseArgument > > 
m_args
 Sub-arguments to check.
 
std::string m_usageString
 Stored usage string.
 
- Protected Attributes inherited from TAP::BaseArgument
bool m_required = false
 True if the argument has to be set.
 

Additional Inherited Members

- Protected Member Functions inherited from TAP::ArgumentConstraint< ConstraintType::Any >
ArgumentConstraintadd (Arg &&arg)
 Add an argument to the constraint. More...
 
unsigned int count () const override
 Returns the number of child arguments which are set.
 
void diagnose_args () const
 Calls diagnose for all set child arguments.
 
std::string usageArgument (const Argument &arg) const
 Returns a string for usage representation of sub-arguments. More...
 
std::string usageArgument (const ArgumentConstraint< ACType > &arg) const
 Returns a string for usage representation of sub-arguments. More...
 

Detailed Description

Simple set of arguments.

Acts very much like ArgumentConstraint<All>, but does not modify arguments on insertion. Designed to be used by the parser.

Constructor & Destructor Documentation

template<typename... A>
TAP::ArgumentSet::ArgumentSet ( const std::string &  name,
A &&...  args 
)

Create a new named ArgumentSet.

The parameter args defines the initial set of arguments.

Parameters
name(Descriptive) name of the argument set
argsArguments to add to the set initially

Member Function Documentation

template<typename Arg >
ArgumentSet& TAP::ArgumentSet::add ( Arg &&  arg)
inline

Add an argument to the set.

Parameters
argArgument to add
Returns
Reference to this set
const std::vector<const Argument*>& TAP::ArgumentSet::args ( ) const
inline

Get the Arguments contained in this ArgumentSet.

Duplicates are filtered out.

Returns
Arguments contained in this ArgumentSet
const std::string& TAP::ArgumentSet::name ( ) const
inline

Get the name of this ArgumentSet.

Returns
string containing the name of this ArgumentSet

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