MCPcopy Create free account
hub / github.com/apple/foundationdb / formatStringRef

Function formatStringRef

fdbcli/fdbcli.actor.cpp:333–350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

331};
332
333static std::string formatStringRef(StringRef item, bool fullEscaping = false) {
334 std::string ret;
335
336 for (int i = 0; i < item.size(); i++) {
337 if (fullEscaping && item[i] == '\\')
338 ret += "\\\\";
339 else if (fullEscaping && item[i] == '"')
340 ret += "\\\"";
341 else if (fullEscaping && item[i] == ' ')
342 ret += format("\\x%02x", item[i]);
343 else if (item[i] >= 32 && item[i] < 127)
344 ret += item[i];
345 else
346 ret += format("\\x%02x", item[i]);
347 }
348
349 return ret;
350}
351
352static std::vector<std::vector<StringRef>> parseLine(std::string& line, bool& err, bool& partial) {
353 err = false;

Callers 3

printMethod · 0.85
printHelpFunction · 0.85
fdbcli.actor.cppFile · 0.85

Calls 2

formatFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected