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

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

Issue 223783005: Add support for reading .gypi files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
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/scope.h" 5 #include "tools/gn/scope.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "tools/gn/parse_tree.h" 9 #include "tools/gn/parse_tree.h"
10 #include "tools/gn/template.h" 10 #include "tools/gn/template.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 } 185 }
186 } 186 }
187 return true; 187 return true;
188 } 188 }
189 189
190 void Scope::GetCurrentScopeValues(KeyValueMap* output) const { 190 void Scope::GetCurrentScopeValues(KeyValueMap* output) const {
191 for (RecordMap::const_iterator i = values_.begin(); i != values_.end(); ++i) 191 for (RecordMap::const_iterator i = values_.begin(); i != values_.end(); ++i)
192 (*output)[i->first] = i->second.value; 192 (*output)[i->first] = i->second.value;
193 } 193 }
194 194
195 void Scope::GetCurrentScopeKeys(std::vector<base::StringPiece>* output) const {
196 for (RecordMap::const_iterator i = values_.begin(); i != values_.end(); ++i)
197 output->push_back(i->first);
198 }
199
195 bool Scope::NonRecursiveMergeTo(Scope* dest, 200 bool Scope::NonRecursiveMergeTo(Scope* dest,
196 bool clobber_existing, 201 bool clobber_existing,
197 const ParseNode* node_for_err, 202 const ParseNode* node_for_err,
198 const char* desc_for_err, 203 const char* desc_for_err,
199 Err* err) const { 204 Err* err) const {
200 // Values. 205 // Values.
201 for (RecordMap::const_iterator i = values_.begin(); i != values_.end(); ++i) { 206 for (RecordMap::const_iterator i = values_.begin(); i != values_.end(); ++i) {
202 const Value& new_value = i->second.value; 207 const Value& new_value = i->second.value;
203 if (!clobber_existing) { 208 if (!clobber_existing) {
204 const Value* existing_value = dest->GetValue(i->first); 209 const Value* existing_value = dest->GetValue(i->first);
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 } 417 }
413 418
414 void Scope::AddProvider(ProgrammaticProvider* p) { 419 void Scope::AddProvider(ProgrammaticProvider* p) {
415 programmatic_providers_.insert(p); 420 programmatic_providers_.insert(p);
416 } 421 }
417 422
418 void Scope::RemoveProvider(ProgrammaticProvider* p) { 423 void Scope::RemoveProvider(ProgrammaticProvider* p) {
419 DCHECK(programmatic_providers_.find(p) != programmatic_providers_.end()); 424 DCHECK(programmatic_providers_.find(p) != programmatic_providers_.end());
420 programmatic_providers_.erase(p); 425 programmatic_providers_.erase(p);
421 } 426 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698