Chromium Code Reviews| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 // character in the string, and when we advance to that position it's the | 81 // character in the string, and when we advance to that position it's the |
| 82 // last time Advance() returns true.) | 82 // last time Advance() returns true.) |
| 83 bool Advance(); | 83 bool Advance(); |
| 84 | 84 |
| 85 // Under BREAK_WORD mode, returns true if the break we just hit is the | 85 // Under BREAK_WORD mode, returns true if the break we just hit is the |
| 86 // end of a word. (Otherwise, the break iterator just skipped over e.g. | 86 // end of a word. (Otherwise, the break iterator just skipped over e.g. |
| 87 // whitespace or punctuation.) Under BREAK_LINE and BREAK_NEWLINE modes, | 87 // whitespace or punctuation.) Under BREAK_LINE and BREAK_NEWLINE modes, |
| 88 // this distinction doesn't apply and it always retuns false. | 88 // this distinction doesn't apply and it always retuns false. |
| 89 bool IsWord() const; | 89 bool IsWord() const; |
| 90 | 90 |
| 91 // Under BREAK_WORD mode, returns true if |position| is at the end of word or | |
|
msw
2011/09/15 01:26:00
Same as your http://codereview.chromium.org/784105
xji
2011/09/15 22:58:09
before commit, both of them need those 2 files. th
| |
| 92 // at the start of word. It always retuns false Under BREAK_LINE and | |
| 93 // BREAK_NEWLINE modes. | |
| 94 bool IsEndOfWord(size_t position) const; | |
| 95 bool IsStartOfWord(size_t position) const; | |
| 96 | |
| 91 // Returns the string between prev() and pos(). | 97 // Returns the string between prev() and pos(). |
| 92 // Advance() must have been called successfully at least once for pos() to | 98 // Advance() must have been called successfully at least once for pos() to |
| 93 // have advanced to somewhere useful. | 99 // have advanced to somewhere useful. |
| 94 string16 GetString() const; | 100 string16 GetString() const; |
| 95 | 101 |
| 96 // Returns the value of pos() returned before Advance() was last called. | 102 // Returns the value of pos() returned before Advance() was last called. |
| 97 size_t prev() const { return prev_; } | 103 size_t prev() const { return prev_; } |
| 98 | 104 |
| 99 // Returns the current break position within the string, | 105 // Returns the current break position within the string, |
| 100 // or BreakIterator::npos when done. | 106 // or BreakIterator::npos when done. |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 116 // Previous and current iterator positions. | 122 // Previous and current iterator positions. |
| 117 size_t prev_, pos_; | 123 size_t prev_, pos_; |
| 118 | 124 |
| 119 DISALLOW_COPY_AND_ASSIGN(BreakIterator); | 125 DISALLOW_COPY_AND_ASSIGN(BreakIterator); |
| 120 }; | 126 }; |
| 121 | 127 |
| 122 } // namespace i18n | 128 } // namespace i18n |
| 123 } // namespace base | 129 } // namespace base |
| 124 | 130 |
| 125 #endif // BASE_I18N_BREAK_ITERATOR_H_ | 131 #endif // BASE_I18N_BREAK_ITERATOR_H_ |
| OLD | NEW |