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

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

Issue 986113002: tools/gn: Convert for loops to use the new range-based loops in C++11. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more fixes Created 5 years, 9 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
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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 size_t chars_to_highlight = line.find(':'); 172 size_t chars_to_highlight = line.find(':');
173 if (chars_to_highlight == std::string::npos) 173 if (chars_to_highlight == std::string::npos)
174 chars_to_highlight = line.size(); 174 chars_to_highlight = line.size();
175 OutputString(line.substr(0, chars_to_highlight), DECORATION_YELLOW); 175 OutputString(line.substr(0, chars_to_highlight), DECORATION_YELLOW);
176 OutputString(line.substr(chars_to_highlight) + "\n"); 176 OutputString(line.substr(chars_to_highlight) + "\n");
177 continue; 177 continue;
178 } 178 }
179 179
180 // Check for a comment. 180 // Check for a comment.
181 TextDecoration dec = DECORATION_NONE; 181 TextDecoration dec = DECORATION_NONE;
182 for (size_t char_i = 0; char_i < line.size(); char_i++) { 182 for (const auto& elem : line) {
183 if (line[char_i] == '#') { 183 if (elem == '#') {
184 // Got a comment, draw dimmed. 184 // Got a comment, draw dimmed.
185 dec = DECORATION_DIM; 185 dec = DECORATION_DIM;
186 break; 186 break;
187 } else if (line[char_i] != ' ') { 187 } else if (elem != ' ') {
188 break; 188 break;
189 } 189 }
190 } 190 }
191 191
192 OutputString(line + "\n", dec); 192 OutputString(line + "\n", dec);
193 } 193 }
194 } 194 }
195 195
OLDNEW
« tools/gn/pattern.cc ('K') | « tools/gn/pattern.cc ('k') | tools/gn/substitution_pattern.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698