CAF  0.17.6
Public Types | Public Attributes | Related Functions | List of all members
caf::config_value_adaptor_field< T > Struct Template Reference

Describes a field of type T of an adaptor. More...

#include <config_value_adaptor_field.hpp>

Public Types

using value_type = T
 Type of the field.
 
using predicate_function = bool(*)(const value_type &)
 Predicate function for verifying user input.
 

Public Attributes

string_view name
 Name of the field in configuration files and on the CLI.
 
optional< value_typedefault_value
 If set, makes the field optional in configuration files and on the CLI by assigning the default whenever the user provides no value. More...
 
predicate_function predicate
 If set, makes the field only accept values that pass this predicate.
 

Related Functions

(Note that these are not member functions.)

template<class T >
config_value_adaptor_field< T > make_config_value_adaptor_field (string_view name, optional< T > default_value=none, bool(*predicate)(const T &)=nullptr)
 Convenience function for creating a config_value_adaptor_field. More...
 

Detailed Description

template<class T>
struct caf::config_value_adaptor_field< T >

Describes a field of type T of an adaptor.

Friends And Related Function Documentation

◆ make_config_value_adaptor_field()

template<class T >
config_value_adaptor_field< T > make_config_value_adaptor_field ( string_view  name,
optional< T >  default_value = none,
bool(*)(const T &)  predicate = nullptr 
)
related

Convenience function for creating a config_value_adaptor_field.

Parameters
namename of the field in configuration files and on the CLI.
default_valueif set, provides a fallback value if the user does not provide a value.
predicateif set, restricts what values the field accepts.
Returns
a config_value_adaptor_field object, constructed from given arguments.

Member Data Documentation

◆ default_value

template<class T >
optional<value_type> caf::config_value_adaptor_field< T >::default_value

If set, makes the field optional in configuration files and on the CLI by assigning the default whenever the user provides no value.


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