mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 21:48:11 +00:00
AK: Use StringBuilder::appendff() instead of appendf()
This commit is contained in:
parent
db0149056f
commit
764af6cdec
4 changed files with 11 additions and 11 deletions
|
@ -73,7 +73,7 @@ String encode_hex(ReadonlyBytes input)
|
||||||
StringBuilder output(input.size() * 2);
|
StringBuilder output(input.size() * 2);
|
||||||
|
|
||||||
for (auto ch : input)
|
for (auto ch : input)
|
||||||
output.appendf("%02x", ch);
|
output.appendff("{:02x}", ch);
|
||||||
|
|
||||||
return output.build();
|
return output.build();
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,7 +172,7 @@ inline void JsonValue::serialize(Builder& builder) const
|
||||||
break;
|
break;
|
||||||
#if !defined(KERNEL)
|
#if !defined(KERNEL)
|
||||||
case Type::Double:
|
case Type::Double:
|
||||||
builder.appendf("%g", m_value.as_double);
|
builder.appendff("{}", m_value.as_double);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case Type::Int32:
|
case Type::Int32:
|
||||||
|
|
|
@ -88,43 +88,43 @@ public:
|
||||||
void add(const StringView& key, int value)
|
void add(const StringView& key, int value)
|
||||||
{
|
{
|
||||||
begin_item(key);
|
begin_item(key);
|
||||||
m_builder.appendf("%d", value);
|
m_builder.appendff("{}", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void add(const StringView& key, unsigned value)
|
void add(const StringView& key, unsigned value)
|
||||||
{
|
{
|
||||||
begin_item(key);
|
begin_item(key);
|
||||||
m_builder.appendf("%u", value);
|
m_builder.appendff("{}", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void add(const StringView& key, long value)
|
void add(const StringView& key, long value)
|
||||||
{
|
{
|
||||||
begin_item(key);
|
begin_item(key);
|
||||||
m_builder.appendf("%ld", value);
|
m_builder.appendff("{}", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void add(const StringView& key, long unsigned value)
|
void add(const StringView& key, long unsigned value)
|
||||||
{
|
{
|
||||||
begin_item(key);
|
begin_item(key);
|
||||||
m_builder.appendf("%lu", value);
|
m_builder.appendff("{}", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void add(const StringView& key, long long value)
|
void add(const StringView& key, long long value)
|
||||||
{
|
{
|
||||||
begin_item(key);
|
begin_item(key);
|
||||||
m_builder.appendf("%lld", value);
|
m_builder.appendff("{}", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void add(const StringView& key, long long unsigned value)
|
void add(const StringView& key, long long unsigned value)
|
||||||
{
|
{
|
||||||
begin_item(key);
|
begin_item(key);
|
||||||
m_builder.appendf("%llu", value);
|
m_builder.appendff("{}", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void add(const StringView& key, double value)
|
void add(const StringView& key, double value)
|
||||||
{
|
{
|
||||||
begin_item(key);
|
begin_item(key);
|
||||||
m_builder.appendf("%f", value);
|
m_builder.appendff("{}", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonArraySerializer<Builder> add_array(const StringView& key)
|
JsonArraySerializer<Builder> add_array(const StringView& key)
|
||||||
|
|
|
@ -207,9 +207,9 @@ void dump_bytes(ReadonlyBytes bytes)
|
||||||
auto flush = [&]() {
|
auto flush = [&]() {
|
||||||
if (nrepeat > 0) {
|
if (nrepeat > 0) {
|
||||||
if (nrepeat == 1)
|
if (nrepeat == 1)
|
||||||
builder.appendf("%s0x%02x", prefix, static_cast<int>(buffered_byte));
|
builder.appendff("{}{:#02x}", prefix, static_cast<int>(buffered_byte));
|
||||||
else
|
else
|
||||||
builder.appendf("%s%zu * 0x%02x", prefix, nrepeat, static_cast<int>(buffered_byte));
|
builder.appendff("{}{} * {:#02x}", prefix, nrepeat, static_cast<int>(buffered_byte));
|
||||||
|
|
||||||
nrepeat = 0;
|
nrepeat = 0;
|
||||||
prefix = ", ";
|
prefix = ", ";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue