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

Side by Side Diff: url/gurl.h

Issue 2421383003: Add operator==(const GURL&, const StringPiece&) to gurl.h (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « net/quic/chromium/quic_stream_factory_test.cc ('k') | url/gurl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef URL_GURL_H_ 5 #ifndef URL_GURL_H_
6 #define URL_GURL_H_ 6 #define URL_GURL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <iosfwd> 10 #include <iosfwd>
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // the individual component getters below. 125 // the individual component getters below.
126 // 126 //
127 // The returned parsed structure will reference into the raw spec, which may 127 // The returned parsed structure will reference into the raw spec, which may
128 // or may not be valid. If you are using this to index into the spec, BE 128 // or may not be valid. If you are using this to index into the spec, BE
129 // SURE YOU ARE USING possibly_invalid_spec() to get the spec, and that you 129 // SURE YOU ARE USING possibly_invalid_spec() to get the spec, and that you
130 // don't do anything "important" with invalid specs. 130 // don't do anything "important" with invalid specs.
131 const url::Parsed& parsed_for_possibly_invalid_spec() const { 131 const url::Parsed& parsed_for_possibly_invalid_spec() const {
132 return parsed_; 132 return parsed_;
133 } 133 }
134 134
135 // Defiant equality operator!
136 bool operator==(const GURL& other) const;
137 bool operator!=(const GURL& other) const;
138
139 // Allows GURL to used as a key in STL (for example, a std::set or std::map). 135 // Allows GURL to used as a key in STL (for example, a std::set or std::map).
140 bool operator<(const GURL& other) const; 136 bool operator<(const GURL& other) const;
141 bool operator>(const GURL& other) const; 137 bool operator>(const GURL& other) const;
142 138
143 // Resolves a URL that's possibly relative to this object's URL, and returns 139 // Resolves a URL that's possibly relative to this object's URL, and returns
144 // it. Absolute URLs are also handled according to the rules of URLs on web 140 // it. Absolute URLs are also handled according to the rules of URLs on web
145 // pages. 141 // pages.
146 // 142 //
147 // It may be impossible to resolve the URLs properly. If the input is not 143 // It may be impossible to resolve the URLs properly. If the input is not
148 // "standard" (IsStandard() == false) and the input looks relative, we can't 144 // "standard" (IsStandard() == false) and the input looks relative, we can't
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 // Identified components of the canonical spec. 436 // Identified components of the canonical spec.
441 url::Parsed parsed_; 437 url::Parsed parsed_;
442 438
443 // Used for nested schemes [currently only filesystem:]. 439 // Used for nested schemes [currently only filesystem:].
444 std::unique_ptr<GURL> inner_url_; 440 std::unique_ptr<GURL> inner_url_;
445 }; 441 };
446 442
447 // Stream operator so GURL can be used in assertion statements. 443 // Stream operator so GURL can be used in assertion statements.
448 URL_EXPORT std::ostream& operator<<(std::ostream& out, const GURL& url); 444 URL_EXPORT std::ostream& operator<<(std::ostream& out, const GURL& url);
449 445
446 // Defiant equality operator!
brettw 2016/10/17 22:58:59 I think this weird comment can be removed now. I t
447 URL_EXPORT bool operator==(const GURL& x, const GURL& y);
448 URL_EXPORT bool operator!=(const GURL& x, const GURL& y);
449
450 // Equality operator for comparing raw spec_. This should be used in place of
451 // url == GURL(spec) where |spec| is known (i.e. constants). This is to prevent
452 // needlessly re-parsing |spec| into a temporary GURL.
453 URL_EXPORT bool operator==(const GURL& x, const base::StringPiece& spec);
454 URL_EXPORT bool operator!=(const GURL& x, const base::StringPiece& spec);
455
450 #endif // URL_GURL_H_ 456 #endif // URL_GURL_H_
OLDNEW
« no previous file with comments | « net/quic/chromium/quic_stream_factory_test.cc ('k') | url/gurl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698