#include "BinaryBuffer.h" #include BinaryBuffer::BinaryBuffer() {} BinaryBuffer& BinaryBuffer::operator<<(const std::string_view& x) { std::uint32_t len = x.size(); *this << len; for (char c : x) *this << c; return *this; } BinaryBuffer& BinaryBuffer::operator>>(std::string& x) { std::uint32_t len; *this >> len; x.resize(len); for (char& c : x) *this >> c; return *this; } std::size_t BinaryBuffer::size() const { return data.size(); } bool BinaryBuffer::empty() const { return data.empty(); } std::ostream& operator<<(std::ostream &out, const BinaryBuffer &x) { for (auto v : x.data) out.put(v); return out; }