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 impl::Value MoveNativeOrCopy(::rapidjson::CrtAllocator& allocator) &&;
287 void SetNative(impl::Value&);
288 int GetExtendedType()
const;
290 impl::VersionedValuePtr holder_{};
291 impl::Value* root_ptr_for_path_{
nullptr};
292 impl::Value* value_ptr_{
nullptr};
301 class LazyDetachedPath
final {
303 LazyDetachedPath()
noexcept;
304 LazyDetachedPath(impl::Value* parent_value_ptr,
int parent_depth, std::string_view key);
306 LazyDetachedPath(
const LazyDetachedPath&);
307 LazyDetachedPath(LazyDetachedPath&&)
noexcept;
308 LazyDetachedPath& operator=(
const LazyDetachedPath&);
309 LazyDetachedPath& operator=(LazyDetachedPath&&)
noexcept;
311 std::string Get(
const impl::Value* root)
const;
312 LazyDetachedPath Chain(std::string_view key)
const;
315 impl::Value* parent_value_ptr_{
nullptr};
316 int parent_depth_{0};
317 std::string virtual_path_{};
320 LazyDetachedPath lazy_detached_path_;
323 friend class Iterator;
324 friend class ValueBuilder;
325 friend class StringBuilder;
327 friend class impl::InlineObjectBuilder;
328 friend class impl::InlineArrayBuilder;
329 friend class impl::MutableValueWrapper;
330 friend class parser::JsonValueParser;
331 friend class impl::StringBuffer;
332 friend class impl::StableSerializer;
335 friend std::int64_t Parse(
const Value& value,
parse::
To<std::int64_t>);
336 friend std::uint64_t Parse(
const Value& value,
parse::
To<std::uint64_t>);
337 friend double Parse(
const Value& value,
parse::
To<
double>);
338 friend std::string Parse(
const Value& value,
parse::
To<std::string>);
353 formats::common::impl::HasParse<
Value, T>,
354 "There is no `Parse(const Value&, formats::parse::To<T>)` in namespace of `T` or `formats::parse`. "
355 "Probably you forgot to include the <userver/formats/parse/common_containers.hpp> or you "
356 "have not provided a `Parse` function overload."
359 return Parse(*
this, formats::
parse::
To<T>{});
364std::int64_t Parse(
const Value& value,
parse::
To<std::int64_t>);
366std::uint64_t Parse(
const Value& value,
parse::
To<std::uint64_t>);
370std::string Parse(
const Value& value,
parse::
To<std::string>);
373bool Value::ConvertTo<
bool>()
const;
376int64_t
Value::ConvertTo<int64_t>()
const;
379uint64_t
Value::ConvertTo<uint64_t>()
const;
382double Value::ConvertTo<
double>()
const;
385std::string
Value::ConvertTo<std::string>()
const;
387template <
typename T,
typename First,
typename... Rest>
388auto Value::
As(First&& default_arg, Rest&&... more_default_args)
const {
392 return decltype(As<T>())(std::forward<First>(default_arg), std::forward<Rest>(more_default_args)...);
404 if constexpr (formats::common::impl::HasConvert<
Value, T>) {
405 return Convert(*
this, formats::
parse::
To<T>{});
406 }
else if constexpr (formats::common::impl::HasParse<
Value, T>) {
407 return Parse(*
this, formats::
parse::
To<T>{});
411 "There is no `Convert(const Value&, formats::parse::To<T>)` or `Parse(const Value&, formats::parse::To<T>)`"
412 "in namespace of `T` or `formats::parse`. Probably you have not provided a `Convert` function overload."
417template <
typename T,
typename First,
typename... Rest>
421 return T(std::forward<First>(default_arg), std::forward<Rest>(more_default_args)...);
423 return ConvertTo<T>();