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.
runtime.h
1 #ifndef SOURCEMETA_JSONBINPACK_RUNTIME_H_
2 #define SOURCEMETA_JSONBINPACK_RUNTIME_H_
3 
12 
13 #ifndef SOURCEMETA_JSONBINPACK_RUNTIME_EXPORT
14 #include <sourcemeta/jsonbinpack/runtime_export.h>
15 #endif
16 
17 #include <sourcemeta/jsontoolkit/json.h>
18 
19 #include <sourcemeta/jsonbinpack/runtime_decoder.h>
20 #include <sourcemeta/jsonbinpack/runtime_encoder.h>
21 #include <sourcemeta/jsonbinpack/runtime_encoding.h>
22 
23 #include <exception> // std::exception
24 #include <utility> // std::move
25 
26 namespace sourcemeta::jsonbinpack {
27 
29 SOURCEMETA_JSONBINPACK_RUNTIME_EXPORT
30 auto load(const sourcemeta::jsontoolkit::JSON &input) -> Encoding;
31 
32 // Exporting symbols that depends on the standard C++ library is considered
33 // safe.
34 // https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4275?view=msvc-170&redirectedfrom=MSDN
35 #if defined(_MSC_VER)
36 #pragma warning(disable : 4251 4275)
37 #endif
38 
41 class SOURCEMETA_JSONBINPACK_RUNTIME_EXPORT EncodingError
42  : public std::exception {
43 public:
44  EncodingError(sourcemeta::jsontoolkit::JSON::String message)
45  : message_{std::move(message)} {}
46 
47  [[nodiscard]] auto what() const noexcept -> const char * override {
48  return this->message_.c_str();
49  }
50 
51 private:
52  const sourcemeta::jsontoolkit::JSON::String message_;
53 };
54 
55 #if defined(_MSC_VER)
56 #pragma warning(default : 4251 4275)
57 #endif
58 
59 } // namespace sourcemeta::jsonbinpack
60 
61 #endif
std::variant< BOUNDED_MULTIPLE_8BITS_ENUM_FIXED, FLOOR_MULTIPLE_ENUM_VARINT, ROOF_MULTIPLE_MIRROR_ENUM_VARINT, ARBITRARY_MULTIPLE_ZIGZAG_VARINT, DOUBLE_VARINT_TUPLE, BYTE_CHOICE_INDEX, LARGE_CHOICE_INDEX, TOP_LEVEL_BYTE_CHOICE_INDEX, CONST_NONE, ANY_PACKED_TYPE_TAG_BYTE_PREFIX, UTF8_STRING_NO_LENGTH, FLOOR_VARINT_PREFIX_UTF8_STRING_SHARED, ROOF_VARINT_PREFIX_UTF8_STRING_SHARED, BOUNDED_8BIT_PREFIX_UTF8_STRING_SHARED, RFC3339_DATE_INTEGER_TRIPLET, PREFIX_VARINT_LENGTH_STRING_SHARED, FIXED_TYPED_ARRAY, BOUNDED_8BITS_TYPED_ARRAY, FLOOR_TYPED_ARRAY, ROOF_TYPED_ARRAY, FIXED_TYPED_ARBITRARY_OBJECT, VARINT_TYPED_ARBITRARY_OBJECT > Encoding
Definition: runtime_encoding.h:54