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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 // character in the string, and when we advance to that position it's the | 80 // character in the string, and when we advance to that position it's the |
81 // last time Advance() returns true.) | 81 // last time Advance() returns true.) |
82 bool Advance(); | 82 bool Advance(); |
83 | 83 |
84 // Under BREAK_WORD mode, returns true if the break we just hit is the | 84 // Under BREAK_WORD mode, returns true if the break we just hit is the |
85 // end of a word. (Otherwise, the break iterator just skipped over e.g. | 85 // end of a word. (Otherwise, the break iterator just skipped over e.g. |
86 // whitespace or punctuation.) Under BREAK_LINE and BREAK_NEWLINE modes, | 86 // whitespace or punctuation.) Under BREAK_LINE and BREAK_NEWLINE modes, |
87 // this distinction doesn't apply and it always retuns false. | 87 // this distinction doesn't apply and it always retuns false. |
88 bool IsWord() const; | 88 bool IsWord() const; |
89 | 89 |
90 // Returns true if |position| is a valid break. | |
91 bool IsBreak(size_t position); | |
oshima
2011/08/18 22:31:13
IsBreakAt may be?
msw
2011/08/19 10:55:30
I went with IsWordBreakAt
| |
92 | |
90 // Returns the string between prev() and pos(). | 93 // Returns the string between prev() and pos(). |
91 // Advance() must have been called successfully at least once for pos() to | 94 // Advance() must have been called successfully at least once for pos() to |
92 // have advanced to somewhere useful. | 95 // have advanced to somewhere useful. |
93 string16 GetString() const; | 96 string16 GetString() const; |
94 | 97 |
95 // Returns the value of pos() returned before Advance() was last called. | 98 // Returns the value of pos() returned before Advance() was last called. |
96 size_t prev() const { return prev_; } | 99 size_t prev() const { return prev_; } |
97 | 100 |
98 // Returns the current break position within the string, | 101 // Returns the current break position within the string, |
99 // or BreakIterator::npos when done. | 102 // or BreakIterator::npos when done. |
(...skipping 15 matching lines...) Expand all Loading... | |
115 // Previous and current iterator positions. | 118 // Previous and current iterator positions. |
116 size_t prev_, pos_; | 119 size_t prev_, pos_; |
117 | 120 |
118 DISALLOW_COPY_AND_ASSIGN(BreakIterator); | 121 DISALLOW_COPY_AND_ASSIGN(BreakIterator); |
119 }; | 122 }; |
120 | 123 |
121 } // namespace i18n | 124 } // namespace i18n |
122 } // namespace base | 125 } // namespace base |
123 | 126 |
124 #endif // BASE_I18N_BREAK_ITERATOR_H_ | 127 #endif // BASE_I18N_BREAK_ITERATOR_H_ |
OLD | NEW |