closure: fix compile error by adding missing externs
[chromium-blink-merge.git] / components / bookmarks / browser / bookmark_match.h
blob5bcab5e3897664d71cac1526082af98a20073cc2
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_TITLE_MATCH_H_
6 #define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_TITLE_MATCH_H_
8 #include <cstddef>
9 #include <utility>
10 #include <vector>
12 namespace bookmarks {
14 class BookmarkNode;
16 struct BookmarkMatch {
17 // Each MatchPosition is the [begin, end) positions of a match within a
18 // string.
19 typedef std::pair<size_t, size_t> MatchPosition;
20 typedef std::vector<MatchPosition> MatchPositions;
22 BookmarkMatch();
23 ~BookmarkMatch();
25 // Extracts and returns the offsets from |match_positions|.
26 static std::vector<size_t> OffsetsFromMatchPositions(
27 const MatchPositions& match_positions);
29 // Replaces the offsets in |match_positions| with those given in |offsets|,
30 // deleting any which are npos, and returns the updated list of match
31 // positions.
32 static MatchPositions ReplaceOffsetsInMatchPositions(
33 const MatchPositions& match_positions,
34 const std::vector<size_t>& offsets);
36 // The matching node of a query.
37 const BookmarkNode* node;
39 // Location of the matching words in the title of the node.
40 MatchPositions title_match_positions;
42 // Location of the matching words in the URL of the node.
43 MatchPositions url_match_positions;
46 } // namespace bookmarks
48 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_TITLE_MATCH_H_