Apply _RELATIVE relocations ahead of others.
[chromium-blink-merge.git] / components / url_matcher / string_pattern.h
blobca5f223ec6f5a31152e2a8bfad328c6786000610
1 // Copyright 2013 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.
5 #ifndef COMPONENTS_URL_MATCHER_STRING_PATTERN_H_
6 #define COMPONENTS_URL_MATCHER_STRING_PATTERN_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "components/url_matcher/url_matcher_export.h"
14 namespace url_matcher {
16 // An individual pattern of a substring or regex matcher. A pattern consists of
17 // a string (interpreted as individual bytes, no character encoding) and an
18 // identifier.
19 // IDs are returned to the caller of SubstringSetMatcher::Match() or
20 // RegexMatcher::MatchURL() to help the caller to figure out what
21 // patterns matched a string. All patterns registered to a matcher
22 // need to contain unique IDs.
23 class URL_MATCHER_EXPORT StringPattern {
24 public:
25 typedef int ID;
27 StringPattern(const std::string& pattern, ID id);
28 ~StringPattern();
29 const std::string& pattern() const { return pattern_; }
30 ID id() const { return id_; }
32 bool operator<(const StringPattern& rhs) const;
34 private:
35 std::string pattern_;
36 ID id_;
38 DISALLOW_COPY_AND_ASSIGN(StringPattern);
41 } // namespace url_matcher
43 #endif // COMPONENTS_URL_MATCHER_STRING_PATTERN_H_