2482ba25bf2b3a82e19d6adc29585eb5fe6f67ed
[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. For the
49 // version taking Label*Pair, only the labels are filled in, the ptr for each
50 // pair in the vector will be null. Sets an error and returns false if a label
51 // is maformed or there are duplicates.
52 bool ExtractListOfUniqueLabels(const Value& value,
53                                const SourceDir& current_dir,
54                                const Label& current_toolchain,
55                                UniqueVector<Label>* dest,
56                                Err* err);
57 bool ExtractListOfUniqueLabels(const Value& value,
58                                const SourceDir& current_dir,
59                                const Label& current_toolchain,
60                                UniqueVector<LabelConfigPair>* dest,
61                                Err* err);
62 bool ExtractListOfUniqueLabels(const Value& value,
63                                const SourceDir& current_dir,
64                                const Label& current_toolchain,
65                                UniqueVector<LabelTargetPair>* dest,
66                                Err* err);
67
68 bool ExtractRelativeFile(const BuildSettings* build_settings,
69                          const Value& value,
70                          const SourceDir& current_dir,
71                          SourceFile* file,
72                          Err* err);
73
74 #endif  // TOOLS_GN_VALUE_EXTRACTORS_H_