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

Side by Side Diff: tools/gn/config_values_extractors.h

Issue 48523006: GN: Separately track labels and origins for lists of stuff (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | « tools/gn/command_gyp.cc ('k') | tools/gn/gn.gyp » ('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 #ifndef TOOLS_GN_CONFIG_VALUES_EXTRACTORS_H_ 5 #ifndef TOOLS_GN_CONFIG_VALUES_EXTRACTORS_H_
6 #define TOOLS_GN_CONFIG_VALUES_EXTRACTORS_H_ 6 #define TOOLS_GN_CONFIG_VALUES_EXTRACTORS_H_
7 7
8 #include <ostream> 8 #include <ostream>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 22 matching lines...) Expand all
33 cur_index_(-1) { 33 cur_index_(-1) {
34 } 34 }
35 35
36 bool done() const { 36 bool done() const {
37 return cur_index_ >= static_cast<int>(target_->configs().size()); 37 return cur_index_ >= static_cast<int>(target_->configs().size());
38 } 38 }
39 39
40 const ConfigValues& cur() const { 40 const ConfigValues& cur() const {
41 if (cur_index_ == -1) 41 if (cur_index_ == -1)
42 return target_->config_values(); 42 return target_->config_values();
43 return target_->configs()[cur_index_]->config_values(); 43 return target_->configs()[cur_index_].ptr->config_values();
44 }
45
46 // Returns the origin of who added this config, if any. This will alwsya be
47 // null for the config values of a target itself.
48 const ParseNode* origin() const {
49 if (cur_index_ == -1)
50 return NULL;
51 return target_->configs()[cur_index_].origin;
44 } 52 }
45 53
46 void Next() { 54 void Next() {
47 cur_index_++; 55 cur_index_++;
48 } 56 }
49 57
50 // Returns the config holding the current config values, or NULL for those 58 // Returns the config holding the current config values, or NULL for those
51 // config values associated with the target itself. 59 // config values associated with the target itself.
52 const Config* GetCurrentConfig() const { 60 const Config* GetCurrentConfig() const {
53 if (cur_index_ == -1) 61 if (cur_index_ == -1)
54 return NULL; 62 return NULL;
55 return target_->configs()[cur_index_]; 63 return target_->configs()[cur_index_].ptr;
56 } 64 }
57 65
58 private: 66 private:
59 const Target* target_; 67 const Target* target_;
60 68
61 // Represents an index into the target_'s configs() or, when -1, the config 69 // Represents an index into the target_'s configs() or, when -1, the config
62 // values on the target itself. 70 // values on the target itself.
63 int cur_index_; 71 int cur_index_;
64 }; 72 };
65 73
(...skipping 22 matching lines...) Expand all
88 } 96 }
89 97
90 // Writes the values out as strings with no transformation. 98 // Writes the values out as strings with no transformation.
91 void RecursiveTargetConfigStringsToStream( 99 void RecursiveTargetConfigStringsToStream(
92 const Target* target, 100 const Target* target,
93 const std::vector<std::string>& (ConfigValues::* getter)() const, 101 const std::vector<std::string>& (ConfigValues::* getter)() const,
94 const EscapeOptions& escape_options, 102 const EscapeOptions& escape_options,
95 std::ostream& out); 103 std::ostream& out);
96 104
97 #endif // TOOLS_GN_CONFIG_VALUES_EXTRACTORS_H_ 105 #endif // TOOLS_GN_CONFIG_VALUES_EXTRACTORS_H_
OLDNEW
« no previous file with comments | « tools/gn/command_gyp.cc ('k') | tools/gn/gn.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698