C++ Essence Library 0.1.0
A Utility Library for Modern C++ Programming
|
Creates a base internal implementation of a CLI option class. More...
#include <option.hpp>
Public Types | |
using | element_type = std::conditional_t<std_basic_string<T>, T, range_value_t_or_self_t<T>> |
using | set_hash_type = std::conditional_t<std_basic_string<element_type>, string_hash, std::hash<element_type>> |
Public Member Functions | |
option () | |
Creates an instance. | |
abi::string | bound_name () const |
option & | set_bound_name (std::string_view name) |
abi::string | description () const |
option & | set_description (std::string_view description) |
std::span< const abi::string > | aliases () const |
option & | add_aliases (std::span< const abi::string > aliases) |
std::optional< abi::string > | default_value_str () const |
std::span< const abi::string > | valid_value_strs () const noexcept |
abi::string | name_hints () const |
abi::string | value_hints () const |
bool | parse_value_and_cache (std::string_view value) |
void | set_target_from_cache (void *target) |
void | validate (std::string_view value, validation_result &result) const |
void | raise_error (std::string_view message) const |
void | on_validation (const validation_handler &handler) const |
void | on_error (const output_handler &handler) const |
template<std::convertible_to< std::string_view >... Args> | |
option & | add_aliases (Args &&... args) |
template<typename U > requires std::constructible_from<T, U> | |
option & | set_default_value (U &&value) |
option & | set_valid_values (std::span< const element_type > values) |
template<typename... Args> requires (std::constructible_from<element_type, Args> && ...) | |
option & | set_valid_values (Args &&... args) |
abstract::option | as_abstract () |
Static Public Member Functions | |
static bool | check_target_type (meta::fingerprint id) noexcept |
Static Public Attributes | |
static constexpr std::string_view | delimiter {U8(",")} |
static constexpr std::string_view | optional_pattern {U8("[]")} |
static constexpr std::string_view | keyword_pattern {U8("``")} |
static constexpr meta::fingerprint | type_id {std::type_identity<T>{}} |
Creates a base internal implementation of a CLI option class.
A CLI option, i.e. –xxx=yyy.
T | The data type of the option. |