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.
5 #ifndef TOOLS_GN_VALUE_EXTRACTORS_H_
6 #define TOOLS_GN_VALUE_EXTRACTORS_H_
11 #include "tools/gn/label_ptr.h"
12 #include "tools/gn/unique_vector.h"
21 // On failure, returns false and sets the error.
22 bool ExtractListOfStringValues(const Value
& value
,
23 std::vector
<std::string
>* dest
,
26 // Looks for a list of source files relative to a given current dir.
27 bool ExtractListOfRelativeFiles(const BuildSettings
* build_settings
,
29 const SourceDir
& current_dir
,
30 std::vector
<SourceFile
>* files
,
33 // Looks for a list of source directories relative to a given current dir.
34 bool ExtractListOfRelativeDirs(const BuildSettings
* build_settings
,
36 const SourceDir
& current_dir
,
37 std::vector
<SourceDir
>* dest
,
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
,
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
,
57 bool ExtractListOfUniqueLabels(const Value
& value
,
58 const SourceDir
& current_dir
,
59 const Label
& current_toolchain
,
60 UniqueVector
<LabelConfigPair
>* dest
,
62 bool ExtractListOfUniqueLabels(const Value
& value
,
63 const SourceDir
& current_dir
,
64 const Label
& current_toolchain
,
65 UniqueVector
<LabelTargetPair
>* dest
,
68 bool ExtractRelativeFile(const BuildSettings
* build_settings
,
70 const SourceDir
& current_dir
,
74 #endif // TOOLS_GN_VALUE_EXTRACTORS_H_