OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 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 COMPONENTS_BOOKMARKS_BROWSER_TITLED_URL_MATCH_H_ | |
6 #define COMPONENTS_BOOKMARKS_BROWSER_TITLED_URL_MATCH_H_ | |
7 | |
8 #include <stddef.h> | |
9 | |
10 #include <cstddef> | |
11 #include <utility> | |
12 #include <vector> | |
13 | |
14 #include "components/bookmarks/browser/titled_url_node.h" | |
15 | |
16 namespace bookmarks { | |
17 | |
18 struct TitledUrlMatch { | |
sky
2016/12/01 20:24:51
Same comment here.
mattreynolds
2016/12/01 23:33:18
Done.
| |
19 // Each MatchPosition is the [begin, end) positions of a match within a | |
20 // string. | |
21 typedef std::pair<size_t, size_t> MatchPosition; | |
22 typedef std::vector<MatchPosition> MatchPositions; | |
23 | |
24 TitledUrlMatch(); | |
25 TitledUrlMatch(const TitledUrlMatch& other); | |
26 ~TitledUrlMatch(); | |
27 | |
28 // Extracts and returns the offsets from |match_positions|. | |
29 static std::vector<size_t> OffsetsFromMatchPositions( | |
30 const MatchPositions& match_positions); | |
31 | |
32 // Replaces the offsets in |match_positions| with those given in |offsets|, | |
33 // deleting any which are npos, and returns the updated list of match | |
34 // positions. | |
35 static MatchPositions ReplaceOffsetsInMatchPositions( | |
36 const MatchPositions& match_positions, | |
37 const std::vector<size_t>& offsets); | |
38 | |
39 // The matching node of a query. | |
40 const TitledUrlNode* node; | |
41 | |
42 // Location of the matching words in the title of the node. | |
43 MatchPositions title_match_positions; | |
44 | |
45 // Location of the matching words in the URL of the node. | |
46 MatchPositions url_match_positions; | |
47 }; | |
48 | |
49 } // namespace bookmarks | |
50 | |
51 #endif // COMPONENTS_BOOKMARKS_BROWSER_TITLED_URL_MATCH_H_ | |
OLD | NEW |