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);
93 typename = std::enable_if_t<
94 !std::is_same_v<std::decay_t<T>, ValueBuilder> && !std::is_same_v<std::decay_t<T>,
Value> &&
95 !std::is_same_v<std::decay_t<T>, std::string>>>
97 : ValueBuilder(DoSerialize(std::forward<T>(t)))
102 ValueBuilder operator[](std::string key);
106 ValueBuilder operator[](std::size_t index);
111 utils::StrongTypedefOps Ops,
112 typename Enable = std::enable_if_t<
utils::IsStrongTypedefLoggable(Ops)>>
113 ValueBuilder operator[](
utils::StrongTypedef<Tag, std::string, Ops> key);
118 void EmplaceNocheck(std::string_view key, ValueBuilder value);
122 void Remove(std::string_view key);
129 bool IsEmpty()
const;
132 bool IsNull()
const noexcept;
135 bool IsBool()
const noexcept;
138 bool IsInt()
const noexcept;
141 bool IsInt64()
const noexcept;
144 bool IsUInt64()
const noexcept;
147 bool IsDouble()
const noexcept;
150 bool IsString()
const noexcept;
153 bool IsArray()
const noexcept;
156 bool IsObject()
const noexcept;
160 std::size_t GetSize()
const;
164 bool HasMember(std::string_view key)
const;
167 std::string GetPath()
const;
172 void Resize(std::size_t size);
176 void PushBack(ValueBuilder&& bld);
182 formats::json::
Value ExtractValue();
185 class EmplaceEnabler {};
189 ValueBuilder(EmplaceEnabler, impl::MutableValueWrapper)
noexcept;
193 enum class CheckMemberExists { kYes, kNo };
195 explicit ValueBuilder(impl::MutableValueWrapper)
noexcept;
197 static void Copy(impl::Value& to,
const ValueBuilder& from);
198 static void Move(impl::Value& to, ValueBuilder&& from);
200 impl::Value& AddMember(std::string_view key, CheckMemberExists);
202 template <
typename T>
203 static Value DoSerialize(T&& t);
205 impl::MutableValueWrapper value_;
254std::enable_if_t<meta::kIsUniqueMap<T> && std::is_convertible_v<
typename T::key_type, std::string>,
Value>