12#include <userver/formats/json_fwd.hpp>
13#include <userver/formats/parse/common.hpp>
14#include <userver/formats/parse/common_containers.hpp>
15#include <userver/formats/yaml/value.hpp>
17#include <userver/yaml_config/iterator.hpp>
19USERVER_NAMESPACE_BEGIN
92 YamlConfig() =
default;
167 template <
typename T>
173 template <
typename T,
typename First,
typename... Rest>
174 auto As(First&& default_arg, Rest&&... more_default_args)
const;
179 template <
typename T>
197 const_iterator
end()
const;
200 formats::
yaml::Value yaml_;
201 formats::
yaml::Value config_vars_;
208 friend std::string Parse(
const YamlConfig& value, formats::
parse::
To<std::string>);
217 "There is no `Parse(const yaml_config::YamlConfig&, "
218 "formats::parse::To<T>)`"
219 "in namespace of `T` or `formats::parse`. "
220 "Probably you forgot to include the "
221 "<userver/formats/parse/common_containers.hpp> or you "
222 "have not provided a `Parse` function overload."
225 return Parse(*
this, formats::
parse::
To<T>{});
238template <
typename T,
typename First,
typename... Rest>
239auto YamlConfig::
As(First&& default_arg, Rest&&... more_default_args)
const {
243 return decltype(As<T>())(std::forward<First>(default_arg), std::forward<Rest>(more_default_args)...);
250 return IsMissing() ?
decltype(As<T>())() : As<T>();
258using formats::
common::Items;