Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
CLI::OptionBase< CRTP > Class Template Reference

#include <CLI11.hpp>

Collaboration diagram for CLI::OptionBase< CRTP >:

Public Member Functions

CRTP * group (const std::string &name)
 Changes the group membership.
 
CRTP * required (bool value=true)
 Set the option as required.
 
CRTP * mandatory (bool value=true)
 Support Plumbum term.
 
CRTP * always_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.
 
CRTP * take_last ()
 Set the multi option policy to take last.
 
CRTP * take_first ()
 Set the multi option policy to take last.
 
CRTP * take_all ()
 Set the multi option policy to take all arguments.
 
CRTP * join ()
 Set the multi option policy to join.
 
CRTP * join (char delim)
 Set the multi option policy to join with a specific delimiter.
 
CRTP * configurable (bool value=true)
 Allow in a configuration file.
 
CRTP * delimiter (char value='\0')
 Allow in a configuration file.
 

Protected Member Functions

template<typename T >
void copy_to (T *other) const
 Copy the contents to another similar class (one based on OptionBase)
 

Protected Attributes

std::string group_ = std::string("Options")
 The group membership.
 
bool required_ {false}
 True if this is a required option.
 
bool ignore_case_ {false}
 Ignore the case when matching (option, not value)
 
bool ignore_underscore_ {false}
 Ignore underscores when matching (option, not value)
 
bool configurable_ {true}
 Allow this option to be given in a configuration file.
 
bool disable_flag_override_ {false}
 Disable overriding flag values with '=value'.
 
char delimiter_ {'\0'}
 Specify a delimiter character for vector arguments.
 
bool always_capture_default_ {false}
 Automatically capture default value.
 
MultiOptionPolicy multi_option_policy_ {MultiOptionPolicy::Throw}
 Policy for handling multiple arguments beyond the expected Max.
 

Detailed Description

template<typename CRTP>
class CLI::OptionBase< CRTP >

This is the CRTP base class for Option and OptionDefaults. It was designed this way to share parts of the class; an OptionDefaults can copy to an Option.

Definition at line 3346 of file CLI11.hpp.

Member Function Documentation

◆ always_capture_default()

template<typename CRTP >
CRTP * CLI::OptionBase< CRTP >::always_capture_default ( bool value = true)
inline

Definition at line 3408 of file CLI11.hpp.

3408 {
3410 return static_cast<CRTP *>(this);
3411 }
bool always_capture_default_
Automatically capture default value.
Definition CLI11.hpp:3372
#define value
Definition pkcs11.h:157

◆ configurable()

template<typename CRTP >
CRTP * CLI::OptionBase< CRTP >::configurable ( bool value = true)
inline

Definition at line 3481 of file CLI11.hpp.

3481 {
3483 return static_cast<CRTP *>(this);
3484 }
bool configurable_
Allow this option to be given in a configuration file.
Definition CLI11.hpp:3363
Here is the caller graph for this function:

◆ copy_to()

template<typename CRTP >
template<typename T >
void CLI::OptionBase< CRTP >::copy_to ( T * other) const
inlineprotected

Definition at line 3378 of file CLI11.hpp.

3378 {
3379 other->group(group_);
3380 other->required(required_);
3381 other->ignore_case(ignore_case_);
3382 other->ignore_underscore(ignore_underscore_);
3383 other->configurable(configurable_);
3384 other->disable_flag_override(disable_flag_override_);
3385 other->delimiter(delimiter_);
3386 other->always_capture_default(always_capture_default_);
3387 other->multi_option_policy(multi_option_policy_);
3388 }
MultiOptionPolicy multi_option_policy_
Policy for handling multiple arguments beyond the expected Max.
Definition CLI11.hpp:3375
bool ignore_case_
Ignore the case when matching (option, not value)
Definition CLI11.hpp:3357
bool disable_flag_override_
Disable overriding flag values with '=value'.
Definition CLI11.hpp:3366
bool required_
True if this is a required option.
Definition CLI11.hpp:3354
char delimiter_
Specify a delimiter character for vector arguments.
Definition CLI11.hpp:3369
std::string group_
The group membership.
Definition CLI11.hpp:3351
bool ignore_underscore_
Ignore underscores when matching (option, not value)
Definition CLI11.hpp:3360

◆ delimiter()

template<typename CRTP >
CRTP * CLI::OptionBase< CRTP >::delimiter ( char value = '\0')
inline

Definition at line 3487 of file CLI11.hpp.

3487 {
3488 delimiter_ = value;
3489 return static_cast<CRTP *>(this);
3490 }
Here is the caller graph for this function:

◆ get_always_capture_default()

template<typename CRTP >
bool CLI::OptionBase< CRTP >::get_always_capture_default ( ) const
inline

Definition at line 3437 of file CLI11.hpp.

3437{ return always_capture_default_; }

◆ get_configurable()

template<typename CRTP >
bool CLI::OptionBase< CRTP >::get_configurable ( ) const
inline

Definition at line 3428 of file CLI11.hpp.

3428{ return configurable_; }
Here is the caller graph for this function:

◆ get_delimiter()

template<typename CRTP >
char CLI::OptionBase< CRTP >::get_delimiter ( ) const
inline

Definition at line 3434 of file CLI11.hpp.

3434{ return delimiter_; }

◆ get_disable_flag_override()

template<typename CRTP >
bool CLI::OptionBase< CRTP >::get_disable_flag_override ( ) const
inline

Definition at line 3431 of file CLI11.hpp.

3431{ return disable_flag_override_; }

◆ get_group()

template<typename CRTP >
const std::string & CLI::OptionBase< CRTP >::get_group ( ) const
inline

Definition at line 3416 of file CLI11.hpp.

3416{ return group_; }
Here is the caller graph for this function:

◆ get_ignore_case()

template<typename CRTP >
bool CLI::OptionBase< CRTP >::get_ignore_case ( ) const
inline

Definition at line 3422 of file CLI11.hpp.

3422{ return ignore_case_; }

◆ get_ignore_underscore()

template<typename CRTP >
bool CLI::OptionBase< CRTP >::get_ignore_underscore ( ) const
inline

Definition at line 3425 of file CLI11.hpp.

3425{ return ignore_underscore_; }

◆ get_multi_option_policy()

template<typename CRTP >
MultiOptionPolicy CLI::OptionBase< CRTP >::get_multi_option_policy ( ) const
inline

Definition at line 3440 of file CLI11.hpp.

3440{ return multi_option_policy_; }

◆ get_required()

template<typename CRTP >
bool CLI::OptionBase< CRTP >::get_required ( ) const
inline

Definition at line 3419 of file CLI11.hpp.

3419{ return required_; }
Here is the caller graph for this function:

◆ group()

template<typename CRTP >
CRTP * CLI::OptionBase< CRTP >::group ( const std::string & name)
inline

Definition at line 3394 of file CLI11.hpp.

3394 {
3395 group_ = name;
3396 return static_cast<CRTP *>(this);
3397 }
std::string name

◆ join() [1/2]

template<typename CRTP >
CRTP * CLI::OptionBase< CRTP >::join ( )
inline

Definition at line 3466 of file CLI11.hpp.

3466 {
3467 auto self = static_cast<CRTP *>(this);
3468 self->multi_option_policy(MultiOptionPolicy::Join);
3469 return self;
3470 }
@ Join
merge all the arguments together into a single string via the delimiter character default(' ')
@ self
the connection is to itself
Definition protocol.hpp:48

◆ join() [2/2]

template<typename CRTP >
CRTP * CLI::OptionBase< CRTP >::join ( char delim)
inline

Definition at line 3473 of file CLI11.hpp.

3473 {
3474 auto self = static_cast<CRTP *>(this);
3475 self->delimiter_ = delim;
3476 self->multi_option_policy(MultiOptionPolicy::Join);
3477 return self;
3478 }

◆ mandatory()

template<typename CRTP >
CRTP * CLI::OptionBase< CRTP >::mandatory ( bool value = true)
inline

Definition at line 3406 of file CLI11.hpp.

3406{ return required(value); }
CRTP * required(bool value=true)
Set the option as required.
Definition CLI11.hpp:3400
Here is the call graph for this function:

◆ required()

template<typename CRTP >
CRTP * CLI::OptionBase< CRTP >::required ( bool value = true)
inline

Definition at line 3400 of file CLI11.hpp.

3400 {
3401 required_ = value;
3402 return static_cast<CRTP *>(this);
3403 }
Here is the caller graph for this function:

◆ take_all()

template<typename CRTP >
CRTP * CLI::OptionBase< CRTP >::take_all ( )
inline

Definition at line 3459 of file CLI11.hpp.

3459 {
3460 auto self = static_cast<CRTP *>(this);
3461 self->multi_option_policy(MultiOptionPolicy::TakeAll);
3462 return self;
3463 }
@ TakeAll
just get all the passed argument regardless

◆ take_first()

template<typename CRTP >
CRTP * CLI::OptionBase< CRTP >::take_first ( )
inline

Definition at line 3452 of file CLI11.hpp.

3452 {
3453 auto self = static_cast<CRTP *>(this);
3454 self->multi_option_policy(MultiOptionPolicy::TakeFirst);
3455 return self;
3456 }
@ TakeFirst
take only the first Expected number of arguments

◆ take_last()

template<typename CRTP >
CRTP * CLI::OptionBase< CRTP >::take_last ( )
inline

Definition at line 3445 of file CLI11.hpp.

3445 {
3446 auto self = static_cast<CRTP *>(this);
3447 self->multi_option_policy(MultiOptionPolicy::TakeLast);
3448 return self;
3449 }
@ TakeLast
take only the last Expected number of arguments

Member Data Documentation

◆ always_capture_default_

template<typename CRTP >
bool CLI::OptionBase< CRTP >::always_capture_default_ {false}
protected

Definition at line 3372 of file CLI11.hpp.

3372{false};

◆ configurable_

template<typename CRTP >
bool CLI::OptionBase< CRTP >::configurable_ {true}
protected

Definition at line 3363 of file CLI11.hpp.

3363{true};

◆ delimiter_

template<typename CRTP >
char CLI::OptionBase< CRTP >::delimiter_ {'\0'}
protected

Definition at line 3369 of file CLI11.hpp.

3369{'\0'};

◆ disable_flag_override_

template<typename CRTP >
bool CLI::OptionBase< CRTP >::disable_flag_override_ {false}
protected

Definition at line 3366 of file CLI11.hpp.

3366{false};

◆ group_

template<typename CRTP >
std::string CLI::OptionBase< CRTP >::group_ = std::string("Options")
protected

Definition at line 3351 of file CLI11.hpp.

◆ ignore_case_

template<typename CRTP >
bool CLI::OptionBase< CRTP >::ignore_case_ {false}
protected

Definition at line 3357 of file CLI11.hpp.

3357{false};

◆ ignore_underscore_

template<typename CRTP >
bool CLI::OptionBase< CRTP >::ignore_underscore_ {false}
protected

Definition at line 3360 of file CLI11.hpp.

3360{false};

◆ multi_option_policy_

template<typename CRTP >
MultiOptionPolicy CLI::OptionBase< CRTP >::multi_option_policy_ {MultiOptionPolicy::Throw}
protected

Definition at line 3375 of file CLI11.hpp.

@ Throw
Throw an error if any extra arguments were given.

◆ required_

template<typename CRTP >
bool CLI::OptionBase< CRTP >::required_ {false}
protected

Definition at line 3354 of file CLI11.hpp.

3354{false};

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