| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_UI_APP_LIST_SEARCH_TOKENIZED_STRING_H_ | 5 #ifndef UI_APP_LIST_SEARCH_TOKENIZED_STRING_H_ |
| 6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_TOKENIZED_STRING_H_ | 6 #define UI_APP_LIST_SEARCH_TOKENIZED_STRING_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "ui/app_list/app_list_export.h" |
| 12 #include "ui/gfx/range/range.h" | 13 #include "ui/gfx/range/range.h" |
| 13 | 14 |
| 14 namespace app_list { | 15 namespace app_list { |
| 15 | 16 |
| 16 // TokenizedString takes a string and breaks it down into token words. It | 17 // 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 // 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 // the words again at camel case boundaries and alpha/number boundaries. |
| 19 class TokenizedString { | 20 class APP_LIST_EXPORT TokenizedString { |
| 20 public: | 21 public: |
| 21 typedef std::vector<base::string16> Tokens; | 22 typedef std::vector<base::string16> Tokens; |
| 22 typedef std::vector<gfx::Range> Mappings; | 23 typedef std::vector<gfx::Range> Mappings; |
| 23 | 24 |
| 24 explicit TokenizedString(const base::string16& text); | 25 explicit TokenizedString(const base::string16& text); |
| 25 ~TokenizedString(); | 26 ~TokenizedString(); |
| 26 | 27 |
| 27 const base::string16& text() const { return text_; } | 28 const base::string16& text() const { return text_; } |
| 28 const Tokens& tokens() const { return tokens_; } | 29 const Tokens& tokens() const { return tokens_; } |
| 29 const Mappings& mappings() const { return mappings_; } | 30 const Mappings& mappings() const { return mappings_; } |
| 30 | 31 |
| 31 private: | 32 private: |
| 32 void Tokenize(); | 33 void Tokenize(); |
| 33 | 34 |
| 34 // Input text. | 35 // Input text. |
| 35 const base::string16 text_; | 36 const base::string16 text_; |
| 36 | 37 |
| 37 // Broken down tokens and the index mapping of tokens in original string. | 38 // Broken down tokens and the index mapping of tokens in original string. |
| 38 Tokens tokens_; | 39 Tokens tokens_; |
| 39 Mappings mappings_; | 40 Mappings mappings_; |
| 40 | 41 |
| 41 DISALLOW_COPY_AND_ASSIGN(TokenizedString); | 42 DISALLOW_COPY_AND_ASSIGN(TokenizedString); |
| 42 }; | 43 }; |
| 43 | 44 |
| 44 } // namespace app_list | 45 } // namespace app_list |
| 45 | 46 |
| 46 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_TOKENIZED_STRING_H_ | 47 #endif // UI_APP_LIST_SEARCH_TOKENIZED_STRING_H_ |
| OLD | NEW |