inventory regions, minor refactor

This commit is contained in:
MihailRis
2024-01-31 00:14:43 +03:00
parent a57fba4fa4
commit 49fdcdfb27
29 changed files with 259 additions and 160 deletions
+5 -1
View File
@@ -56,7 +56,11 @@ static void to_binary(ByteBuilder& builder, const Value* value) {
static List* array_from_binary(ByteReader& reader);
static Map* object_from_binary(ByteReader& reader);
std::vector<ubyte> json::to_binary(const Map* obj) {
std::vector<ubyte> json::to_binary(const Map* obj, bool compress) {
if (compress) {
auto bytes = to_binary(obj, false);
return gzip::compress(bytes.data(), bytes.size());
}
ByteBuilder builder;
// type byte
builder.put(BJSON_TYPE_DOCUMENT);