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_
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
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
{
27 StringPattern(const std::string
& pattern
, ID id
);
29 const std::string
& pattern() const { return pattern_
; }
30 ID
id() const { return id_
; }
32 bool operator<(const StringPattern
& rhs
) const;
38 DISALLOW_COPY_AND_ASSIGN(StringPattern
);
41 } // namespace url_matcher
43 #endif // COMPONENTS_URL_MATCHER_STRING_PATTERN_H_