MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / getLine

Method getLine

test/testvarid.cpp:2456–2465  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2454 }
2455
2456 static std::string getLine(const std::string &code, int lineNumber) {
2457 std::string nr = std::to_string(lineNumber);
2458 const std::string::size_type pos1 = code.find('\n' + nr + ": ");
2459 if (pos1 == std::string::npos)
2460 return "";
2461 const std::string::size_type pos2 = code.find('\n', pos1+1);
2462 if (pos2 == std::string::npos)
2463 return "";
2464 return code.substr(pos1+1, pos2-pos1-1);
2465 }
2466
2467 void varid_namespace_3() { // #8627
2468 const char code[] = "namespace foo {\n"

Callers

nothing calls this directly

Calls 1

findMethod · 0.45

Tested by

no test coverage detected