CAF  0.17.2
Classes | 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>

Classes

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 Member Functions

 config_option (string_view category, string_view name, 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
 
string_view category () const noexcept
 Returns the category of the option.
 
string_view long_name () const noexcept
 Returns the name of the option.
 
string_view short_names () const noexcept
 Returns (optional) one-letter short names of the option.
 
string_view description () const noexcept
 Returns a human-readable description of the option.
 
string_view full_name () const noexcept
 Returns the full name for this config option as "<category>.<long name>".
 
error check (const config_value &x) const
 Checks whether x holds a legal value for this option.
 
void store (const config_value &x) const
 Stores x in this option unless it is stateless. More...
 
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.
 
expected< config_valueparse (string_view input) const
 Tries to parse an input string. More...
 

Friends

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

Detailed Description

Defines a configuration option for the application.

Member Function Documentation

◆ parse()

expected<config_value> caf::config_option::parse ( string_view  input) const

Tries to parse an input string.

Stores and returns the parsed value on success, returns an error otherwise.

◆ store()

void caf::config_option::store ( const config_value x) const

Stores x in this option unless it is stateless.

Precondition
check(x) == none.

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