Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1001)

Unified Diff: tools/gn/substitution_list.h

Issue 429423002: Refactor GN source expansions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/source_file.cc ('k') | tools/gn/substitution_list.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
+ 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
« no previous file with comments | « tools/gn/source_file.cc ('k') | tools/gn/substitution_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698