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
3 // found in the LICENSE file.
5 #ifndef TOOLS_GN_SUBSTITUTION_LIST_H_
6 #define TOOLS_GN_SUBSTITUTION_LIST_H_
11 #include "tools/gn/substitution_pattern.h"
13 // Represents a list of strings with {{substitution_patterns}} in them.
14 class SubstitutionList
{
19 bool Parse(const Value
& value
, Err
* err
);
20 bool Parse(const std::vector
<std::string
>& values
,
21 const ParseNode
* origin
,
24 // Makes a SubstitutionList from the given hardcoded patterns.
25 static SubstitutionList
MakeForTest(
27 const char* b
= nullptr,
28 const char* c
= nullptr);
30 const std::vector
<SubstitutionPattern
>& list() const { return list_
; }
32 // Returns a list of all substitution types used by the patterns in thist
33 // list, with the exception of LITERAL.
34 const std::vector
<SubstitutionType
>& required_types() const {
35 return required_types_
;
38 void FillRequiredTypes(SubstitutionBits
* bits
) const;
41 std::vector
<SubstitutionPattern
> list_
;
43 std::vector
<SubstitutionType
> required_types_
;
46 #endif // TOOLS_GN_SUBSTITUTION_LIST_H_