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.
| 8828 | // The array starts at *begin, the length is len, it may include L'\0' |
| 8829 | // characters and may not be null-terminated. |
| 8830 | static 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. |
| 8848 | void PrintTo(const char* s, ostream* os) { |
no test coverage detected