mirror of
https://github.com/XTXMarkets/ternfs.git
synced 2026-01-06 19:09:59 -06:00
Most operations apart from spans-related ones work. Using this as a checkpoint -- the Python code is currently not really working, I'm working to migrate to pretty much a full C++/go world.
25 lines
640 B
C++
25 lines
640 B
C++
#include "Bincode.hpp"
|
|
|
|
std::ostream& operator<<(std::ostream& out, const BincodeBytes& x) {
|
|
out << "b\"";
|
|
for (int i = 0; i < x.length; i++) {
|
|
uint8_t ch = x.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;
|
|
}
|
|
|
|
const char* BincodeException::what() const noexcept {
|
|
return _msg.c_str();
|
|
}
|