37class ValueBuilder
final {
40 using ValueType = formats::
json::ValueBuilder;
41 using Reference = formats::
json::ValueBuilder&;
42 using Pointer = formats::
json::ValueBuilder*;
43 using ContainerType = impl::MutableValueWrapper;
58 ValueBuilder(
const ValueBuilder& other);
60 ValueBuilder(ValueBuilder&& other);
61 ValueBuilder& operator=(
const ValueBuilder& other);
63 ValueBuilder& operator=(ValueBuilder&& other);
65 ValueBuilder(
const formats::
json::
Value& other);
66 ValueBuilder(formats::
json::
Value&& other);
70 ValueBuilder(std::nullptr_t)
74 ValueBuilder(
const char* str);
75 ValueBuilder(
char* str);
76 ValueBuilder(
const std::string& str);
77 ValueBuilder(std::string_view str);
79 ValueBuilder(
unsigned int t);
80 ValueBuilder(uint64_t t);
81 ValueBuilder(int64_t t);
82 ValueBuilder(
float t);
83 ValueBuilder(
double t);
89 : ValueBuilder(DoSerialize(t))
101 template <
typename Tag,
utils::StrongTypedefOps Ops>
102 requires(
utils::IsStrongTypedefLoggable(Ops))
104 return (*
this)[std::move(key.GetUnderlying())];
177 class EmplaceEnabler {};
181 ValueBuilder(EmplaceEnabler, impl::MutableValueWrapper)
noexcept;
185 enum class CheckMemberExists { kYes, kNo };
187 explicit ValueBuilder(impl::MutableValueWrapper)
noexcept;
189 static void Copy(impl::Value& to,
const ValueBuilder& from);
190 static void Move(impl::Value& to, ValueBuilder&& from);
192 impl::Value& AddMember(std::string_view key, CheckMemberExists);
194 template <
typename T>
195 USERVER_IMPL_NODEBUG_INLINE_FUNC
static Value DoSerialize(
const T& t) {
198 "There is no `Serialize(const T&, formats::serialize::To<json::Value>)` "
199 "in namespace of `T` or `formats::serialize`. "
201 "Probably you forgot to include the <userver/formats/serialize/common_containers.hpp> header "
202 "or one of the <formats/json/serialize_*.hpp> headers or you have not provided a `Serialize` function "
209 impl::MutableValueWrapper value_;
237requires meta::IsUniqueMap<T> && std::is_convertible_v<
typename T::key_type, std::string>