CLI11 2.6.2
Loading...
Searching...
No Matches
CLI::FormatterBase Class Referenceabstract

#include <FormatterFwd.hpp>

Inheritance diagram for CLI::FormatterBase:
Collaboration diagram for CLI::FormatterBase:

Public Member Functions

Basic
 FormatterBase ()=default
 FormatterBase (const FormatterBase &)=default
 FormatterBase (FormatterBase &&)=default
FormatterBaseoperator= (const FormatterBase &)=default
FormatterBaseoperator= (FormatterBase &&)=default
virtual ~FormatterBase () noexcept
 Adding a destructor in this form to work around bug in GCC 4.7.
virtual std::string make_help (const App *, std::string, AppFormatMode) const =0
 This is the key method that puts together help.
Setters
void label (std::string key, std::string val)
 Set the "REQUIRED" or other labels.
void column_width (std::size_t val)
 Set the left column width (options/flags/subcommands)
void long_option_alignment_ratio (float ratio)
void right_column_width (std::size_t val)
 Set the right column width (description of options/flags/subcommands)
void description_paragraph_width (std::size_t val)
 Set the description paragraph width at the top of help.
void footer_paragraph_width (std::size_t val)
 Set the footer paragraph width.
void enable_description_formatting (bool value=true)
 enable formatting for description paragraph
void enable_footer_formatting (bool value=true)
 disable formatting for footer paragraph
void enable_option_defaults (bool value=true)
 enable option defaults to be printed
void enable_option_type_names (bool value=true)
 enable option type names to be printed
void enable_default_flag_values (bool value=true)
 enable default flag values to be printed
Getters
CLI11_NODISCARD std::string get_label (std::string key) const
 Get the current value of a name (REQUIRED, etc.)
CLI11_NODISCARD std::size_t get_column_width () const
 Get the current left column width (options/flags/subcommands)
CLI11_NODISCARD std::size_t get_right_column_width () const
 Get the current right column width (description of options/flags/subcommands)
CLI11_NODISCARD std::size_t get_description_paragraph_width () const
 Get the current description paragraph width at the top of help.
CLI11_NODISCARD std::size_t get_footer_paragraph_width () const
 Get the current footer paragraph width.
CLI11_NODISCARD float get_long_option_alignment_ratio () const
 Get the current alignment ratio for long options within the left column.
CLI11_NODISCARD bool is_description_paragraph_formatting_enabled () const
 Get the current status of description paragraph formatting.
CLI11_NODISCARD bool is_footer_paragraph_formatting_enabled () const
 Get the current status of whether footer paragraph formatting is enabled.
CLI11_NODISCARD bool is_option_defaults_enabled () const
 Get the current status of whether option defaults are printed.
CLI11_NODISCARD bool is_option_type_names_enabled () const
 Get the current status of whether option type names are printed.
CLI11_NODISCARD bool is_default_flag_values_enabled () const
 Get the current status of whether default flag values are printed.

Protected Attributes

Options
std::size_t column_width_ {30}
 The width of the left column (options/flags/subcommands)
float long_option_alignment_ratio_ {1 / 3.f}
 The alignment ratio for long options within the left column.
std::size_t right_column_width_ {65}
 The width of the right column (description of options/flags/subcommands)
std::size_t description_paragraph_width_ {80}
 The width of the description paragraph at the top of help.
std::size_t footer_paragraph_width_ {80}
 The width of the footer paragraph.
bool enable_description_formatting_ {true}
 options controlling formatting for footer and descriptions
bool enable_footer_formatting_ {true}
bool enable_option_defaults_ {true}
 options controlling formatting of options
bool enable_option_type_names_ {true}
bool enable_default_flag_values_ {true}
std::map< std::string, std::string > labels_ {}
 The required help printout labels (user changeable) Values are Needs, Excludes, etc.

Detailed Description

This is the minimum requirements to run a formatter.

A user can subclass this is if they do not care at all about the structure in CLI::Formatter.

Constructor & Destructor Documentation

◆ FormatterBase() [1/3]

CLI::FormatterBase::FormatterBase ( )
default

◆ FormatterBase() [2/3]

CLI::FormatterBase::FormatterBase ( const FormatterBase & )
default

◆ FormatterBase() [3/3]

CLI::FormatterBase::FormatterBase ( FormatterBase && )
default

◆ ~FormatterBase()

virtual CLI::FormatterBase::~FormatterBase ( )
inlinevirtualnoexcept

Adding a destructor in this form to work around bug in GCC 4.7.

Member Function Documentation

◆ column_width()

void CLI::FormatterBase::column_width ( std::size_t val)
inline

Set the left column width (options/flags/subcommands)

◆ description_paragraph_width()

void CLI::FormatterBase::description_paragraph_width ( std::size_t val)
inline

Set the description paragraph width at the top of help.

◆ enable_default_flag_values()

void CLI::FormatterBase::enable_default_flag_values ( bool value = true)
inline

enable default flag values to be printed

◆ enable_description_formatting()

void CLI::FormatterBase::enable_description_formatting ( bool value = true)
inline

enable formatting for description paragraph

◆ enable_footer_formatting()

void CLI::FormatterBase::enable_footer_formatting ( bool value = true)
inline

disable formatting for footer paragraph

◆ enable_option_defaults()

void CLI::FormatterBase::enable_option_defaults ( bool value = true)
inline

enable option defaults to be printed

◆ enable_option_type_names()

void CLI::FormatterBase::enable_option_type_names ( bool value = true)
inline

enable option type names to be printed

◆ footer_paragraph_width()

void CLI::FormatterBase::footer_paragraph_width ( std::size_t val)
inline

Set the footer paragraph width.

◆ get_column_width()

CLI11_NODISCARD std::size_t CLI::FormatterBase::get_column_width ( ) const
inline

Get the current left column width (options/flags/subcommands)

◆ get_description_paragraph_width()

CLI11_NODISCARD std::size_t CLI::FormatterBase::get_description_paragraph_width ( ) const
inline

Get the current description paragraph width at the top of help.

◆ get_footer_paragraph_width()

CLI11_NODISCARD std::size_t CLI::FormatterBase::get_footer_paragraph_width ( ) const
inline

Get the current footer paragraph width.

◆ get_label()

CLI11_NODISCARD std::string CLI::FormatterBase::get_label ( std::string key) const
inline

Get the current value of a name (REQUIRED, etc.)

◆ get_long_option_alignment_ratio()

CLI11_NODISCARD float CLI::FormatterBase::get_long_option_alignment_ratio ( ) const
inline

Get the current alignment ratio for long options within the left column.

Returns

◆ get_right_column_width()

CLI11_NODISCARD std::size_t CLI::FormatterBase::get_right_column_width ( ) const
inline

Get the current right column width (description of options/flags/subcommands)

◆ is_default_flag_values_enabled()

CLI11_NODISCARD bool CLI::FormatterBase::is_default_flag_values_enabled ( ) const
inline

Get the current status of whether default flag values are printed.

◆ is_description_paragraph_formatting_enabled()

CLI11_NODISCARD bool CLI::FormatterBase::is_description_paragraph_formatting_enabled ( ) const
inline

Get the current status of description paragraph formatting.

◆ is_footer_paragraph_formatting_enabled()

CLI11_NODISCARD bool CLI::FormatterBase::is_footer_paragraph_formatting_enabled ( ) const
inline

Get the current status of whether footer paragraph formatting is enabled.

◆ is_option_defaults_enabled()

CLI11_NODISCARD bool CLI::FormatterBase::is_option_defaults_enabled ( ) const
inline

Get the current status of whether option defaults are printed.

◆ is_option_type_names_enabled()

CLI11_NODISCARD bool CLI::FormatterBase::is_option_type_names_enabled ( ) const
inline

Get the current status of whether option type names are printed.

◆ label()

void CLI::FormatterBase::label ( std::string key,
std::string val )
inline

Set the "REQUIRED" or other labels.

◆ long_option_alignment_ratio()

void CLI::FormatterBase::long_option_alignment_ratio ( float ratio)
inline

Set the alignment ratio for long options within the left column The ratio is in [0;1] range (e.g. 0.2 = 20% of column width, 6.f/column_width = 6th character)

◆ make_help()

virtual std::string CLI::FormatterBase::make_help ( const App * ,
std::string ,
AppFormatMode  ) const
pure virtual

This is the key method that puts together help.

Implemented in CLI::Formatter, and CLI::FormatterLambda.

◆ operator=() [1/2]

FormatterBase & CLI::FormatterBase::operator= ( const FormatterBase & )
default

◆ operator=() [2/2]

FormatterBase & CLI::FormatterBase::operator= ( FormatterBase && )
default

◆ right_column_width()

void CLI::FormatterBase::right_column_width ( std::size_t val)
inline

Set the right column width (description of options/flags/subcommands)

Member Data Documentation

◆ column_width_

std::size_t CLI::FormatterBase::column_width_ {30}
protected

The width of the left column (options/flags/subcommands)

◆ description_paragraph_width_

std::size_t CLI::FormatterBase::description_paragraph_width_ {80}
protected

The width of the description paragraph at the top of help.

◆ enable_default_flag_values_

bool CLI::FormatterBase::enable_default_flag_values_ {true}
protected

◆ enable_description_formatting_

bool CLI::FormatterBase::enable_description_formatting_ {true}
protected

options controlling formatting for footer and descriptions

◆ enable_footer_formatting_

bool CLI::FormatterBase::enable_footer_formatting_ {true}
protected

◆ enable_option_defaults_

bool CLI::FormatterBase::enable_option_defaults_ {true}
protected

options controlling formatting of options

◆ enable_option_type_names_

bool CLI::FormatterBase::enable_option_type_names_ {true}
protected

◆ footer_paragraph_width_

std::size_t CLI::FormatterBase::footer_paragraph_width_ {80}
protected

The width of the footer paragraph.

◆ labels_

std::map<std::string, std::string> CLI::FormatterBase::labels_ {}
protected

The required help printout labels (user changeable) Values are Needs, Excludes, etc.

◆ long_option_alignment_ratio_

float CLI::FormatterBase::long_option_alignment_ratio_ {1 / 3.f}
protected

The alignment ratio for long options within the left column.

◆ right_column_width_

std::size_t CLI::FormatterBase::right_column_width_ {65}
protected

The width of the right column (description of options/flags/subcommands)


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