MCPcopy Create free account
hub / github.com/EmbeddedRPC/erpc / PrintCharsAsStringTo

Function PrintCharsAsStringTo

test/common/gtest/gtest.cpp:10101–10117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10099GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
10100GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
10101static void PrintCharsAsStringTo(
10102 const CharType* begin, size_t len, ostream* os) {
10103 const char* const kQuoteBegin = sizeof(CharType) == 1 ? "\"" : "L\"";
10104 *os << kQuoteBegin;
10105 bool is_previous_hex = false;
10106 for (size_t index = 0; index < len; ++index) {
10107 const CharType cur = begin[index];
10108 if (is_previous_hex && IsXDigit(cur)) {
10109 // Previous character is of '\x..' form and this character can be
10110 // interpreted as another hexadecimal digit in its number. Break string to
10111 // disambiguate.
10112 *os << "\" " << kQuoteBegin;
10113 }
10114 is_previous_hex = PrintAsStringLiteralTo(cur, os) == kHexEscape;
10115 }
10116 *os << "\"";
10117}
10118
10119// Prints a (const) char/wchar_t array of 'len' elements, starting at address
10120// 'begin'. CharType must be either char or wchar_t.

Callers 4

UniversalPrintCharArrayFunction · 0.85
PrintToFunction · 0.85
PrintStringToFunction · 0.85
PrintWideStringToFunction · 0.85

Calls 2

IsXDigitFunction · 0.85
PrintAsStringLiteralToFunction · 0.85

Tested by

no test coverage detected