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

Side by Side Diff: base/strings/string_split.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « base/string_util_unittest.cc ('k') | base/strings/string_split_unittest.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "base/strings/string_split.h" 5 #include "base/strings/string_split.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/third_party/icu/icu_utf.h" 9 #include "base/third_party/icu/icu_utf.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 std::string key; 100 std::string key;
101 std::vector<std::string> value; 101 std::vector<std::string> value;
102 if (!SplitStringIntoKeyValues(pairs[i], 102 if (!SplitStringIntoKeyValues(pairs[i],
103 key_value_delimiter, 103 key_value_delimiter,
104 &key, &value)) { 104 &key, &value)) {
105 // Don't return here, to allow for keys without associated 105 // Don't return here, to allow for keys without associated
106 // values; just record that our split failed. 106 // values; just record that our split failed.
107 success = false; 107 success = false;
108 } 108 }
109 DCHECK_LE(value.size(), 1U); 109 DCHECK_LE(value.size(), 1U);
110 kv_pairs->push_back(make_pair(key, value.empty()? "" : value[0])); 110 kv_pairs->push_back(
111 make_pair(key, value.empty() ? std::string() : value[0]));
111 } 112 }
112 return success; 113 return success;
113 } 114 }
114 115
115 template <typename STR> 116 template <typename STR>
116 static void SplitStringUsingSubstrT(const STR& str, 117 static void SplitStringUsingSubstrT(const STR& str,
117 const STR& s, 118 const STR& s,
118 std::vector<STR>* r) { 119 std::vector<STR>* r) {
119 r->clear(); 120 r->clear();
120 typename STR::size_type begin_index = 0; 121 typename STR::size_type begin_index = 0;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 std::vector<string16>* result) { 211 std::vector<string16>* result) {
211 SplitStringAlongWhitespaceT(str, result); 212 SplitStringAlongWhitespaceT(str, result);
212 } 213 }
213 214
214 void SplitStringAlongWhitespace(const std::string& str, 215 void SplitStringAlongWhitespace(const std::string& str,
215 std::vector<std::string>* result) { 216 std::vector<std::string>* result) {
216 SplitStringAlongWhitespaceT(str, result); 217 SplitStringAlongWhitespaceT(str, result);
217 } 218 }
218 219
219 } // namespace base 220 } // namespace base
OLDNEW
« no previous file with comments | « base/string_util_unittest.cc ('k') | base/strings/string_split_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698