Argument constraint class. More...
#include <ArgumentConstraint.hpp>
Public Member Functions | |
| template<typename... A> | |
| 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. | |
| ArgumentConstraint & | operator= (ArgumentConstraint other) |
| ArgumentConstraint assignment operator. | |
| ArgumentConstraint & | operator= (ArgumentConstraint &&)=default |
| ArgumentConstraint move assignment operator. | |
| ArgumentConstraint & | operator+= (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< BaseArgument > | clone () const &override |
| See BaseArgument::clone(). | |
| std::unique_ptr< BaseArgument > | clone ()&&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. | |
| BaseArgument & | operator= (const BaseArgument &)=default |
| BaseArgument assignment operator. | |
| BaseArgument & | operator= (BaseArgument &&)=default |
| BaseArgument move assignment operator. | |
| operator bool () const | |
| Boolean conversion operator (so you can do things like if (arg) { ... More... | |
| BaseArgument & | set_required (bool required=true) |
| Mark the argument as required or not. More... | |
| bool | required () const |
| Returns whether the argument is required. More... | |
Protected Member Functions | |
| template<typename Arg > | |
| ArgumentConstraint & | add (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... | |
| template<ConstraintType ACType> | |
| std::string | usageArgument (const ArgumentConstraint< ACType > &arg) const |
| Returns a string for usage representation of sub-arguments. More... | |
Protected Attributes | |
|
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. | |
Argument constraint class.
Given a set of sub-arguments, the constraint will check if the number of satisfied arguments fall within a certain range. Sub-arguments are allowed to be ArgumentConstraint instances themselves, thus allowing to nest constraints and build a tree. Template parameter CType indicates the type of the constraint, for possibilities see ConstraintType.
| TAP::ArgumentConstraint< CType >::ArgumentConstraint | ( | A &&... | args | ) |
Construct a ArgumentConstraint with the (possibly empty) given list of arguments.
| args | Arguments to add |
|
protected |
Add an argument to the constraint.
| arg | Argument to add |
|
inline |
Appends the given argument to the constraint.
| arg | Argument to append |
|
inline |
Returns the number of contained sub-arguments.
|
protected |
Returns a string for usage representation of sub-arguments.
|
protected |
Returns a string for usage representation of sub-arguments.
1.8.6