C++ Actor Framework 0.19
No Matches
Classes | Public Types | Public Member Functions | Friends | List of all members
caf::config_option Class Reference

Defines a configuration option for the application. More...

#include <config_option.hpp>


struct  find_result
 Stores the result of a find operation. More...
struct  meta_state
 Custom vtable-like struct for delegating to type-specific functions and storing type-specific information shared by several config options. More...

Public Types

using argument_iterator = std::vector< std::string >::const_iterator
 An iterator over CLI arguments.

Public Member Functions

 config_option (std::string_view category, std::string_view name, std::string_view description, const meta_state *meta, void *value=nullptr)
 Constructs a config option.
 config_option (const config_option &)
 config_option (config_option &&)=default
config_optionoperator= (const config_option &)
config_optionoperator= (config_option &&)=default
std::string_view category () const noexcept
 Returns the category of the option.
std::string_view long_name () const noexcept
 Returns the name of the option.
std::string_view short_names () const noexcept
 Returns (optional) one-letter short names of the option.
std::string_view description () const noexcept
 Returns a human-readable description of the option.
std::string_view full_name () const noexcept
 Returns the full name for this config option as "<category>.<long name>".
error sync (config_value &x) const
 Synchronizes the value of this config option with x and vice versa.
std::string_view type_name () const noexcept
 Returns a human-readable representation of this option's expected type.
bool is_flag () const noexcept
 Returns whether this config option stores a boolean flag.
bool has_flat_cli_name () const noexcept
 Returns whether the category is optional for CLI options.
find_result find_by_long_name (argument_iterator first, argument_iterator last) const noexcept
 Tries to find this option by its long name in [first, last).


void swap (config_option &first, config_option &second) noexcept

Detailed Description

Defines a configuration option for the application.

Member Function Documentation

◆ sync()

error caf::config_option::sync ( config_value x) const

Synchronizes the value of this config option with x and vice versa.

Tries to perform this sequence of steps:

  • Convert the config value to the type of the config option.
  • Assign the converted value back to the config value to synchronize conversions back to the caller.
  • Store the converted value unless this option is stateless.

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