Loading...
Searching...
No Matches
OptionBase< CRTP > Class Template Reference

This is the CRTP base class for Option and OptionDefaults. More...

#include <CLI11.h>

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)
 
CLI11_NODISCARD const std::string & get_group () const
 Get the group of this option.
 
CLI11_NODISCARD bool get_required () const
 True if this is a required option.
 
CLI11_NODISCARD bool get_ignore_case () const
 The status of ignore case.
 
CLI11_NODISCARD bool get_ignore_underscore () const
 The status of ignore_underscore.
 
CLI11_NODISCARD bool get_configurable () const
 The status of configurable.
 
CLI11_NODISCARD bool get_disable_flag_override () const
 The status of configurable.
 
CLI11_NODISCARD char get_delimiter () const
 Get the current delimiter char.
 
CLI11_NODISCARD bool get_always_capture_default () const
 Return true if this will automatically capture the default value for help printing.
 
CLI11_NODISCARD 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 pxr_CLI::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 4168 of file CLI11.h.

Member Function Documentation

◆ always_capture_default()

CRTP * always_capture_default ( bool  value = true)
inline

Definition at line 4223 of file CLI11.h.

◆ configurable()

CRTP * configurable ( bool  value = true)
inline

Allow in a configuration file.

Definition at line 4296 of file CLI11.h.

◆ copy_to()

void copy_to ( T *  other) const
protected

Copy the contents to another similar class (one based on OptionBase)

Definition at line 4924 of file CLI11.h.

◆ delimiter()

CRTP * delimiter ( char  value = '\0')
inline

Allow in a configuration file.

Definition at line 4302 of file CLI11.h.

◆ get_always_capture_default()

CLI11_NODISCARD bool get_always_capture_default ( ) const
inline

Return true if this will automatically capture the default value for help printing.

Definition at line 4252 of file CLI11.h.

◆ get_configurable()

CLI11_NODISCARD bool get_configurable ( ) const
inline

The status of configurable.

Definition at line 4243 of file CLI11.h.

◆ get_delimiter()

CLI11_NODISCARD char get_delimiter ( ) const
inline

Get the current delimiter char.

Definition at line 4249 of file CLI11.h.

◆ get_disable_flag_override()

CLI11_NODISCARD bool get_disable_flag_override ( ) const
inline

The status of configurable.

Definition at line 4246 of file CLI11.h.

◆ get_group()

CLI11_NODISCARD const std::string & get_group ( ) const
inline

Get the group of this option.

Definition at line 4231 of file CLI11.h.

◆ get_ignore_case()

CLI11_NODISCARD bool get_ignore_case ( ) const
inline

The status of ignore case.

Definition at line 4237 of file CLI11.h.

◆ get_ignore_underscore()

CLI11_NODISCARD bool get_ignore_underscore ( ) const
inline

The status of ignore_underscore.

Definition at line 4240 of file CLI11.h.

◆ get_multi_option_policy()

CLI11_NODISCARD MultiOptionPolicy get_multi_option_policy ( ) const
inline

The status of the multi option policy.

Definition at line 4255 of file CLI11.h.

◆ get_required()

CLI11_NODISCARD bool get_required ( ) const
inline

True if this is a required option.

Definition at line 4234 of file CLI11.h.

◆ group()

CRTP * group ( const std::string &  name)
inline

Changes the group membership.

Definition at line 4206 of file CLI11.h.

◆ join() [1/2]

CRTP * join ( )
inline

Set the multi option policy to join.

Definition at line 4281 of file CLI11.h.

◆ join() [2/2]

CRTP * join ( char  delim)
inline

Set the multi option policy to join with a specific delimiter.

Definition at line 4288 of file CLI11.h.

◆ mandatory()

CRTP * mandatory ( bool  value = true)
inline

Support Plumbum term.

Definition at line 4221 of file CLI11.h.

◆ required()

CRTP * required ( bool  value = true)
inline

Set the option as required.

Definition at line 4215 of file CLI11.h.

◆ take_all()

CRTP * take_all ( )
inline

Set the multi option policy to take all arguments.

Definition at line 4274 of file CLI11.h.

◆ take_first()

CRTP * take_first ( )
inline

Set the multi option policy to take last.

Definition at line 4267 of file CLI11.h.

◆ take_last()

CRTP * take_last ( )
inline

Set the multi option policy to take last.

Definition at line 4260 of file CLI11.h.

Member Data Documentation

◆ always_capture_default_

bool always_capture_default_ {false}
protected

Automatically capture default value.

Definition at line 4194 of file CLI11.h.

◆ configurable_

bool configurable_ {true}
protected

Allow this option to be given in a configuration file.

Definition at line 4185 of file CLI11.h.

◆ delimiter_

char delimiter_ {'\0'}
protected

Specify a delimiter character for vector arguments.

Definition at line 4191 of file CLI11.h.

◆ disable_flag_override_

bool disable_flag_override_ {false}
protected

Disable overriding flag values with '=value'.

Definition at line 4188 of file CLI11.h.

◆ group_

std::string group_ = std::string("Options")
protected

The group membership.

Definition at line 4173 of file CLI11.h.

◆ ignore_case_

bool ignore_case_ {false}
protected

Ignore the case when matching (option, not value)

Definition at line 4179 of file CLI11.h.

◆ ignore_underscore_

bool ignore_underscore_ {false}
protected

Ignore underscores when matching (option, not value)

Definition at line 4182 of file CLI11.h.

◆ multi_option_policy_

MultiOptionPolicy multi_option_policy_ {MultiOptionPolicy::Throw}
protected

Policy for handling multiple arguments beyond the expected Max.

Definition at line 4197 of file CLI11.h.

◆ required_

bool required_ {false}
protected

True if this is a required option.

Definition at line 4176 of file CLI11.h.


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