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

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

Issue 1284833004: Remove remaining legacy SplitString calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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/runtime_deps.cc ('k') | tools/ipc_fuzzer/fuzzer/fuzzer_main.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/standard_out.h" 5 #include "tools/gn/standard_out.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 OutputString(line.substr(begin_bracket, first_normal - begin_bracket), 197 OutputString(line.substr(begin_bracket, first_normal - begin_bracket),
198 DECORATION_DIM); 198 DECORATION_DIM);
199 } 199 }
200 200
201 OutputString(line.substr(first_normal) + "\n"); 201 OutputString(line.substr(first_normal) + "\n");
202 } 202 }
203 203
204 void PrintLongHelp(const std::string& text) { 204 void PrintLongHelp(const std::string& text) {
205 EnsureInitialized(); 205 EnsureInitialized();
206 206
207 std::vector<std::string> lines;
208 base::SplitStringDontTrim(text, '\n', &lines);
209
210 bool first_header = true; 207 bool first_header = true;
211 bool in_body = false; 208 bool in_body = false;
212 for (const auto& line : lines) { 209 for (const std::string& line : base::SplitString(
210 text, "\n", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL)) {
213 // Check for a heading line. 211 // Check for a heading line.
214 if (!line.empty() && line[0] != ' ') { 212 if (!line.empty() && line[0] != ' ') {
215 if (is_markdown) { 213 if (is_markdown) {
216 // GN's block-level formatting is converted to markdown as follows: 214 // GN's block-level formatting is converted to markdown as follows:
217 // * The first heading is treated as an H2. 215 // * The first heading is treated as an H2.
218 // * Subsequent heading are treated as H3s. 216 // * Subsequent heading are treated as H3s.
219 // * Any other text is wrapped in a code block and displayed as-is. 217 // * Any other text is wrapped in a code block and displayed as-is.
220 // 218 //
221 // Span-level formatting (the decorations) is converted inside 219 // Span-level formatting (the decorations) is converted inside
222 // OutputString(). 220 // OutputString().
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 } 256 }
259 } 257 }
260 258
261 OutputString(line + "\n", dec); 259 OutputString(line + "\n", dec);
262 } 260 }
263 261
264 if (is_markdown && in_body) 262 if (is_markdown && in_body)
265 OutputString("\n```\n"); 263 OutputString("\n```\n");
266 } 264 }
267 265
OLDNEW
« no previous file with comments | « tools/gn/runtime_deps.cc ('k') | tools/ipc_fuzzer/fuzzer/fuzzer_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698