Tangible serialization and design improvements

This commit is contained in:
2021-03-14 18:17:34 -04:00
parent 4426fa157a
commit 7c9fd1e46b
7 changed files with 108 additions and 44 deletions

View File

@@ -320,6 +320,7 @@ public:
void write_uint32(uint32_t v) { write_int32(v); }
void write_uint64(uint64_t v) { write_int64(v); }
void write_size(size_t sz) { write_int64(sz); }
void write_bool(bool b) { write_int8(b ? 1 : 0); }
// Write strings or blocks of bytes into the buffer.
void write_string(const std::string &s);
@@ -347,6 +348,7 @@ public:
uint16_t read_uint16() { return read_int16(); }
uint32_t read_uint32() { return read_int32(); }
uint64_t read_uint64() { return read_int64(); }
bool read_bool() { return read_int8(); }
// May throw StreamEof or StreamCorruption.
size_t read_size();