C++ Actor Framework 1.0.0
Loading...
Searching...
No Matches
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 (std::string_view name) const
 Returns the first config_option that matches the CLI name.
 
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 (std::string_view category, std::string_view long_name) const
 Returns the first config_option that matches category and long name.
 
option_pointer qualified_name_lookup (std::string_view name) const
 Returns the first config_option that matches the qualified name.
 
bool has_category (std::string_view category) const noexcept
 Returns whether a config_option for the given category exists.
 
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 (std::string_view category, std::string_view name, std::string_view description) &
 Adds a config option to the set.
 
template<class T >
config_option_setadd (std::string_view name, std::string_view description) &
 Adds a config option to the set.
 
template<class T >
config_option_set && add (std::string_view category, std::string_view name, std::string_view description) &&
 Adds a config option to the set.
 
template<class T >
config_option_set && add (std::string_view name, std::string_view description) &&
 Adds a config option to the set.
 
template<class T >
config_option_setadd (T &ref, std::string_view category, std::string_view name, std::string_view description) &
 Adds a config option to the set that synchronizes its value with ref.
 
template<class T >
config_option_setadd (T &ref, std::string_view name, std::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, std::string_view category, std::string_view name, std::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, std::string_view name, std::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 hide_caf_options=true) const
 Generates human-readable help text for all options.
 
void clear ()
 Drops 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()

config_option_set::option_pointer caf::config_option_set::cli_long_name_lookup ( std::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()

config_option_set::option_pointer caf::config_option_set::qualified_name_lookup ( std::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 files: