Chromium Code Reviews| Index: tools/gn/substitution_list.h |
| diff --git a/tools/gn/substitution_list.h b/tools/gn/substitution_list.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..297ba4843afc8ceeaeeedfd93ad694cf1883c8c6 |
| --- /dev/null |
| +++ b/tools/gn/substitution_list.h |
| @@ -0,0 +1,46 @@ |
| +// 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_SUBSTUTITION_LIST_H |
| +#define TOOLS_GN_SUBSTUTITION_LIST_H |
| + |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "tools/gn/substitution_pattern.h" |
| + |
| +// Represents a list of strings with {{substitution_patterns}} in them. |
| +class SubstitutionList { |
| + public: |
| + SubstitutionList(); |
| + ~SubstitutionList(); |
| + |
| + bool Parse(const Value& value, Err* err); |
| + bool Parse(const std::vector<std::string>& values, |
| + const ParseNode* origin, |
| + Err* err); |
| + |
| + // Makes a SubstitutionList from the given hardcoded patterns. |
| + static SubstitutionList MakeForTest( |
|
scottmg
2014/08/05 22:30:32
Seems like this doesn't need to be in-class.
brettw
2014/08/06 18:25:01
No, but it seems like the best place for it to me,
|
| + const char* a, |
| + const char* b = NULL, |
| + const char* c = NULL); |
| + |
| + const std::vector<SubstitutionPattern>& list() const { return list_; } |
| + |
| + // Returns a list of all substitution types used by the patterns in thist |
| + // list, with the exception of LITERAL. |
| + const std::vector<SubstitutionType>& required_types() const { |
| + return required_types_; |
| + } |
| + |
| + private: |
| + void FillRequiredTypes(); |
| + |
| + std::vector<SubstitutionPattern> list_; |
| + |
| + std::vector<SubstitutionType> required_types_; |
| +}; |
| + |
| +#endif // TOOLS_GN_SUBSTUTITION_LIST_H |