OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_LABEL_PATTERN_H_ | 5 #ifndef TOOLS_GN_LABEL_PATTERN_H_ |
6 #define TOOLS_GN_LABEL_PATTERN_H_ | 6 #define TOOLS_GN_LABEL_PATTERN_H_ |
7 | 7 |
8 #include "base/strings/string_piece.h" | 8 #include "base/strings/string_piece.h" |
9 #include "tools/gn/label.h" | 9 #include "tools/gn/label.h" |
10 #include "tools/gn/source_dir.h" | 10 #include "tools/gn/source_dir.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 LabelPattern(); | 29 LabelPattern(); |
30 LabelPattern(Type type, | 30 LabelPattern(Type type, |
31 const SourceDir& dir, | 31 const SourceDir& dir, |
32 const base::StringPiece& name, | 32 const base::StringPiece& name, |
33 const Label& toolchain_label); | 33 const Label& toolchain_label); |
34 ~LabelPattern(); | 34 ~LabelPattern(); |
35 | 35 |
36 // Converts the given input string to a pattern. This does special stuff | 36 // Converts the given input string to a pattern. This does special stuff |
37 // to treat the pattern as a label. Sets the error on failure. | 37 // to treat the pattern as a label. Sets the error on failure. |
38 static LabelPattern GetPattern(const SourceDir& current_dir, | 38 static LabelPattern GetPattern(const base::FilePath& source_root, |
| 39 const SourceDir& current_dir, |
39 const Value& value, | 40 const Value& value, |
40 Err* err); | 41 Err* err); |
41 | 42 |
42 // Returns true if this pattern matches the given label. | 43 // Returns true if this pattern matches the given label. |
43 bool Matches(const Label& label) const; | 44 bool Matches(const Label& label) const; |
44 | 45 |
45 // Returns a string representation of this pattern. | 46 // Returns a string representation of this pattern. |
46 std::string Describe() const; | 47 std::string Describe() const; |
47 | 48 |
48 Type type() const { return type_; } | 49 Type type() const { return type_; } |
(...skipping 14 matching lines...) Expand all Loading... |
63 // Used when type_ == PRIVATE and PRIVATE_RECURSIVE. This specifies the | 64 // Used when type_ == PRIVATE and PRIVATE_RECURSIVE. This specifies the |
64 // directory that to which the pattern is private to. | 65 // directory that to which the pattern is private to. |
65 SourceDir dir_; | 66 SourceDir dir_; |
66 | 67 |
67 // Empty name means match everything. Otherwise the name must match | 68 // Empty name means match everything. Otherwise the name must match |
68 // exactly. | 69 // exactly. |
69 std::string name_; | 70 std::string name_; |
70 }; | 71 }; |
71 | 72 |
72 #endif // TOOLS_GN_LABEL_PATTERN_H_ | 73 #endif // TOOLS_GN_LABEL_PATTERN_H_ |
OLD | NEW |