diff options
author | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-09 19:16:02 +0000 |
---|---|---|
committer | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-09 19:16:02 +0000 |
commit | 7de99596feecaa24900a082a721ef8d4f57b47ee (patch) | |
tree | bee4f2c6846d15bac3880e756edc22d6c2671182 /chrome/browser/history/query_parser.h | |
parent | 9a2e76b4ed08763e9bbecff875ad1a06a9e39f69 (diff) | |
download | chromium_src-7de99596feecaa24900a082a721ef8d4f57b47ee.zip chromium_src-7de99596feecaa24900a082a721ef8d4f57b47ee.tar.gz chromium_src-7de99596feecaa24900a082a721ef8d4f57b47ee.tar.bz2 |
Adds QueryParser::ExtractQueryWords. For consistent this should
probably be ParseQuery, but I couldn't bring myself to another
ParseQuery method. I'm going to need this for bookmark queries.
BUG=4065
TEST=none
Review URL: http://codereview.chromium.org/13296
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6604 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history/query_parser.h')
-rw-r--r-- | chrome/browser/history/query_parser.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/chrome/browser/history/query_parser.h b/chrome/browser/history/query_parser.h index d374ba4..ed7bcf2 100644 --- a/chrome/browser/history/query_parser.h +++ b/chrome/browser/history/query_parser.h @@ -48,6 +48,9 @@ class QueryNode { // giving the matching region. virtual bool HasMatchIn(const std::vector<QueryWord>& words, Snippet::MatchPositions* match_positions) const = 0; + + // Appends the words that make up this node in |words|. + virtual void AppendWords(std::vector<std::wstring>* words) const = 0; }; @@ -67,6 +70,13 @@ class QueryParser { void ParseQuery(const std::wstring& query, std::vector<QueryNode*>* nodes); + // Parses a query returning the words that make up the query. Any words in + // quotes are put in |words| without the quotes. For example, the query text + // "foo bar" results in two entries being added to words, one for foo and one + // for bar. + void ExtractQueryWords(const std::wstring& query, + std::vector<std::wstring>* words); + // Returns true if the string text matches the query nodes created by a call // to ParseQuery. If the query does match each of the matching positions in // the text is added to |match_positions|. |