| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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_FILE_TEMPLATE_H_ | 5 #ifndef TOOLS_GN_FILE_TEMPLATE_H_ |
| 6 #define TOOLS_GN_FILE_TEMPLATE_H_ | 6 #define TOOLS_GN_FILE_TEMPLATE_H_ |
| 7 | 7 |
| 8 #include <iosfwd> | 8 #include <iosfwd> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 void WriteNinjaVariablesForSubstitution( | 122 void WriteNinjaVariablesForSubstitution( |
| 123 std::ostream& out, | 123 std::ostream& out, |
| 124 const SourceFile& source, | 124 const SourceFile& source, |
| 125 const EscapeOptions& escape_options) const; | 125 const EscapeOptions& escape_options) const; |
| 126 | 126 |
| 127 // Returns the Ninja variable name used by the above Ninja functions to | 127 // Returns the Ninja variable name used by the above Ninja functions to |
| 128 // substitute for the given type. | 128 // substitute for the given type. |
| 129 static const char* GetNinjaVariableNameForType(Subrange::Type type); | 129 static const char* GetNinjaVariableNameForType(Subrange::Type type); |
| 130 | 130 |
| 131 // Extracts the given type of substitution from the given source file. | 131 // Extracts the given type of substitution from the given source file. |
| 132 // If output_style is RELATIVE, relative_to indicates the directory that the | 132 // If output_style is OUTPUT_RELATIVE, relative_to indicates the directory |
| 133 // relative directories should be relative to, otherwise it is ignored. | 133 // that the relative directories should be relative to, otherwise it is |
| 134 // ignored. |
| 134 static std::string GetSubstitution(const Settings* settings, | 135 static std::string GetSubstitution(const Settings* settings, |
| 135 const SourceFile& source, | 136 const SourceFile& source, |
| 136 Subrange::Type type, | 137 Subrange::Type type, |
| 137 OutputStyle output_style, | 138 OutputStyle output_style, |
| 138 const SourceDir& relative_to); | 139 const SourceDir& relative_to); |
| 139 | 140 |
| 140 // Known template types, these include the "{{ }}". | 141 // Known template types, these include the "{{ }}". |
| 141 // IF YOU ADD NEW ONES: If the expansion expands to something inside the | 142 // IF YOU ADD NEW ONES: If the expansion expands to something inside the |
| 142 // output directory, also update EnsureStringIsInOutputDir. | 143 // output directory, also update EnsureStringIsInOutputDir. |
| 143 static const char kSource[]; | 144 static const char kSource[]; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 167 // required. This allows us to precompute these types whem applying them | 168 // required. This allows us to precompute these types whem applying them |
| 168 // to a given source file. | 169 // to a given source file. |
| 169 bool types_required_[Subrange::NUM_TYPES]; | 170 bool types_required_[Subrange::NUM_TYPES]; |
| 170 | 171 |
| 171 // Set when any of the types_required_ is true. Otherwise, everythins is a | 172 // Set when any of the types_required_ is true. Otherwise, everythins is a |
| 172 // literal (a common case so we can optimize some code paths). | 173 // literal (a common case so we can optimize some code paths). |
| 173 bool has_substitutions_; | 174 bool has_substitutions_; |
| 174 }; | 175 }; |
| 175 | 176 |
| 176 #endif // TOOLS_GN_FILE_TEMPLATE_H_ | 177 #endif // TOOLS_GN_FILE_TEMPLATE_H_ |
| OLD | NEW |