MCPcopy Create free account
hub / github.com/BVLC/caffe / PrintWideCharsAsStringTo

Function PrintWideCharsAsStringTo

src/gtest/gtest-all.cpp:8830–8845  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

8828// The array starts at *begin, the length is len, it may include L'\0'
8829// characters and may not be null-terminated.
8830static void PrintWideCharsAsStringTo(const wchar_t* begin, size_t len,
8831 ostream* os) {
8832 *os << "L\"";
8833 bool is_previous_hex = false;
8834 for (size_t index = 0; index < len; ++index) {
8835 const wchar_t cur = begin[index];
8836 if (is_previous_hex && isascii(cur) && IsXDigit(static_cast<char>(cur))) {
8837 // Previous character is of '\x..' form and this character can be
8838 // interpreted as another hexadecimal digit in its number. Break string to
8839 // disambiguate.
8840 *os << "\" L\"";
8841 }
8842 is_previous_hex = PrintAsWideStringLiteralTo(cur, os) == kHexEscape;
8843 }
8844 *os << "\"";
8845}
8846
8847// Prints the given C string to the ostream.
8848void PrintTo(const char* s, ostream* os) {

Callers 2

PrintToFunction · 0.85
PrintWideStringToFunction · 0.85

Calls 2

IsXDigitFunction · 0.85

Tested by

no test coverage detected