mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
AK: Add some integer overloads to JsonObjectSerializer
This avoids constructing a temporary JsonValue just to append an int.
This commit is contained in:
parent
37d336d741
commit
276b6a4372
Notes:
sideshowbarker
2024-07-19 09:44:04 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/276b6a43729
1 changed files with 24 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue