Removes all uses of StrStream; fixes the VC projects and simplifies them by using gtest-all.cc.
This commit is contained in:
@@ -58,7 +58,7 @@ namespace testing {
|
||||
// Typical usage:
|
||||
//
|
||||
// 1. You stream a bunch of values to a Message object.
|
||||
// It will remember the text in a StrStream.
|
||||
// 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.
|
||||
@@ -74,7 +74,7 @@ namespace testing {
|
||||
// Message is not intended to be inherited from. In particular, its
|
||||
// destructor is not virtual.
|
||||
//
|
||||
// Note that StrStream behaves differently in gcc and in MSVC. You
|
||||
// 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
|
||||
@@ -87,27 +87,26 @@ class GTEST_API_ Message {
|
||||
|
||||
public:
|
||||
// Constructs an empty Message.
|
||||
// We allocate the StrStream separately because it otherwise each use of
|
||||
// We allocate the stringstream separately because otherwise each use of
|
||||
// ASSERT/EXPECT in a procedure adds over 200 bytes to the procedure's
|
||||
// stack frame leading to huge stack frames in some cases; gcc does not reuse
|
||||
// the stack space.
|
||||
Message() : ss_(new internal::StrStream) {
|
||||
Message() : ss_(new ::std::stringstream) {
|
||||
// By default, we want there to be enough precision when printing
|
||||
// a double to a Message.
|
||||
*ss_ << std::setprecision(std::numeric_limits<double>::digits10 + 2);
|
||||
}
|
||||
|
||||
// Copy constructor.
|
||||
Message(const Message& msg) : ss_(new internal::StrStream) { // NOLINT
|
||||
Message(const Message& msg) : ss_(new ::std::stringstream) { // NOLINT
|
||||
*ss_ << msg.GetString();
|
||||
}
|
||||
|
||||
// Constructs a Message from a C-string.
|
||||
explicit Message(const char* str) : ss_(new internal::StrStream) {
|
||||
explicit Message(const char* str) : ss_(new ::std::stringstream) {
|
||||
*ss_ << str;
|
||||
}
|
||||
|
||||
~Message() { delete ss_; }
|
||||
#if GTEST_OS_SYMBIAN
|
||||
// Streams a value (either a pointer or not) to this object.
|
||||
template <typename T>
|
||||
@@ -119,7 +118,7 @@ class GTEST_API_ Message {
|
||||
// Streams a non-pointer value to this object.
|
||||
template <typename T>
|
||||
inline Message& operator <<(const T& val) {
|
||||
::GTestStreamToHelper(ss_, val);
|
||||
::GTestStreamToHelper(ss_.get(), val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -141,7 +140,7 @@ class GTEST_API_ Message {
|
||||
if (pointer == NULL) {
|
||||
*ss_ << "(null)";
|
||||
} else {
|
||||
::GTestStreamToHelper(ss_, pointer);
|
||||
::GTestStreamToHelper(ss_.get(), pointer);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -189,7 +188,7 @@ class GTEST_API_ Message {
|
||||
//
|
||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
||||
internal::String GetString() const {
|
||||
return internal::StrStreamToString(ss_);
|
||||
return internal::StringStreamToString(ss_.get());
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -203,17 +202,17 @@ class GTEST_API_ Message {
|
||||
if (pointer == NULL) {
|
||||
*ss_ << "(null)";
|
||||
} else {
|
||||
::GTestStreamToHelper(ss_, pointer);
|
||||
::GTestStreamToHelper(ss_.get(), pointer);
|
||||
}
|
||||
}
|
||||
template <typename T>
|
||||
inline void StreamHelper(internal::false_type /*dummy*/, const T& value) {
|
||||
::GTestStreamToHelper(ss_, value);
|
||||
::GTestStreamToHelper(ss_.get(), value);
|
||||
}
|
||||
#endif // GTEST_OS_SYMBIAN
|
||||
|
||||
// We'll hold the text streamed to this object here.
|
||||
internal::StrStream* const ss_;
|
||||
const internal::scoped_ptr< ::std::stringstream> ss_;
|
||||
|
||||
// We declare (but don't implement) this to prevent the compiler
|
||||
// from implementing the assignment operator.
|
||||
|
||||
@@ -1517,18 +1517,18 @@ AssertionResult CmpHelperFloatingPointEQ(const char* expected_expression,
|
||||
return AssertionSuccess();
|
||||
}
|
||||
|
||||
StrStream expected_ss;
|
||||
::std::stringstream expected_ss;
|
||||
expected_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
|
||||
<< expected;
|
||||
|
||||
StrStream actual_ss;
|
||||
::std::stringstream actual_ss;
|
||||
actual_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
|
||||
<< actual;
|
||||
|
||||
return EqFailure(expected_expression,
|
||||
actual_expression,
|
||||
StrStreamToString(&expected_ss),
|
||||
StrStreamToString(&actual_ss),
|
||||
StringStreamToString(&expected_ss),
|
||||
StringStreamToString(&actual_ss),
|
||||
false);
|
||||
}
|
||||
|
||||
|
||||
@@ -732,8 +732,6 @@ typedef ::wstring wstring;
|
||||
typedef ::std::wstring wstring;
|
||||
#endif // GTEST_HAS_GLOBAL_WSTRING
|
||||
|
||||
typedef ::std::stringstream StrStream;
|
||||
|
||||
// A helper for suppressing warnings on constant condition. It just
|
||||
// returns 'condition'.
|
||||
GTEST_API_ bool IsTrue(bool condition);
|
||||
|
||||
@@ -329,9 +329,9 @@ inline ::std::ostream& operator<<(::std::ostream& os, const String& str) {
|
||||
return os;
|
||||
}
|
||||
|
||||
// Gets the content of the StrStream's buffer as a String. Each '\0'
|
||||
// Gets the content of the stringstream's buffer as a String. Each '\0'
|
||||
// character in the buffer is replaced with "\\0".
|
||||
GTEST_API_ String StrStreamToString(StrStream* stream);
|
||||
GTEST_API_ String StringStreamToString(::std::stringstream* stream);
|
||||
|
||||
// Converts a streamable value to a String. A NULL pointer is
|
||||
// converted to "(null)". When the input value is a ::string,
|
||||
|
||||
Reference in New Issue
Block a user