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_TYPE_H_ | 5 #ifndef TOOLS_GN_SUBSTITUTION_TYPE_H_ |
6 #define TOOLS_GN_SUBSTITUTION_TYPE_H_ | 6 #define TOOLS_GN_SUBSTITUTION_TYPE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 class Err; | 10 class Err; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 // An array of size SUBSTITUTION_NUM_TYPES that lists the names of the | 63 // An array of size SUBSTITUTION_NUM_TYPES that lists the names of the |
64 // substitution patterns, including the curly braces. So, for example, | 64 // substitution patterns, including the curly braces. So, for example, |
65 // kSubstitutionNames[SUBSTITUTION_SOURCE] == "{{source}}". | 65 // kSubstitutionNames[SUBSTITUTION_SOURCE] == "{{source}}". |
66 extern const char* kSubstitutionNames[SUBSTITUTION_NUM_TYPES]; | 66 extern const char* kSubstitutionNames[SUBSTITUTION_NUM_TYPES]; |
67 | 67 |
68 // Ninja variables corresponding to each substitution. These do not include | 68 // Ninja variables corresponding to each substitution. These do not include |
69 // the dollar sign. | 69 // the dollar sign. |
70 extern const char* kSubstitutionNinjaNames[SUBSTITUTION_NUM_TYPES]; | 70 extern const char* kSubstitutionNinjaNames[SUBSTITUTION_NUM_TYPES]; |
71 | 71 |
72 // A wrapper around an array if flags indicating whether a give substitution | 72 // A wrapper around an array if flags indicating whether a given substitution |
73 // type is required in some context. By convention, the LITERAL type bit is | 73 // type is required in some context. By convention, the LITERAL type bit is |
74 // not set. | 74 // not set. |
75 struct SubstitutionBits { | 75 struct SubstitutionBits { |
76 SubstitutionBits(); | 76 SubstitutionBits(); |
77 | 77 |
78 // Merges any bits set in the given "other" to this one. This object will | 78 // Merges any bits set in the given "other" to this one. This object will |
79 // then be the union of all bits in the two lists. | 79 // then be the union of all bits in the two lists. |
80 void MergeFrom(const SubstitutionBits& other); | 80 void MergeFrom(const SubstitutionBits& other); |
81 | 81 |
82 // Converts the substitution type bitfield (with a true set for each required | 82 // Converts the substitution type bitfield (with a true set for each required |
(...skipping 19 matching lines...) Expand all Loading... |
102 bool IsValidCopySubstitution(SubstitutionType type); | 102 bool IsValidCopySubstitution(SubstitutionType type); |
103 | 103 |
104 // Like the "IsValid..." version above but checks a list of types and sets a | 104 // Like the "IsValid..." version above but checks a list of types and sets a |
105 // an error blaming the given source if the test fails. | 105 // an error blaming the given source if the test fails. |
106 bool EnsureValidSourcesSubstitutions( | 106 bool EnsureValidSourcesSubstitutions( |
107 const std::vector<SubstitutionType>& types, | 107 const std::vector<SubstitutionType>& types, |
108 const ParseNode* origin, | 108 const ParseNode* origin, |
109 Err* err); | 109 Err* err); |
110 | 110 |
111 #endif // TOOLS_GN_SUBSTITUTION_TYPE_H_ | 111 #endif // TOOLS_GN_SUBSTITUTION_TYPE_H_ |
OLD | NEW |