Public release

This commit is contained in:
Dave Allie
2025-12-03 22:00:29 +11:00
commit 2ccdbeecc8
54 changed files with 33356 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
#pragma once
#include <iostream>
namespace serialization {
template <typename T>
static void writePod(std::ostream& os, const T& value) {
os.write(reinterpret_cast<const char*>(&value), sizeof(T));
}
template <typename T>
static void readPod(std::istream& is, T& value) {
is.read(reinterpret_cast<char*>(&value), sizeof(T));
}
static void writeString(std::ostream& os, const std::string& s) {
const uint32_t len = s.size();
writePod(os, len);
os.write(s.data(), len);
}
static void readString(std::istream& is, std::string& s) {
uint32_t len;
readPod(is, len);
s.resize(len);
is.read(&s[0], len);
}
} // namespace serialization