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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // will print "1 != 2". | 70 // will print "1 != 2". |
71 // | 71 // |
72 // Message is not intended to be inherited from. In particular, its | 72 // Message is not intended to be inherited from. In particular, its |
73 // destructor is not virtual. | 73 // destructor is not virtual. |
74 // | 74 // |
75 // Note that StrStream behaves differently in gcc and in MSVC. You | 75 // Note that StrStream behaves differently in gcc and in MSVC. You |
76 // can stream a NULL char pointer to it in the former, but not in the | 76 // can stream a NULL char pointer to it in the former, but not in the |
77 // latter (it causes an access violation if you do). The Message | 77 // latter (it causes an access violation if you do). The Message |
78 // class hides this difference by treating a NULL char pointer as | 78 // class hides this difference by treating a NULL char pointer as |
79 // "(null)". | 79 // "(null)". |
80 class Message { | 80 class GOOGLE_TEST_API Message { |
81 private: | 81 private: |
82 // The type of basic IO manipulators (endl, ends, and flush) for | 82 // The type of basic IO manipulators (endl, ends, and flush) for |
83 // narrow streams. | 83 // narrow streams. |
84 typedef std::ostream& (*BasicNarrowIoManip)(std::ostream&); | 84 typedef std::ostream& (*BasicNarrowIoManip)(std::ostream&); |
85 | 85 |
86 public: | 86 public: |
87 // Constructs an empty Message. | 87 // Constructs an empty Message. |
88 // We allocate the StrStream separately because it otherwise each use of | 88 // We allocate the StrStream separately because it otherwise each use of |
89 // ASSERT/EXPECT in a procedure adds over 200 bytes to the procedure's | 89 // ASSERT/EXPECT in a procedure adds over 200 bytes to the procedure's |
90 // stack frame leading to huge stack frames in some cases; gcc does not reuse | 90 // stack frame leading to huge stack frames in some cases; gcc does not reuse |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 }; | 215 }; |
216 | 216 |
217 // Streams a Message to an ostream. | 217 // Streams a Message to an ostream. |
218 inline std::ostream& operator <<(std::ostream& os, const Message& sb) { | 218 inline std::ostream& operator <<(std::ostream& os, const Message& sb) { |
219 return os << sb.GetString(); | 219 return os << sb.GetString(); |
220 } | 220 } |
221 | 221 |
222 } // namespace testing | 222 } // namespace testing |
223 | 223 |
224 #endif // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_ | 224 #endif // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_ |
OLD | NEW |