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 BASE_I18N_BREAK_ITERATOR_H_ | 5 #ifndef BASE_I18N_BREAK_ITERATOR_H_ |
6 #define BASE_I18N_BREAK_ITERATOR_H_ | 6 #define BASE_I18N_BREAK_ITERATOR_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/i18n/base_i18n_export.h" | 9 #include "base/i18n/base_i18n_export.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // whitespace or punctuation.) Under BREAK_LINE and BREAK_NEWLINE modes, | 99 // whitespace or punctuation.) Under BREAK_LINE and BREAK_NEWLINE modes, |
100 // this distinction doesn't apply and it always returns false. | 100 // this distinction doesn't apply and it always returns false. |
101 bool IsWord() const; | 101 bool IsWord() const; |
102 | 102 |
103 // Under BREAK_WORD mode, returns true if |position| is at the end of word or | 103 // Under BREAK_WORD mode, returns true if |position| is at the end of word or |
104 // at the start of word. It always returns false under BREAK_LINE and | 104 // at the start of word. It always returns false under BREAK_LINE and |
105 // BREAK_NEWLINE modes. | 105 // BREAK_NEWLINE modes. |
106 bool IsEndOfWord(size_t position) const; | 106 bool IsEndOfWord(size_t position) const; |
107 bool IsStartOfWord(size_t position) const; | 107 bool IsStartOfWord(size_t position) const; |
108 | 108 |
| 109 // Under BREAK_CHARACTER mode, returns whether |position| is a Unicode |
| 110 // grapheme boundary. |
| 111 bool IsGraphemeBoundary(size_t position) const; |
| 112 |
109 // Returns the string between prev() and pos(). | 113 // Returns the string between prev() and pos(). |
110 // Advance() must have been called successfully at least once for pos() to | 114 // Advance() must have been called successfully at least once for pos() to |
111 // have advanced to somewhere useful. | 115 // have advanced to somewhere useful. |
112 string16 GetString() const; | 116 string16 GetString() const; |
113 | 117 |
114 // Returns the value of pos() returned before Advance() was last called. | 118 // Returns the value of pos() returned before Advance() was last called. |
115 size_t prev() const { return prev_; } | 119 size_t prev() const { return prev_; } |
116 | 120 |
117 // Returns the current break position within the string, | 121 // Returns the current break position within the string, |
118 // or BreakIterator::npos when done. | 122 // or BreakIterator::npos when done. |
(...skipping 18 matching lines...) Expand all Loading... |
137 // Previous and current iterator positions. | 141 // Previous and current iterator positions. |
138 size_t prev_, pos_; | 142 size_t prev_, pos_; |
139 | 143 |
140 DISALLOW_COPY_AND_ASSIGN(BreakIterator); | 144 DISALLOW_COPY_AND_ASSIGN(BreakIterator); |
141 }; | 145 }; |
142 | 146 |
143 } // namespace i18n | 147 } // namespace i18n |
144 } // namespace base | 148 } // namespace base |
145 | 149 |
146 #endif // BASE_I18N_BREAK_ITERATOR_H_ | 150 #endif // BASE_I18N_BREAK_ITERATOR_H_ |
OLD | NEW |