|
koutil
|
Represents a positional command-line argument. More...
#include <argument.h>
Public Types | |
| using | result_t = Result |
| using | handle_t = std::function<void(std::string_view, result_t&)> |
| Type alias for argument handler function. | |
Public Member Functions | |
| argument_t (std::string_view name, std::string_view description) | |
| Constructs an argument with a name and description. | |
| template<void_handle< std::string_view, result_t & > Handle> | |
| argument_t (std::string_view name, std::string_view description, Handle &&handle) | |
| Constructs an argument with a name, description, and handler. | |
| std::string_view | name () const |
| Gets the argument name. | |
| std::string_view | description () const |
| Gets the argument description. | |
| void | process (std::string_view value, result_t &result) const |
| Processes the argument value using the assigned handler. | |
Private Attributes | |
| std::string_view | m_name |
| std::string_view | m_description |
| handle_t | m_handle |
Represents a positional command-line argument.
Each argument has a name, description, and an optional handler function. The order in which arguments are added defines the order in which they are expected on the command line and displayed in the help text.
| using koutil::args::argument_t< Result >::handle_t = std::function<void(std::string_view, result_t&)> |
Type alias for argument handler function.
| using koutil::args::argument_t< Result >::result_t = Result |
|
inlineexplicit |
Constructs an argument with a name and description.
| name | Argument name. |
| description | Argument description. |
|
inlineexplicit |
Constructs an argument with a name, description, and handler.
| Handle | Callable type compatible with void(std::string_view, result_t&). |
| name | Argument name. |
| description | Argument description. |
| handle | Function to process the argument value. |
|
inlinenodiscard |
Gets the argument description.
|
inlinenodiscard |
Gets the argument name.
| void koutil::args::argument_t< Result >::process | ( | std::string_view | value, |
| result_t & | result ) const |
Processes the argument value using the assigned handler.
| value | Argument value. |
| result | Result object to update. |
|
private |
|
private |
|
private |