Class template for pre-declared program parameter. More...
#include <eagine/program_args.hpp>
Public Member Functions | |
program_parameter (string_view short_tag, string_view long_tag) noexcept | |
Construction from short and long tag strings. | |
program_parameter (string_view short_tag, string_view long_tag, T initial) noexcept | |
Construction from short and long tag strings and the initial value. | |
auto | ref () noexcept -> T & |
Returns a reference to the parameter value. | |
auto | has_valid_value () const noexcept -> bool |
Indicates if the current value is valid. More... | |
auto | validate (std::ostream &log) const -> bool |
Validate the current value, print potential error messages to log. | |
auto | value () const -> auto & |
Returns the current parameter value. | |
operator const T & () const noexcept | |
Returns the current parameter value. More... | |
![]() | |
constexpr auto | short_tag () const noexcept -> string_view |
Get the short tag string for this parameter. | |
constexpr auto | long_tag () const noexcept -> string_view |
Get the long tag string for this parameter. | |
constexpr auto | description () const noexcept -> string_view |
Returns a human-readable description for this program parameter. | |
constexpr auto | description (string_view help_str) noexcept -> auto & |
Specifies a human-readable description for this program parameter. | |
Class template for pre-declared program parameter.
This is a class for application-specific program parameters that are typically parsed from the program command-line arguments list. A declared parameter has a short tag like "-h" and a long tag like "--help" and has storage for a value of the type T
.
|
inlinenoexcept |
Indicates if the current value is valid.
Referenced by eagine::program_parameter< T >::validate().
|
inlinenoexcept |
Returns the current parameter value.