Base argument class, used both by actual Argument classes and constraints (ArgumentConstraint). More...
#include <BaseArgument.hpp>
Public Member Functions | |
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. | |
virtual void | find_all_arguments (std::vector< const Argument * > &collector) const =0 |
Collect all Argument instances contained in this argument into the given vector. More... | |
operator bool () const | |
Boolean conversion operator (so you can do things like if (arg) { ... More... | |
virtual unsigned int | count () const =0 |
Return the actual count of occurrences. 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... | |
virtual void | check_valid () const =0 |
Check if the argument constraints are satisfied. More... | |
virtual std::string | usage () const =0 |
Returns a string representing how the argument may be used on the command line. More... | |
virtual std::unique_ptr < BaseArgument > | clone () const &=0 |
Make a clone of the BaseArgument. More... | |
virtual std::unique_ptr < BaseArgument > | clone ()&&=0 |
Make a clone of the BaseArgument and move all data to it. More... | |
Protected Attributes | |
bool | m_required = false |
True if the argument has to be set. | |
Base argument class, used both by actual Argument classes and constraints (ArgumentConstraint).
|
pure virtual |
Check if the argument constraints are satisfied.
Returns if this is the case, will throw an TAP::exception indicating the problem otherwise.
Implemented in TAP::Argument, TAP::ArgumentConstraint< CType >, and TAP::ArgumentConstraint< ConstraintType::Any >.
|
pure virtual |
Make a clone of the BaseArgument.
Returns a pointer which is owned by the caller.
Implemented in TAP::SwitchArgument, TAP::ConstArgument< T >, TAP::ValueArgument< T, multi >, TAP::Argument, TAP::VariableArgument< T, multi >, TAP::ArgumentSet, TAP::TypedArgument< T, multi >, TAP::TypedArgument< bool, false >, TAP::TypedArgument< T, false >, TAP::ArgumentConstraint< CType >, and TAP::ArgumentConstraint< ConstraintType::Any >.
|
pure virtual |
Make a clone of the BaseArgument and move all data to it.
Returns a pointer which is owned by the caller. The original object is no longer valid.
Implemented in TAP::SwitchArgument, TAP::ConstArgument< T >, TAP::ValueArgument< T, multi >, TAP::Argument, TAP::VariableArgument< T, multi >, TAP::ArgumentSet, TAP::ArgumentConstraint< CType >, TAP::TypedArgument< T, multi >, TAP::ArgumentConstraint< ConstraintType::Any >, TAP::TypedArgument< bool, false >, and TAP::TypedArgument< T, false >.
|
pure virtual |
Return the actual count of occurrences.
Implemented in TAP::Argument, TAP::ArgumentConstraint< CType >, and TAP::ArgumentConstraint< ConstraintType::Any >.
|
pure virtual |
Collect all Argument instances contained in this argument into the given vector.
collector | Vector to store the arguments in |
Implemented in TAP::Argument, TAP::ArgumentConstraint< CType >, and TAP::ArgumentConstraint< ConstraintType::Any >.
|
inlineexplicit |
Boolean conversion operator (so you can do things like if (arg) { ...
} ) It is set to true if and only if the argument is set.
|
inline |
Returns whether the argument is required.
|
inline |
Mark the argument as required or not.
required | If true, the argument must be set at least once (see min()) |
|
pure virtual |
Returns a string representing how the argument may be used on the command line.
Implemented in TAP::Argument, TAP::VariableArgument< T, multi >, TAP::ArgumentConstraint< CType >, and TAP::ArgumentConstraint< ConstraintType::Any >.