Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1127)

Unified Diff: url/gurl.cc

Issue 2421383003: Add operator==(const GURL&, const StringPiece&) to gurl.h (Closed)
Patch Set: remove comment Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « url/gurl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: url/gurl.cc
diff --git a/url/gurl.cc b/url/gurl.cc
index 8b5c89260033a1df7cf76511b5121b1f2767cd53..98a0300216c2ea95e95791075077db4579cc00cb 100644
--- a/url/gurl.cc
+++ b/url/gurl.cc
@@ -180,14 +180,6 @@ const std::string& GURL::spec() const {
return EmptyStringForGURL();
}
-bool GURL::operator==(const GURL& other) const {
- return spec_ == other.spec_;
-}
-
-bool GURL::operator!=(const GURL& other) const {
- return spec_ != other.spec_;
-}
-
bool GURL::operator<(const GURL& other) const {
return spec_ < other.spec_;
}
@@ -510,3 +502,19 @@ void GURL::Swap(GURL* other) {
std::ostream& operator<<(std::ostream& out, const GURL& url) {
return out << url.possibly_invalid_spec();
}
+
+bool operator==(const GURL& x, const GURL& y) {
+ return x.possibly_invalid_spec() == y.possibly_invalid_spec();
+}
+
+bool operator!=(const GURL& x, const GURL& y) {
+ return !(x == y);
+}
+
+bool operator==(const GURL& x, const base::StringPiece& spec) {
+ return x.possibly_invalid_spec() == spec;
+}
+
+bool operator!=(const GURL& x, const base::StringPiece& spec) {
+ return !(x == spec);
+}
« no previous file with comments | « url/gurl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698