JSON BinPack 0.0.1
A space-efficient open-source binary JSON serialization format based on JSON Schema with both schema-driven and schema-less support.
Loading...
Searching...
No Matches
runtime_output_stream.h
1#ifndef SOURCEMETA_JSONBINPACK_RUNTIME_OUTPUT_STREAM_H_
2#define SOURCEMETA_JSONBINPACK_RUNTIME_OUTPUT_STREAM_H_
3
4#ifndef SOURCEMETA_JSONBINPACK_RUNTIME_EXPORT
5#include <sourcemeta/jsonbinpack/runtime_export.h>
6#endif
7
8#include <sourcemeta/core/io.h>
9#include <sourcemeta/core/json.h>
10
11#include <cstdint> // std::uint64_t, std::int64_t
12#include <ostream> // std::basic_ostream
13
14namespace sourcemeta::jsonbinpack {
15
17class SOURCEMETA_JSONBINPACK_RUNTIME_EXPORT OutputStream
18 : public sourcemeta::core::BinaryWriter {
19public:
20 using Stream = std::basic_ostream<sourcemeta::core::JSON::Char,
21 sourcemeta::core::JSON::CharTraits>;
22 OutputStream(Stream &output);
23
24 auto put_varint(const std::uint64_t value) -> void;
25 auto put_varint_zigzag(const std::int64_t value) -> void;
26 auto put_string_utf8(const sourcemeta::core::JSON::String &string,
27 const std::uint64_t length) -> void;
28};
29
30} // namespace sourcemeta::jsonbinpack
31
32#endif