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

Unified Diff: url/url_canon_stdstring.h

Issue 889463003: GURL::Replacements methods accept a StringPiece instead of std::string&. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase (fixed some merge conflicts). Created 5 years, 10 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/url_canon_stdstring.h
diff --git a/url/url_canon_stdstring.h b/url/url_canon_stdstring.h
index c3d8ba141cc45ef4bfb3bbfde9d67256389050ca..662cac73b41cb036c706cefc7dbed4a3baebcd54 100644
--- a/url/url_canon_stdstring.h
+++ b/url/url_canon_stdstring.h
@@ -12,6 +12,7 @@
#include <string>
#include "base/compiler_specific.h"
+#include "base/strings/string_piece.h"
#include "url/url_canon.h"
#include "url/url_export.h"
@@ -48,35 +49,35 @@ class URL_EXPORT StdStringCanonOutput : public CanonOutput {
};
// An extension of the Replacements class that allows the setters to use
-// standard strings.
+// StringPieces (implicitly allowing strings or char*s).
//
-// The strings passed as arguments are not copied and must remain valid until
-// this class goes out of scope.
+// The contents of the StringPieces are not copied and must remain valid until
+// the StringPieceReplacements object goes out of scope.
template<typename STR>
-class StdStringReplacements : public Replacements<typename STR::value_type> {
+class StringPieceReplacements : public Replacements<typename STR::value_type> {
public:
- void SetSchemeStr(const STR& s) {
+ void SetSchemeStr(const base::BasicStringPiece<STR>& s) {
this->SetScheme(s.data(), Component(0, static_cast<int>(s.length())));
}
- void SetUsernameStr(const STR& s) {
+ void SetUsernameStr(const base::BasicStringPiece<STR>& s) {
this->SetUsername(s.data(), Component(0, static_cast<int>(s.length())));
}
- void SetPasswordStr(const STR& s) {
+ void SetPasswordStr(const base::BasicStringPiece<STR>& s) {
this->SetPassword(s.data(), Component(0, static_cast<int>(s.length())));
}
- void SetHostStr(const STR& s) {
+ void SetHostStr(const base::BasicStringPiece<STR>& s) {
this->SetHost(s.data(), Component(0, static_cast<int>(s.length())));
}
- void SetPortStr(const STR& s) {
+ void SetPortStr(const base::BasicStringPiece<STR>& s) {
this->SetPort(s.data(), Component(0, static_cast<int>(s.length())));
}
- void SetPathStr(const STR& s) {
+ void SetPathStr(const base::BasicStringPiece<STR>& s) {
this->SetPath(s.data(), Component(0, static_cast<int>(s.length())));
}
- void SetQueryStr(const STR& s) {
+ void SetQueryStr(const base::BasicStringPiece<STR>& s) {
this->SetQuery(s.data(), Component(0, static_cast<int>(s.length())));
}
- void SetRefStr(const STR& s) {
+ void SetRefStr(const base::BasicStringPiece<STR>& s) {
this->SetRef(s.data(), Component(0, static_cast<int>(s.length())));
}
};
« 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