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_;
322 template <
typename, common::IteratorDirection>
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;
334 friend bool Parse(
const Value& value, parse::To<bool>);
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>);
340 friend formats::json::Value
FromString(std::string_view);
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."
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>) {
406 }
else if constexpr (formats::common::impl::HasParse<Value, 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)...);
430std::chrono::microseconds Parse(
const Value& value, parse::To<std::chrono::microseconds>);
432std::chrono::milliseconds Parse(
const Value& value, parse::To<std::chrono::milliseconds>);
434std::chrono::minutes Parse(
const Value& value, parse::To<std::chrono::minutes>);
436std::chrono::hours Parse(
const Value& value, parse::To<std::chrono::hours>);