AK: Add some integer overloads to JsonObjectSerializer

This avoids constructing a temporary JsonValue just to append an int.
This commit is contained in:
Andreas Kling 2020-02-01 10:55:16 +01:00
parent 37d336d741
commit 276b6a4372
Notes: sideshowbarker 2024-07-19 09:44:04 +09:00

View file

@ -79,6 +79,30 @@ public:
m_builder.append('"');
}
void add(const StringView& key, i32 value)
{
begin_item(key);
m_builder.appendf("%d", value);
}
void add(const StringView& key, u32 value)
{
begin_item(key);
m_builder.appendf("%u", value);
}
void add(const StringView& key, i64 value)
{
begin_item(key);
m_builder.appendf("%lld", value);
}
void add(const StringView& key, u64 value)
{
begin_item(key);
m_builder.appendf("%llu", value);
}
JsonArraySerializer<Builder> add_array(const StringView& key)
{
begin_item(key);