| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 URL_EXPORT bool operator==(const GURL& x, const GURL& y); |
| 447 URL_EXPORT bool operator!=(const GURL& x, const GURL& y); |
| 448 |
| 449 // Equality operator for comparing raw spec_. This should be used in place of |
| 450 // url == GURL(spec) where |spec| is known (i.e. constants). This is to prevent |
| 451 // needlessly re-parsing |spec| into a temporary GURL. |
| 452 URL_EXPORT bool operator==(const GURL& x, const base::StringPiece& spec); |
| 453 URL_EXPORT bool operator!=(const GURL& x, const base::StringPiece& spec); |
| 454 |
| 450 #endif // URL_GURL_H_ | 455 #endif // URL_GURL_H_ |
| OLD | NEW |