OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef TOOLS_GN_SUBSTITUTION_WRITER_H_ | 5 #ifndef TOOLS_GN_SUBSTITUTION_WRITER_H_ |
6 #define TOOLS_GN_SUBSTITUTION_WRITER_H_ | 6 #define TOOLS_GN_SUBSTITUTION_WRITER_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 class SubstitutionWriter { | 26 class SubstitutionWriter { |
27 public: | 27 public: |
28 enum OutputStyle { | 28 enum OutputStyle { |
29 OUTPUT_ABSOLUTE, // Dirs will be absolute "//foo/bar". | 29 OUTPUT_ABSOLUTE, // Dirs will be absolute "//foo/bar". |
30 OUTPUT_RELATIVE, // Dirs will be relative to a given directory. | 30 OUTPUT_RELATIVE, // Dirs will be relative to a given directory. |
31 }; | 31 }; |
32 | 32 |
33 SubstitutionWriter(); | 33 SubstitutionWriter(); |
34 ~SubstitutionWriter(); | 34 ~SubstitutionWriter(); |
35 | 35 |
| 36 // Converts the given SubstitutionList to OutputFiles assuming there are |
| 37 // no substitutions (it will assert if there are). This is used for cases |
| 38 // like actions where the outputs are explicit, but the list is stored as |
| 39 // a SubstitutionList. |
| 40 static void GetListAsSourceFiles( |
| 41 const Settings* settings, |
| 42 const SubstitutionList& list, |
| 43 std::vector<SourceFile>* output); |
| 44 static void GetListAsOutputFiles( |
| 45 const Settings* settings, |
| 46 const SubstitutionList& list, |
| 47 std::vector<OutputFile>* output); |
| 48 |
36 // Applies the substitution pattern to a source file, returning the result | 49 // Applies the substitution pattern to a source file, returning the result |
37 // as either a SourceFile or OutputFile. | 50 // as either a SourceFile or OutputFile. |
38 static SourceFile ApplyPatternToSource( | 51 static SourceFile ApplyPatternToSource( |
39 const Settings* settings, | 52 const Settings* settings, |
40 const SubstitutionPattern& pattern, | 53 const SubstitutionPattern& pattern, |
41 const SourceFile& source); | 54 const SourceFile& source); |
42 static OutputFile ApplyPatternToSourceAsOutputFile( | 55 static OutputFile ApplyPatternToSourceAsOutputFile( |
43 const Settings* settings, | 56 const Settings* settings, |
44 const SubstitutionPattern& pattern, | 57 const SubstitutionPattern& pattern, |
45 const SourceFile& source); | 58 const SourceFile& source); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // to, otherwise it is ignored. | 111 // to, otherwise it is ignored. |
99 static std::string GetSourceSubstitution( | 112 static std::string GetSourceSubstitution( |
100 const Settings* settings, | 113 const Settings* settings, |
101 const SourceFile& source, | 114 const SourceFile& source, |
102 SubstitutionType type, | 115 SubstitutionType type, |
103 OutputStyle output_style, | 116 OutputStyle output_style, |
104 const SourceDir& relative_to); | 117 const SourceDir& relative_to); |
105 }; | 118 }; |
106 | 119 |
107 #endif // TOOLS_GN_SUBSTITUTION_WRITER_H_ | 120 #endif // TOOLS_GN_SUBSTITUTION_WRITER_H_ |
OLD | NEW |