class Message

Defined at line 101 of file ../../third_party/googletest/src/googletest/include/gtest/gtest-message.h

The Message class works like an ostream repeater.

Typical usage:

1. You stream a bunch of values to a Message object.

It will remember the text in a stringstream.

2. Then you stream the Message object to an ostream.

This causes the text in the Message to be streamed

to the ostream.

For example;

testing::Message foo;

foo

<

<

1

<

<

" != "

<

<

2;

std::cout

<

<

foo;

will print "1 != 2".

Message is not intended to be inherited from. In particular, its

destructor is not virtual.

Note that stringstream behaves differently in gcc and in MSVC. You

can stream a NULL char pointer to it in the former, but not in the

latter (it causes an access violation if you do). The Message

class hides this difference by treating a NULL char pointer as

"(null)".

Public Methods

void Message ()

Constructs an empty Message.

void Message (const Message & msg)

Copy constructor.

Defined at line 112 of file ../../third_party/googletest/src/googletest/include/gtest/gtest-message.h

void Message (const char * str)

Constructs a Message from a C-string.

Defined at line 117 of file ../../third_party/googletest/src/googletest/include/gtest/gtest-message.h

template <typename T>
Message & operator<< (const T & val)

Defined at line 132 of file ../../third_party/googletest/src/googletest/include/gtest/gtest-message.h

template <typename T>
Message & operator<< (T *const & pointer)

Streams a pointer value to this object.

This function is an overload of the previous one. When you

stream a pointer to a Message, this definition will be used as it

is more specialized. (The C++ Standard, section

[temp.func.order].) If you stream a non-pointer, then the

previous definition will be used.

The reason for this overload is that streaming a NULL pointer to

ostream is undefined behavior. Depending on the compiler, you

may get "0", "(nil)", "(null)", or an access violation. To

ensure consistent result across compilers, we always treat NULL

as "(null)".

Defined at line 181 of file ../../third_party/googletest/src/googletest/include/gtest/gtest-message.h

Message & operator<< (BasicNarrowIoManip val)

Since the basic IO manipulators are overloaded for both narrow

and wide streams, we have to provide this specialized definition

of operator

<

<

, even though its body is the same as the

templatized version above. Without this definition, streaming

endl or other basic IO manipulators to Message will confuse the

compiler.

Defined at line 196 of file ../../third_party/googletest/src/googletest/include/gtest/gtest-message.h

Message & operator<< (bool b)

Instead of 1/0, we want to see true/false for bool values.

Defined at line 202 of file ../../third_party/googletest/src/googletest/include/gtest/gtest-message.h

Message & operator<< (const wchar_t * wide_c_str)

These two overloads allow streaming a wide C string to a Message

using the UTF-8 encoding.

Message & operator<< (wchar_t * wide_c_str)
Message & operator<< (const ::std::wstring & wstr)

Converts the given wide string to a narrow string using the UTF-8

encoding, and streams the result to this Message object.

std::string GetString ()

Gets the text streamed to this object so far as an std::string.

Each '

\

0' character in the buffer is replaced with "\\0".

INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.