Zserio C++17 runtime library 1.3.0
Built for Zserio 2.20.0
Loading...
Searching...
No Matches
JsonEncoder.h
Go to the documentation of this file.
1#ifndef ZSERIO_JSON_ENCODER_H_INC
2#define ZSERIO_JSON_ENCODER_H_INC
3
4#include <cstdint>
5#include <string_view>
6#include <type_traits>
7
9#include "zserio/String.h"
11
12namespace zserio
13{
14
19{
20public:
26 static void encodeNull(std::ostream& stream);
27
34 static void encodeBool(std::ostream& stream, bool value);
35
42 template <typename T>
43 static void encodeIntegral(std::ostream& stream, T value);
44
51 static void encodeFloatingPoint(std::ostream& stream, double value);
52
61 static void encodeString(std::ostream& stream, std::string_view value);
62};
63
64template <typename T>
65void JsonEncoder::encodeIntegral(std::ostream& stream, T value)
66{
67 using U = typename std::conditional<std::is_signed<T>::value, int64_t, uint64_t>::type;
69}
70
71} // namespace zserio
72
73#endif // ZSERIO_JSON_ENCODER_H_INC
static void encodeFloatingPoint(std::ostream &stream, double value)
static void encodeNull(std::ostream &stream)
static void encodeBool(std::ostream &stream, bool value)
static void encodeIntegral(std::ostream &stream, T value)
Definition JsonEncoder.h:65
static void encodeString(std::ostream &stream, std::string_view value)