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

Side by Side Diff: url/gurl.h

Issue 2481923002: [WIP] make GURL::path() return a StringPiece (Closed)
Patch Set: thanks asan Created 4 years, 1 month 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 | « ui/base/webui/web_ui_util.cc ('k') | no next file » | 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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 } 316 }
317 base::StringPiece port_piece() const { 317 base::StringPiece port_piece() const {
318 return ComponentStringPiece(parsed_.port); 318 return ComponentStringPiece(parsed_.port);
319 } 319 }
320 320
321 // Including first slash following host, up to the query. The URL 321 // Including first slash following host, up to the query. The URL
322 // "http://www.google.com/" has a path of "/". 322 // "http://www.google.com/" has a path of "/".
323 bool has_path() const { 323 bool has_path() const {
324 return parsed_.path.len >= 0; 324 return parsed_.path.len >= 0;
325 } 325 }
326 std::string path() const { 326
327 return ComponentString(parsed_.path); 327 base::StringPiece path() const { return ComponentStringPiece(parsed_.path); }
328 }
329 base::StringPiece path_piece() const { 328 base::StringPiece path_piece() const {
330 return ComponentStringPiece(parsed_.path); 329 return ComponentStringPiece(parsed_.path);
331 } 330 }
332 331
333 // Stuff following '?' up to the ref. The getters will not include the '?'. 332 // Stuff following '?' up to the ref. The getters will not include the '?'.
334 bool has_query() const { 333 bool has_query() const {
335 return parsed_.query.len >= 0; 334 return parsed_.query.len >= 0;
336 } 335 }
337 std::string query() const { 336 std::string query() const {
338 return ComponentString(parsed_.query); 337 return ComponentString(parsed_.query);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 URL_EXPORT bool operator==(const GURL& x, const GURL& y); 452 URL_EXPORT bool operator==(const GURL& x, const GURL& y);
454 URL_EXPORT bool operator!=(const GURL& x, const GURL& y); 453 URL_EXPORT bool operator!=(const GURL& x, const GURL& y);
455 454
456 // Equality operator for comparing raw spec_. This should be used in place of 455 // Equality operator for comparing raw spec_. This should be used in place of
457 // url == GURL(spec) where |spec| is known (i.e. constants). This is to prevent 456 // url == GURL(spec) where |spec| is known (i.e. constants). This is to prevent
458 // needlessly re-parsing |spec| into a temporary GURL. 457 // needlessly re-parsing |spec| into a temporary GURL.
459 URL_EXPORT bool operator==(const GURL& x, const base::StringPiece& spec); 458 URL_EXPORT bool operator==(const GURL& x, const base::StringPiece& spec);
460 URL_EXPORT bool operator!=(const GURL& x, const base::StringPiece& spec); 459 URL_EXPORT bool operator!=(const GURL& x, const base::StringPiece& spec);
461 460
462 #endif // URL_GURL_H_ 461 #endif // URL_GURL_H_
OLDNEW
« no previous file with comments | « ui/base/webui/web_ui_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698