Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
CLI::Option Class Reference

#include <CLI11.hpp>

Inheritance diagram for CLI::Option:
Collaboration diagram for CLI::Option:

Public Member Functions

Basic
 Option (const Option &)=delete
 
Optionoperator= (const Option &)=delete
 
std::size_t count () const
 Count the total number of times an option was passed.
 
bool empty () const
 True if the option was not passed.
 
 operator bool () const
 This class is true if option is passed.
 
void clear ()
 Clear the parsed results (mostly for testing)
 
Setting options
Optionexpected (int value)
 Set the number of expected arguments.
 
Optionexpected (int value_min, int value_max)
 Set the range of expected arguments.
 
Optionallow_extra_args (bool value=true)
 
bool get_allow_extra_args () const
 Get the current value of allow extra args.
 
Optionrun_callback_for_default (bool value=true)
 
bool get_run_callback_for_default () const
 Get the current value of run_callback_for_default.
 
Optioncheck (Validator validator, const std::string &validator_name="")
 Adds a Validator with a built in type name.
 
Optioncheck (std::function< std::string(const std::string &)> Validator, std::string Validator_description="", std::string Validator_name="")
 Adds a Validator. Takes a const string& and returns an error message (empty if conversion/check is okay).
 
Optiontransform (Validator Validator, const std::string &Validator_name="")
 Adds a transforming Validator with a built in type name.
 
Optiontransform (const std::function< std::string(std::string)> &func, std::string transform_description="", std::string transform_name="")
 Adds a Validator-like function that can change result.
 
Optioneach (const std::function< void(std::string)> &func)
 Adds a user supplied function to run on each item passed in (communicate though lambda capture)
 
Validatorget_validator (const std::string &Validator_name="")
 Get a named Validator.
 
Validatorget_validator (int index)
 Get a Validator by index NOTE: this may not be the order of definition.
 
Optionneeds (Option *opt)
 Sets required options.
 
template<typename T = App>
Optionneeds (std::string opt_name)
 Can find a string if needed.
 
template<typename A , typename B , typename... ARG>
Optionneeds (A opt, B opt1, ARG... args)
 Any number supported, any mix of string and Opt.
 
bool remove_needs (Option *opt)
 Remove needs link from an option. Returns true if the option really was in the needs list.
 
Optionexcludes (Option *opt)
 Sets excluded options.
 
template<typename T = App>
Optionexcludes (std::string opt_name)
 Can find a string if needed.
 
template<typename A , typename B , typename... ARG>
Optionexcludes (A opt, B opt1, ARG... args)
 Any number supported, any mix of string and Opt.
 
bool remove_excludes (Option *opt)
 Remove needs link from an option. Returns true if the option really was in the needs list.
 
Optionenvname (std::string name)
 Sets environment variable to read if no option given.
 
template<typename T = App>
Optionignore_case (bool value=true)
 
template<typename T = App>
Optionignore_underscore (bool value=true)
 
Optionmulti_option_policy (MultiOptionPolicy value=MultiOptionPolicy::Throw)
 Take the last argument if given multiple times (or another policy)
 
Optiondisable_flag_override (bool value=true)
 Disable flag overrides values, e.g. –flag=is not allowed.
 
Accessors
int get_type_size () const
 The number of arguments the option expects.
 
int get_type_size_min () const
 The minimum number of arguments the option expects.
 
int get_type_size_max () const
 The maximum number of arguments the option expects.
 
std::string get_envname () const
 The environment variable associated to this value.
 
std::set< Option * > get_needs () const
 The set of options needed.
 
std::set< Option * > get_excludes () const
 The set of options excluded.
 
std::string get_default_str () const
 The default value (for help printing)
 
callback_t get_callback () const
 Get the callback function.
 
const std::vector< std::string > & get_lnames () const
 Get the long names.
 
const std::vector< std::string > & get_snames () const
 Get the short names.
 
const std::vector< std::string > & get_fnames () const
 Get the flag names with specified default values.
 
int get_expected () const
 The number of times the option expects to be included.
 
int get_expected_min () const
 The number of times the option expects to be included.
 
int get_expected_max () const
 The max number of times the option expects to be included.
 
int get_items_expected_min () const
 The total min number of expected string values to be used.
 
int get_items_expected_max () const
 Get the maximum number of items expected to be returned and used for the callback.
 
int get_items_expected () const
 The total min number of expected string values to be used.
 
bool get_positional () const
 True if the argument can be given directly.
 
bool nonpositional () const
 True if option has at least one non-positional name.
 
bool has_description () const
 True if option has description.
 
const std::string & get_description () const
 Get the description.
 
Optiondescription (std::string option_description)
 Set the description.
 
Help tools
std::string get_name (bool positional=false, bool all_options=false) const
 Gets a comma separated list of names. Will include / prefer the positional name if positional is true. If all_options is false, pick just the most descriptive name to show. Use get_name(true) to get the positional name (replaces get_pname)
 
Parser tools
void run_callback ()
 Process the callback.
 
const std::string & matching_name (const Option &other) const
 If options share any of the same names, find it.
 
bool operator== (const Option &other) const
 If options share any of the same names, they are equal (not counting positional)
 
bool check_name (std::string name) const
 Check a name. Requires "-" or "--" for short / long, supports positional name.
 
bool check_sname (std::string name) const
 Requires "-" to be removed from string.
 
bool check_lname (std::string name) const
 Requires "--" to be removed from string.
 
bool check_fname (std::string name) const
 Requires "--" to be removed from string.
 
std::string get_flag_value (const std::string &name, std::string input_value) const
 
Optionadd_result (std::string s)
 Puts a result at the end.
 
Optionadd_result (std::string s, int &results_added)
 Puts a result at the end and get a count of the number of arguments actually added.
 
Optionadd_result (std::vector< std::string > s)
 Puts a result at the end.
 
results_t results () const
 Get a copy of the results.
 
results_t reduced_results () const
 Get a copy of the results.
 
template<typename T , enable_if_t<!std::is_const< T >::value, detail::enabler > = detail::dummy>
void results (T &output) const
 Get the results as a specified type.
 
template<typename T >
T as () const
 Return the results as the specified type.
 
bool get_callback_run () const
 See if the callback has been run already.
 
- Public Member Functions inherited from CLI::OptionBase< Option >
Optiongroup (const std::string &name)
 Changes the group membership.
 
Optionrequired (bool value=true)
 Set the option as required.
 
Optionmandatory (bool value=true)
 Support Plumbum term.
 
Optionalways_capture_default (bool value=true)
 
const std::string & get_group () const
 Get the group of this option.
 
bool get_required () const
 True if this is a required option.
 
bool get_ignore_case () const
 The status of ignore case.
 
bool get_ignore_underscore () const
 The status of ignore_underscore.
 
bool get_configurable () const
 The status of configurable.
 
bool get_disable_flag_override () const
 The status of configurable.
 
char get_delimiter () const
 Get the current delimiter char.
 
bool get_always_capture_default () const
 Return true if this will automatically capture the default value for help printing.
 
MultiOptionPolicy get_multi_option_policy () const
 The status of the multi option policy.
 
Optiontake_last ()
 Set the multi option policy to take last.
 
Optiontake_first ()
 Set the multi option policy to take last.
 
Optiontake_all ()
 Set the multi option policy to take all arguments.
 
Optionjoin ()
 Set the multi option policy to join.
 
Optionjoin (char delim)
 Set the multi option policy to join with a specific delimiter.
 
Optionconfigurable (bool value=true)
 Allow in a configuration file.
 
Optiondelimiter (char value='\0')
 Allow in a configuration file.
 

Protected Member Functions

 Option (std::string option_name, std::string option_description, callback_t callback, App *parent)
 Making an option by hand is not defined, it must be made by the App class.
 
- Protected Member Functions inherited from CLI::OptionBase< Option >
void copy_to (T *other) const
 Copy the contents to another similar class (one based on OptionBase)
 

Protected Attributes

Names
std::vector< std::string > snames_ {}
 A list of the short names (-a) without the leading dashes.
 
std::vector< std::string > lnames_ {}
 A list of the long names (--long) without the leading dashes.
 
std::vector< std::pair< std::string, std::string > > default_flag_values_ {}
 
std::vector< std::string > fnames_ {}
 a list of flag names with specified default values;
 
std::string pname_ {}
 A positional name.
 
std::string envname_ {}
 If given, check the environment for this option.
 
Help
std::string description_ {}
 The description for help strings.
 
std::string default_str_ {}
 A human readable default value, either manually set, captured, or captured by default.
 
std::function< std::string()> type_name_ {[]() { return std::string(); }}
 
std::function< std::string()> default_function_ {}
 Run this function to capture a default (ignore if empty)
 
Configuration
int type_size_max_ {1}
 
int type_size_min_ {1}
 The minimum number of arguments an option should be expecting.
 
int expected_min_ {1}
 The minimum number of expected values.
 
int expected_max_ {1}
 The maximum number of expected values.
 
std::vector< Validatorvalidators_ {}
 A list of Validators to run on each value parsed.
 
std::set< Option * > needs_ {}
 A list of options that are required with this option.
 
std::set< Option * > excludes_ {}
 A list of options that are excluded with this option.
 
Other
Appparent_ {nullptr}
 Remember the parent app.
 
callback_t callback_ {}
 Options store a callback to do all the work.
 
- Protected Attributes inherited from CLI::OptionBase< Option >
std::string group_
 The group membership.
 
bool required_
 True if this is a required option.
 
bool ignore_case_
 Ignore the case when matching (option, not value)
 
bool ignore_underscore_
 Ignore underscores when matching (option, not value)
 
bool configurable_
 Allow this option to be given in a configuration file.
 
bool disable_flag_override_
 Disable overriding flag values with '=value'.
 
char delimiter_
 Specify a delimiter character for vector arguments.
 
bool always_capture_default_
 Automatically capture default value.
 
MultiOptionPolicy multi_option_policy_
 Policy for handling multiple arguments beyond the expected Max.
 

Parsing results

enum class  option_state { parsing = 0 , validated = 2 , reduced = 4 , callback_run = 6 }
 enumeration for the option state machine More...
 
results_t results_ {}
 complete Results of parsing
 
results_t proc_results_ {}
 results after reduction
 
option_state current_option_state_ {option_state::parsing}
 Whether the callback has run (needed for INI parsing)
 
bool allow_extra_args_ {false}
 Specify that extra args beyond type_size_max should be allowed.
 
bool flag_like_ {false}
 Specify that the option should act like a flag vs regular option.
 
bool run_callback_for_default_ {false}
 Control option to run the callback to set the default.
 

Custom options

Optiontype_name_fn (std::function< std::string()> typefun)
 Set the type function to run when displayed on this option.
 
Optiontype_name (std::string typeval)
 Set a custom option typestring.
 
Optiontype_size (int option_type_size)
 Set a custom option size.
 
Optiontype_size (int option_type_size_min, int option_type_size_max)
 Set a custom option type size range.
 
Optiondefault_function (const std::function< std::string()> &func)
 Set a capture function for the default. Mostly used by App.
 
Optioncapture_default_str ()
 Capture the default value from the original value (if it can be captured)
 
Optiondefault_str (std::string val)
 Set the default value string representation (does not change the contained value)
 
template<typename X >
Optiondefault_val (const X &val)
 
std::string get_type_name () const
 Get the full typename for this option.
 

Detailed Description

Definition at line 3532 of file CLI11.hpp.

Member Enumeration Documentation

◆ option_state

enum class CLI::Option::option_state
strongprotected
Enumerator
parsing 

The option is currently collecting parsed results.

validated 

the results have been validated

reduced 

a subset of results has been generated

callback_run 

the callback has been executed

Definition at line 3619 of file CLI11.hpp.

3619 {
3620 parsing = 0,
3621 validated = 2,
3622 reduced = 4,
3623 callback_run = 6,
3624 };
@ reduced
a subset of results has been generated
@ callback_run
the callback has been executed
@ validated
the results have been validated
@ parsing
The option is currently collecting parsed results.

Constructor & Destructor Documentation

◆ Option() [1/2]

CLI::Option::Option ( std::string option_name,
std::string option_description,
callback_t callback,
App * parent )
inlineprotected

Definition at line 3636 of file CLI11.hpp.

3637 : description_(std::move(option_description)), parent_(parent), callback_(std::move(callback)) {
3638 std::tie(snames_, lnames_, pname_) = detail::get_names(detail::split_names(option_name));
3639 }
std::string pname_
A positional name.
Definition CLI11.hpp:3553
std::vector< std::string > snames_
A list of the short names (-a) without the leading dashes.
Definition CLI11.hpp:3540
App * parent_
Remember the parent app.
Definition CLI11.hpp:3605
std::string description_
The description for help strings.
Definition CLI11.hpp:3563
callback_t callback_
Options store a callback to do all the work.
Definition CLI11.hpp:3608
std::vector< std::string > lnames_
A list of the long names (--long) without the leading dashes.
Definition CLI11.hpp:3543
std::vector< std::string > split_names(std::string current)
Definition CLI11.hpp:1879
std::tuple< std::vector< std::string >, std::vector< std::string >, std::string > get_names(const std::vector< std::string > &input)
Get a vector of short names, one of long names, and a single name.
Definition CLI11.hpp:1919
Here is the call graph for this function:

◆ Option() [2/2]

CLI::Option::Option ( const Option & )
delete

Member Function Documentation

◆ add_result() [1/3]

Option * CLI::Option::add_result ( std::string s)
inline

Definition at line 4223 of file CLI11.hpp.

4223 {
4224 _add_result(std::move(s), results_);
4226 return this;
4227 }
option_state current_option_state_
Whether the callback has run (needed for INI parsing)
Definition CLI11.hpp:3626
results_t results_
complete Results of parsing
Definition CLI11.hpp:3615
char * s
Here is the caller graph for this function:

◆ add_result() [2/3]

Option * CLI::Option::add_result ( std::string s,
int & results_added )
inline

Definition at line 4230 of file CLI11.hpp.

4230 {
4231 results_added = _add_result(std::move(s), results_);
4233 return this;
4234 }

◆ add_result() [3/3]

Option * CLI::Option::add_result ( std::vector< std::string > s)
inline

Definition at line 4237 of file CLI11.hpp.

4237 {
4238 for(auto &str : s) {
4239 _add_result(std::move(str), results_);
4240 }
4242 return this;
4243 }

◆ allow_extra_args()

Option * CLI::Option::allow_extra_args ( bool value = true)
inline

Set the value of allow_extra_args which allows extra value arguments on the flag or option to be included with each instance

Definition at line 3710 of file CLI11.hpp.

3710 {
3712 return this;
3713 }
bool allow_extra_args_
Specify that extra args beyond type_size_max should be allowed.
Definition CLI11.hpp:3628
#define value
Definition pkcs11.h:157
Here is the caller graph for this function:

◆ as()

template<typename T >
T CLI::Option::as ( ) const
inline

Definition at line 4300 of file CLI11.hpp.

4300 {
4301 T output;
4302 results(output);
4303 return output;
4304 }
results_t results() const
Get a copy of the results.
Definition CLI11.hpp:4246
#define T(meth, val, expected)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ capture_default_str()

Option * CLI::Option::capture_default_str ( )
inline

Definition at line 4371 of file CLI11.hpp.

4371 {
4372 if(default_function_) {
4374 }
4375 return this;
4376 }
std::string default_str_
A human readable default value, either manually set, captured, or captured by default.
Definition CLI11.hpp:3566
std::function< std::string()> default_function_
Run this function to capture a default (ignore if empty)
Definition CLI11.hpp:3574

◆ check() [1/2]

Option * CLI::Option::check ( std::function< std::string(const std::string &)> Validator,
std::string Validator_description = "",
std::string Validator_name = "" )
inline

Definition at line 3736 of file CLI11.hpp.

3738 {
3739 validators_.emplace_back(Validator, std::move(Validator_description), std::move(Validator_name));
3740 validators_.back().non_modifying();
3741 return this;
3742 }
std::vector< Validator > validators_
A list of Validators to run on each value parsed.
Definition CLI11.hpp:3592

◆ check() [2/2]

Option * CLI::Option::check ( Validator validator,
const std::string & validator_name = "" )
inline

Definition at line 3727 of file CLI11.hpp.

3727 {
3728 validator.non_modifying();
3729 validators_.push_back(std::move(validator));
3730 if(!validator_name.empty())
3731 validators_.back().name(validator_name);
3732 return this;
3733 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_fname()

bool CLI::Option::check_fname ( std::string name) const
inline

Definition at line 4170 of file CLI11.hpp.

4170 {
4171 if(fnames_.empty()) {
4172 return false;
4173 }
4174 return (detail::find_member(std::move(name), fnames_, ignore_case_, ignore_underscore_) >= 0);
4175 }
std::string name
std::vector< std::string > fnames_
a list of flag names with specified default values;
Definition CLI11.hpp:3550
std::ptrdiff_t find_member(std::string name, const std::vector< std::string > names, bool ignore_case=false, bool ignore_underscore=false)
Check if a string is a member of a list of strings and optionally ignore case or ignore underscores.
Definition CLI11.hpp:381
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_lname()

bool CLI::Option::check_lname ( std::string name) const
inline

Definition at line 4165 of file CLI11.hpp.

4165 {
4166 return (detail::find_member(std::move(name), lnames_, ignore_case_, ignore_underscore_) >= 0);
4167 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_name()

bool CLI::Option::check_name ( std::string name) const
inline

Definition at line 4140 of file CLI11.hpp.

4140 {
4141
4142 if(name.length() > 2 && name[0] == '-' && name[1] == '-')
4143 return check_lname(name.substr(2));
4144 if(name.length() > 1 && name.front() == '-')
4145 return check_sname(name.substr(1));
4146
4147 std::string local_pname = pname_;
4148 if(ignore_underscore_) {
4149 local_pname = detail::remove_underscore(local_pname);
4151 }
4152 if(ignore_case_) {
4153 local_pname = detail::to_lower(local_pname);
4155 }
4156 return name == local_pname;
4157 }
bool check_lname(std::string name) const
Requires "--" to be removed from string.
Definition CLI11.hpp:4165
bool check_sname(std::string name) const
Requires "-" to be removed from string.
Definition CLI11.hpp:4160
std::string remove_underscore(std::string str)
remove underscores from a string
Definition CLI11.hpp:344
std::string to_lower(std::string str)
Return a lower case version of a string.
Definition CLI11.hpp:336
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_sname()

bool CLI::Option::check_sname ( std::string name) const
inline

Definition at line 4160 of file CLI11.hpp.

4160 {
4161 return (detail::find_member(std::move(name), snames_, ignore_case_) >= 0);
4162 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear()

void CLI::Option::clear ( )
inline

Definition at line 3658 of file CLI11.hpp.

3658 {
3659 results_.clear();
3661 }
Here is the caller graph for this function:

◆ count()

std::size_t CLI::Option::count ( ) const
inline

Definition at line 3649 of file CLI11.hpp.

3649{ return results_.size(); }
Here is the caller graph for this function:

◆ default_function()

Option * CLI::Option::default_function ( const std::function< std::string()> & func)
inline

Definition at line 4365 of file CLI11.hpp.

4365 {
4367 return this;
4368 }

◆ default_str()

Option * CLI::Option::default_str ( std::string val)
inline

Definition at line 4379 of file CLI11.hpp.

4379 {
4380 default_str_ = std::move(val);
4381 return this;
4382 }
Here is the caller graph for this function:

◆ default_val()

template<typename X >
Option * CLI::Option::default_val ( const X & val)
inline

Set the default value and validate the results and run the callback if appropriate to set the value into the bound value only available for types that can be converted to a string

Definition at line 4386 of file CLI11.hpp.

4386 {
4387 std::string val_str = detail::to_string(val);
4388 auto old_option_state = current_option_state_;
4389 results_t old_results{std::move(results_)};
4390 results_.clear();
4391 try {
4392 add_result(val_str);
4394 run_callback(); // run callback sets the state we need to reset it again
4396 } else {
4397 _validate_results(results_);
4398 current_option_state_ = old_option_state;
4399 }
4400 } catch(const CLI::Error &) {
4401 // this should be done
4402 results_ = std::move(old_results);
4403 current_option_state_ = old_option_state;
4404 throw;
4405 }
4406 results_ = std::move(old_results);
4407 default_str_ = std::move(val_str);
4408 return this;
4409 }
All errors derive from this one.
Definition CLI11.hpp:568
bool run_callback_for_default_
Control option to run the callback to set the default.
Definition CLI11.hpp:3632
Option * add_result(std::string s)
Puts a result at the end.
Definition CLI11.hpp:4223
void run_callback()
Process the callback.
Definition CLI11.hpp:4091
auto to_string(T &&value) -> decltype(std::forward< T >(value))
Convert an object to a string (directly forward if this can become a string)
Definition CLI11.hpp:1053
std::vector< std::string > results_t
Definition CLI11.hpp:3327
Here is the call graph for this function:

◆ description()

Option * CLI::Option::description ( std::string option_description)
inline

Definition at line 4018 of file CLI11.hpp.

4018 {
4019 description_ = std::move(option_description);
4020 return this;
4021 }
Here is the caller graph for this function:

◆ disable_flag_override()

Option * CLI::Option::disable_flag_override ( bool value = true)
inline

Definition at line 3946 of file CLI11.hpp.

3946 {
3948 return this;
3949 }

◆ each()

Option * CLI::Option::each ( const std::function< void(std::string)> & func)
inline

Definition at line 3769 of file CLI11.hpp.

3769 {
3770 validators_.emplace_back(
3771 [func](std::string &inout) {
3772 func(inout);
3773 return std::string{};
3774 },
3775 std::string{});
3776 return this;
3777 }

◆ empty()

bool CLI::Option::empty ( ) const
inline

Definition at line 3652 of file CLI11.hpp.

3652{ return results_.empty(); }
Here is the caller graph for this function:

◆ envname()

Option * CLI::Option::envname ( std::string name)
inline

Definition at line 3877 of file CLI11.hpp.

3877 {
3878 envname_ = std::move(name);
3879 return this;
3880 }
std::string envname_
If given, check the environment for this option.
Definition CLI11.hpp:3556

◆ excludes() [1/3]

template<typename A , typename B , typename... ARG>
Option * CLI::Option::excludes ( A opt,
B opt1,
ARG... args )
inline

Definition at line 3860 of file CLI11.hpp.

3860 {
3861 excludes(opt);
3862 return excludes(opt1, args...);
3863 }
Option * excludes(Option *opt)
Sets excluded options.
Definition CLI11.hpp:3835
Here is the call graph for this function:

◆ excludes() [2/3]

Option * CLI::Option::excludes ( Option * opt)
inline

Definition at line 3835 of file CLI11.hpp.

3835 {
3836 if(opt == this) {
3837 throw(IncorrectConstruction("and option cannot exclude itself"));
3838 }
3839 excludes_.insert(opt);
3840
3841 // Help text should be symmetric - excluding a should exclude b
3842 opt->excludes_.insert(this);
3843
3844 // Ignoring the insert return value, excluding twice is now allowed.
3845 // (Mostly to allow both directions to be excluded by user, even though the library does it for you.)
3846
3847 return this;
3848 }
std::set< Option * > excludes_
A list of options that are excluded with this option.
Definition CLI11.hpp:3598
Here is the caller graph for this function:

◆ excludes() [3/3]

template<typename T = App>
Option * CLI::Option::excludes ( std::string opt_name)
inline

Definition at line 3851 of file CLI11.hpp.

3851 {
3852 auto opt = dynamic_cast<T *>(parent_)->get_option_no_throw(opt_name);
3853 if(opt == nullptr) {
3854 throw IncorrectConstruction::MissingOption(opt_name);
3855 }
3856 return excludes(opt);
3857 }
Here is the call graph for this function:

◆ expected() [1/2]

Option * CLI::Option::expected ( int value)
inline

Definition at line 3668 of file CLI11.hpp.

3668 {
3669 if(value < 0) {
3673 }
3674 allow_extra_args_ = true;
3675 flag_like_ = false;
3677 expected_min_ = 1;
3679 allow_extra_args_ = true;
3680 flag_like_ = false;
3681 } else {
3684 flag_like_ = (expected_min_ == 0);
3685 }
3686 return this;
3687 }
int expected_min_
The minimum number of expected values.
Definition CLI11.hpp:3587
bool flag_like_
Specify that the option should act like a flag vs regular option.
Definition CLI11.hpp:3630
int expected_max_
The maximum number of expected values.
Definition CLI11.hpp:3589
constexpr int expected_max_vector_size
Definition CLI11.hpp:176
Here is the caller graph for this function:

◆ expected() [2/2]

Option * CLI::Option::expected ( int value_min,
int value_max )
inline

Definition at line 3690 of file CLI11.hpp.

3690 {
3691 if(value_min < 0) {
3692 value_min = -value_min;
3693 }
3694
3695 if(value_max < 0) {
3697 }
3698 if(value_max < value_min) {
3699 expected_min_ = value_max;
3700 expected_max_ = value_min;
3701 } else {
3702 expected_max_ = value_max;
3703 expected_min_ = value_min;
3704 }
3705
3706 return this;
3707 }

◆ get_allow_extra_args()

bool CLI::Option::get_allow_extra_args ( ) const
inline

Definition at line 3715 of file CLI11.hpp.

3715{ return allow_extra_args_; }
Here is the caller graph for this function:

◆ get_callback()

callback_t CLI::Option::get_callback ( ) const
inline

Definition at line 3975 of file CLI11.hpp.

3975{ return callback_; }

◆ get_callback_run()

bool CLI::Option::get_callback_run ( ) const
inline

Definition at line 4307 of file CLI11.hpp.

Here is the caller graph for this function:

◆ get_default_str()

std::string CLI::Option::get_default_str ( ) const
inline

Definition at line 3972 of file CLI11.hpp.

3972{ return default_str_; }
Here is the caller graph for this function:

◆ get_description()

const std::string & CLI::Option::get_description ( ) const
inline

Definition at line 4015 of file CLI11.hpp.

4015{ return description_; }
Here is the caller graph for this function:

◆ get_envname()

std::string CLI::Option::get_envname ( ) const
inline

Definition at line 3963 of file CLI11.hpp.

3963{ return envname_; }
Here is the caller graph for this function:

◆ get_excludes()

std::set< Option * > CLI::Option::get_excludes ( ) const
inline

Definition at line 3969 of file CLI11.hpp.

3969{ return excludes_; }
Here is the caller graph for this function:

◆ get_expected()

int CLI::Option::get_expected ( ) const
inline

Definition at line 3987 of file CLI11.hpp.

3987{ return expected_min_; }
Here is the caller graph for this function:

◆ get_expected_max()

int CLI::Option::get_expected_max ( ) const
inline

Definition at line 3992 of file CLI11.hpp.

3992{ return expected_max_; }
Here is the caller graph for this function:

◆ get_expected_min()

int CLI::Option::get_expected_min ( ) const
inline

Definition at line 3990 of file CLI11.hpp.

3990{ return expected_min_; }
Here is the caller graph for this function:

◆ get_flag_value()

std::string CLI::Option::get_flag_value ( const std::string & name,
std::string input_value ) const
inline

Get the value that goes for a flag, nominally gets the default value but allows for overrides if not disabled

Definition at line 4179 of file CLI11.hpp.

4179 {
4180 static const std::string trueString{"true"};
4181 static const std::string falseString{"false"};
4182 static const std::string emptyString{"{}"};
4183 // check for disable flag override_
4185 if(!((input_value.empty()) || (input_value == emptyString))) {
4187 if(default_ind >= 0) {
4188 // We can static cast this to std::size_t because it is more than 0 in this block
4189 if(default_flag_values_[static_cast<std::size_t>(default_ind)].second != input_value) {
4190 throw(ArgumentMismatch::FlagOverride(name));
4191 }
4192 } else {
4193 if(input_value != trueString) {
4194 throw(ArgumentMismatch::FlagOverride(name));
4195 }
4196 }
4197 }
4198 }
4200 if((input_value.empty()) || (input_value == emptyString)) {
4201 if(flag_like_) {
4202 return (ind < 0) ? trueString : default_flag_values_[static_cast<std::size_t>(ind)].second;
4203 } else {
4204 return (ind < 0) ? default_str_ : default_flag_values_[static_cast<std::size_t>(ind)].second;
4205 }
4206 }
4207 if(ind < 0) {
4208 return input_value;
4209 }
4210 if(default_flag_values_[static_cast<std::size_t>(ind)].second == falseString) {
4211 try {
4212 auto val = detail::to_flag_value(input_value);
4213 return (val == 1) ? falseString : (val == (-1) ? trueString : std::to_string(-val));
4214 } catch(const std::invalid_argument &) {
4215 return input_value;
4216 }
4217 } else {
4218 return input_value;
4219 }
4220 }
std::vector< std::pair< std::string, std::string > > default_flag_values_
Definition CLI11.hpp:3547
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_fnames()

const std::vector< std::string > & CLI::Option::get_fnames ( ) const
inline

Definition at line 3984 of file CLI11.hpp.

3984{ return fnames_; }

◆ get_items_expected()

int CLI::Option::get_items_expected ( ) const
inline

Definition at line 4003 of file CLI11.hpp.

4003{ return get_items_expected_min(); }
int get_items_expected_min() const
The total min number of expected string values to be used.
Definition CLI11.hpp:3995
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_items_expected_max()

int CLI::Option::get_items_expected_max ( ) const
inline

Definition at line 3998 of file CLI11.hpp.

3998 {
3999 int t = type_size_max_;
4001 }
int type_size_max_
Definition CLI11.hpp:3582
std::enable_if< std::is_integral< T >::value, bool >::type checked_multiply(T &a, T b)
Performs a *= b; if it doesn't cause integer overflow. Returns false otherwise.
Definition CLI11.hpp:2684
Here is the call graph for this function:

◆ get_items_expected_min()

int CLI::Option::get_items_expected_min ( ) const
inline

Definition at line 3995 of file CLI11.hpp.

3995{ return type_size_min_ * expected_min_; }
int type_size_min_
The minimum number of arguments an option should be expecting.
Definition CLI11.hpp:3584
Here is the caller graph for this function:

◆ get_lnames()

const std::vector< std::string > & CLI::Option::get_lnames ( ) const
inline

Definition at line 3978 of file CLI11.hpp.

3978{ return lnames_; }
Here is the caller graph for this function:

◆ get_name()

std::string CLI::Option::get_name ( bool positional = false,
bool all_options = false ) const
inline

The all list will never include a positional unless asked or that's the only name.

Definition at line 4031 of file CLI11.hpp.

4033 {
4034 if(get_group().empty())
4035 return {}; // Hidden
4036
4037 if(all_options) {
4038
4039 std::vector<std::string> name_list;
4040
4042 if((positional && (!pname_.empty())) || (snames_.empty() && lnames_.empty())) {
4043 name_list.push_back(pname_);
4044 }
4045 if((get_items_expected() == 0) && (!fnames_.empty())) {
4046 for(const std::string &sname : snames_) {
4047 name_list.push_back("-" + sname);
4048 if(check_fname(sname)) {
4049 name_list.back() += "{" + get_flag_value(sname, "") + "}";
4050 }
4051 }
4052
4053 for(const std::string &lname : lnames_) {
4054 name_list.push_back("--" + lname);
4055 if(check_fname(lname)) {
4056 name_list.back() += "{" + get_flag_value(lname, "") + "}";
4057 }
4058 }
4059 } else {
4060 for(const std::string &sname : snames_)
4061 name_list.push_back("-" + sname);
4062
4063 for(const std::string &lname : lnames_)
4064 name_list.push_back("--" + lname);
4065 }
4066
4067 return detail::join(name_list);
4068 }
4069
4070 // This returns the positional name no matter what
4071 if(positional)
4072 return pname_;
4073
4074 // Prefer long name
4075 if(!lnames_.empty())
4076 return std::string(2, '-') + lnames_[0];
4077
4078 // Or short name if no long name
4079 if(!snames_.empty())
4080 return std::string(1, '-') + snames_[0];
4081
4082 // If positional is the only name, it's okay to use that
4083 return pname_;
4084 }
const std::string & get_group() const
Definition CLI11.hpp:3416
bool check_fname(std::string name) const
Requires "--" to be removed from string.
Definition CLI11.hpp:4170
std::string get_flag_value(const std::string &name, std::string input_value) const
Definition CLI11.hpp:4179
bool empty() const
True if the option was not passed.
Definition CLI11.hpp:3652
int get_items_expected() const
The total min number of expected string values to be used.
Definition CLI11.hpp:4003
std::string join(const T &v, std::string delim=",")
Simple function to join a string.
Definition CLI11.hpp:196
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_needs()

std::set< Option * > CLI::Option::get_needs ( ) const
inline

Definition at line 3966 of file CLI11.hpp.

3966{ return needs_; }
std::set< Option * > needs_
A list of options that are required with this option.
Definition CLI11.hpp:3595
Here is the caller graph for this function:

◆ get_positional()

bool CLI::Option::get_positional ( ) const
inline

Definition at line 4006 of file CLI11.hpp.

4006{ return pname_.length() > 0; }
Here is the caller graph for this function:

◆ get_run_callback_for_default()

bool CLI::Option::get_run_callback_for_default ( ) const
inline

Definition at line 3724 of file CLI11.hpp.

3724{ return run_callback_for_default_; }

◆ get_snames()

const std::vector< std::string > & CLI::Option::get_snames ( ) const
inline

Definition at line 3981 of file CLI11.hpp.

3981{ return snames_; }

◆ get_type_name()

std::string CLI::Option::get_type_name ( ) const
inline

Definition at line 4412 of file CLI11.hpp.

4412 {
4413 std::string full_type_name = type_name_();
4414 if(!validators_.empty()) {
4415 for(auto &Validator : validators_) {
4416 std::string vtype = Validator.get_description();
4417 if(!vtype.empty()) {
4418 full_type_name += ":" + vtype;
4419 }
4420 }
4421 }
4422 return full_type_name;
4423 }
std::function< std::string()> type_name_
Definition CLI11.hpp:3571
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_type_size()

int CLI::Option::get_type_size ( ) const
inline

Definition at line 3955 of file CLI11.hpp.

3955{ return type_size_min_; }
Here is the caller graph for this function:

◆ get_type_size_max()

int CLI::Option::get_type_size_max ( ) const
inline

Definition at line 3960 of file CLI11.hpp.

3960{ return type_size_max_; }
Here is the caller graph for this function:

◆ get_type_size_min()

int CLI::Option::get_type_size_min ( ) const
inline

Definition at line 3958 of file CLI11.hpp.

3958{ return type_size_min_; }
Here is the caller graph for this function:

◆ get_validator() [1/2]

Validator * CLI::Option::get_validator ( const std::string & Validator_name = "")
inline

Definition at line 3779 of file CLI11.hpp.

3779 {
3780 for(auto &Validator : validators_) {
3781 if(Validator_name == Validator.get_name()) {
3782 return &Validator;
3783 }
3784 }
3785 if((Validator_name.empty()) && (!validators_.empty())) {
3786 return &(validators_.front());
3787 }
3788 throw OptionNotFound(std::string{"Validator "} + Validator_name + " Not Found");
3789 }
Here is the call graph for this function:

◆ get_validator() [2/2]

Validator * CLI::Option::get_validator ( int index)
inline

Definition at line 3792 of file CLI11.hpp.

3792 {
3793 // This is an signed int so that it is not equivalent to a pointer.
3794 if(index >= 0 && index < static_cast<int>(validators_.size())) {
3795 return &(validators_[static_cast<decltype(validators_)::size_type>(index)]);
3796 }
3797 throw OptionNotFound("Validator index is not valid");
3798 }

◆ has_description()

bool CLI::Option::has_description ( ) const
inline

Definition at line 4012 of file CLI11.hpp.

4012{ return description_.length() > 0; }
Here is the caller graph for this function:

◆ ignore_case()

template<typename T = App>
Option * CLI::Option::ignore_case ( bool value = true)
inline

Ignore case

The template hides the fact that we don't have the definition of App yet. You are never expected to add an argument to the template here.

Definition at line 3886 of file CLI11.hpp.

3886 {
3887 if(!ignore_case_ && value) {
3889 auto *parent = dynamic_cast<T *>(parent_);
3890 for(const Option_p &opt : parent->options_) {
3891 if(opt.get() == this) {
3892 continue;
3893 }
3894 auto &omatch = opt->matching_name(*this);
3895 if(!omatch.empty()) {
3896 ignore_case_ = false;
3897 throw OptionAlreadyAdded("adding ignore case caused a name conflict with " + omatch);
3898 }
3899 }
3900 } else {
3902 }
3903 return this;
3904 }
std::unique_ptr< Option > Option_p
Definition CLI11.hpp:3334

◆ ignore_underscore()

template<typename T = App>
Option * CLI::Option::ignore_underscore ( bool value = true)
inline

Ignore underscores in the option names

The template hides the fact that we don't have the definition of App yet. You are never expected to add an argument to the template here.

Definition at line 3910 of file CLI11.hpp.

3910 {
3911
3912 if(!ignore_underscore_ && value) {
3914 auto *parent = dynamic_cast<T *>(parent_);
3915 for(const Option_p &opt : parent->options_) {
3916 if(opt.get() == this) {
3917 continue;
3918 }
3919 auto &omatch = opt->matching_name(*this);
3920 if(!omatch.empty()) {
3921 ignore_underscore_ = false;
3922 throw OptionAlreadyAdded("adding ignore underscore caused a name conflict with " + omatch);
3923 }
3924 }
3925 } else {
3927 }
3928 return this;
3929 }

◆ matching_name()

const std::string & CLI::Option::matching_name ( const Option & other) const
inline

Definition at line 4116 of file CLI11.hpp.

4116 {
4117 static const std::string estring;
4118 for(const std::string &sname : snames_)
4119 if(other.check_sname(sname))
4120 return sname;
4121 for(const std::string &lname : lnames_)
4122 if(other.check_lname(lname))
4123 return lname;
4124
4125 if(ignore_case_ ||
4126 ignore_underscore_) { // We need to do the inverse, in case we are ignore_case or ignore underscore
4127 for(const std::string &sname : other.snames_)
4128 if(check_sname(sname))
4129 return sname;
4130 for(const std::string &lname : other.lnames_)
4131 if(check_lname(lname))
4132 return lname;
4133 }
4134 return estring;
4135 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ multi_option_policy()

Option * CLI::Option::multi_option_policy ( MultiOptionPolicy value = MultiOptionPolicy::Throw)
inline

Definition at line 3932 of file CLI11.hpp.

3932 {
3935 expected_min_ > 1) { // this bizarre condition is to maintain backwards compatibility
3936 // with the previous behavior of expected_ with vectors
3938 }
3941 }
3942 return this;
3943 }
MultiOptionPolicy multi_option_policy_
Definition CLI11.hpp:3375
@ Throw
Throw an error if any extra arguments were given.
Here is the caller graph for this function:

◆ needs() [1/3]

template<typename A , typename B , typename... ARG>
Option * CLI::Option::needs ( A opt,
B opt1,
ARG... args )
inline

Definition at line 3818 of file CLI11.hpp.

3818 {
3819 needs(opt);
3820 return needs(opt1, args...);
3821 }
Option * needs(Option *opt)
Sets required options.
Definition CLI11.hpp:3801
Here is the call graph for this function:

◆ needs() [2/3]

Option * CLI::Option::needs ( Option * opt)
inline

Definition at line 3801 of file CLI11.hpp.

3801 {
3802 if(opt != this) {
3803 needs_.insert(opt);
3804 }
3805 return this;
3806 }
Here is the caller graph for this function:

◆ needs() [3/3]

template<typename T = App>
Option * CLI::Option::needs ( std::string opt_name)
inline

Definition at line 3809 of file CLI11.hpp.

3809 {
3810 auto opt = dynamic_cast<T *>(parent_)->get_option_no_throw(opt_name);
3811 if(opt == nullptr) {
3812 throw IncorrectConstruction::MissingOption(opt_name);
3813 }
3814 return needs(opt);
3815 }
Here is the call graph for this function:

◆ nonpositional()

bool CLI::Option::nonpositional ( ) const
inline

Definition at line 4009 of file CLI11.hpp.

4009{ return (snames_.size() + lnames_.size()) > 0; }
Here is the caller graph for this function:

◆ operator bool()

CLI::Option::operator bool ( ) const
inlineexplicit

Definition at line 3655 of file CLI11.hpp.

3655{ return !empty(); }
Here is the call graph for this function:

◆ operator=()

Option & CLI::Option::operator= ( const Option & )
delete

◆ operator==()

bool CLI::Option::operator== ( const Option & other) const
inline

Definition at line 4137 of file CLI11.hpp.

4137{ return !matching_name(other).empty(); }
const std::string & matching_name(const Option &other) const
If options share any of the same names, find it.
Definition CLI11.hpp:4116
Here is the call graph for this function:

◆ reduced_results()

results_t CLI::Option::reduced_results ( ) const
inline

Definition at line 4249 of file CLI11.hpp.

4249 {
4253 res = results_;
4254 _validate_results(res);
4255 }
4256 if(!res.empty()) {
4257 results_t extra;
4258 _reduce_results(extra, res);
4259 if(!extra.empty()) {
4260 res = std::move(extra);
4261 }
4262 }
4263 }
4264 return res;
4265 }
results_t proc_results_
results after reduction
Definition CLI11.hpp:3617
Here is the caller graph for this function:

◆ remove_excludes()

bool CLI::Option::remove_excludes ( Option * opt)
inline

Definition at line 3866 of file CLI11.hpp.

3866 {
3867 auto iterator = std::find(std::begin(excludes_), std::end(excludes_), opt);
3868
3869 if(iterator == std::end(excludes_)) {
3870 return false;
3871 }
3872 excludes_.erase(iterator);
3873 return true;
3874 }

◆ remove_needs()

bool CLI::Option::remove_needs ( Option * opt)
inline

Definition at line 3824 of file CLI11.hpp.

3824 {
3825 auto iterator = std::find(std::begin(needs_), std::end(needs_), opt);
3826
3827 if(iterator == std::end(needs_)) {
3828 return false;
3829 }
3830 needs_.erase(iterator);
3831 return true;
3832 }

◆ results() [1/2]

results_t CLI::Option::results ( ) const
inline

Definition at line 4246 of file CLI11.hpp.

4246{ return results_; }
Here is the caller graph for this function:

◆ results() [2/2]

template<typename T , enable_if_t<!std::is_const< T >::value, detail::enabler > = detail::dummy>
void CLI::Option::results ( T & output) const
inline

Definition at line 4269 of file CLI11.hpp.

4269 {
4270 bool retval;
4271 if(current_option_state_ >= option_state::reduced || (results_.size() == 1 && validators_.empty())) {
4272 const results_t &res = (proc_results_.empty()) ? results_ : proc_results_;
4274 } else {
4275 results_t res;
4276 if(results_.empty()) {
4277 if(!default_str_.empty()) {
4278 //_add_results takes an rvalue only
4279 _add_result(std::string(default_str_), res);
4280 _validate_results(res);
4281 results_t extra;
4282 _reduce_results(extra, res);
4283 if(!extra.empty()) {
4284 res = std::move(extra);
4285 }
4286 } else {
4287 res.emplace_back();
4288 }
4289 } else {
4290 res = reduced_results();
4291 }
4293 }
4294 if(!retval) {
4296 }
4297 }
results_t reduced_results() const
Get a copy of the results.
Definition CLI11.hpp:4249
std::string get_name(bool positional=false, bool all_options=false) const
Gets a comma separated list of names. Will include / prefer the positional name if positional is true...
Definition CLI11.hpp:4031
return retval
Definition CLI11.hpp:1754
bool lexical_conversion(const std::vector< std ::string > &strings, T &output)
Conversion for tuples.
Definition CLI11.hpp:1759
Here is the call graph for this function:

◆ run_callback()

void CLI::Option::run_callback ( )
inline

Definition at line 4091 of file CLI11.hpp.

4091 {
4092
4094 _validate_results(results_);
4096 }
4097
4099 _reduce_results(proc_results_, results_);
4101 }
4104 if(!(callback_)) {
4105 return;
4106 }
4107 const results_t &send_results = proc_results_.empty() ? results_ : proc_results_;
4108 bool local_result = callback_(send_results);
4109
4110 if(!local_result)
4112 }
4113 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ run_callback_for_default()

Option * CLI::Option::run_callback_for_default ( bool value = true)
inline

Set the value of run_callback_for_default which controls whether the callback function should be called to set the default This is controlled automatically but could be manipulated by the user.

Definition at line 3719 of file CLI11.hpp.

3719 {
3721 return this;
3722 }
Here is the caller graph for this function:

◆ transform() [1/2]

Option * CLI::Option::transform ( const std::function< std::string(std::string)> & func,
std::string transform_description = "",
std::string transform_name = "" )
inline

Definition at line 3753 of file CLI11.hpp.

3755 {
3756 validators_.insert(validators_.begin(),
3757 Validator(
3758 [func](std::string &val) {
3759 val = func(val);
3760 return std::string{};
3761 },
3762 std::move(transform_description),
3763 std::move(transform_name)));
3764
3765 return this;
3766 }

◆ transform() [2/2]

Option * CLI::Option::transform ( Validator Validator,
const std::string & Validator_name = "" )
inline

Definition at line 3745 of file CLI11.hpp.

3745 {
3746 validators_.insert(validators_.begin(), std::move(Validator));
3747 if(!Validator_name.empty())
3748 validators_.front().name(Validator_name);
3749 return this;
3750 }

◆ type_name()

Option * CLI::Option::type_name ( std::string typeval)
inline

Definition at line 4320 of file CLI11.hpp.

4320 {
4321 type_name_fn([typeval]() { return typeval; });
4322 return this;
4323 }
Option * type_name_fn(std::function< std::string()> typefun)
Set the type function to run when displayed on this option.
Definition CLI11.hpp:4314
Here is the call graph for this function:
Here is the caller graph for this function:

◆ type_name_fn()

Option * CLI::Option::type_name_fn ( std::function< std::string()> typefun)
inline

Definition at line 4314 of file CLI11.hpp.

4314 {
4315 type_name_ = std::move(typefun);
4316 return this;
4317 }
Here is the caller graph for this function:

◆ type_size() [1/2]

Option * CLI::Option::type_size ( int option_type_size)
inline

Definition at line 4326 of file CLI11.hpp.

4326 {
4327 if(option_type_size < 0) {
4328 // this section is included for backwards compatibility
4329 type_size_max_ = -option_type_size;
4330 type_size_min_ = -option_type_size;
4332 } else {
4333 type_size_max_ = option_type_size;
4335 type_size_min_ = option_type_size;
4336 }
4337 if(type_size_max_ == 0)
4338 required_ = false;
4339 }
4340 return this;
4341 }
Here is the caller graph for this function:

◆ type_size() [2/2]

Option * CLI::Option::type_size ( int option_type_size_min,
int option_type_size_max )
inline

Definition at line 4343 of file CLI11.hpp.

4343 {
4344 if(option_type_size_min < 0 || option_type_size_max < 0) {
4345 // this section is included for backwards compatibility
4347 option_type_size_min = (std::abs)(option_type_size_min);
4348 option_type_size_max = (std::abs)(option_type_size_max);
4349 }
4350
4351 if(option_type_size_min > option_type_size_max) {
4352 type_size_max_ = option_type_size_min;
4353 type_size_min_ = option_type_size_max;
4354 } else {
4355 type_size_min_ = option_type_size_min;
4356 type_size_max_ = option_type_size_max;
4357 }
4358 if(type_size_max_ == 0) {
4359 required_ = false;
4360 }
4361 return this;
4362 }

Member Data Documentation

◆ allow_extra_args_

bool CLI::Option::allow_extra_args_ {false}
protected

Definition at line 3628 of file CLI11.hpp.

3628{false};

◆ callback_

callback_t CLI::Option::callback_ {}
protected

Definition at line 3608 of file CLI11.hpp.

3608{};

◆ current_option_state_

option_state CLI::Option::current_option_state_ {option_state::parsing}
protected

Definition at line 3626 of file CLI11.hpp.

◆ default_flag_values_

std::vector<std::pair<std::string, std::string> > CLI::Option::default_flag_values_ {}
protected

A list of the flag names with the appropriate default value, the first part of the pair should be duplicates of what is in snames or lnames but will trigger a particular response on a flag

Definition at line 3547 of file CLI11.hpp.

3547{};

◆ default_function_

std::function<std::string()> CLI::Option::default_function_ {}
protected

Definition at line 3574 of file CLI11.hpp.

3574{};

◆ default_str_

std::string CLI::Option::default_str_ {}
protected

Definition at line 3566 of file CLI11.hpp.

3566{};

◆ description_

std::string CLI::Option::description_ {}
protected

Definition at line 3563 of file CLI11.hpp.

3563{};

◆ envname_

std::string CLI::Option::envname_ {}
protected

Definition at line 3556 of file CLI11.hpp.

3556{};

◆ excludes_

std::set<Option *> CLI::Option::excludes_ {}
protected

Definition at line 3598 of file CLI11.hpp.

3598{};

◆ expected_max_

int CLI::Option::expected_max_ {1}
protected

Definition at line 3589 of file CLI11.hpp.

3589{1};

◆ expected_min_

int CLI::Option::expected_min_ {1}
protected

Definition at line 3587 of file CLI11.hpp.

3587{1};

◆ flag_like_

bool CLI::Option::flag_like_ {false}
protected

Definition at line 3630 of file CLI11.hpp.

3630{false};

◆ fnames_

std::vector<std::string> CLI::Option::fnames_ {}
protected

Definition at line 3550 of file CLI11.hpp.

3550{};

◆ lnames_

std::vector<std::string> CLI::Option::lnames_ {}
protected

Definition at line 3543 of file CLI11.hpp.

3543{};

◆ needs_

std::set<Option *> CLI::Option::needs_ {}
protected

Definition at line 3595 of file CLI11.hpp.

3595{};

◆ parent_

App* CLI::Option::parent_ {nullptr}
protected

Definition at line 3605 of file CLI11.hpp.

3605{nullptr};

◆ pname_

std::string CLI::Option::pname_ {}
protected

Definition at line 3553 of file CLI11.hpp.

3553{};

◆ proc_results_

results_t CLI::Option::proc_results_ {}
protected

Definition at line 3617 of file CLI11.hpp.

3617{};

◆ results_

results_t CLI::Option::results_ {}
protected

Definition at line 3615 of file CLI11.hpp.

3615{};

◆ run_callback_for_default_

bool CLI::Option::run_callback_for_default_ {false}
protected

Definition at line 3632 of file CLI11.hpp.

3632{false};

◆ snames_

std::vector<std::string> CLI::Option::snames_ {}
protected

Definition at line 3540 of file CLI11.hpp.

3540{};

◆ type_name_

std::function<std::string()> CLI::Option::type_name_ {[]() { return std::string(); }}
protected

A human readable type value, set when App creates this

This is a lambda function so "types" can be dynamic, such as when a set prints its contents.

Definition at line 3571 of file CLI11.hpp.

3571{[]() { return std::string(); }};

◆ type_size_max_

int CLI::Option::type_size_max_ {1}
protected

The number of arguments that make up one option. max is the nominal type size, min is the minimum number of strings

Definition at line 3582 of file CLI11.hpp.

3582{1};

◆ type_size_min_

int CLI::Option::type_size_min_ {1}
protected

Definition at line 3584 of file CLI11.hpp.

3584{1};

◆ validators_

std::vector<Validator> CLI::Option::validators_ {}
protected

Definition at line 3592 of file CLI11.hpp.

3592{};

The documentation for this class was generated from the following file: