209 T
ConvertTo(First&& default_arg, Rest&&... more_default_args)
const;
258 struct EmplaceEnabler {
259 explicit EmplaceEnabler() =
default;
262 class LazyDetachedPath;
268 const impl::VersionedValuePtr& root,
269 const impl::Value* root_ptr_for_path,
270 const impl::Value* value_ptr,
276 const impl::VersionedValuePtr& root,
277 impl::Value* root_ptr_for_path,
278 LazyDetachedPath&& lazy_detached_path
283 explicit Value(impl::VersionedValuePtr root)
noexcept;
285 bool IsUniqueReference()
const;
286 void EnsureNotMissing()
const;
287 const impl::Value& GetNative()
const;
288 impl::Value& GetNative();
289 void SetNative(impl::Value&);
290 int GetExtendedType()
const;
292 impl::VersionedValuePtr holder_{};
293 impl::Value* root_ptr_for_path_{
nullptr};
294 impl::Value* value_ptr_{
nullptr};
303 class LazyDetachedPath
final {
305 LazyDetachedPath()
noexcept;
306 LazyDetachedPath(impl::Value* parent_value_ptr,
int parent_depth, std::string_view key);
308 LazyDetachedPath(
const LazyDetachedPath&);
309 LazyDetachedPath(LazyDetachedPath&&)
noexcept;
310 LazyDetachedPath& operator=(
const LazyDetachedPath&);
311 LazyDetachedPath& operator=(LazyDetachedPath&&)
noexcept;
313 std::string Get(
const impl::Value* root)
const;
314 LazyDetachedPath Chain(std::string_view key)
const;
317 impl::Value* parent_value_ptr_{
nullptr};
318 int parent_depth_{0};
319 std::string virtual_path_{};
322 LazyDetachedPath lazy_detached_path_;
325 friend class Iterator;
326 friend class ValueBuilder;
327 friend class StringBuilder;
329 friend class impl::InlineObjectBuilder;
330 friend class impl::InlineArrayBuilder;
331 friend class impl::MutableValueWrapper;
332 friend class parser::JsonValueParser;
333 friend class impl::StringBuffer;
335 friend bool Parse(
const Value& value,
parse::To<
bool>);
336 friend std::int64_t Parse(
const Value& value,
parse::To<std::int64_t>);
337 friend std::uint64_t Parse(
const Value& value,
parse::To<std::uint64_t>);
338 friend double Parse(
const Value& value,
parse::To<
double>);
339 friend std::string Parse(
const Value& value,
parse::To<std::string>);
348 friend logging::LogHelper& operator<<(logging::LogHelper&,
const Value&);
355 "There is no `Parse(const Value&, formats::parse::To<T>)` in namespace of `T` or `formats::parse`. "
356 "Probably you forgot to include the <userver/formats/parse/common_containers.hpp> or you "
357 "have not provided a `Parse` function overload."
360 return Parse(*
this, formats::
parse::To<T>{});
363bool Parse(
const Value& value,
parse::To<
bool>);
365std::int64_t Parse(
const Value& value,
parse::To<std::int64_t>);
367std::uint64_t Parse(
const Value& value,
parse::To<std::uint64_t>);
369double Parse(
const Value& value,
parse::To<
double>);
371std::string Parse(
const Value& value,
parse::To<std::string>);
388template <
typename T,
typename First,
typename... Rest>
389auto Value::
As(First&& default_arg, Rest&&... more_default_args)
const {
393 return decltype(As<T>())(std::forward<First>(default_arg), std::forward<Rest>(more_default_args)...);
405 if constexpr (formats::
common::impl::HasConvert<
Value, T>) {
406 return Convert(*
this, formats::
parse::To<T>{});
407 }
else if constexpr (formats::
common::impl::HasParse<
Value, T>) {
408 return Parse(*
this, formats::
parse::To<T>{});
412 "There is no `Convert(const Value&, formats::parse::To<T>)` or `Parse(const Value&, formats::parse::To<T>)`"
413 "in namespace of `T` or `formats::parse`. Probably you have not provided a `Convert` function overload."
418template <
typename T,
typename First,
typename... Rest>
422 return T(std::forward<First>(default_arg), std::forward<Rest>(more_default_args)...);
424 return ConvertTo<T>();