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

Side by Side Diff: tools/gn/value_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/value.cc ('k') | tools/gn/value_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_VALUE_EXTRACTORS_H_
6 #define TOOLS_GN_VALUE_EXTRACTORS_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "tools/gn/value.h"
12
13 class Err;
14 class Label;
15 class SourceDir;
16 class SourceFile;
17
18 // Sets the error and returns false on failure.
19 template<typename T, class Converter>
20 bool ListValueExtractor(const Value& value, std::vector<T>* dest,
21 Err* err,
22 const Converter& converter) {
23 if (!value.VerifyTypeIs(Value::LIST, err))
24 return false;
25 const std::vector<Value>& input_list = value.list_value();
26 dest->resize(input_list.size());
27 for (size_t i = 0; i < input_list.size(); i++) {
28 if (!converter(input_list[i], &(*dest)[i], err))
29 return false;
30 }
31 return true;
32 }
33
34 // On failure, returns false and sets the error.
35 bool ExtractListOfStringValues(const Value& value,
36 std::vector<std::string>* dest,
37 Err* err);
38
39 // Looks for a list of source files relative to a given current dir.
40 bool ExtractListOfRelativeFiles(const Value& value,
41 const SourceDir& current_dir,
42 std::vector<SourceFile>* files,
43 Err* err);
44
45 // Looks for a list of source directories relative to a given current dir.
46 bool ExtractListOfRelativeDirs(const Value& value,
47 const SourceDir& current_dir,
48 std::vector<SourceDir>* dest,
49 Err* err);
50
51 bool ExtractListOfLabels(const Value& value,
52 const SourceDir& current_dir,
53 const Label& current_toolchain,
54 std::vector<Label>* dest,
55 Err* err);
56
57 #endif // TOOLS_GN_VALUE_EXTRACTORS_H_
OLDNEW
« no previous file with comments | « tools/gn/value.cc ('k') | tools/gn/value_extractors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698