OLD | NEW |
1 // Copyright 2005, Google Inc. | 1 // Copyright 2005, 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // implementing Google Test. We do not intend to implement a full-fledged | 69 // implementing Google Test. We do not intend to implement a full-fledged |
70 // string class here. | 70 // string class here. |
71 // | 71 // |
72 // Since the purpose of this class is to provide a substitute for | 72 // Since the purpose of this class is to provide a substitute for |
73 // std::string on platforms where it cannot be used, we define a copy | 73 // std::string on platforms where it cannot be used, we define a copy |
74 // constructor and assignment operators such that we don't need | 74 // constructor and assignment operators such that we don't need |
75 // conditional compilation in a lot of places. | 75 // conditional compilation in a lot of places. |
76 // | 76 // |
77 // In order to make the representation efficient, the d'tor of String | 77 // In order to make the representation efficient, the d'tor of String |
78 // is not virtual. Therefore DO NOT INHERIT FROM String. | 78 // is not virtual. Therefore DO NOT INHERIT FROM String. |
79 class String { | 79 class GOOGLE_TEST_API String { |
80 public: | 80 public: |
81 // Static utility methods | 81 // Static utility methods |
82 | 82 |
83 // Returns the input enclosed in double quotes if it's not NULL; | 83 // Returns the input enclosed in double quotes if it's not NULL; |
84 // otherwise returns "(null)". For example, "\"Hello\"" is returned | 84 // otherwise returns "(null)". For example, "\"Hello\"" is returned |
85 // for input "Hello". | 85 // for input "Hello". |
86 // | 86 // |
87 // This is useful for printing a C string in the syntax of a literal. | 87 // This is useful for printing a C string in the syntax of a literal. |
88 // | 88 // |
89 // Known issue: escape sequences are not handled yet. | 89 // Known issue: escape sequences are not handled yet. |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 } else { | 322 } else { |
323 os << c_str[i]; | 323 os << c_str[i]; |
324 } | 324 } |
325 } | 325 } |
326 } | 326 } |
327 return os; | 327 return os; |
328 } | 328 } |
329 | 329 |
330 // Gets the content of the StrStream's buffer as a String. Each '\0' | 330 // Gets the content of the StrStream's buffer as a String. Each '\0' |
331 // character in the buffer is replaced with "\\0". | 331 // character in the buffer is replaced with "\\0". |
332 String StrStreamToString(StrStream* stream); | 332 GOOGLE_TEST_API String StrStreamToString(StrStream* stream); |
333 | 333 |
334 // Converts a streamable value to a String. A NULL pointer is | 334 // Converts a streamable value to a String. A NULL pointer is |
335 // converted to "(null)". When the input value is a ::string, | 335 // converted to "(null)". When the input value is a ::string, |
336 // ::std::string, ::wstring, or ::std::wstring object, each NUL | 336 // ::std::string, ::wstring, or ::std::wstring object, each NUL |
337 // character in it is replaced with "\\0". | 337 // character in it is replaced with "\\0". |
338 | 338 |
339 // Declared here but defined in gtest.h, so that it has access | 339 // Declared here but defined in gtest.h, so that it has access |
340 // to the definition of the Message class, required by the ARM | 340 // to the definition of the Message class, required by the ARM |
341 // compiler. | 341 // compiler. |
342 template <typename T> | 342 template <typename T> |
343 String StreamableToString(const T& streamable); | 343 String StreamableToString(const T& streamable); |
344 | 344 |
345 } // namespace internal | 345 } // namespace internal |
346 } // namespace testing | 346 } // namespace testing |
347 | 347 |
348 #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ | 348 #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ |
OLD | NEW |