userver: dynamic_config::ValueDict< ValueType > Class Template Reference
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
dynamic_config::ValueDict< ValueType > Class Template Referencefinal

Public Types

using DictType = utils::impl::TransparentMap< std::string, ValueType >
 
using const_iterator = typename DictType::const_iterator
 
using iterator = const_iterator
 
using value_type = typename DictType::value_type
 
using key_type = std::string
 
using mapped_type = ValueType
 

Public Member Functions

 ValueDict (std::initializer_list< value_type > contents)
 
 ValueDict (DictType dict)
 
 ValueDict (std::string name, DictType dict)
 
 ValueDict (std::string name, const DocsMap &docs_map)
 
bool HasDefaultValue () const
 
bool HasValue (std::string_view key) const
 
const ValueType & GetDefaultValue () const
 
const ValueType & operator[] (std::string_view key) const
 
template<typename StringType >
const ValueType & operator[] (const std::optional< StringType > &key) const
 
const ValueType & Get (std::string_view key) const
 
template<typename StringType >
const ValueType & Get (const std::optional< StringType > &key) const
 
std::optional< ValueType > GetOptional (std::string_view key) const
 
void SetDefault (ValueType value)
 
template<typename StringType >
void Set (StringType &&key, ValueType value)
 
auto begin () const
 
auto end () const
 
const std::string & GetName () const
 
bool operator== (const ValueDict &r) const
 
bool operator!= (const ValueDict &r) const
 

Detailed Description

template<typename ValueType>
class dynamic_config::ValueDict< ValueType >

Definition at line 75 of file value.hpp.

Member Typedef Documentation

◆ const_iterator

template<typename ValueType >
using dynamic_config::ValueDict< ValueType >::const_iterator = typename DictType::const_iterator

Definition at line 78 of file value.hpp.

◆ DictType

template<typename ValueType >
using dynamic_config::ValueDict< ValueType >::DictType = utils::impl::TransparentMap<std::string, ValueType>

Definition at line 77 of file value.hpp.

◆ iterator

template<typename ValueType >
using dynamic_config::ValueDict< ValueType >::iterator = const_iterator

Definition at line 79 of file value.hpp.

◆ key_type

template<typename ValueType >
using dynamic_config::ValueDict< ValueType >::key_type = std::string

Definition at line 81 of file value.hpp.

◆ mapped_type

template<typename ValueType >
using dynamic_config::ValueDict< ValueType >::mapped_type = ValueType

Definition at line 82 of file value.hpp.

◆ value_type

template<typename ValueType >
using dynamic_config::ValueDict< ValueType >::value_type = typename DictType::value_type

Definition at line 80 of file value.hpp.

Constructor & Destructor Documentation

◆ ValueDict() [1/4]

template<typename ValueType >
dynamic_config::ValueDict< ValueType >::ValueDict ( std::initializer_list< value_type >  contents)
inline

Definition at line 86 of file value.hpp.

◆ ValueDict() [2/4]

template<typename ValueType >
dynamic_config::ValueDict< ValueType >::ValueDict ( DictType  dict)
inline

Definition at line 88 of file value.hpp.

◆ ValueDict() [3/4]

template<typename ValueType >
dynamic_config::ValueDict< ValueType >::ValueDict ( std::string  name,
DictType  dict 
)
inline

Definition at line 90 of file value.hpp.

◆ ValueDict() [4/4]

template<typename ValueType >
dynamic_config::ValueDict< ValueType >::ValueDict ( std::string  name,
const DocsMap docs_map 
)
inline

Definition at line 94 of file value.hpp.

Member Function Documentation

◆ begin()

template<typename ValueType >
auto dynamic_config::ValueDict< ValueType >::begin ( ) const
inline

Definition at line 162 of file value.hpp.

◆ end()

template<typename ValueType >
auto dynamic_config::ValueDict< ValueType >::end ( ) const
inline

Definition at line 164 of file value.hpp.

◆ Get() [1/2]

template<typename ValueType >
template<typename StringType >
const ValueType & dynamic_config::ValueDict< ValueType >::Get ( const std::optional< StringType > &  key) const
inline

Definition at line 132 of file value.hpp.

◆ Get() [2/2]

template<typename ValueType >
const ValueType & dynamic_config::ValueDict< ValueType >::Get ( std::string_view  key) const
inline

Definition at line 129 of file value.hpp.

◆ GetDefaultValue()

template<typename ValueType >
const ValueType & dynamic_config::ValueDict< ValueType >::GetDefaultValue ( ) const
inline

Definition at line 104 of file value.hpp.

◆ GetName()

template<typename ValueType >
const std::string & dynamic_config::ValueDict< ValueType >::GetName ( ) const
inline

Definition at line 166 of file value.hpp.

◆ GetOptional()

template<typename ValueType >
std::optional< ValueType > dynamic_config::ValueDict< ValueType >::GetOptional ( std::string_view  key) const
inline

Definition at line 136 of file value.hpp.

◆ HasDefaultValue()

template<typename ValueType >
bool dynamic_config::ValueDict< ValueType >::HasDefaultValue ( ) const
inline

Definition at line 98 of file value.hpp.

◆ HasValue()

template<typename ValueType >
bool dynamic_config::ValueDict< ValueType >::HasValue ( std::string_view  key) const
inline

Definition at line 100 of file value.hpp.

◆ operator!=()

template<typename ValueType >
bool dynamic_config::ValueDict< ValueType >::operator!= ( const ValueDict< ValueType > &  r) const
inline

Definition at line 170 of file value.hpp.

◆ operator==()

template<typename ValueType >
bool dynamic_config::ValueDict< ValueType >::operator== ( const ValueDict< ValueType > &  r) const
inline

Definition at line 168 of file value.hpp.

◆ operator[]() [1/2]

template<typename ValueType >
template<typename StringType >
const ValueType & dynamic_config::ValueDict< ValueType >::operator[] ( const std::optional< StringType > &  key) const
inline

Definition at line 124 of file value.hpp.

◆ operator[]() [2/2]

template<typename ValueType >
const ValueType & dynamic_config::ValueDict< ValueType >::operator[] ( std::string_view  key) const
inline

Definition at line 112 of file value.hpp.

◆ Set()

template<typename ValueType >
template<typename StringType >
void dynamic_config::ValueDict< ValueType >::Set ( StringType &&  key,
ValueType  value 
)
inline

Sets a mapping. key == dynamic_config::kValueDictDefaultName is allowed. The function is primarily there for testing purposes - ValueDict is normally obtained by parsing the config.

Definition at line 157 of file value.hpp.

◆ SetDefault()

template<typename ValueType >
void dynamic_config::ValueDict< ValueType >::SetDefault ( ValueType  value)
inline

Sets the default value. The function is primarily there for testing purposes - ValueDict is normally obtained by parsing the config.

Definition at line 149 of file value.hpp.


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