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

Function escapeString

externals/simplecpp/simplecpp.cpp:608–620  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

606}
607
608static std::string escapeString(const std::string &str)
609{
610 std::ostringstream ostr;
611 ostr << '\"';
612 for (std::size_t i = 1U; i < str.size() - 1; ++i) {
613 const char c = str[i];
614 if (c == '\\' || c == '\"' || c == '\'')
615 ostr << '\\';
616 ostr << c;
617 }
618 ostr << '\"';
619 return ostr.str();
620}
621
622static void portabilityBackslash(simplecpp::OutputList *outputList, const simplecpp::Location &location)
623{

Callers 2

readfileMethod · 0.85
expandHashMethod · 0.85

Calls 2

sizeMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected