OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_COMMON_EXTENSIONS_MATCHER_STRING_PATTERN_H_ | |
6 #define CHROME_COMMON_EXTENSIONS_MATCHER_STRING_PATTERN_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/basictypes.h" | |
12 | |
13 namespace extensions { | |
14 | |
15 // An individual pattern of a substring or regex matcher. A pattern consists of | |
16 // a string (interpreted as individual bytes, no character encoding) and an | |
17 // identifier. | |
18 // IDs are returned to the caller of SubstringSetMatcher::Match() or | |
19 // RegexMatcher::MatchURL() to help the caller to figure out what | |
20 // patterns matched a string. All patterns registered to a matcher | |
21 // need to contain unique IDs. | |
22 class StringPattern { | |
23 public: | |
24 typedef int ID; | |
25 | |
26 StringPattern(const std::string& pattern, ID id); | |
27 ~StringPattern(); | |
28 const std::string& pattern() const { return pattern_; } | |
29 ID id() const { return id_; } | |
30 | |
31 bool operator<(const StringPattern& rhs) const; | |
32 | |
33 private: | |
34 std::string pattern_; | |
35 ID id_; | |
36 | |
37 DISALLOW_COPY_AND_ASSIGN(StringPattern); | |
38 }; | |
39 | |
40 } // namespace extensions | |
41 | |
42 #endif // CHROME_COMMON_EXTENSIONS_MATCHER_STRING_PATTERN_H_ | |
OLD | NEW |