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. 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,
56 bool ExtractListOfUniqueLabels(const Value& value,
57 const SourceDir& current_dir,
58 const Label& current_toolchain,
59 UniqueVector<LabelTargetPair>* dest,
62 bool ExtractRelativeFile(const BuildSettings* build_settings,
64 const SourceDir& current_dir,
68 #endif // TOOLS_GN_VALUE_EXTRACTORS_H_