OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_HISTORY_QUERY_PARSER_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_QUERY_PARSER_H_ |
6 #define CHROME_BROWSER_HISTORY_QUERY_PARSER_H_ | 6 #define CHROME_BROWSER_HISTORY_QUERY_PARSER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 | 94 |
95 // Returns true if all of the |words| match the query |nodes| created by a | 95 // Returns true if all of the |words| match the query |nodes| created by a |
96 // call to ParseQuery. | 96 // call to ParseQuery. |
97 bool DoesQueryMatch(const std::vector<QueryWord>& words, | 97 bool DoesQueryMatch(const std::vector<QueryWord>& words, |
98 const std::vector<QueryNode*>& nodes); | 98 const std::vector<QueryNode*>& nodes); |
99 | 99 |
100 // Extracts the words from |text|, placing each word into |words|. | 100 // Extracts the words from |text|, placing each word into |words|. |
101 void ExtractQueryWords(const base::string16& text, | 101 void ExtractQueryWords(const base::string16& text, |
102 std::vector<QueryWord>* words); | 102 std::vector<QueryWord>* words); |
103 | 103 |
104 // Sorts the match positions in |matches| by their first index, then | |
105 // coalesces any match positions that intersect each other. | |
106 static void CoalesceAndSortMatchPositions(Snippet::MatchPositions* matches); | |
Peter Kasting
2014/04/16 23:44:25
Nit: If it sorts and then coalesces, name it SortA
Mark P
2014/04/17 20:24:18
Done.
| |
107 | |
104 private: | 108 private: |
105 // Does the work of parsing |query|; creates nodes in |root| as appropriate. | 109 // Does the work of parsing |query|; creates nodes in |root| as appropriate. |
106 // This is invoked from both of the ParseQuery methods. | 110 // This is invoked from both of the ParseQuery methods. |
107 bool ParseQueryImpl(const base::string16& query, QueryNodeList* root); | 111 bool ParseQueryImpl(const base::string16& query, QueryNodeList* root); |
108 | 112 |
109 DISALLOW_COPY_AND_ASSIGN(QueryParser); | 113 DISALLOW_COPY_AND_ASSIGN(QueryParser); |
110 }; | 114 }; |
111 | 115 |
112 #endif // CHROME_BROWSER_HISTORY_QUERY_PARSER_H_ | 116 #endif // CHROME_BROWSER_HISTORY_QUERY_PARSER_H_ |
OLD | NEW |