TAP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Classes | Typedefs | Enumerations | Functions | Variables
TAP Namespace Reference

The main TAP namespace. More...

Classes

class  Argument
 Simple argument class. More...
 
class  ValueAcceptor
 Interface class for arguments that accept a value when takes_value() is true. More...
 
class  ArgumentConstraint
 Argument constraint class. More...
 
class  ArgumentSet
 Simple set of arguments. More...
 
class  BaseArgument
 Base argument class, used both by actual Argument classes and constraints (ArgumentConstraint). More...
 
class  exception
 Standard exception class for TAP. More...
 
class  command_error
 Exception class for errors in the command line (such as unknown arguments or syntax errors). More...
 
class  unknown_argument
 Exception class raised when an unknown argument is encountered. More...
 
class  argument_error
 Exception class raised when an error occurs verifying a command line argument. More...
 
class  argument_count_mismatch
 Exception class raised when an argument is used an incorrect amount of times. More...
 
class  argument_invalid_value
 Exception class raised when an argument value is incorrect. More...
 
class  argument_missing_value
 Exception class raised when an argument value is missing from the command line. More...
 
class  argument_no_value
 Exception class raised when an argument value is given but not expected. More...
 
class  constraint_error
 Exception class raised when an argument constraint is not satisfied. More...
 
class  ArgumentParser
 Argument parser class. More...
 
class  TypedArgument
 Base class for arguments that hold a typed value. More...
 
class  VariableArgument
 Concrete implementation of TypedArgument. More...
 
class  ValueArgument
 Implementation of TypedArgument that stores a value by itself, based on VariableArgument. More...
 
class  ConstArgument
 Specialization of TypedArgument that acts as a switch on the command line, but stores an arbitrary constant in the given variable storage. More...
 
class  SwitchArgument
 SwitchArgument is a specialization for TypedArgument, which does not accept values (it switches). More...
 

Typedefs

using ArgumentCheckFunc = std::function< void(const Argument &)>
 Function pointer that is used by Argument::check(). More...
 
template<typename T , bool multi>
using TypedArgumentCheckFunc = std::function< void(const TypedArgument< T, multi > &, const T &value)>
 Function pointer that is used by ValueArgument::check()
 
template<typename T >
using MultiVariableArgument = VariableArgument< T, true >
 MultiVariableArgument is a VariableArgument that, when allowed to occur multiple times, stores each given value individually in a vector. More...
 
template<typename T >
using MultiValueArgument = ValueArgument< T, true >
 MultiValueArgument is a ValueArgument that, when allowed to occur multiple times, stores each given value individually in a vector. More...
 

Enumerations

enum  ConstraintType { ConstraintType::None, ConstraintType::One, ConstraintType::Any, ConstraintType::All }
 Enumeration of possible argument constraints. More...
 

Functions

ArgumentConstraint
< ConstraintType::One
operator^ (Argument &left, Argument &right)
 Joins two arguments together using the ConstraintType::One operator. More...
 
ArgumentConstraint
< ConstraintType::One
operator^ (ArgumentConstraint< ConstraintType::One > left, Argument &right)
 Joins two arguments together using the ConstraintType::One operator. More...
 
ArgumentConstraint
< ConstraintType::One
operator^ (Argument &left, ArgumentConstraint< ConstraintType::One > &right)
 Joins two arguments together using the ConstraintType::One operator. More...
 
ArgumentConstraint
< ConstraintType::Any
operator| (Argument &left, Argument &right)
 Joins two arguments together using the ConstraintType::Any operator. More...
 
ArgumentConstraint
< ConstraintType::Any
operator| (ArgumentConstraint< ConstraintType::Any > left, Argument &right)
 Joins two arguments together using the ConstraintType::Any operator. More...
 
ArgumentConstraint
< ConstraintType::Any
operator| (Argument &left, ArgumentConstraint< ConstraintType::Any > &right)
 Joins two arguments together using the ConstraintType::Any operator. More...
 
ArgumentConstraint
< ConstraintType::All
operator& (Argument &left, Argument &right)
 Joins two arguments together using the ConstraintType::All operator. More...
 
ArgumentConstraint
< ConstraintType::All
operator& (ArgumentConstraint< ConstraintType::All > left, Argument &right)
 Joins two arguments together using the ConstraintType::All operator. More...
 
ArgumentConstraint
< ConstraintType::All
operator& (Argument &left, ArgumentConstraint< ConstraintType::All > &right)
 Joins two arguments together using the ConstraintType::All operator. More...
 
ArgumentConstraint
< ConstraintType::None
operator~ (Argument &arg)
 "Negates" an argument using the ConstraintType::None operator. More...
 
template<ConstraintType CType>
ArgumentConstraint
< ConstraintType::None
operator~ (ArgumentConstraint< CType > &arg)
 "Negates" an argument constraint using the ConstraintType::None operator. More...
 
Argumentoperator- (Argument &arg)
 Makes an argument optional. More...
 
template<ConstraintType CType>
ArgumentConstraint< CType > & operator- (ArgumentConstraint< CType > &arg)
 Makes an argument constraint optional. More...
 
Argumentoperator+ (Argument &arg)
 Makes an argument required. More...
 
Argument && operator+ (Argument &&arg)
 Makes an argument required. More...
 
template<ConstraintType CType>
ArgumentConstraint< CType > & operator+ (ArgumentConstraint< CType > &arg)
 Makes an argument constraint required. More...
 
template<ConstraintType CType>
ArgumentConstraint< CType > && operator+ (ArgumentConstraint< CType > &&arg)
 Makes an argument constraint required. More...
 

Variables

const char flagStart [] = "-"
 Marker for flags (one letter arg)
 
const char nameStart [] = "--"
 Marker for names (>1 letter arg)
 
const char nameDelim = '='
 Delimiter between name and argument (e.g. More...
 
const char skip [] = "--"
 Define the parsed arg delimiter. More...
 

Detailed Description

The main TAP namespace.

Everything in the TAP library is part of this namespace.

Typedef Documentation

using TAP::ArgumentCheckFunc = typedef std::function<void(const Argument&)>

Function pointer that is used by Argument::check().

template<typename T >
using TAP::MultiValueArgument = typedef ValueArgument<T, true>

MultiValueArgument is a ValueArgument that, when allowed to occur multiple times, stores each given value individually in a vector.

Alias for ValueArgument with the multi template argument set to true.

template<typename T >
using TAP::MultiVariableArgument = typedef VariableArgument<T, true>

MultiVariableArgument is a VariableArgument that, when allowed to occur multiple times, stores each given value individually in a vector.

Alias for VariableArgument with the multi template argument set to true.

Enumeration Type Documentation

enum TAP::ConstraintType
strong

Enumeration of possible argument constraints.

See the comments inside the enumeration for details and meaning.

Enumerator
None 

0: No arguments may be set

One 

1: Exactly one argument must be set

Any 

[1,n]: At least one argument must be set

All 

n: All arguments must be set

Function Documentation

ArgumentConstraint<ConstraintType::All> TAP::operator& ( Argument &  left,
Argument &  right 
)

Joins two arguments together using the ConstraintType::All operator.

Parameters
leftLeft argument
rightRight argument
Returns
An ArgumentConstraint containing the given arguments, using the ConstraintType::All operator
ArgumentConstraint<ConstraintType::All> TAP::operator& ( ArgumentConstraint< ConstraintType::All >  left,
Argument &  right 
)

Joins two arguments together using the ConstraintType::All operator.

Parameters
leftLeft argument
rightRight argument
Returns
An ArgumentConstraint containing the given arguments, using the ConstraintType::All operator
ArgumentConstraint<ConstraintType::All> TAP::operator& ( Argument &  left,
ArgumentConstraint< ConstraintType::All > &  right 
)

Joins two arguments together using the ConstraintType::All operator.

Parameters
leftLeft argument
rightRight argument
Returns
An ArgumentConstraint containing the given arguments, using the ConstraintType::All operator
Argument& TAP::operator+ ( Argument &  arg)

Makes an argument required.

Parameters
argArgument to make required
Returns
input Argument
Argument&& TAP::operator+ ( Argument &&  arg)

Makes an argument required.

Parameters
argArgument to make required
Returns
input Argument
template<ConstraintType CType>
ArgumentConstraint<CType>& TAP::operator+ ( ArgumentConstraint< CType > &  arg)

Makes an argument constraint required.

Parameters
argArgument constraint to make required
Returns
input Argument constraint
template<ConstraintType CType>
ArgumentConstraint<CType>&& TAP::operator+ ( ArgumentConstraint< CType > &&  arg)

Makes an argument constraint required.

Parameters
argArgument constraint to make required
Returns
input Argument constraint
Argument& TAP::operator- ( Argument &  arg)

Makes an argument optional.

Parameters
argArgument to make optional
Returns
input Argument
template<ConstraintType CType>
ArgumentConstraint<CType>& TAP::operator- ( ArgumentConstraint< CType > &  arg)

Makes an argument constraint optional.

Parameters
argArgument to make optional
Returns
input Argument
ArgumentConstraint<ConstraintType::One> TAP::operator^ ( Argument &  left,
Argument &  right 
)

Joins two arguments together using the ConstraintType::One operator.

Parameters
leftLeft argument
rightRight argument
Returns
An ArgumentConstraint containing the given arguments, using the ConstraintType::One operator
ArgumentConstraint<ConstraintType::One> TAP::operator^ ( ArgumentConstraint< ConstraintType::One >  left,
Argument &  right 
)

Joins two arguments together using the ConstraintType::One operator.

Parameters
leftLeft argument
rightRight argument
Returns
An ArgumentConstraint containing the given arguments, using the ConstraintType::One operator
ArgumentConstraint<ConstraintType::One> TAP::operator^ ( Argument &  left,
ArgumentConstraint< ConstraintType::One > &  right 
)

Joins two arguments together using the ConstraintType::One operator.

Parameters
leftLeft argument
rightRight argument
Returns
An ArgumentConstraint containing the given arguments, using the ConstraintType::One operator
ArgumentConstraint<ConstraintType::Any> TAP::operator| ( Argument &  left,
Argument &  right 
)

Joins two arguments together using the ConstraintType::Any operator.

Parameters
leftLeft argument
rightRight argument
Returns
An ArgumentConstraint containing the given arguments, using the ConstraintType::One operator
ArgumentConstraint<ConstraintType::Any> TAP::operator| ( ArgumentConstraint< ConstraintType::Any >  left,
Argument &  right 
)

Joins two arguments together using the ConstraintType::Any operator.

Parameters
leftLeft argument
rightRight argument
Returns
An ArgumentConstraint containing the given arguments, using the ConstraintType::Any operator
ArgumentConstraint<ConstraintType::Any> TAP::operator| ( Argument &  left,
ArgumentConstraint< ConstraintType::Any > &  right 
)

Joins two arguments together using the ConstraintType::Any operator.

Parameters
leftLeft argument
rightRight argument
Returns
An ArgumentConstraint containing the given arguments, using the ConstraintType::Any operator
ArgumentConstraint<ConstraintType::None> TAP::operator~ ( Argument &  arg)

"Negates" an argument using the ConstraintType::None operator.

Parameters
argArgument to negate
Returns
An ArgumentConstraint containing the given argument, using the ConstraintType::None operator
template<ConstraintType CType>
ArgumentConstraint<ConstraintType::None> TAP::operator~ ( ArgumentConstraint< CType > &  arg)

"Negates" an argument constraint using the ConstraintType::None operator.

Parameters
argArgument constraint to negate
Returns
An ArgumentConstraint containing the given argument, using the ConstraintType::None operator

Variable Documentation

const char TAP::nameDelim = '='

Delimiter between name and argument (e.g.

–name=value). Define as '\0' to disable

const char TAP::skip[] = "--"

Define the parsed arg delimiter.

Define as "" to disable