OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_MATCH_H_ | |
6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_MATCH_H_ | |
7 | |
8 #include <stddef.h> | |
Peter Kasting
2014/04/16 23:44:25
Nit: If this is needed for size_t, include <cstdde
Mark P
2014/04/17 20:24:18
Appears unnecessary. Removing. (It was in the ori
| |
9 | |
10 #include <utility> | |
11 #include <vector> | |
12 | |
13 class BookmarkNode; | |
14 | |
15 struct BookmarkMatch { | |
16 // Each MatchPosition is the [begin, end) positions of a match within a | |
17 // string. | |
18 typedef std::pair<size_t, size_t> MatchPosition; | |
19 typedef std::vector<MatchPosition> MatchPositions; | |
20 | |
21 BookmarkMatch(); | |
22 ~BookmarkMatch(); | |
23 | |
24 // Extracts and returns the offsets from |match_positions|. | |
25 static std::vector<size_t> OffsetsFromMatchPositions( | |
26 const MatchPositions& match_positions); | |
27 | |
28 // Replaces the offsets in |match_positions| with those given in |offsets|, | |
29 // deleting any which are npos, and returns the updated list of match | |
30 // positions. | |
31 static MatchPositions ReplaceOffsetsInMatchPositions( | |
32 const MatchPositions& match_positions, | |
33 const std::vector<size_t>& offsets); | |
34 | |
35 // The matching node of a query. | |
36 const BookmarkNode* node; | |
37 | |
38 // Location of the matching words in the title of the node. | |
39 MatchPositions title_match_positions; | |
40 | |
41 // Location of the matching words in the URL of the node. | |
42 MatchPositions url_match_positions; | |
43 }; | |
44 | |
45 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MATCH_H_ | |
OLD | NEW |