proxygen
testing::Message Class Reference

#include <gtest-message.h>

Public Member Functions

 Message ()
 
 Message (const Message &msg)
 
 Message (const char *str)
 
template<typename T >
Messageoperator<< (const T &val)
 
template<typename T >
Messageoperator<< (T *const &pointer)
 
Messageoperator<< (BasicNarrowIoManip val)
 
Messageoperator<< (bool b)
 
Messageoperator<< (const wchar_t *wide_c_str)
 
Messageoperator<< (wchar_t *wide_c_str)
 
std::string GetString () const
 
 Message ()
 
 Message (const Message &msg)
 
 Message (const char *str)
 
template<typename T >
Messageoperator<< (const T &val)
 
template<typename T >
Messageoperator<< (T *const &pointer)
 
Messageoperator<< (BasicNarrowIoManip val)
 
Messageoperator<< (bool b)
 
Messageoperator<< (const wchar_t *wide_c_str)
 
Messageoperator<< (wchar_t *wide_c_str)
 
std::string GetString () const
 
 Message ()
 
 Message (const Message &msg)
 
 Message (const char *str)
 
template<typename T >
Messageoperator<< (const T &val)
 
template<typename T >
Messageoperator<< (T *const &pointer)
 
Messageoperator<< (BasicNarrowIoManip val)
 
Messageoperator<< (bool b)
 
Messageoperator<< (const wchar_t *wide_c_str)
 
Messageoperator<< (wchar_t *wide_c_str)
 
std::string GetString () const
 

Private Types

typedef std::ostream &(* BasicNarrowIoManip) (std::ostream &)
 
typedef std::ostream &(* BasicNarrowIoManip) (std::ostream &)
 
typedef std::ostream &(* BasicNarrowIoManip) (std::ostream &)
 

Private Member Functions

void operator= (const Message &)
 
void operator= (const Message &)
 
void operator= (const Message &)
 

Private Attributes

const internal::scoped_ptr< ::std::stringstream > ss_
 

Detailed Description

Definition at line 85 of file gtest-message.h.

Member Typedef Documentation

typedef std::ostream&(* testing::Message::BasicNarrowIoManip) (std::ostream &)
private

Definition at line 89 of file gtest-message.h.

typedef std::ostream&(* testing::Message::BasicNarrowIoManip) (std::ostream &)
private

Definition at line 89 of file gtest-message.h.

typedef std::ostream&(* testing::Message::BasicNarrowIoManip) (std::ostream &)
private

Definition at line 89 of file gtest-message.h.

Constructor & Destructor Documentation

testing::Message::Message ( )

Definition at line 946 of file gtest.cc.

References folly::digits10().

Referenced by testing::internal::ShouldRunTestCase().

946  : ss_(new ::std::stringstream) {
947  // By default, we want there to be enough precision when printing
948  // a double to a Message.
950 }
uint32_t digits10(uint64_t v)
Definition: Conv.h:295
const internal::scoped_ptr< ::std::stringstream > ss_
testing::Message::Message ( const Message msg)
inline

Definition at line 96 of file gtest-message.h.

References GetString().

96  : ss_(new ::std::stringstream) { // NOLINT
97  *ss_ << msg.GetString();
98  }
const internal::scoped_ptr< ::std::stringstream > ss_
testing::Message::Message ( const char *  str)
inlineexplicit

Definition at line 101 of file gtest-message.h.

References testing::operator<<(), T, and value.

101  : ss_(new ::std::stringstream) {
102  *ss_ << str;
103  }
const internal::scoped_ptr< ::std::stringstream > ss_
testing::Message::Message ( )
testing::Message::Message ( const Message msg)
inline

Definition at line 96 of file gtest-message.h.

References GetString().

96  : ss_(new ::std::stringstream) { // NOLINT
97  *ss_ << msg.GetString();
98  }
const internal::scoped_ptr< ::std::stringstream > ss_
testing::Message::Message ( const char *  str)
inlineexplicit

Definition at line 101 of file gtest-message.h.

References testing::operator<<(), T, and value.

101  : ss_(new ::std::stringstream) {
102  *ss_ << str;
103  }
const internal::scoped_ptr< ::std::stringstream > ss_
testing::Message::Message ( )
testing::Message::Message ( const Message msg)
inline

Definition at line 96 of file gtest-message.h.

References GetString().

96  : ss_(new ::std::stringstream) { // NOLINT
97  *ss_ << msg.GetString();
98  }
const internal::scoped_ptr< ::std::stringstream > ss_
testing::Message::Message ( const char *  str)
inlineexplicit

Definition at line 101 of file gtest-message.h.

References testing::operator<<(), T, and value.

101  : ss_(new ::std::stringstream) {
102  *ss_ << str;
103  }
const internal::scoped_ptr< ::std::stringstream > ss_

Member Function Documentation

std::string testing::Message::GetString ( ) const

Definition at line 981 of file gtest.cc.

References testing::internal::scoped_ptr< T >::get(), ss_, and testing::internal::StringStreamToString().

Referenced by testing::UnitTest::AddTestPartResult(), testing::AssertionResult::AppendMessage(), testing::internal::AppendUserMessage(), testing::internal::XmlUnitTestResultPrinter::EscapeXml(), testing::internal::XmlUnitTestResultPrinter::EscapeXmlText(), testing::internal::FlagToEnvVar(), testing::FormatWordList(), testing::internal::GetBoolAssertionFailureMessage(), SequenceTestingListener::GetEventDescription(), testing::Test::HasSameFixtureClass(), testing::internal::MakeAndRegisterTestInfo(), Message(), testing::internal::EventRecordingListener::OnTestIterationEnd(), testing::internal::EventRecordingListener::OnTestIterationStart(), operator<<(), testing::operator<<(), testing::internal::ParseInt32(), testing::internal::PortableLocaltime(), testing::Test::RecordProperty(), testing::internal::ShouldRunTestCase(), testing::internal::ShouldShard(), testing::internal::TearDownEnvironment(), TEST(), testing::TestPartNonfatallyFailed(), testing::internal::XmlUnitTestResultPrinter::TestPropertiesAsXmlAttributes(), and testing::internal::ScopedPrematureExitFile::~ScopedPrematureExitFile().

981  {
983 }
const internal::scoped_ptr< ::std::stringstream > ss_
GTEST_API_ std::string StringStreamToString(::std::stringstream *stream)
Definition: gtest.cc:1982
std::string testing::Message::GetString ( ) const
std::string testing::Message::GetString ( ) const
template<typename T >
Message& testing::Message::operator<< ( const T val)
inline

Definition at line 115 of file gtest-message.h.

References val.

115  {
116  // Some libraries overload << for STL containers. These
117  // overloads are defined in the global namespace instead of ::std.
118  //
119  // C++'s symbol lookup rule (i.e. Koenig lookup) says that these
120  // overloads are visible in either the std namespace or the global
121  // namespace, but not other namespaces, including the testing
122  // namespace which Google Test's Message class is in.
123  //
124  // To allow STL containers (and other types that has a << operator
125  // defined in the global namespace) to be used in Google Test
126  // assertions, testing::Message must access the custom << operator
127  // from the global namespace. With this using declaration,
128  // overloads of << defined in the global namespace and those
129  // visible via Koenig lookup are both exposed in this function.
130  using ::operator <<;
131  *ss_ << val;
132  return *this;
133  }
double val
Definition: String.cpp:273
const internal::scoped_ptr< ::std::stringstream > ss_
template<typename T >
Message& testing::Message::operator<< ( const T val)
inline

Definition at line 115 of file gtest-message.h.

References val.

115  {
116  // Some libraries overload << for STL containers. These
117  // overloads are defined in the global namespace instead of ::std.
118  //
119  // C++'s symbol lookup rule (i.e. Koenig lookup) says that these
120  // overloads are visible in either the std namespace or the global
121  // namespace, but not other namespaces, including the testing
122  // namespace which Google Test's Message class is in.
123  //
124  // To allow STL containers (and other types that has a << operator
125  // defined in the global namespace) to be used in Google Test
126  // assertions, testing::Message must access the custom << operator
127  // from the global namespace. With this using declaration,
128  // overloads of << defined in the global namespace and those
129  // visible via Koenig lookup are both exposed in this function.
130  using ::operator <<;
131  *ss_ << val;
132  return *this;
133  }
double val
Definition: String.cpp:273
const internal::scoped_ptr< ::std::stringstream > ss_
template<typename T >
Message& testing::Message::operator<< ( const T val)
inline

Definition at line 115 of file gtest-message.h.

References val.

Referenced by operator<<(), and testing::internal::ShouldRunTestCase().

115  {
116  // Some libraries overload << for STL containers. These
117  // overloads are defined in the global namespace instead of ::std.
118  //
119  // C++'s symbol lookup rule (i.e. Koenig lookup) says that these
120  // overloads are visible in either the std namespace or the global
121  // namespace, but not other namespaces, including the testing
122  // namespace which Google Test's Message class is in.
123  //
124  // To allow STL containers (and other types that has a << operator
125  // defined in the global namespace) to be used in Google Test
126  // assertions, testing::Message must access the custom << operator
127  // from the global namespace. With this using declaration,
128  // overloads of << defined in the global namespace and those
129  // visible via Koenig lookup are both exposed in this function.
130  using ::operator <<;
131  *ss_ << val;
132  return *this;
133  }
double val
Definition: String.cpp:273
const internal::scoped_ptr< ::std::stringstream > ss_
template<typename T >
Message& testing::Message::operator<< ( T *const &  pointer)
inline

Definition at line 149 of file gtest-message.h.

149  { // NOLINT
150  if (pointer == NULL) {
151  *ss_ << "(null)";
152  } else {
153  *ss_ << pointer;
154  }
155  return *this;
156  }
const internal::scoped_ptr< ::std::stringstream > ss_
template<typename T >
Message& testing::Message::operator<< ( T *const &  pointer)
inline

Definition at line 149 of file gtest-message.h.

149  { // NOLINT
150  if (pointer == NULL) {
151  *ss_ << "(null)";
152  } else {
153  *ss_ << pointer;
154  }
155  return *this;
156  }
const internal::scoped_ptr< ::std::stringstream > ss_
template<typename T >
Message& testing::Message::operator<< ( T *const &  pointer)
inline

Definition at line 149 of file gtest-message.h.

149  { // NOLINT
150  if (pointer == NULL) {
151  *ss_ << "(null)";
152  } else {
153  *ss_ << pointer;
154  }
155  return *this;
156  }
const internal::scoped_ptr< ::std::stringstream > ss_
Message& testing::Message::operator<< ( BasicNarrowIoManip  val)
inline

Definition at line 165 of file gtest-message.h.

References val.

165  {
166  *ss_ << val;
167  return *this;
168  }
double val
Definition: String.cpp:273
const internal::scoped_ptr< ::std::stringstream > ss_
Message& testing::Message::operator<< ( BasicNarrowIoManip  val)
inline

Definition at line 165 of file gtest-message.h.

References val.

165  {
166  *ss_ << val;
167  return *this;
168  }
double val
Definition: String.cpp:273
const internal::scoped_ptr< ::std::stringstream > ss_
Message& testing::Message::operator<< ( BasicNarrowIoManip  val)
inline

Definition at line 165 of file gtest-message.h.

References val.

165  {
166  *ss_ << val;
167  return *this;
168  }
double val
Definition: String.cpp:273
const internal::scoped_ptr< ::std::stringstream > ss_
Message& testing::Message::operator<< ( bool  b)
inline

Definition at line 171 of file gtest-message.h.

References testing::operator<<(), string, T, and value.

171  {
172  return *this << (b ? "true" : "false");
173  }
char b
Message& testing::Message::operator<< ( bool  b)
inline

Definition at line 171 of file gtest-message.h.

References GetString(), testing::operator<<(), testing::internal::StreamableToString(), string, T, and value.

171  {
172  return *this << (b ? "true" : "false");
173  }
char b
Message& testing::Message::operator<< ( bool  b)
inline

Definition at line 171 of file gtest-message.h.

References GetString(), testing::operator<<(), testing::internal::StreamableToString(), string, T, and value.

171  {
172  return *this << (b ? "true" : "false");
173  }
char b
Message& testing::Message::operator<< ( const wchar_t *  wide_c_str)
Message& testing::Message::operator<< ( const wchar_t *  wide_c_str)
Message & testing::Message::operator<< ( const wchar_t *  wide_c_str)

Definition at line 954 of file gtest.cc.

References testing::internal::String::ShowWideCString().

954  {
955  return *this << internal::String::ShowWideCString(wide_c_str);
956 }
static std::string ShowWideCString(const wchar_t *wide_c_str)
Definition: gtest.cc:1848
Message& testing::Message::operator<< ( wchar_t *  wide_c_str)
Message & testing::Message::operator<< ( wchar_t *  wide_c_str)

Definition at line 957 of file gtest.cc.

References operator<<(), and testing::internal::String::ShowWideCString().

957  {
958  return *this << internal::String::ShowWideCString(wide_c_str);
959 }
static std::string ShowWideCString(const wchar_t *wide_c_str)
Definition: gtest.cc:1848
Message& testing::Message::operator<< ( wchar_t *  wide_c_str)
void testing::Message::operator= ( const Message )
private
void testing::Message::operator= ( const Message )
private
void testing::Message::operator= ( const Message )
private

Member Data Documentation

const internal::scoped_ptr<::std::stringstream > testing::Message::ss_
private

Definition at line 224 of file gtest-message.h.

Referenced by GetString().


The documentation for this class was generated from the following files: