|
cli20 0.1.2
A C++20 typed-schema command-line parser
|
The result returned by Parser::parse() and the free cli::parse() function. More...
#include <parser.hh>
Public Member Functions | |
| constexpr | operator bool () const noexcept |
| Returns true when parsing succeeded. | |
| constexpr auto | has_value () const noexcept -> bool |
| Returns true when parsing succeeded. | |
| constexpr auto | has_error () const noexcept -> bool |
| Returns true when parsing failed. | |
Static Public Member Functions | |
| template<class U> | |
| static constexpr auto | ok (U &&value) -> ParseResult< T > |
| Creates a success result holding value. | |
| static constexpr auto | fail (ParseError error) -> ParseResult< T > |
| Creates a failure result carrying error. | |
Public Attributes | |
| T | value {} |
| The parsed argument struct (valid only when has_value() is true). | |
| ParseError | error {} |
| The error details (valid only when has_error() is true). | |
The result returned by Parser::parse() and the free cli::parse() function.
On success, value holds the fully populated argument specification struct and error is in the default (no-error) state. On failure, error describes what went wrong and value is in a partially-initialised (unusable) state.
Typical usage:
| T | The argument specification type. |
|
inlinestaticnodiscardconstexpr |
Creates a failure result carrying error.
| error | The error to store. |
|
inlinenodiscardconstexprnoexcept |
|
inlinenodiscardconstexprnoexcept |
|
inlinestaticnodiscardconstexpr |
Creates a success result holding value.
| U | Type of the value (deduced). |
| value | The parsed argument struct to store. |
|
inlineexplicitnodiscardconstexprnoexcept |
| ParseError cli::ParseResult< T >::error {} |
The error details (valid only when has_error() is true).
| T cli::ParseResult< T >::value {} |
The parsed argument struct (valid only when has_value() is true).