63 void PrintByteSegmentInObjectTo(
const unsigned char* obj_bytes,
size_t start,
66 for (
size_t i = 0;
i !=
count;
i++) {
67 const size_t j = start +
i;
82 void PrintBytesInObjectToImpl(
const unsigned char* obj_bytes,
size_t count,
85 *os << count <<
"-byte object <";
87 const size_t kThreshold = 132;
88 const size_t kChunkSize = 64;
93 if (count < kThreshold) {
94 PrintByteSegmentInObjectTo(obj_bytes, 0, count, os);
96 PrintByteSegmentInObjectTo(obj_bytes, 0, kChunkSize, os);
99 const size_t resume_pos = (count - kChunkSize + 1)/2*2;
100 PrintByteSegmentInObjectTo(obj_bytes, resume_pos, count - resume_pos, os);
107 namespace internal2 {
116 PrintBytesInObjectToImpl(obj_bytes, count, os);
138 return 0x20 <= c && c <= 0x7E;
145 template <
typename Un
signedChar,
typename Char>
147 switch (static_cast<wchar_t>(c)) {
180 *os << static_cast<char>(
c);
201 return PrintAsCharLiteralTo<wchar_t>(
c,
os);
209 static_cast<wchar_t>(static_cast<unsigned char>(c)), os);
216 template <
typename Un
signedChar,
typename Char>
219 *os << ((sizeof(c) > 1) ?
"L'" :
"'");
228 *os <<
" (" <<
static_cast<int>(
c);
233 if (format ==
kHexEscape || (1 <= c && c <= 9)) {
241 void PrintTo(
unsigned char c, ::std::ostream* os) {
242 PrintCharAndCodeTo<unsigned char>(
c,
os);
245 PrintCharAndCodeTo<unsigned char>(
c,
os);
251 PrintCharAndCodeTo<wchar_t>(wc,
os);
258 template <
typename CharType>
263 const CharType*
begin,
size_t len, ostream* os) {
264 const char*
const kQuoteBegin =
sizeof(CharType) == 1 ?
"\"" :
"L\"";
266 bool is_previous_hex =
false;
269 if (is_previous_hex &&
IsXDigit(cur)) {
273 *os <<
"\" " << kQuoteBegin;
282 template <
typename CharType>
287 const CharType*
begin,
size_t len, ostream* os) {
295 if (len > 0 && begin[len - 1] ==
'\0') {
305 *os <<
" (no terminating NUL)";
324 *os << ImplicitCast_<const void*>(
s) <<
" pointing to ";
335 #if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
341 *os << ImplicitCast_<const void*>(
s) <<
" pointing to ";
345 #endif // wchar_t is native
348 #if GTEST_HAS_GLOBAL_STRING
352 #endif // GTEST_HAS_GLOBAL_STRING
359 #if GTEST_HAS_GLOBAL_WSTRING
363 #endif // GTEST_HAS_GLOBAL_WSTRING
365 #if GTEST_HAS_STD_WSTRING
369 #endif // GTEST_HAS_STD_WSTRING