CPP-AP 2.2.6
Command-line argument parser for C++20
|
The optioanl argument class. More...
#include <optional.hpp>
Public Types | |
using | value_type = T |
The argument's value type. | |
using | count_type = nargs::range::count_type |
The argument's value count type. | |
Public Member Functions | |
optional (const detail::argument_name &name) | |
Constructor for optional argument with the name identifier. | |
bool | operator== (const optional &other) const noexcept |
Equality comparison operator for optional argument. | |
optional & | help (std::string_view help_msg) noexcept |
Set the help message for the optional argument. | |
optional & | required () noexcept |
Mark the optional argument as required. | |
optional & | bypass_required () noexcept |
Enable bypassing the required status for the optional argument. | |
optional & | nargs (const nargs::range &range) noexcept |
Set the nargs range for the optional argument. | |
optional & | nargs (const count_type n) noexcept |
Set the nargs range for the optional argument. | |
optional & | nargs (const count_type lower_bound, const count_type upper_bound) noexcept |
Set the nargs range for the optional argument. | |
template<action::detail::c_action_specifier AS, typename F > | |
optional & | action (F &&action) noexcept |
Set the action for the optional argument. | |
template<detail::c_range_of< value_type, detail::type_validator::convertible > CR> requires (std::equality_comparable<value_type>) | |
optional & | choices (const CR &choices) noexcept |
Set the choices for the optional argument. | |
optional & | choices (std::initializer_list< value_type > choices) noexcept |
Set the choices for the optional argument. | |
optional & | default_value (const value_type &default_value) noexcept |
Set the default value for the optional argument. | |
optional & | implicit_value (const value_type &implicit_value) noexcept |
Set the implicit value for the optional argument. | |
Friends | |
class | ::ap::argument_parser |
Friend class declaration for access by argument_parser. | |
Additional Inherited Members | |
![]() | |
argument_base (const argument_name &name) | |
const ap::detail::argument_name & | name () const noexcept |
const std::optional< std::string > & | help () const noexcept |
![]() | |
const ap::detail::argument_name | _name |
std::optional< std::string > | _help_msg |
The optioanl argument class.
T | The argument's value type. |
Definition at line 31 of file optional.hpp.
using ap::argument::optional< T >::count_type = nargs::range::count_type |
The argument's value count type.
Definition at line 34 of file optional.hpp.
using ap::argument::optional< T >::value_type = T |
The argument's value type.
Definition at line 33 of file optional.hpp.
|
inline |
Constructor for optional argument with the name
identifier.
name | The name identifier of the optional argument. |
Definition at line 42 of file optional.hpp.
|
inlinenoexcept |
Set the action for the optional argument.
AS | The action specifier type (see ap/action/specifiers.hpp). |
F | The type of the action function. |
action | The action function to set. |
Definition at line 124 of file optional.hpp.
|
inlinenoexcept |
Enable bypassing the required status for the optional argument.
Definition at line 80 of file optional.hpp.
|
inlinenoexcept |
Set the choices for the optional argument.
CR | The choices range type. |
choices | The range of valid choices for the argument. |
value_type
must be equality comparable. CR
must be a range such that its value type is convertible to value_type
. Definition at line 145 of file optional.hpp.
|
inlinenoexcept |
Set the choices for the optional argument.
choices | The list of valid choices for the argument. |
value_type
must be equality comparable. Definition at line 159 of file optional.hpp.
|
inlinenoexcept |
Set the default value for the optional argument.
default_value | The default value to set. |
Definition at line 170 of file optional.hpp.
|
inlinenoexcept |
Set the help message for the optional argument.
help_msg | The help message to set. |
Definition at line 60 of file optional.hpp.
|
inlinenoexcept |
Set the implicit value for the optional argument.
implicit_value | The implicit value to set. |
Definition at line 180 of file optional.hpp.
|
inlinenoexcept |
Set the nargs range for the optional argument.
lower_bound | The lower bound for nargs range. |
upper_bound | The upper bound for nargs range. |
Definition at line 111 of file optional.hpp.
|
inlinenoexcept |
Set the nargs range for the optional argument.
n | The exact bound for nargs range. |
Definition at line 100 of file optional.hpp.
|
inlinenoexcept |
Set the nargs range for the optional argument.
range | The nargs range to set. |
Definition at line 90 of file optional.hpp.
|
inlinenoexcept |
Equality comparison operator for optional argument.
other | The optional argument to compare with. |
Definition at line 51 of file optional.hpp.
|
inlinenoexcept |
Mark the optional argument as required.
const bool
parameter to enable explicit enabling/disabling of this option. Definition at line 71 of file optional.hpp.
|
friend |
Friend class declaration for access by argument_parser.
Definition at line 186 of file optional.hpp.