userver: components::ComponentConfig Class 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
components::ComponentConfig Class Referencefinal

Detailed Description

+ Inheritance diagram for components::ComponentConfig:
+ Collaboration diagram for components::ComponentConfig:

Public Member Functions

 ComponentConfig (std::string name)
 Creates an empty config.
 
 ComponentConfig (yaml_config::YamlConfig value)
 
const std::string & Name () const
 
void SetName (std::string name)
 
- Public Member Functions inherited from yaml_config::YamlConfig
 YamlConfig (formats::yaml::Value yaml, formats::yaml::Value config_vars, Mode mode=Mode::kSecure)
 YamlConfig = config + config_vars.
 
const formats::yaml::ValueYaml () const
 Get the plain Yaml without substitutions. It may contain raw references.
 
YamlConfig operator[] (std::string_view key) const
 Access member by key for read.
 
YamlConfig operator[] (size_t index) const
 Access member by index for read.
 
std::size_t GetSize () const
 Returns array size or object members count.
 
bool IsMissing () const noexcept
 Returns true if *this holds nothing. When IsMissing() returns true any attempt to get the actual value or iterate over *this will throw MemberMissingException.
 
bool IsNull () const noexcept
 Returns true if *this holds 'null'.
 
bool IsBool () const noexcept
 Returns true if *this is convertible to bool.
 
bool IsInt () const noexcept
 Returns true if *this is convertible to int.
 
bool IsInt64 () const noexcept
 Returns true if *this is convertible to int64_t.
 
bool IsUInt64 () const noexcept
 Returns true if *this is convertible to uint64_t.
 
bool IsDouble () const noexcept
 Returns true if *this is convertible to double.
 
bool IsString () const noexcept
 Returns true if *this is convertible to std::string.
 
bool IsArray () const noexcept
 Returns true if *this is an array (Type::kArray).
 
bool IsObject () const noexcept
 Returns true if *this is a map (Type::kObject).
 
void CheckNotMissing () const
 
void CheckArray () const
 
void CheckArrayOrNull () const
 
void CheckObjectOrNull () const
 
void CheckObject () const
 
void CheckString () const
 
void CheckObjectOrArrayOrNull () const
 
template<typename T >
auto As () const
 Returns value of *this converted to T.
 
template<typename T , typename First , typename... Rest>
auto As (First &&default_arg, Rest &&... more_default_args) const
 Returns value of *this converted to T or T(args) if this->IsMissing().
 
template<typename T >
auto As (DefaultConstructed) const
 Returns value of *this converted to T or T() if this->IsMissing().
 
bool HasMember (std::string_view key) const
 Returns true if *this holds a key.
 
std::string GetPath () const
 Returns full path to this value.
 
const_iterator begin () const
 Returns an iterator to the beginning of the held array or map.
 
const_iterator end () const
 Returns an iterator to the end of the held array or map.
 

Additional Inherited Members

- Public Types inherited from yaml_config::YamlConfig
enum class  Mode {
  kSecure ,
  kEnvAllowed
}
 
using const_iterator = Iterator<IterTraits>
 
using Exception = yaml_config::Exception
 
using ParseException = yaml_config::ParseException
 

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