|
kaycxx-cli
C++ CLI library
|
Parsed command line arguments. More...
#include <kaycxx/cli/args.hpp>
Public Member Functions | |
| args ()=default | |
| Creates an empty argument collection. | |
| args (args const &)=delete | |
| Prevents copying parsed arguments. | |
| args & | operator= (args const &)=delete |
| Prevents copy-assigning parsed arguments. | |
| args (args &&other) noexcept=default | |
| Moves parsed arguments. | |
| args & | operator= (args &&other) noexcept=default |
| Move-assigns parsed arguments. | |
| void | validate () const |
| Validates and converts all positional parameters. | |
| bool | get (flag_handle const &flag) const |
| Checks whether a flag was set. | |
| template<parseable_value T> | |
| T const & | get (option_handle< T > const &option) const |
| Returns a parsed option value. | |
| template<parseable_value T> | |
| bool | has (option_handle< T > const &option) const |
| Checks whether an option value is available. | |
| template<parseable_value T> | |
| std::vector< T > const & | get (repeatable_option_handle< T > const &option) const |
| Returns all parsed values of a repeatable option. | |
| template<parseable_value T> | |
| bool | has (repeatable_option_handle< T > const &option) const |
| Checks whether values for a repeatable option are available. | |
| template<parseable_value T> | |
| T const & | get (parameter_handle< T > const ¶meter) const |
| Returns a parsed positional parameter value. | |
| template<parseable_value T> | |
| bool | has (parameter_handle< T > const ¶meter) const |
| Checks whether a positional parameter value is available. | |
| template<parseable_value T> | |
| std::vector< T > const & | get (parameters_handle< T > const ¶meters) const |
| Returns parsed positional parameter list values. | |
| template<parseable_value T> | |
| bool | has (parameters_handle< T > const ¶meters) const |
| Checks whether positional parameter list values are available. | |
Friends | |
| class | command |
Parsed command line arguments.
Instances are returned directly by command::parse(). Values are queried with the handles returned by command registration methods.
Parsed arguments have unique ownership and can be moved but not copied.
Positional parameters are validated and converted lazily when first accessed or when validate() is called explicitly.
The command that created an instance must outlive it and all handles used to access it.
|
defaultnoexcept |
Moves parsed arguments.
| other | Parsed arguments to move from. |
| bool kaycxx::cli::args::get | ( | flag_handle const & | flag | ) | const |
Checks whether a flag was set.
| flag | Flag handle returned by command::flag(). |
|
inline |
Returns a parsed option value.
| T | Option value type. |
| option | Option handle returned by command::option(). |
|
inline |
Returns a parsed positional parameter value.
| T | Parameter value type. |
| parameter | Parameter handle returned by command::parameter(). |
| parse_error | When positional parameter validation fails. |
|
inline |
Returns parsed positional parameter list values.
| T | Parameter value type. |
| parameters | Parameter list handle returned by command::parameters(). |
| parse_error | When positional parameter validation fails. |
|
inline |
Returns all parsed values of a repeatable option.
| T | Option value type. |
| option | Repeatable option handle returned by command::repeatable_option(). |
|
inline |
Checks whether an option value is available.
| T | Option value type. |
| option | Option handle returned by command::option(). |
|
inline |
Checks whether a positional parameter value is available.
| T | Parameter value type. |
| parameter | Parameter handle returned by command::parameter(). |
| parse_error | When positional parameter validation fails. |
|
inline |
Checks whether positional parameter list values are available.
| T | Parameter value type. |
| parameters | Parameter list handle returned by command::parameters(). |
| parse_error | When positional parameter validation fails. |
|
inline |
Checks whether values for a repeatable option are available.
| T | Option value type. |
| option | Repeatable option handle returned by command::repeatable_option(). |
Move-assigns parsed arguments.
| other | Parsed arguments to move from. |
| void kaycxx::cli::args::validate | ( | ) | const |
Validates and converts all positional parameters.
Calling this method repeatedly has no effect after the first successful validation.
| parse_error | When a required positional parameter is missing, an unexpected positional argument is present, or conversion fails. |