| 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 // Defines an iterator class that enumerates words supported by our spellchecker | 5 // Defines an iterator class that enumerates words supported by our spellchecker |
| 6 // from multi-language text. This class is used for filtering out characters | 6 // from multi-language text. This class is used for filtering out characters |
| 7 // not supported by our spellchecker. | 7 // not supported by our spellchecker. |
| 8 | 8 |
| 9 #ifndef CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_WORDITERATOR_H_ | 9 #ifndef CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_WORDITERATOR_H_ |
| 10 #define CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_WORDITERATOR_H_ | 10 #define CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_WORDITERATOR_H_ |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // changes the input text, such as string16::replace(), we need to use | 132 // changes the input text, such as string16::replace(), we need to use |
| 133 // 'word_start' and 'word_length' as listed in the following snippet. | 133 // 'word_start' and 'word_length' as listed in the following snippet. |
| 134 // | 134 // |
| 135 // while(iterator.GetNextWord(&word, &offset, &length)) | 135 // while(iterator.GetNextWord(&word, &offset, &length)) |
| 136 // text.replace(offset, length, word); | 136 // text.replace(offset, length, word); |
| 137 // | 137 // |
| 138 bool GetNextWord(string16* word_string, | 138 bool GetNextWord(string16* word_string, |
| 139 int* word_start, | 139 int* word_start, |
| 140 int* word_length); | 140 int* word_length); |
| 141 | 141 |
| 142 // Releases all the resources attached to this object. |
| 143 void Reset(); |
| 144 |
| 142 private: | 145 private: |
| 143 // Releases all the resources attached to this object. | |
| 144 void Close(); | |
| 145 | |
| 146 // Normalizes a non-terminated string returned from an ICU word-break | 146 // Normalizes a non-terminated string returned from an ICU word-break |
| 147 // iterator. A word returned from an ICU break iterator may include characters | 147 // iterator. A word returned from an ICU break iterator may include characters |
| 148 // not supported by our spellchecker, e.g. ligatures, combining/ characters, | 148 // not supported by our spellchecker, e.g. ligatures, combining/ characters, |
| 149 // full-width letters, etc. This function replaces such characters with | 149 // full-width letters, etc. This function replaces such characters with |
| 150 // alternative characters supported by our spellchecker. This function also | 150 // alternative characters supported by our spellchecker. This function also |
| 151 // calls SpellcheckWordIterator::OutputChar() to filter out false-positive | 151 // calls SpellcheckWordIterator::OutputChar() to filter out false-positive |
| 152 // characters. | 152 // characters. |
| 153 bool Normalize(int input_start, | 153 bool Normalize(int input_start, |
| 154 int input_length, | 154 int input_length, |
| 155 string16* output_string) const; | 155 string16* output_string) const; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 168 const SpellcheckCharAttribute* attribute_; | 168 const SpellcheckCharAttribute* attribute_; |
| 169 | 169 |
| 170 // The ICU break iterator. | 170 // The ICU break iterator. |
| 171 UBreakIterator* iterator_; | 171 UBreakIterator* iterator_; |
| 172 | 172 |
| 173 DISALLOW_COPY_AND_ASSIGN(SpellcheckWordIterator); | 173 DISALLOW_COPY_AND_ASSIGN(SpellcheckWordIterator); |
| 174 }; | 174 }; |
| 175 | 175 |
| 176 #endif // CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_WORDITERATOR_H_ | 176 #endif // CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_WORDITERATOR_H_ |
| 177 | 177 |
| OLD | NEW |