MCPcopy Create free account
hub / github.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal / StringStreamToString

Function StringStreamToString

Gtest/src/gtest.cc:1659–1675  ·  view source on GitHub ↗

Converts the buffer in a stringstream to an std::string, converting NUL bytes to "\\0" along the way.

Source from the content-addressed store, hash-verified

1657// Converts the buffer in a stringstream to an std::string, converting NUL
1658// bytes to "\\0" along the way.
1659std::string StringStreamToString(::std::stringstream* ss) {
1660 const ::std::string& str = ss->str();
1661 const char* const start = str.c_str();
1662 const char* const end = start + str.length();
1663
1664 std::string result;
1665 result.reserve(2 * (end - start));
1666 for (const char* ch = start; ch != end; ++ch) {
1667 if (*ch == '\0') {
1668 result += "\\0"; // Replaces NUL with "\\0";
1669 } else {
1670 result += *ch;
1671 }
1672 }
1673
1674 return result;
1675}
1676
1677// Appends the user-supplied message to the Google-Test-generated message.
1678std::string AppendUserMessage(const std::string& gtest_msg,

Callers 5

GetStringMethod · 0.85
FloatingPointLEFunction · 0.85
WideStringToUtf8Function · 0.85
OnTestIterationEndMethod · 0.85
CmpHelperFloatingPointEQFunction · 0.85

Calls 3

reserveMethod · 0.80
c_strMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected