Files
ternfs-XTXMarkets/cpp/core/Bincode.cpp
Francesco Mazzoli 5bff9b8fae Many, many changes -- tests pass, but FUSE is currently not present
The main thing that's added is full RS support, but a lot of things
were rejigged along the way. The tests are still a bit lacking,
and will be augmented in future commits.
2023-03-03 16:42:22 +00:00

35 lines
901 B
C++

#include "Bincode.hpp"
#include "Common.hpp"
std::ostream& operator<<(std::ostream& out, const BincodeBytesRef& x) {
return goLangBytesFmt(out, x.data(), x.size());
/*
out << "b\"";
uint8_t len = x.size();
const uint8_t* data = (const uint8_t*)x.data();
for (int i = 0; i < len; i++) {
uint8_t ch = data[i];
if (isprint(ch)) {
out << ch;
} else if (ch == 0) {
out << "\\0";
} else {
const char cfill = out.fill();
out << std::hex << std::setfill('0');
out << "\\x" << std::setw(2) << (int)ch;
out << std::setfill(cfill) << std::dec;
}
}
out << "\"";
return out;
*/
}
std::ostream& operator<<(std::ostream& out, const BincodeBytes& x) {
return out << x.ref();
}
const char* BincodeException::what() const noexcept {
return _msg.c_str();
}