Bash++
Bash++ compiler internal documentation
Classes | Concepts | Functions
XGetOpt::Helpers Namespace Reference

Classes

struct  FixedString
 A fixed-size string class for compile-time string manipulation. More...
 
struct  OptionView
 
struct  TextView
 A simple view over a text string. More...
 

Concepts

concept  option_like
 

Functions

constexpr bool is_ws (char c)
 
template<size_t N>
 FixedString (const char(&)[N]) -> FixedString< N >
 
template<option_like T>
constexpr size_t option_label_length (const T &option)
 Calculate the length of the option label for help string formatting.
 
template<size_t N, option_like T>
constexpr size_t max_option_label_length (const std::array< T, N > &options)
 Calculate the maximum option label length among a set of options.
 
template<size_t N, option_like T>
constexpr size_t calculate_help_string_length (const std::array< T, N > &options)
 Calculate the length of the help string for a set of options.
 

Function Documentation

◆ calculate_help_string_length()

template<size_t N, option_like T>
constexpr size_t XGetOpt::Helpers::calculate_help_string_length ( const std::array< T, N > &  options)
constexpr

Calculate the length of the help string for a set of options.

Template Parameters
NThe number of options
TThe option-like type
Parameters
optionsThe array of options to calculate the help string length for
Returns
constexpr size_t The length of the help string

◆ FixedString()

template<size_t N>
XGetOpt::Helpers::FixedString ( const   char(&)[N]) -> FixedString< N >

◆ is_ws()

constexpr bool XGetOpt::Helpers::is_ws ( char  c)
constexpr

◆ max_option_label_length()

template<size_t N, option_like T>
constexpr size_t XGetOpt::Helpers::max_option_label_length ( const std::array< T, N > &  options)
constexpr

Calculate the maximum option label length among a set of options.

Template Parameters
NThe number of options
TThe option-like type
Parameters
optionsThe array of options to calculate the maximum label length for
Returns
constexpr size_t The maximum option label length

◆ option_label_length()

template<option_like T>
constexpr size_t XGetOpt::Helpers::option_label_length ( const T &  option)
constexpr

Calculate the length of the option label for help string formatting.

Template Parameters
TThe option-like type
Parameters
optionThe option to calculate the label length for
Returns
constexpr size_t The length of the option label

The option label format:

  1. -x, –longopt <arg>
  2. -x, –longopt[=arg]
  3. -x, –longopt
  4. -x <arg>
  5. -x[arg]
  6. -x
  7. –longopt <arg>
  8. –longopt[=arg]
  9. –longopt

Where <arg> is used for required arguments and [=arg] is used for optional arguments. And where '-x' is the option's actual shortopt character, '–longopt' is the option's actual longopt string, and 'arg' is the option's argument placeholder string if provided, or 'arg' if not provided.