MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / toString

Method toString

src/common/types/blob.cpp:65–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65std::string Blob::toString(const uint8_t* value, uint64_t len) {
66 std::string result;
67 for (auto i = 0u; i < len; i++) {
68 if (isRegularChar(value[i])) {
69 // ascii characters are rendered as-is.
70 result += value[i];
71 } else {
72 auto firstByte = value[i] >> HexFormatConstants::NUM_BYTES_TO_SHIFT_FOR_FIRST_BYTE;
73 auto secondByte = value[i] & HexFormatConstants::SECOND_BYTE_MASK;
74 // non-ascii characters are rendered as hexadecimal (e.g. \x00).
75 result += '\\';
76 result += 'x';
77 result += HexFormatConstants::HEX_TABLE[firstByte];
78 result += HexFormatConstants::HEX_TABLE[secondByte];
79 }
80 }
81 return result;
82}
83
84void Blob::validateHexCode(const uint8_t* blobStr, uint64_t length, uint64_t curPos) {
85 if (curPos + HexFormatConstants::LENGTH > length) {

Callers 3

setArrowFormatMethod · 0.45
resizeVectorFunction · 0.45
MAP>Method · 0.45

Calls 1

isRegularCharFunction · 0.85

Tested by

no test coverage detected