|
CPP-AP 3.0.1
Command-line argument parser for C++20
|
Represents a group of arguments. More...
#include <argument_group.hpp>
Public Member Functions | |
| argument_group ()=delete | |
| argument_group & | required (const bool r=true) noexcept |
Set the required attribute of the group. | |
| argument_group & | mutually_exclusive (const bool me=true) noexcept |
Set the mutually_exclusive attribute of the group. | |
Private Types | |
| using | arg_ptr_t = std::shared_ptr< detail::argument_base > |
| The argument pointer type alias. | |
| using | arg_ptr_vec_t = std::vector< arg_ptr_t > |
| The argument pointer list type alias. | |
Private Member Functions | |
| argument_group (argument_parser &parser, const std::string_view name) | |
| Construct a new argument group with the given name. | |
| void | _add_argument (arg_ptr_t arg) noexcept |
| Add a new argument to this group (called internally by parser). | |
Static Private Member Functions | |
| static std::unique_ptr< argument_group > | create (argument_parser &parser, std::string_view name) |
| Factory method to create an argument group. | |
Private Attributes | |
| argument_parser * | _parser |
| Pointer to the owning parser. | |
| std::string | _name |
| Name of the group (used in help output). | |
| arg_ptr_vec_t | _arguments |
| A list of arguments that belong to this group. | |
| bool | _required: 1 = false |
| The required attribute value (default: false). | |
| bool | _mutually_exclusive: 1 = false |
| The mutually exclusive attribute value (default: false). | |
Friends | |
| class | argument_parser |
Represents a group of arguments.
Groups allow arguments to be organized under a dedicated section in the parser's help message.
A group can be marked as:
add_group method of ap::argument_parser. Example usage:
Here out_opts is a mutually exclusive group, so using both arguments at the same time would cause an error.
Definition at line 41 of file argument_group.hpp.
|
private |
The argument pointer type alias.
Definition at line 78 of file argument_group.hpp.
|
private |
The argument pointer list type alias.
Definition at line 79 of file argument_group.hpp.
|
delete |
|
inlineprivate |
Construct a new argument group with the given name.
Definition at line 91 of file argument_group.hpp.
|
inlineprivatenoexcept |
Add a new argument to this group (called internally by parser).
Definition at line 95 of file argument_group.hpp.
|
inlinestaticprivate |
Factory method to create an argument group.
| parser | The owning parser. |
| name | Name of the group. |
Definition at line 86 of file argument_group.hpp.
|
inlinenoexcept |
Set the mutually_exclusive attribute of the group.
| me | The value to set for the attribute (default: true). |
Definition at line 70 of file argument_group.hpp.
|
inlinenoexcept |
Set the required attribute of the group.
| r | The value to set for the attribute (default: true). |
Definition at line 55 of file argument_group.hpp.
|
friend |
Definition at line 75 of file argument_group.hpp.
|
private |
A list of arguments that belong to this group.
Definition at line 101 of file argument_group.hpp.
|
private |
The mutually exclusive attribute value (default: false).
Definition at line 104 of file argument_group.hpp.
|
private |
Name of the group (used in help output).
Definition at line 100 of file argument_group.hpp.
|
private |
Pointer to the owning parser.
Definition at line 99 of file argument_group.hpp.
|
private |
The required attribute value (default: false).
Definition at line 103 of file argument_group.hpp.