// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef TOOLS_GN_SUBSTITUTION_LIST_H_ #define TOOLS_GN_SUBSTITUTION_LIST_H_ #include #include #include "gn/substitution_pattern.h" // Represents a list of strings with {{substitution_patterns}} in them. class SubstitutionList { public: SubstitutionList(); SubstitutionList(const SubstitutionList& other); ~SubstitutionList(); SubstitutionList& operator=(const SubstitutionList&) = default; bool Parse(const Value& value, Err* err); bool Parse(const std::vector& values, const ParseNode* origin, Err* err); // Makes a SubstitutionList from the given hardcoded patterns. static SubstitutionList MakeForTest(const char* a, const char* b = nullptr, const char* c = nullptr, const char* d = nullptr); const std::vector& list() const { return list_; } // Returns a list of all substitution types used by the patterns in this // list, with the exception of LITERAL. const std::vector& required_types() const { return required_types_; } void FillRequiredTypes(SubstitutionBits* bits) const; private: std::vector list_; std::vector required_types_; }; #endif // TOOLS_GN_SUBSTITUTION_LIST_H_