CAF  0.17.2
Public Types | Public Member Functions | List of all members
caf::config_option_set Class Reference

A set of config_option objects that parses CLI arguments into a settings object. More...

#include <config_option_set.hpp>

Public Types

using argument_iterator = std::vector< std::string >::const_iterator
 An iterator over CLI arguments.
 
using parse_result = std::pair< pec, argument_iterator >
 The result of parse member functions.
 
using option_vector = std::vector< config_option >
 List of config options.
 
using option_pointer = const config_option *
 Pointer to a config option.
 
using iterator = option_vector::iterator
 An iterator over ::config_option unique pointers.
 
using const_iterator = option_vector::const_iterator
 An iterator over ::config_option unique pointers.
 

Public Member Functions

option_pointer cli_long_name_lookup (string_view name) const
 Returns the first config_option that matches the CLI name. More...
 
option_pointer cli_short_name_lookup (char short_name) const
 Returns the first config_option that matches the CLI short option name.
 
option_pointer qualified_name_lookup (string_view category, string_view long_name) const
 Returns the first config_option that matches category and long name.
 
option_pointer qualified_name_lookup (string_view name) const
 Returns the first config_option that matches the qualified name. More...
 
size_t size () const noexcept
 Returns the number of stored config options.
 
bool empty () const noexcept
 Returns the number of stored config options.
 
iterator begin () noexcept
 Returns an iterator to the first ::config_option object.
 
const_iterator begin () const noexcept
 Returns an iterator to the first ::config_option object.
 
iterator end () noexcept
 Returns the past-the-end iterator.
 
const_iterator end () const noexcept
 Returns the past-the-end iterator.
 
template<class T >
config_option_setadd (string_view category, string_view name, string_view description) &
 Adds a config option to the set.
 
template<class T >
config_option_setadd (string_view name, string_view description) &
 Adds a config option to the set.
 
template<class T >
config_option_set && add (string_view category, string_view name, string_view description) &&
 Adds a config option to the set.
 
template<class T >
config_option_set && add (string_view name, string_view description) &&
 Adds a config option to the set.
 
template<class T >
config_option_setadd (T &ref, string_view category, string_view name, string_view description) &
 Adds a config option to the set that synchronizes its value with ref.
 
template<class T >
config_option_setadd (T &ref, string_view name, string_view description) &
 Adds a config option to the set that synchronizes its value with ref.
 
template<class T >
config_option_set && add (T &ref, string_view category, string_view name, string_view description) &&
 Adds a config option to the set that synchronizes its value with ref.
 
template<class T >
config_option_set && add (T &ref, string_view name, string_view description) &&
 Adds a config option to the set that synchronizes its value with ref.
 
config_option_setadd (config_option opt)
 Adds a config option to the set.
 
std::string help_text (bool global_only=true) const
 Generates human-readable help text for all options.
 
parse_result parse (settings &config, argument_iterator begin, argument_iterator end) const
 Parses a given range as CLI arguments into config.
 
parse_result parse (settings &config, const std::vector< std::string > &args) const
 Parses a given range as CLI arguments into config.
 

Detailed Description

A set of config_option objects that parses CLI arguments into a settings object.

Member Function Documentation

◆ cli_long_name_lookup()

option_pointer caf::config_option_set::cli_long_name_lookup ( string_view  name) const

Returns the first config_option that matches the CLI name.

Parameters
nameConfig option name formatted as <prefix>#<category>.<long-name>. Users can omit <prefix> for options that have an empty prefix and <category> if the category is "global".

◆ qualified_name_lookup()

option_pointer caf::config_option_set::qualified_name_lookup ( string_view  name) const

Returns the first config_option that matches the qualified name.

Parameters
nameConfig option name formatted as <category>.<long-name>.

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