Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / app_list / search / tokenized_string.h
blobabc2ec2548a95e719d79e366da01e093bcc6f65b
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.
5 #ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_TOKENIZED_STRING_H_
6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_TOKENIZED_STRING_H_
8 #include <vector>
10 #include "base/basictypes.h"
11 #include "base/strings/string16.h"
12 #include "ui/gfx/range/range.h"
14 namespace app_list {
16 // TokenizedString takes a string and breaks it down into token words. It
17 // first breaks using BreakIterator to get all the words. Then it breaks
18 // the words again at camel case boundaries and alpha/number boundaries.
19 class TokenizedString {
20 public:
21 typedef std::vector<base::string16> Tokens;
22 typedef std::vector<gfx::Range> Mappings;
24 explicit TokenizedString(const base::string16& text);
25 ~TokenizedString();
27 const base::string16& text() const { return text_; }
28 const Tokens& tokens() const { return tokens_; }
29 const Mappings& mappings() const { return mappings_; }
31 private:
32 void Tokenize();
34 // Input text.
35 const base::string16 text_;
37 // Broken down tokens and the index mapping of tokens in original string.
38 Tokens tokens_;
39 Mappings mappings_;
41 DISALLOW_COPY_AND_ASSIGN(TokenizedString);
44 } // namespace app_list
46 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_TOKENIZED_STRING_H_