205 T
ConvertTo(First&& default_arg, Rest&&... more_default_args)
const;
254 struct EmplaceEnabler {
255 explicit EmplaceEnabler() =
default;
258 class LazyDetachedPath;
264 const impl::VersionedValuePtr& root,
265 const impl::Value* root_ptr_for_path,
266 const impl::Value* value_ptr,
272 const impl::VersionedValuePtr& root,
273 impl::Value* root_ptr_for_path,
274 LazyDetachedPath&& lazy_detached_path
279 explicit Value(impl::VersionedValuePtr root)
noexcept;
281 bool IsUniqueReference()
const;
282 void EnsureNotMissing()
const;
283 const impl::Value& GetNative()
const;
284 impl::Value& GetNative();
285 void SetNative(impl::Value&);
286 int GetExtendedType()
const;
288 impl::VersionedValuePtr holder_{};
289 impl::Value* root_ptr_for_path_{
nullptr};
290 impl::Value* value_ptr_{
nullptr};
299 class LazyDetachedPath
final {
301 LazyDetachedPath()
noexcept;
302 LazyDetachedPath(impl::Value* parent_value_ptr,
int parent_depth, std::string_view key);
304 LazyDetachedPath(
const LazyDetachedPath&);
305 LazyDetachedPath(LazyDetachedPath&&)
noexcept;
306 LazyDetachedPath& operator=(
const LazyDetachedPath&);
307 LazyDetachedPath& operator=(LazyDetachedPath&&)
noexcept;
309 std::string Get(
const impl::Value* root)
const;
310 LazyDetachedPath Chain(std::string_view key)
const;
313 impl::Value* parent_value_ptr_{
nullptr};
314 int parent_depth_{0};
315 std::string virtual_path_{};
318 LazyDetachedPath lazy_detached_path_;
321 friend class Iterator;
322 friend class ValueBuilder;
323 friend class StringBuilder;
325 friend class impl::InlineObjectBuilder;
326 friend class impl::InlineArrayBuilder;
327 friend class impl::MutableValueWrapper;
328 friend class parser::JsonValueParser;
329 friend class impl::StringBuffer;
331 friend bool Parse(
const Value& value,
parse::To<
bool>);
332 friend std::int64_t Parse(
const Value& value,
parse::To<std::int64_t>);
333 friend std::uint64_t Parse(
const Value& value,
parse::To<std::uint64_t>);
334 friend double Parse(
const Value& value,
parse::To<
double>);
335 friend std::string Parse(
const Value& value,
parse::To<std::string>);
344 friend logging::LogHelper& operator<<(logging::LogHelper&,
const Value&);
351 "There is no `Parse(const Value&, formats::parse::To<T>)` in namespace of `T` or `formats::parse`. "
352 "Probably you forgot to include the <userver/formats/parse/common_containers.hpp> or you "
353 "have not provided a `Parse` function overload."
356 return Parse(*
this, formats::
parse::To<T>{});
359bool Parse(
const Value& value,
parse::To<
bool>);
361std::int64_t Parse(
const Value& value,
parse::To<std::int64_t>);
363std::uint64_t Parse(
const Value& value,
parse::To<std::uint64_t>);
365double Parse(
const Value& value,
parse::To<
double>);
367std::string Parse(
const Value& value,
parse::To<std::string>);
384template <
typename T,
typename First,
typename... Rest>
385auto Value::
As(First&& default_arg, Rest&&... more_default_args)
const {
389 return decltype(As<T>())(std::forward<First>(default_arg), std::forward<Rest>(more_default_args)...);
401 if constexpr (formats::
common::impl::HasConvert<
Value, T>) {
402 return Convert(*
this, formats::
parse::To<T>{});
403 }
else if constexpr (formats::
common::impl::HasParse<
Value, T>) {
404 return Parse(*
this, formats::
parse::To<T>{});
408 "There is no `Convert(const Value&, formats::parse::To<T>)` or `Parse(const Value&, formats::parse::To<T>)`"
409 "in namespace of `T` or `formats::parse`. Probably you have not provided a `Convert` function overload."
414template <
typename T,
typename First,
typename... Rest>
418 return T(std::forward<First>(default_arg), std::forward<Rest>(more_default_args)...);
420 return ConvertTo<T>();