206 T
ConvertTo(First&& default_arg, Rest&&... more_default_args)
const;
255 struct EmplaceEnabler {
256 explicit EmplaceEnabler() =
default;
259 class LazyDetachedPath;
265 const impl::VersionedValuePtr& root,
266 const impl::Value* root_ptr_for_path,
267 const impl::Value* value_ptr,
273 const impl::VersionedValuePtr& root,
274 impl::Value* root_ptr_for_path,
275 LazyDetachedPath&& lazy_detached_path
280 explicit Value(impl::VersionedValuePtr root)
noexcept;
282 bool IsUniqueReference()
const;
283 void EnsureNotMissing()
const;
284 const impl::Value& GetNative()
const;
285 impl::Value& GetNative();
286 void SetNative(impl::Value&);
287 int GetExtendedType()
const;
289 impl::VersionedValuePtr holder_{};
290 impl::Value* root_ptr_for_path_{
nullptr};
291 impl::Value* value_ptr_{
nullptr};
300 class LazyDetachedPath
final {
302 LazyDetachedPath()
noexcept;
303 LazyDetachedPath(impl::Value* parent_value_ptr,
int parent_depth, std::string_view key);
305 LazyDetachedPath(
const LazyDetachedPath&);
306 LazyDetachedPath(LazyDetachedPath&&)
noexcept;
307 LazyDetachedPath& operator=(
const LazyDetachedPath&);
308 LazyDetachedPath& operator=(LazyDetachedPath&&)
noexcept;
310 std::string Get(
const impl::Value* root)
const;
311 LazyDetachedPath Chain(std::string_view key)
const;
314 impl::Value* parent_value_ptr_{
nullptr};
315 int parent_depth_{0};
316 std::string virtual_path_{};
319 LazyDetachedPath lazy_detached_path_;
322 friend class Iterator;
323 friend class ValueBuilder;
324 friend class StringBuilder;
326 friend class impl::InlineObjectBuilder;
327 friend class impl::InlineArrayBuilder;
328 friend class impl::MutableValueWrapper;
329 friend class parser::JsonValueParser;
330 friend class impl::StringBuffer;
331 friend class impl::StableSerializer;
334 friend std::int64_t Parse(
const Value& value,
parse::
To<std::int64_t>);
335 friend std::uint64_t Parse(
const Value& value,
parse::
To<std::uint64_t>);
336 friend double Parse(
const Value& value,
parse::
To<
double>);
337 friend std::string Parse(
const Value& value,
parse::
To<std::string>);
352 formats::common::impl::HasParse<
Value, T>,
353 "There is no `Parse(const Value&, formats::parse::To<T>)` in namespace of `T` or `formats::parse`. "
354 "Probably you forgot to include the <userver/formats/parse/common_containers.hpp> or you "
355 "have not provided a `Parse` function overload."
358 return Parse(*
this, formats::
parse::
To<T>{});
363std::int64_t Parse(
const Value& value,
parse::
To<std::int64_t>);
365std::uint64_t Parse(
const Value& value,
parse::
To<std::uint64_t>);
369std::string Parse(
const Value& value,
parse::
To<std::string>);
372bool Value::ConvertTo<
bool>()
const;
375int64_t
Value::ConvertTo<int64_t>()
const;
378uint64_t
Value::ConvertTo<uint64_t>()
const;
381double Value::ConvertTo<
double>()
const;
384std::string
Value::ConvertTo<std::string>()
const;
386template <
typename T,
typename First,
typename... Rest>
387auto Value::
As(First&& default_arg, Rest&&... more_default_args)
const {
391 return decltype(As<T>())(std::forward<First>(default_arg), std::forward<Rest>(more_default_args)...);
403 if constexpr (formats::common::impl::HasConvert<
Value, T>) {
404 return Convert(*
this, formats::
parse::
To<T>{});
405 }
else if constexpr (formats::common::impl::HasParse<
Value, T>) {
406 return Parse(*
this, formats::
parse::
To<T>{});
410 "There is no `Convert(const Value&, formats::parse::To<T>)` or `Parse(const Value&, formats::parse::To<T>)`"
411 "in namespace of `T` or `formats::parse`. Probably you have not provided a `Convert` function overload."
416template <
typename T,
typename First,
typename... Rest>
420 return T(std::forward<First>(default_arg), std::forward<Rest>(more_default_args)...);
422 return ConvertTo<T>();