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

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

Issue 21114002: Add initial prototype for the GN meta-buildsystem. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add owners and readme Created 7 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 | Annotate | Revision Log
« no previous file with comments | « tools/gn/config_values.cc ('k') | tools/gn/config_values_extractors.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef TOOLS_GN_CONFIG_VALUES_EXTRACTORS_H_
6 #define TOOLS_GN_CONFIG_VALUES_EXTRACTORS_H_
7
8 #include <ostream>
9 #include <string>
10 #include <vector>
11
12 #include "tools/gn/config.h"
13 #include "tools/gn/config_values.h"
14 #include "tools/gn/target.h"
15
16 template<typename T, class Writer>
17 inline void ConfigValuesToStream(
18 const ConfigValues& values,
19 const std::vector<T>& (ConfigValues::* getter)() const,
20 const Writer& writer,
21 std::ostream& out) {
22 const std::vector<T>& v = (values.*getter)();
23 for (size_t i = 0; i < v.size(); i++)
24 writer(v[i], out);
25 };
26
27 template<typename T, class Writer>
28 inline void RecursiveTargetConfigToStream(
29 const Target* target,
30 const std::vector<T>& (ConfigValues::* getter)() const,
31 const Writer& writer,
32 std::ostream& out) {
33 // Write all configs in reverse order (to get oldest first, which will look
34 // more normal in the output).
35 for (int i = static_cast<int>(target->configs().size() - 1); i >= 0; i--) {
36 ConfigValuesToStream(target->configs()[i]->config_values(), getter,
37 writer, out);
38 }
39
40 // Last write from the config from the Target itself, if any.
41 ConfigValuesToStream(target->config_values(), getter, writer, out);
42 }
43
44 // Writes the values out as strings with no transformation.
45 void RecursiveTargetConfigStringsToStream(
46 const Target* target,
47 const std::vector<std::string>& (ConfigValues::* getter)() const,
48 std::ostream& out);
49
50 #endif // TOOLS_GN_CONFIG_VALUES_EXTRACTORS_H_
OLDNEW
« no previous file with comments | « tools/gn/config_values.cc ('k') | tools/gn/config_values_extractors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698