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_TERM_BREAK_ITERATOR_H_ | 5 #ifndef UI_APP_LIST_SEARCH_TERM_BREAK_ITERATOR_H_ |
6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_TERM_BREAK_ITERATOR_H_ | 6 #define UI_APP_LIST_SEARCH_TERM_BREAK_ITERATOR_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "ui/app_list/app_list_export.h" |
11 | 12 |
12 namespace base { | 13 namespace base { |
13 namespace i18n { | 14 namespace i18n { |
14 class UTF16CharIterator; | 15 class UTF16CharIterator; |
15 } | 16 } |
16 } | 17 } |
17 | 18 |
18 namespace app_list { | 19 namespace app_list { |
19 | 20 |
20 // TermBreakIterator breaks terms out of a word. Terms are broken on | 21 // TermBreakIterator breaks terms out of a word. Terms are broken on |
21 // camel case boundaries and alpha/number boundaries. Numbers are defined | 22 // camel case boundaries and alpha/number boundaries. Numbers are defined |
22 // as [0-9\.,]+. | 23 // as [0-9\.,]+. |
23 // e.g. | 24 // e.g. |
24 // CamelCase -> Camel, Case | 25 // CamelCase -> Camel, Case |
25 // Python2.7 -> Python, 2.7 | 26 // Python2.7 -> Python, 2.7 |
26 class TermBreakIterator { | 27 class APP_LIST_EXPORT TermBreakIterator { |
27 public: | 28 public: |
28 // Note that |word| must out live this iterator. | 29 // Note that |word| must out live this iterator. |
29 explicit TermBreakIterator(const base::string16& word); | 30 explicit TermBreakIterator(const base::string16& word); |
30 ~TermBreakIterator(); | 31 ~TermBreakIterator(); |
31 | 32 |
32 // Advance to the next term. Returns false if at the end of the word. | 33 // Advance to the next term. Returns false if at the end of the word. |
33 bool Advance(); | 34 bool Advance(); |
34 | 35 |
35 // Returns the current term, which is the substr of |word_| in range | 36 // Returns the current term, which is the substr of |word_| in range |
36 // [prev_, pos_). | 37 // [prev_, pos_). |
(...skipping 22 matching lines...) Expand all Loading... |
59 size_t pos_; | 60 size_t pos_; |
60 | 61 |
61 scoped_ptr<base::i18n::UTF16CharIterator> iter_; | 62 scoped_ptr<base::i18n::UTF16CharIterator> iter_; |
62 State state_; | 63 State state_; |
63 | 64 |
64 DISALLOW_COPY_AND_ASSIGN(TermBreakIterator); | 65 DISALLOW_COPY_AND_ASSIGN(TermBreakIterator); |
65 }; | 66 }; |
66 | 67 |
67 } // namespace app_list | 68 } // namespace app_list |
68 | 69 |
69 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_TERM_BREAK_ITERATOR_H_ | 70 #endif // UI_APP_LIST_SEARCH_TERM_BREAK_ITERATOR_H_ |
OLD | NEW |