MCPcopy Create free account
hub / github.com/baidu/tera / DebugString

Function DebugString

src/utils/string_util.cc:45–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45std::string DebugString(const std::string& src) {
46 size_t src_len = src.size();
47 std::string dst;
48 dst.resize(src_len << 2);
49
50 size_t j = 0;
51 for (size_t i = 0; i < src_len; i++) {
52 uint8_t c = src[i];
53 if (IsVisible(c)) {
54 if ('\\' == c) {
55 dst[j++] = '\\';
56 dst[j++] = '\\';
57 } else {
58 dst[j++] = c;
59 }
60 } else {
61 dst[j++] = '\\';
62 dst[j++] = 'x';
63 dst[j++] = ToHex(c >> 4);
64 dst[j++] = ToHex(c & 0xF);
65 }
66 }
67
68 return dst.substr(0, j);
69}
70
71bool ParseDebugString(const std::string& src, std::string* dst) {
72 size_t src_len = src.size();

Callers 15

DumpRangeFunction · 0.85
WriteDiffDataToStreamFunction · 0.85
PrintableFormatterFunction · 0.85
ShowTabletListFunction · 0.85
CompactPreprocessFunction · 0.85
PrintMetaInfoFunction · 0.85
ModifyMetaValueFunction · 0.85
PutTabletMetaFunction · 0.85
ProcessMetaFunction · 0.85
MapOutPutDiffFunction · 0.85
TabletDiffFunction · 0.85
MetaConvOpFunction · 0.85

Calls 3

IsVisibleFunction · 0.85
ToHexFunction · 0.85
sizeMethod · 0.45

Tested by 1

TEST_FFunction · 0.68