| 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 21 matching lines...) Expand all Loading... |
| 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 SourceDir& current_dir, |
| 39 const Value& value, | 39 const Value& value, |
| 40 Err* err); | 40 Err* err); |
| 41 | 41 |
| 42 // Returns true if the given input string might match more than one thing. |
| 43 static bool HasWildcard(const std::string& str); |
| 44 |
| 42 // Returns true if this pattern matches the given label. | 45 // Returns true if this pattern matches the given label. |
| 43 bool Matches(const Label& label) const; | 46 bool Matches(const Label& label) const; |
| 44 | 47 |
| 45 // Returns a string representation of this pattern. | 48 // Returns a string representation of this pattern. |
| 46 std::string Describe() const; | 49 std::string Describe() const; |
| 47 | 50 |
| 48 Type type() const { return type_; } | 51 Type type() const { return type_; } |
| 49 | 52 |
| 50 const SourceDir& dir() const { return dir_; } | 53 const SourceDir& dir() const { return dir_; } |
| 51 const std::string& name() const { return name_; } | 54 const std::string& name() const { return name_; } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 63 // Used when type_ == PRIVATE and PRIVATE_RECURSIVE. This specifies the | 66 // Used when type_ == PRIVATE and PRIVATE_RECURSIVE. This specifies the |
| 64 // directory that to which the pattern is private to. | 67 // directory that to which the pattern is private to. |
| 65 SourceDir dir_; | 68 SourceDir dir_; |
| 66 | 69 |
| 67 // Empty name means match everything. Otherwise the name must match | 70 // Empty name means match everything. Otherwise the name must match |
| 68 // exactly. | 71 // exactly. |
| 69 std::string name_; | 72 std::string name_; |
| 70 }; | 73 }; |
| 71 | 74 |
| 72 #endif // TOOLS_GN_LABEL_PATTERN_H_ | 75 #endif // TOOLS_GN_LABEL_PATTERN_H_ |
| OLD | NEW |