|
|
| option_t (const option_t &)=delete |
|
auto | operator= (const option_t &) -> option_t &=delete |
| auto | count () const -> std::size_t |
| | Returns how many values were collected.
|
| auto | empty () const -> bool |
| | Reports whether no values were collected.
|
| | operator bool () const |
| | Reports whether the option was used.
|
|
auto | clear () -> void |
| | Discards collected values and resets the parse state.
|
| template<typename T = app_t> |
| auto | ignore_case (bool value=true) -> option_t * |
| | Makes name matching case-insensitive.
|
| template<typename T = app_t> |
| auto | ignore_underscore (bool value=true) -> option_t * |
| | Makes name matching ignore underscores.
|
| auto | multi_option_policy (multi_option_policy_t value=multi_option_policy_t::reject) -> option_t * |
| | Sets what happens to surplus values.
|
| auto | disable_flag_override (bool value=true) -> option_t * |
| | Rejects --no-flag style overrides.
|
| auto | expected (int value) -> option_t * |
| | Sets how many values the option accepts.
|
| auto | expected (int value_min, int value_max) -> option_t * |
| | Sets the range of value counts the option accepts.
|
| auto | allow_extra_args (bool value=true) -> option_t * |
| | Allows the option to absorb surplus arguments.
|
| auto | get_allow_extra_args () const -> bool |
| | Reports whether the option absorbs surplus arguments.
|
| auto | trigger_on_parse (bool value=true) -> option_t * |
| | Runs the callback as soon as a value is parsed.
|
| auto | get_trigger_on_parse () const -> bool |
| | Reports whether the callback runs during parsing.
|
| auto | force_callback (bool value=true) -> option_t * |
| | Runs the callback even when the option is absent.
|
| auto | get_force_callback () const -> bool |
| | Reports whether the callback runs when the option is absent.
|
| auto | run_callback_for_default (bool value=true) -> option_t * |
| | Runs the callback when only the default value is present.
|
| auto | get_run_callback_for_default () const -> bool |
| | Reports whether the callback runs for default values.
|
| auto | callback_priority (callback_priority_t value=callback_priority_t::normal) -> option_t * |
| | Sets when this option's callback runs.
|
A check inspects a value; a transform rewrites it. Checks are appended and run after any transforms, which are prepended.
|
| auto | check (validator_ptr_t validator) -> option_t * |
| | Appends a shared validator as a check.
|
| auto | check (validator_t validator, const std::string &validator_name="") -> option_t * |
| | Appends a validator as a check.
|
| auto | check (std::function< std::string(const std::string &)> validator_func, std::string validator_description="", std::string validator_name="") -> option_t * |
| | Appends a callable as a check.
|
| auto | transform (validator_ptr_t validator) -> option_t * |
| | Prepends a shared validator as a transform.
|
| auto | transform (validator_t validator, const std::string &transform_name="") -> option_t * |
| | Prepends a validator as a transform.
|
| auto | transform (std::function< std::string(std::string)> transform_func, std::string transform_description="", std::string transform_name="") -> option_t * |
| | Prepends a callable as a transform.
|
| auto | each (std::function< void(std::string)> func) -> option_t * |
| | Appends a callable run once per value, for its side effects.
|
| auto | get_validator (const std::string &validator_name="") -> validator_t * |
| | Finds a validator by name.
|
| auto | get_validator (int index) -> validator_t * |
| | Finds a validator by position.
|
| auto | needs (option_t *opt) -> option_t * |
| | Requires another option to appear alongside this one.
|
| template<typename T = app_t> |
| auto | needs (std::string opt_name) -> option_t * |
| | Requires a named option to appear alongside this one.
|
| template<typename A, typename B, typename... args_t> |
| auto | needs (A opt, B opt1, args_t... args) -> option_t * |
| | Requires several options to appear alongside this one.
|
| auto | remove_needs (option_t *opt) -> bool |
| | Drops a dependency.
|
| auto | excludes (option_t *opt) -> option_t * |
| | Forbids another option from appearing alongside this one.
|
| template<typename T = app_t> |
| auto | excludes (std::string opt_name) -> option_t * |
| | Forbids a named option from appearing alongside this one.
|
| template<typename A, typename B, typename... args_t> |
| auto | excludes (A opt, B opt1, args_t... args) -> option_t * |
| | Forbids several options from appearing alongside this one.
|
| auto | remove_excludes (option_t *opt) -> bool |
| | Drops an exclusion.
|
| auto | envname (std::string name) -> option_t * |
| | Sets the environment variable consulted when the option is absent.
|
| auto | get_type_size () const -> int |
| | Returns the smallest number of values one appearance consumes.
|
| auto | get_type_size_min () const -> int |
| | Returns the smallest number of values one appearance consumes.
|
| auto | get_type_size_max () const -> int |
| | Returns the largest number of values one appearance consumes.
|
| auto | get_inject_separator () const -> bool |
| | Reports whether a separator is inserted between value groups.
|
| auto | get_envname () const -> const std::string & |
| | Returns the environment variable consulted when the option is absent.
|
| auto | get_needs () const -> const std::set< option_t * > & |
| | Returns the options this one depends on.
|
| auto | get_excludes () const -> const std::set< option_t * > & |
| | Returns the options this one excludes.
|
| auto | get_default_str () const -> const std::string & |
| | Returns the default value as shown in help output.
|
| auto | get_callback () const -> const callback_t & |
| | Returns the callback that writes the bound variable.
|
| auto | get_lnames () const -> const std::vector< std::string > & |
| | Returns the long names, without their leading dashes.
|
| auto | get_snames () const -> const std::vector< std::string > & |
| | Returns the short names, without their leading dash.
|
| auto | get_fnames () const -> const std::vector< std::string > & |
| | Returns the flag names.
|
| auto | get_single_name () const -> const std::string & |
| | Returns one representative name for this option.
|
| auto | get_expected () const -> int |
| | Returns the smallest number of values accepted in total.
|
| auto | get_expected_min () const -> int |
| | Returns the smallest number of values accepted in total.
|
| auto | get_expected_max () const -> int |
| | Returns the largest number of values accepted in total.
|
| auto | get_items_expected_min () const -> int |
| | Returns the smallest total number of items accepted.
|
| auto | get_items_expected_max () const -> int |
| | Returns the largest total number of items accepted.
|
| auto | get_items_expected () const -> int |
| | Returns the smallest total number of items accepted.
|
| auto | get_positional () const -> bool |
| | Reports whether this option is a positional.
|
| auto | nonpositional () const -> bool |
| | Reports whether this option has a dashed name.
|
| auto | has_description () const -> bool |
| | Reports whether a description was set.
|
| auto | get_description () const -> const std::string & |
| | Returns the description shown in help output.
|
| auto | description (std::string option_description) -> option_t * |
| | Sets the description shown in help output.
|
| auto | option_text (std::string text) -> option_t * |
| | Replaces the generated type name in help output.
|
| auto | get_option_text () const -> const std::string & |
| | Returns the text replacing the generated type name.
|
| auto | get_name (bool positional=false, bool all_options=false, bool disable_default_flag_values=false) const -> std::string |
| | Renders this option's name for help output.
|
| auto | run_callback () -> void |
| | Validates, reduces, and hands the results to the callback.
|
| auto | matching_name (const option_t &other) const -> const std::string & |
| | Returns the first name this option shares with another.
|
| auto | operator== (const option_t &other) const -> bool |
| | Reports whether two options share a name.
|
| auto | check_name (const std::string &name) const -> bool |
| | Reports whether a command-line token names this option.
|
| auto | check_sname (std::string name) const -> bool |
| | Reports whether a short name belongs to this option.
|
| auto | check_lname (std::string name) const -> bool |
| | Reports whether a long name belongs to this option.
|
| auto | check_fname (std::string name) const -> bool |
| | Reports whether a flag name belongs to this option.
|
| auto | get_flag_value (const std::string &name, std::string input_value) const -> std::string |
| | Resolves the value a flag contributes.
|
| auto | add_result (std::string s) -> option_t * |
| | Adds one raw result, resetting the parse state.
|
| auto | add_result (std::string s, int &results_added) -> option_t * |
| | Adds one raw result and reports how many entries it produced.
|
| auto | add_result (std::vector< std::string > s) -> option_t * |
| | Adds several raw results, resetting the parse state.
|
| auto | results () const -> const results_t & |
| | Returns the raw results, before validation or reduction.
|
| auto | reduced_results () const -> results_t |
| | Returns the results after validation and reduction.
|
| template<typename T> |
| auto | results (T &output) const -> void |
| | Converts the results into a value of type T.
|
| template<typename T> |
| auto | as () const -> T |
| | Converts the results and returns them.
|
| auto | get_callback_run () const -> bool |
| | Reports whether the callback has already run.
|
| auto | type_name_fn (std::function< std::string()> typefun) -> option_t * |
| | Sets the callable producing the type name shown in help output.
|
| auto | type_name (std::string typeval) -> option_t * |
| | Sets a fixed type name for help output.
|
| auto | type_size (int option_type_size) -> option_t * |
| | Sets how many values one appearance consumes.
|
| auto | type_size (int option_type_size_min, int option_type_size_max) -> option_t * |
| | Sets the range of values one appearance may consume.
|
| auto | inject_separator (bool value=true) -> void |
| | Sets whether a separator is inserted between value groups.
|
| auto | default_function (std::function< std::string()> func) -> option_t * |
| | Sets the callable that produces the printed default.
|
| auto | capture_default_str () -> option_t * |
| | Evaluates the default function and records the result.
|
| auto | default_str (std::string val) -> option_t * |
| | Sets the printed default directly.
|
| template<typename X> |
| auto | default_val (const X &val) -> option_t * |
| | Sets the default from a typed value, checking that it converts.
|
| auto | get_type_name () const -> std::string |
| | Returns the type name shown in help output.
|
| template<typename self_t> |
| auto | group (this self_t &self, const std::string &name) -> self_t * |
| | Sets the help group this option is listed under.
|
| template<typename self_t> |
| auto | required (this self_t &self, bool value=true) -> self_t * |
| | Marks the option as required.
|
| template<typename self_t> |
| auto | mandatory (this self_t &self, bool value=true) -> self_t * |
| | Marks the option as required.
|
| template<typename self_t> |
| auto | always_capture_default (this self_t &self, bool value=true) -> self_t * |
| | Captures the bound variable's value as the printed default.
|
| auto | get_group () const -> const std::string & |
| | Returns the help group this option is listed under.
|
| auto | get_required () const -> bool |
| | Reports whether the option must appear.
|
| auto | get_ignore_case () const -> bool |
| | Reports whether name matching ignores case.
|
| auto | get_ignore_underscore () const -> bool |
| | Reports whether name matching ignores underscores.
|
| auto | get_configurable () const -> bool |
| | Reports whether the option may be set from a configuration file.
|
| auto | get_disable_flag_override () const -> bool |
| | Reports whether flag overrides are rejected.
|
| auto | get_delimiter () const -> char |
| | Returns the character that splits a value into several.
|
| auto | get_always_capture_default () const -> bool |
| | Reports whether defaults are captured automatically.
|
| auto | get_multi_option_policy () const -> multi_option_policy_t |
| | Returns what happens to surplus values.
|
| auto | get_callback_priority () const -> callback_priority_t |
| | Returns when this option's callback runs.
|
| template<typename self_t> |
| auto | take_last (this self_t &self) -> self_t * |
| | Keeps only the last value given.
|
| template<typename self_t> |
| auto | take_first (this self_t &self) -> self_t * |
| | Keeps only the first value given.
|
| template<typename self_t> |
| auto | take_all (this self_t &self) -> self_t * |
| | Keeps every value given.
|
| template<typename self_t> |
| auto | join (this self_t &self) -> self_t * |
| | Joins every value given.
|
| template<typename self_t> |
| auto | join (this self_t &self, char delim) -> self_t * |
| | Joins every value given, using a specific delimiter.
|
| template<typename self_t> |
| auto | configurable (this self_t &self, bool value=true) -> self_t * |
| | Allows or forbids setting the option from a configuration file.
|
| template<typename self_t> |
| auto | delimiter (this self_t &self, char value='\0') -> self_t * |
| | Sets the character that splits a value into several.
|
|
|
std::vector< std::string > | snames_ {} |
| | Short names, without their leading dash.
|
|
std::vector< std::string > | lnames_ {} |
| | Long names, without their leading dashes.
|
|
std::vector< std::pair< std::string, std::string > > | default_flag_values_ {} |
| | Flag names paired with the default value each implies.
|
|
std::vector< std::string > | fnames_ {} |
| | Every flag name, in the order given.
|
|
std::string | pname_ {} |
| | The positional name, empty if this is not a positional.
|
|
std::string | envname_ {} |
| | The environment variable consulted when the option is absent.
|
|
std::string | description_ {} |
| | The description shown in help output.
|
|
std::string | default_str_ {} |
| | The default value as shown in help output.
|
|
std::string | option_text_ {} |
| | Text replacing the generated type name in help output.
|
|
std::function< std::string()> | type_name_ {[] { return std::string(); }} |
| | Produces the type name shown in help output.
|
|
std::function< std::string()> | default_function_ {} |
| | Produces the default value shown in help output.
|
|
int | type_size_max_ {1} |
| | Largest number of values one appearance consumes.
|
|
int | type_size_min_ {1} |
| | Smallest number of values one appearance consumes.
|
|
int | expected_min_ {1} |
| | Smallest number of values accepted in total.
|
|
int | expected_max_ {1} |
| | Largest number of values accepted in total.
|
|
std::vector< validator_ptr_t > | validators_ {} |
| | Validators and transforms, applied in order.
|
|
std::set< option_t * > | needs_ {} |
| | Options that must also appear.
|
|
std::set< option_t * > | excludes_ {} |
| | Options that must not appear alongside this one.
|
|
app_t * | parent_ {nullptr} |
| | The application this option belongs to.
|
|
callback_t | callback_ {} |
| | Writes the collected results into the bound variable.
|
|
results_t | results_ {} |
| | The raw strings collected during parsing.
|
|
results_t | proc_results_ {} |
| | The results after validation and reduction.
|
|
option_state_t | current_option_state_ {option_state_t::parsing} |
| | How far this option has progressed.
|
|
bool | allow_extra_args_ {false} |
| | Whether surplus arguments are absorbed by this option.
|
|
bool | flag_like_ {false} |
| | Whether this option behaves like a flag.
|
|
bool | run_callback_for_default_ {false} |
| | Whether the callback runs even when only the default is present.
|
|
bool | inject_separator_ {false} |
| | Whether a separator is inserted between value groups.
|
|
bool | trigger_on_result_ {false} |
| | Whether the callback runs as soon as a value is parsed.
|
|
bool | force_callback_ {false} |
| | Whether the callback runs even when the option is absent.
|
|
std::string | group_ = std::string("OPTIONS") |
| | The help group this option is listed under.
|
|
bool | required_ {false} |
| | Whether the option must appear.
|
|
bool | ignore_case_ {false} |
| | Whether name matching ignores case.
|
|
bool | ignore_underscore_ {false} |
| | Whether name matching ignores underscores.
|
|
bool | configurable_ {true} |
| | Whether the option may be set from a configuration file.
|
|
bool | disable_flag_override_ {false} |
| | Whether --no-flag style overrides are rejected.
|
|
char | delimiter_ {'\0'} |
| | Character that splits a single value into several.
|
|
bool | always_capture_default_ {false} |
| | Whether the bound value's default is captured automatically.
|
|
multi_option_policy_t | multi_option_policy_ {multi_option_policy_t::reject} |
| | What to do with surplus values.
|
|
callback_priority_t | callback_priority_ {callback_priority_t::normal} |
| | When this option's callback runs.
|