Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / tools / gn / value_extractors.h
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/label_ptr.h"
12 #include "tools/gn/unique_vector.h"
13
14 class BuildSettings;
15 class Err;
16 class Label;
17 class SourceDir;
18 class SourceFile;
19 class Value;
20
21 // On failure, returns false and sets the error.
22 bool ExtractListOfStringValues(const Value& value,
23                                std::vector<std::string>* dest,
24                                Err* err);
25
26 // Looks for a list of source files relative to a given current dir.
27 bool ExtractListOfRelativeFiles(const BuildSettings* build_settings,
28                                 const Value& value,
29                                 const SourceDir& current_dir,
30                                 std::vector<SourceFile>* files,
31                                 Err* err);
32
33 // Looks for a list of source directories relative to a given current dir.
34 bool ExtractListOfRelativeDirs(const BuildSettings* build_settings,
35                                const Value& value,
36                                const SourceDir& current_dir,
37                                std::vector<SourceDir>* dest,
38                                Err* err);
39
40 // Extracts the list of labels and their origins to the given vector. Only the
41 // labels are filled in, the ptr for each pair in the vector will be null.
42 bool ExtractListOfLabels(const Value& value,
43                          const SourceDir& current_dir,
44                          const Label& current_toolchain,
45                          LabelTargetVector* dest,
46                          Err* err);
47
48 // Extracts the list of labels and their origins to the given vector. Only the
49 // labels are filled in, the ptr for each pair in the vector will be null. Sets
50 // an error and returns false if a label is maformed or there are duplicates.
51 bool ExtractListOfUniqueLabels(const Value& value,
52                                const SourceDir& current_dir,
53                                const Label& current_toolchain,
54                                UniqueVector<LabelConfigPair>* dest,
55                                Err* err);
56 bool ExtractListOfUniqueLabels(const Value& value,
57                                const SourceDir& current_dir,
58                                const Label& current_toolchain,
59                                UniqueVector<LabelTargetPair>* dest,
60                                Err* err);
61
62 bool ExtractRelativeFile(const BuildSettings* build_settings,
63                          const Value& value,
64                          const SourceDir& current_dir,
65                          SourceFile* file,
66                          Err* err);
67
68 #endif  // TOOLS_GN_VALUE_EXTRACTORS_H_