47 #ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_MESSAGE_H_ 48 #define GOOGLETEST_INCLUDE_GTEST_GTEST_MESSAGE_H_ 54 #include "gtest/internal/gtest-port.h" 56 GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
61 void operator<<(const
testing::internal::Secret&,
int);
91 class GTEST_API_ Message {
95 typedef std::ostream& (*BasicNarrowIoManip)(std::ostream&);
102 Message(
const Message& msg) : ss_(new ::
std::stringstream) {
103 *ss_ << msg.GetString();
107 explicit Message(
const char* str) : ss_(new ::
std::stringstream) {
112 template <
typename T>
113 inline Message& operator <<(
const T& val) {
146 template <
typename T>
147 inline Message& operator <<(T*
const& pointer) {
148 if (pointer ==
nullptr) {
162 Message& operator <<(BasicNarrowIoManip val) {
168 Message& operator <<(
bool b) {
169 return *
this << (b ?
"true" :
"false");
174 Message& operator <<(
const wchar_t* wide_c_str);
175 Message& operator <<(
wchar_t* wide_c_str);
177 #if GTEST_HAS_STD_WSTRING 180 Message& operator <<(const ::std::wstring& wstr);
181 #endif // GTEST_HAS_STD_WSTRING 187 std::string GetString()
const;
191 const std::unique_ptr< ::std::stringstream> ss_;
195 void operator=(
const Message&);
199 inline std::ostream& operator <<(std::ostream& os,
const Message& sb) {
200 return os << sb.GetString();
209 template <
typename T>
210 std::string StreamableToString(
const T& streamable) {
211 return (Message() << streamable).GetString();
217 GTEST_DISABLE_MSC_WARNINGS_POP_()
219 #endif // GOOGLETEST_INCLUDE_GTEST_GTEST_MESSAGE_H_ Definition: gmock-actions.h:154
Definition: gtest-internal.h:1322