MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / PrintCharsAsStringTo

Function PrintCharsAsStringTo

rtpose_wrapper/src/gtest/gtest-all.cpp:8806–8820  ·  view source on GitHub ↗

Prints the given array of characters to the ostream. The array starts at *begin, the length is len, it may include '\0' characters and may not be null-terminated.

Source from the content-addressed store, hash-verified

8804// The array starts at *begin, the length is len, it may include '\0' characters
8805// and may not be null-terminated.
8806static void PrintCharsAsStringTo(const char* begin, size_t len, ostream* os) {
8807 *os << "\"";
8808 bool is_previous_hex = false;
8809 for (size_t index = 0; index < len; ++index) {
8810 const char cur = begin[index];
8811 if (is_previous_hex && IsXDigit(cur)) {
8812 // Previous character is of '\x..' form and this character can be
8813 // interpreted as another hexadecimal digit in its number. Break string to
8814 // disambiguate.
8815 *os << "\" \"";
8816 }
8817 is_previous_hex = PrintAsNarrowStringLiteralTo(cur, os) == kHexEscape;
8818 }
8819 *os << "\"";
8820}
8821
8822// Prints a (const) char array of 'len' elements, starting at address 'begin'.
8823void UniversalPrintArray(const char* begin, size_t len, ostream* os) {

Callers 3

UniversalPrintArrayFunction · 0.85
PrintToFunction · 0.85
PrintStringToFunction · 0.85

Calls 2

IsXDigitFunction · 0.85

Tested by

no test coverage detected