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_input_stream.h
1#ifndef SOURCEMETA_JSONBINPACK_RUNTIME_INPUT_STREAM_H_
2#define SOURCEMETA_JSONBINPACK_RUNTIME_INPUT_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 <istream> // std::basic_istream
13
14namespace sourcemeta::jsonbinpack {
15
17class SOURCEMETA_JSONBINPACK_RUNTIME_EXPORT InputStream
18 : public sourcemeta::core::BinaryReader {
19public:
20 using Stream = std::basic_istream<sourcemeta::core::JSON::Char,
21 sourcemeta::core::JSON::CharTraits>;
22 InputStream(Stream &input);
23
24 // Seek backwards given a relative offset
25 auto rewind(const std::uint64_t relative_offset, const std::uint64_t position)
26 -> std::uint64_t;
27 auto get_varint() -> std::uint64_t;
28 auto get_varint_zigzag() -> std::int64_t;
29 auto get_string_utf8(const std::uint64_t length)
30 -> sourcemeta::core::JSON::String;
31};
32
33} // namespace sourcemeta::jsonbinpack
34
35#endif