41class ValueBuilder
final {
44 using ValueType = formats::json::ValueBuilder;
45 using Reference = formats::json::ValueBuilder&;
46 using Pointer = formats::json::ValueBuilder*;
47 using ContainerType = impl::MutableValueWrapper;
50 using iterator = Iterator<IterTraits>;
53 ValueBuilder() =
default;
60 ValueBuilder(
common::TransferTag, ValueBuilder&&)
noexcept;
62 ValueBuilder(
const ValueBuilder& other);
64 ValueBuilder(ValueBuilder&& other);
65 ValueBuilder& operator=(
const ValueBuilder& other);
67 ValueBuilder& operator=(ValueBuilder&& other);
69 ValueBuilder(
const formats::json::
Value& other);
70 ValueBuilder(formats::json::
Value&& other);
74 ValueBuilder(std::nullptr_t)
78 ValueBuilder(
const char* str);
79 ValueBuilder(
char* str);
80 ValueBuilder(
const std::string& str);
81 ValueBuilder(std::string_view str);
83 ValueBuilder(
unsigned int t);
84 ValueBuilder(uint64_t t);
85 ValueBuilder(int64_t t);
86 ValueBuilder(
float t);
87 ValueBuilder(
double t);
92 ValueBuilder(
const T& t)
93 : ValueBuilder(DoSerialize(t))
98 ValueBuilder operator[](std::string key);
102 ValueBuilder operator[](std::size_t index);
105 template <
typename Tag,
utils::StrongTypedefOps Ops>
106 requires(
utils::IsStrongTypedefLoggable(Ops))
107 ValueBuilder operator[](
utils::StrongTypedef<Tag, std::string, Ops> key) {
108 return (*
this)[std::move(key.GetUnderlying())];
114 void EmplaceNocheck(std::string_view key, ValueBuilder value);
118 void Remove(std::string_view key);
125 bool IsEmpty()
const;
128 bool IsNull()
const noexcept;
131 bool IsBool()
const noexcept;
134 bool IsInt()
const noexcept;
137 bool IsInt64()
const noexcept;
140 bool IsUInt64()
const noexcept;
143 bool IsDouble()
const noexcept;
146 bool IsString()
const noexcept;
149 bool IsArray()
const noexcept;
152 bool IsObject()
const noexcept;
156 std::size_t GetSize()
const;
160 bool HasMember(std::string_view key)
const;
163 std::string GetPath()
const;
168 void Resize(std::size_t size);
172 void PushBack(ValueBuilder&& bld);
178 formats::json::
Value ExtractValue();
181 class EmplaceEnabler {};
185 ValueBuilder(EmplaceEnabler, impl::MutableValueWrapper)
noexcept;
189 enum class CheckMemberExists { kYes, kNo };
191 explicit ValueBuilder(impl::MutableValueWrapper)
noexcept;
193 static void Copy(impl::Value& to,
const ValueBuilder& from);
194 static void Move(impl::Value& to, ValueBuilder&& from);
196 impl::Value& AddMember(std::string_view key, CheckMemberExists);
198 template <
typename T>
199 static Value DoSerialize(
const T& t);
201 impl::MutableValueWrapper value_;
243requires meta::kIsUniqueMap<T> && std::is_convertible_v<
typename T::key_type, std::string>