diff options
author | Nico Weber <thakis@chromium.org> | 2017-05-15 21:07:03 (GMT) |
---|---|---|
committer | Nico Weber <thakis@chromium.org> | 2017-05-15 21:53:04 (GMT) |
commit | 09fd5b3ebfaac10b78bda664ec7f57fac74ef214 (patch) | |
tree | 89a7afc9280b7e42b96391ea2b42075446503e0f /googletest/src/gtest-internal-inl.h | |
parent | 294f72bc773c92410aa3c5ecdd6cd4a757c3fbf4 (diff) | |
download | googletest-09fd5b3ebfaac10b78bda664ec7f57fac74ef214.zip googletest-09fd5b3ebfaac10b78bda664ec7f57fac74ef214.tar.gz googletest-09fd5b3ebfaac10b78bda664ec7f57fac74ef214.tar.bz2 |
Use std::string and ::string explicitly in gtest and gmock code.refs/pull/1089/head
This merges a Google-internal change (117235625).
Original CL description:
This CL was created manually in about an hour with sed, a Python script
to find all the places unqualified 'string' was mentioned, and some help
from Emacs to add the "std::" qualifications, plus a few manual tweaks.
Diffstat (limited to 'googletest/src/gtest-internal-inl.h')
-rw-r--r-- | googletest/src/gtest-internal-inl.h | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/googletest/src/gtest-internal-inl.h b/googletest/src/gtest-internal-inl.h index ed8a682..021feb1 100644 --- a/googletest/src/gtest-internal-inl.h +++ b/googletest/src/gtest-internal-inl.h @@ -426,7 +426,7 @@ class OsStackTraceGetterInterface { // in the trace. // skip_count - the number of top frames to be skipped; doesn't count // against max_depth. - virtual string CurrentStackTrace(int max_depth, int skip_count) = 0; + virtual std::string CurrentStackTrace(int max_depth, int skip_count) = 0; // UponLeavingGTest() should be called immediately before Google Test calls // user code. It saves some information about the current stack that @@ -446,7 +446,7 @@ class OsStackTraceGetter : public OsStackTraceGetterInterface { public: OsStackTraceGetter() {} - virtual string CurrentStackTrace(int max_depth, int skip_count); + virtual std::string CurrentStackTrace(int max_depth, int skip_count); virtual void UponLeavingGTest(); private: @@ -1040,21 +1040,19 @@ class GTEST_API_ StreamingListener : public EmptyTestEventListener { virtual ~AbstractSocketWriter() {} // Sends a string to the socket. - virtual void Send(const string& message) = 0; + virtual void Send(const std::string& message) = 0; // Closes the socket. virtual void CloseConnection() {} // Sends a string and a newline to the socket. - void SendLn(const string& message) { - Send(message + "\n"); - } + void SendLn(const std::string& message) { Send(message + "\n"); } }; // Concrete class for actually writing strings to a socket. class SocketWriter : public AbstractSocketWriter { public: - SocketWriter(const string& host, const string& port) + SocketWriter(const std::string& host, const std::string& port) : sockfd_(-1), host_name_(host), port_num_(port) { MakeConnection(); } @@ -1065,7 +1063,7 @@ class GTEST_API_ StreamingListener : public EmptyTestEventListener { } // Sends a string to the socket. - virtual void Send(const string& message) { + virtual void Send(const std::string& message) { GTEST_CHECK_(sockfd_ != -1) << "Send() can be called only when there is a connection."; @@ -1091,17 +1089,19 @@ class GTEST_API_ StreamingListener : public EmptyTestEventListener { } int sockfd_; // socket file descriptor - const string host_name_; - const string port_num_; + const std::string host_name_; + const std::string port_num_; GTEST_DISALLOW_COPY_AND_ASSIGN_(SocketWriter); }; // class SocketWriter // Escapes '=', '&', '%', and '\n' characters in str as "%xx". - static string UrlEncode(const char* str); + static std::string UrlEncode(const char* str); - StreamingListener(const string& host, const string& port) - : socket_writer_(new SocketWriter(host, port)) { Start(); } + StreamingListener(const std::string& host, const std::string& port) + : socket_writer_(new SocketWriter(host, port)) { + Start(); + } explicit StreamingListener(AbstractSocketWriter* socket_writer) : socket_writer_(socket_writer) { Start(); } @@ -1162,13 +1162,13 @@ class GTEST_API_ StreamingListener : public EmptyTestEventListener { private: // Sends the given message and a newline to the socket. - void SendLn(const string& message) { socket_writer_->SendLn(message); } + void SendLn(const std::string& message) { socket_writer_->SendLn(message); } // Called at the start of streaming to notify the receiver what // protocol we are using. void Start() { SendLn("gtest_streaming_protocol_version=1.0"); } - string FormatBool(bool value) { return value ? "1" : "0"; } + std::string FormatBool(bool value) { return value ? "1" : "0"; } const scoped_ptr<AbstractSocketWriter> socket_writer_; |