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

`#include <Option.hpp>`

## 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.
CLI11_NODISCARD CallbackPriority | get_callback_priority () const
| The priority of callback.
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.
CallbackPriority | callback_priority_ {CallbackPriority::Normal}
| Priority of callback.

## 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.

## Member Function Documentation

## always_capture_default()

template<typename CRTP>

CRTP * CLI::OptionBase< CRTP >::always_capture_default | ( | bool | value = true | ) |

inline

## configurable()

template<typename CRTP>

CRTP * CLI::OptionBase< CRTP >::configurable | ( | bool | value = true | ) |

inline

Allow in a configuration file.

## copy_to()

template<typename CRTP>
template<typename T>

void CLI::OptionBase< CRTP >::copy_to | ( | T * | other | ) | const

protected

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

## delimiter()

template<typename CRTP>

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

inline

Allow in a configuration file.

## get_always_capture_default()

template<typename CRTP>

CLI11_NODISCARD bool CLI::OptionBase< CRTP >::get_always_capture_default | ( |  | ) | const

inline

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

## get_callback_priority()

template<typename CRTP>

CLI11_NODISCARD CallbackPriority CLI::OptionBase< CRTP >::get_callback_priority | ( |  | ) | const

inline

The priority of callback.

## get_configurable()

template<typename CRTP>

CLI11_NODISCARD bool CLI::OptionBase< CRTP >::get_configurable | ( |  | ) | const

inline

The status of configurable.

## get_delimiter()

template<typename CRTP>

CLI11_NODISCARD char CLI::OptionBase< CRTP >::get_delimiter | ( |  | ) | const

inline

Get the current delimiter char.

## get_disable_flag_override()

template<typename CRTP>

CLI11_NODISCARD bool CLI::OptionBase< CRTP >::get_disable_flag_override | ( |  | ) | const

inline

The status of configurable.

## get_group()

template<typename CRTP>

CLI11_NODISCARD const std::string & CLI::OptionBase< CRTP >::get_group | ( |  | ) | const

inline

Get the group of this option.

## get_ignore_case()

template<typename CRTP>

CLI11_NODISCARD bool CLI::OptionBase< CRTP >::get_ignore_case | ( |  | ) | const

inline

The status of ignore case.

## get_ignore_underscore()

template<typename CRTP>

CLI11_NODISCARD bool CLI::OptionBase< CRTP >::get_ignore_underscore | ( |  | ) | const

inline

The status of ignore_underscore.

## get_multi_option_policy()

template<typename CRTP>

CLI11_NODISCARD MultiOptionPolicy CLI::OptionBase< CRTP >::get_multi_option_policy | ( |  | ) | const

inline

The status of the multi option policy.

## get_required()

template<typename CRTP>

CLI11_NODISCARD bool CLI::OptionBase< CRTP >::get_required | ( |  | ) | const

inline

True if this is a required option.

## group()

template<typename CRTP>

CRTP * CLI::OptionBase< CRTP >::group | ( | const std::string & | name | ) |

inline

Changes the group membership.

## join() [1/2]

template<typename CRTP>

CRTP * CLI::OptionBase< CRTP >::join | ( |  | ) |

inline

Set the multi option policy to join.

## join() [2/2]

template<typename CRTP>

CRTP * CLI::OptionBase< CRTP >::join | ( | char | delim | ) |

inline

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

## mandatory()

template<typename CRTP>

CRTP * CLI::OptionBase< CRTP >::mandatory | ( | bool | value = true | ) |

inline

Support Plumbum term.

## required()

template<typename CRTP>

CRTP * CLI::OptionBase< CRTP >::required | ( | bool | value = true | ) |

inline

Set the option as required.

## take_all()

template<typename CRTP>

CRTP * CLI::OptionBase< CRTP >::take_all | ( |  | ) |

inline

Set the multi option policy to take all arguments.

## take_first()

template<typename CRTP>

CRTP * CLI::OptionBase< CRTP >::take_first | ( |  | ) |

inline

Set the multi option policy to take last.

## take_last()

template<typename CRTP>

CRTP * CLI::OptionBase< CRTP >::take_last | ( |  | ) |

inline

Set the multi option policy to take last.

## Member Data Documentation

## always_capture_default_

template<typename CRTP>

bool CLI::OptionBase< CRTP >::always_capture_default_ {false}

protected

Automatically capture default value.

## callback_priority_

template<typename CRTP>

CallbackPriority CLI::OptionBase< CRTP >::callback_priority_ {CallbackPriority::Normal}

protected

Priority of callback.

## configurable_

template<typename CRTP>

bool CLI::OptionBase< CRTP >::configurable_ {true}

protected

Allow this option to be given in a configuration file.

## delimiter_

template<typename CRTP>

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

protected

Specify a delimiter character for vector arguments.

## disable_flag_override_

template<typename CRTP>

bool CLI::OptionBase< CRTP >::disable_flag_override_ {false}

protected

Disable overriding flag values with '=value'.

## group_

template<typename CRTP>

std::string CLI::OptionBase< CRTP >::group_ = std::string("OPTIONS")

protected

The group membership.

## ignore_case_

template<typename CRTP>

bool CLI::OptionBase< CRTP >::ignore_case_ {false}

protected

Ignore the case when matching (option, not value).

## ignore_underscore_

template<typename CRTP>

bool CLI::OptionBase< CRTP >::ignore_underscore_ {false}

protected

Ignore underscores when matching (option, not value).

## multi_option_policy_

template<typename CRTP>

MultiOptionPolicy CLI::OptionBase< CRTP >::multi_option_policy_ {MultiOptionPolicy::Throw}

protected

Policy for handling multiple arguments beyond the expected Max.

## required_

template<typename CRTP>

bool CLI::OptionBase< CRTP >::required_ {false}

protected

True if this is a required option.

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

- include/CLI/Option.hpp