OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_PATTERN_H_ | 5 #ifndef TOOLS_GN_PATTERN_H_ |
6 #define TOOLS_GN_PATTERN_H_ | 6 #define TOOLS_GN_PATTERN_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "tools/gn/value.h" | 11 #include "tools/gn/value.h" |
12 | 12 |
13 extern const char kPattern_Help[]; | |
14 | |
15 class Pattern { | 13 class Pattern { |
16 public: | 14 public: |
17 struct Subrange { | 15 struct Subrange { |
18 enum Type { | 16 enum Type { |
19 LITERAL, // Matches exactly the contents of the string. | 17 LITERAL, // Matches exactly the contents of the string. |
20 ANYTHING, // * (zero or more chars). | 18 ANYTHING, // * (zero or more chars). |
21 PATH_BOUNDARY // '/' or beginning of string. | 19 PATH_BOUNDARY // '/' or beginning of string. |
22 }; | 20 }; |
23 | 21 |
24 Subrange(Type t, const std::string& l = std::string()) | 22 Subrange(Type t, const std::string& l = std::string()) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 void SetFromValue(const Value& v, Err* err); | 79 void SetFromValue(const Value& v, Err* err); |
82 | 80 |
83 bool MatchesString(const std::string& s) const; | 81 bool MatchesString(const std::string& s) const; |
84 bool MatchesValue(const Value& v) const; | 82 bool MatchesValue(const Value& v) const; |
85 | 83 |
86 private: | 84 private: |
87 std::vector<Pattern> patterns_; | 85 std::vector<Pattern> patterns_; |
88 }; | 86 }; |
89 | 87 |
90 #endif // TOOLS_GN_PATTERN_H_ | 88 #endif // TOOLS_GN_PATTERN_H_ |
OLD | NEW |