| OLD | NEW |
| 1 // Copyright 2007, Google Inc. | 1 // Copyright 2007, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 // The array starts at *begin, the length is len, it may include '\0' characters | 235 // The array starts at *begin, the length is len, it may include '\0' characters |
| 236 // and may not be null-terminated. | 236 // and may not be null-terminated. |
| 237 static void PrintCharsAsStringTo(const char* begin, size_t len, ostream* os) { | 237 static void PrintCharsAsStringTo(const char* begin, size_t len, ostream* os) { |
| 238 *os << "\""; | 238 *os << "\""; |
| 239 for (size_t index = 0; index < len; ++index) { | 239 for (size_t index = 0; index < len; ++index) { |
| 240 PrintAsStringLiteralTo(begin[index], os); | 240 PrintAsStringLiteralTo(begin[index], os); |
| 241 } | 241 } |
| 242 *os << "\""; | 242 *os << "\""; |
| 243 } | 243 } |
| 244 | 244 |
| 245 // Prints a (const) char array of 'len' elements, starting at address 'begin'. |
| 246 void UniversalPrintArray(const char* begin, size_t len, ostream* os) { |
| 247 PrintCharsAsStringTo(begin, len, os); |
| 248 } |
| 249 |
| 245 // Prints the given array of wide characters to the ostream. | 250 // Prints the given array of wide characters to the ostream. |
| 246 // The array starts at *begin, the length is len, it may include L'\0' | 251 // The array starts at *begin, the length is len, it may include L'\0' |
| 247 // characters and may not be null-terminated. | 252 // characters and may not be null-terminated. |
| 248 static void PrintWideCharsAsStringTo(const wchar_t* begin, size_t len, | 253 static void PrintWideCharsAsStringTo(const wchar_t* begin, size_t len, |
| 249 ostream* os) { | 254 ostream* os) { |
| 250 *os << "L\""; | 255 *os << "L\""; |
| 251 for (size_t index = 0; index < len; ++index) { | 256 for (size_t index = 0; index < len; ++index) { |
| 252 PrintAsWideStringLiteralTo(begin[index], os); | 257 PrintAsWideStringLiteralTo(begin[index], os); |
| 253 } | 258 } |
| 254 *os << "\""; | 259 *os << "\""; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 | 309 |
| 305 #if GTEST_HAS_STD_WSTRING | 310 #if GTEST_HAS_STD_WSTRING |
| 306 void PrintWideStringTo(const ::std::wstring& s, ostream* os) { | 311 void PrintWideStringTo(const ::std::wstring& s, ostream* os) { |
| 307 PrintWideCharsAsStringTo(s.data(), s.size(), os); | 312 PrintWideCharsAsStringTo(s.data(), s.size(), os); |
| 308 } | 313 } |
| 309 #endif // GTEST_HAS_STD_WSTRING | 314 #endif // GTEST_HAS_STD_WSTRING |
| 310 | 315 |
| 311 } // namespace internal | 316 } // namespace internal |
| 312 | 317 |
| 313 } // namespace testing | 318 } // namespace testing |
| OLD | NEW |