3 #include "JsonWriter.h"
5 #include <rapidjson/prettywriter.h>
6 #include <rapidjson/stringbuffer.h>
11 #include <string_view>
17 rapidjson::StringBuffer _prettyBuffer;
18 std::unique_ptr<rapidjson::PrettyWriter<rapidjson::StringBuffer>> pretty;
26 bool Bool(
bool b)
override;
27 bool Int(
int i)
override;
28 bool Uint(
unsigned int i)
override;
29 bool Uint64(std::uint64_t i)
override;
30 bool Int64(std::int64_t i)
override;
31 bool Double(
double d)
override;
32 bool RawNumber(
const char* str,
unsigned int length,
bool copy)
override;
33 bool Key(std::string_view
string)
override;
34 bool String(std::string_view
string)
override;
35 bool StartObject()
override;
36 bool EndObject()
override;
37 bool StartArray()
override;
38 bool EndArray()
override;
41 void Primitive(std::int32_t value)
override;
42 void Primitive(std::uint32_t value)
override;
43 void Primitive(std::int64_t value)
override;
44 void Primitive(std::uint64_t value)
override;
45 void Primitive(
float value)
override;
46 void Primitive(
double value)
override;
47 void Primitive(std::nullptr_t value)
override;
48 void Primitive(std::string_view
string)
override;
51 void KeyPrimitive(std::string_view keyName, std::int32_t value)
override;
52 void KeyPrimitive(std::string_view keyName, std::uint32_t value)
override;
53 void KeyPrimitive(std::string_view keyName, std::int64_t value)
override;
54 void KeyPrimitive(std::string_view keyName, std::uint64_t value)
override;
57 void KeyPrimitive(std::string_view keyName, std::string_view value)
override;
60 void KeyPrimitive(std::string_view keyName,
float value)
override;
61 void KeyPrimitive(std::string_view keyName,
double value)
override;
64 void KeyPrimitive(std::string_view keyName, std::nullptr_t value)
override;
67 void KeyArray(std::string_view keyName, std::function<
void(
void)> insideArray)
71 std::string_view keyName,
72 std::function<
void(
void)> insideObject)
override;
74 std::string toString()
override;
75 std::string_view toStringView()
override;
76 std::vector<std::byte> toBytes()
override;
Classes for writing JSON.