Remove our stream << overloads from non-test build targets.

Most are removed entirely, but RtcErrorType, RtpTransceiverDirection, IPAddress and
SocketAddress are kept behind gtest's #ifdef UNIT_TEST.

Bug: webrtc:8982
Change-Id: I36db19891e7d25aeacb08b9a08aa2b4004765e70
Reviewed-on: https://webrtc-review.googlesource.com/64143
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Reviewed-by: Benjamin Wright <benwright@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22916}
This commit is contained in:
Jonas Olsson
2018-04-18 10:11:07 +02:00
committed by Commit Bot
parent b02644f2b8
commit c841d18d25
14 changed files with 34 additions and 107 deletions

View File

@ -120,11 +120,6 @@ bool IPAddress::operator <(const IPAddress &other) const {
return false;
}
std::ostream& operator<<(std::ostream& os, const IPAddress& ip) {
os << ip.ToString();
return os;
}
in6_addr IPAddress::ipv6_address() const {
return u_.ip6;
}
@ -216,10 +211,6 @@ const InterfaceAddress& InterfaceAddress::operator=(
return *this;
}
std::ostream& operator<<(std::ostream& os, const InterfaceAddress& ip) {
return os << ip.ToString();
}
std::string InterfaceAddress::ToString() const {
std::string result = IPAddress::ToString();

View File

@ -83,7 +83,13 @@ class IPAddress {
bool operator!=(const IPAddress& other) const;
bool operator <(const IPAddress& other) const;
bool operator >(const IPAddress& other) const;
friend std::ostream& operator<<(std::ostream& os, const IPAddress& addr);
#ifdef UNIT_TEST
inline std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
std::ostream& os) { // no-presubmit-check TODO(webrtc:8982)
return os << ToString();
}
#endif // UNIT_TEST
int family() const { return family_; }
in_addr ipv4_address() const;
@ -141,8 +147,6 @@ class InterfaceAddress : public IPAddress {
bool operator!=(const InterfaceAddress& other) const;
int ipv6_flags() const { return ipv6_flags_; }
friend std::ostream& operator<<(std::ostream& os,
const InterfaceAddress& addr);
std::string ToString() const;

View File

@ -199,11 +199,6 @@ bool SocketAddress::FromString(const std::string& str) {
return true;
}
std::ostream& operator<<(std::ostream& os, const SocketAddress& addr) {
os << addr.HostAsURIString() << ":" << addr.port();
return os;
}
bool SocketAddress::IsAnyIP() const {
return IPIsAny(ip_);
}

View File

@ -13,6 +13,9 @@
#include <iosfwd>
#include <string>
#ifdef UNIT_TEST
#include <ostream> // no-presubmit-check TODO(webrtc:8982)
#endif // UNIT_TEST
#include <vector>
#include "rtc_base/basictypes.h"
#include "rtc_base/ipaddress.h"
@ -126,7 +129,12 @@ class SocketAddress {
// Parses hostname:port and [hostname]:port.
bool FromString(const std::string& str);
friend std::ostream& operator<<(std::ostream& os, const SocketAddress& addr);
#ifdef UNIT_TEST
inline std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
std::ostream& os) { // no-presubmit-check TODO(webrtc:8982)
return os << HostAsURIString() << ":" << port();
}
#endif // UNIT_TEST
// Determines whether this represents a missing / any IP address.
// That is, 0.0.0.0 or ::.