|
CAF 0.17.6
|
A type for config parameters with similar interface to a variant.
More...
#include <config_value.hpp>
Public Types | |
| using | integer = int64_t |
| using | boolean = bool |
| using | real = double |
| using | atom = atom_value |
| using | timespan = caf::timespan |
| using | string = std::string |
| using | list = std::vector< config_value > |
| using | dictionary = caf::dictionary< config_value > |
| using | types = detail::type_list< integer, boolean, real, atom, timespan, uri, string, list, dictionary > |
| using | variant_type = detail::tl_apply_t< types, variant > |
Public Member Functions | |
| config_value (config_value &&other)=default | |
| config_value (const config_value &other)=default | |
| template<class T , class E = detail::enable_if_t< !std::is_same<detail::decay_t<T>, config_value>::value>> | |
| config_value (T &&x) | |
| config_value & | operator= (config_value &&other)=default |
| config_value & | operator= (const config_value &other)=default |
| template<class T , class E = detail::enable_if_t< !std::is_same<detail::decay_t<T>, config_value>::value>> | |
| config_value & | operator= (T &&x) |
| void | convert_to_list () |
| Converts the value to a list with one element. | |
| list & | as_list () |
| Returns the value as a list, converting it to one if needed. | |
| dictionary & | as_dictionary () |
| Returns the value as a dictionary, converting it to one if needed. | |
| void | append (config_value x) |
Appends x to a list. | |
| const char * | type_name () const noexcept |
| Returns a human-readable type name of the current value. | |
| variant_type & | get_data () |
| Returns the underlying variant. | |
| const variant_type & | get_data () const |
| Returns the underlying variant. | |
| variant_type * | get_data_ptr () |
| Returns a pointer to the underlying variant. | |
| const variant_type * | get_data_ptr () const |
| Returns a pointer to the underlying variant. | |
Static Public Member Functions | |
| static expected< config_value > | parse (string_view::iterator first, string_view::iterator last) |
Tries to parse a value from str. | |
| static expected< config_value > | parse (string_view str) |
Tries to parse a value from str. | |
Related Symbols | |
(Note that these are not member symbols.) | |
| using | settings = dictionary< config_value > |
| Software options stored as key-value pairs. | |
| bool | operator< (const config_value &x, const config_value &y) |
| bool | operator== (const config_value &x, const config_value &y) |
| bool | operator>= (const config_value &x, const config_value &y) |
| bool | operator!= (const config_value &x, const config_value &y) |
| std::string | to_string (const config_value &x) |
| std::ostream & | operator<< (std::ostream &out, const config_value &x) |
| template<class Inspector > | |
| Inspector::result_type | inspect (Inspector &f, config_value &x) |
| const config_value * | get_if (const settings *xs, string_view name) |
Tries to retrieve the value associated to name from xs. | |
| template<class T > | |
| optional< T > | get_if (const settings *xs, string_view name) |
Tries to retrieve the value associated to name from xs. | |
| template<class T > | |
| bool | holds_alternative (const settings &xs, string_view name) |
Returns whether xs associates a value of type T to name. | |
A type for config parameters with similar interface to a variant.
This type is not implemented as a simple variant alias because variants cannot contain lists of themselves.
| void caf::config_value::append | ( | config_value | x | ) |
Appends x to a list.
Converts this config value to a list first by calling convert_to_list if needed.
| void caf::config_value::convert_to_list | ( | ) |
Converts the value to a list with one element.
Does nothing if the value already is a list.