17 stream << std::boolalpha << value << std::noboolalpha;
22 if (std::isnan(value))
26 else if (std::isinf(value))
36 double intPart = 1e16;
37 const double fractPart = std::modf(value, &intPart);
39 if (fractPart == 0.0 && intPart > -1e16 && intPart < 1e16)
41 stream << std::fixed << std::setprecision(1) << value << std::defaultfloat;
45 stream << std::setprecision(15) << value << std::defaultfloat;
52 static const std::array<char, 17> HEX = {
"0123456789abcdef"};
55 for (
char character : value)
62 stream.put(character);
85 if (
static_cast<uint8_t
>(character) <= 0x1F)
91 stream.put(HEX[
static_cast<uint8_t
>(
static_cast<uint8_t
>(character) >> 4U) & 0xFU]);
92 stream.put(HEX[
static_cast<uint8_t
>(character) & 0xFU]);
96 stream.put(character);
static void encodeFloatingPoint(std::ostream &stream, double value)
static void encodeNull(std::ostream &stream)
static void encodeBool(std::ostream &stream, bool value)
static void encodeString(std::ostream &stream, StringView value)