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

Side by Side Diff: tools/gn/input_conversion.cc

Issue 1242023005: Remove legacy StartsWithASCII function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: y Created 5 years, 5 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 | « tools/gn/header_checker.cc ('k') | tools/gn/target.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "tools/gn/input_conversion.h" 5 #include "tools/gn/input_conversion.h"
6 6
7 #include "base/strings/string_split.h" 7 #include "base/strings/string_split.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "tools/gn/build_settings.h" 9 #include "tools/gn/build_settings.h"
10 #include "tools/gn/err.h" 10 #include "tools/gn/err.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 Value DoConvertInputToValue(const Settings* settings, 109 Value DoConvertInputToValue(const Settings* settings,
110 const std::string& input, 110 const std::string& input,
111 const ParseNode* origin, 111 const ParseNode* origin,
112 const Value& original_input_conversion, 112 const Value& original_input_conversion,
113 const std::string& input_conversion, 113 const std::string& input_conversion,
114 Err* err) { 114 Err* err) {
115 if (input_conversion.empty()) 115 if (input_conversion.empty())
116 return Value(); // Empty string means discard the result. 116 return Value(); // Empty string means discard the result.
117 117
118 const char kTrimPrefix[] = "trim "; 118 const char kTrimPrefix[] = "trim ";
119 if (base::StartsWithASCII(input_conversion, kTrimPrefix, true)) { 119 if (base::StartsWith(input_conversion, kTrimPrefix,
120 base::CompareCase::SENSITIVE)) {
120 std::string trimmed; 121 std::string trimmed;
121 base::TrimWhitespaceASCII(input, base::TRIM_ALL, &trimmed); 122 base::TrimWhitespaceASCII(input, base::TRIM_ALL, &trimmed);
122 123
123 // Remove "trim" prefix from the input conversion and re-run. 124 // Remove "trim" prefix from the input conversion and re-run.
124 return DoConvertInputToValue( 125 return DoConvertInputToValue(
125 settings, trimmed, origin, original_input_conversion, 126 settings, trimmed, origin, original_input_conversion,
126 input_conversion.substr(arraysize(kTrimPrefix) - 1), err); 127 input_conversion.substr(arraysize(kTrimPrefix) - 1), err);
127 } 128 }
128 129
129 if (input_conversion == "value") 130 if (input_conversion == "value")
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 const ParseNode* origin, 201 const ParseNode* origin,
201 const Value& input_conversion_value, 202 const Value& input_conversion_value,
202 Err* err) { 203 Err* err) {
203 if (input_conversion_value.type() == Value::NONE) 204 if (input_conversion_value.type() == Value::NONE)
204 return Value(); // Allow null inputs to mean discard the result. 205 return Value(); // Allow null inputs to mean discard the result.
205 if (!input_conversion_value.VerifyTypeIs(Value::STRING, err)) 206 if (!input_conversion_value.VerifyTypeIs(Value::STRING, err))
206 return Value(); 207 return Value();
207 return DoConvertInputToValue(settings, input, origin, input_conversion_value, 208 return DoConvertInputToValue(settings, input, origin, input_conversion_value,
208 input_conversion_value.string_value(), err); 209 input_conversion_value.string_value(), err);
209 } 210 }
OLDNEW
« no previous file with comments | « tools/gn/header_checker.cc ('k') | tools/gn/target.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698