diff --git a/AK/JsonArraySerializer.h b/AK/JsonArraySerializer.h index 0d51f1dca70..2137146eab5 100644 --- a/AK/JsonArraySerializer.h +++ b/AK/JsonArraySerializer.h @@ -31,11 +31,13 @@ public: finish(); } +#ifndef KERNEL void add(const JsonValue& value) { begin_item(); value.serialize(m_builder); } +#endif void add(const StringView& value) { @@ -61,6 +63,48 @@ public: m_builder.append('"'); } + void add(bool value) + { + begin_item(); + m_builder.append(value ? "true"sv : "false"sv); + } + + void add(int value) + { + begin_item(); + m_builder.appendff("{}", value); + } + + void add(unsigned value) + { + begin_item(); + m_builder.appendff("{}", value); + } + + void add(long value) + { + begin_item(); + m_builder.appendff("{}", value); + } + + void add(long unsigned value) + { + begin_item(); + m_builder.appendff("{}", value); + } + + void add(long long value) + { + begin_item(); + m_builder.appendff("{}", value); + } + + void add(long long unsigned value) + { + begin_item(); + m_builder.appendff("{}", value); + } + JsonArraySerializer add_array() { begin_item(); diff --git a/AK/JsonObjectSerializer.h b/AK/JsonObjectSerializer.h index 0289b909849..4c50a6fa72a 100644 --- a/AK/JsonObjectSerializer.h +++ b/AK/JsonObjectSerializer.h @@ -7,7 +7,10 @@ #pragma once #include -#include + +#ifndef KERNEL +# include +#endif namespace AK { @@ -29,11 +32,13 @@ public: finish(); } +#ifndef KERNEL void add(const StringView& key, const JsonValue& value) { begin_item(key); value.serialize(m_builder); } +#endif void add(const StringView& key, const StringView& value) { @@ -101,11 +106,13 @@ public: m_builder.appendff("{}", value); } +#ifndef KERNEL void add(const StringView& key, double value) { begin_item(key); m_builder.appendff("{}", value); } +#endif JsonArraySerializer add_array(const StringView& key) { diff --git a/Kernel/CMakeLists.txt b/Kernel/CMakeLists.txt index bf937387c62..d50f8dc9400 100644 --- a/Kernel/CMakeLists.txt +++ b/Kernel/CMakeLists.txt @@ -301,7 +301,6 @@ set(AK_SOURCES ../AK/FlyString.cpp ../AK/GenericLexer.cpp ../AK/Hex.cpp - ../AK/JsonValue.cpp ../AK/LexicalPath.cpp ../AK/String.cpp ../AK/StringBuilder.cpp diff --git a/Kernel/ProcessSpecificExposed.cpp b/Kernel/ProcessSpecificExposed.cpp index 45b244649c8..ab8fb29f6bb 100644 --- a/Kernel/ProcessSpecificExposed.cpp +++ b/Kernel/ProcessSpecificExposed.cpp @@ -5,7 +5,6 @@ */ #include -#include #include #include #include @@ -44,7 +43,7 @@ private: address = 0xdeadc0de; kernel_address_added = true; } - array.add(JsonValue(address)); + array.add(address); } array.finish();