Chromium Code Reviews| Index: chrome/renderer/spellchecker/spellcheck_worditerator.h |
| diff --git a/chrome/renderer/spellchecker/spellcheck_worditerator.h b/chrome/renderer/spellchecker/spellcheck_worditerator.h |
| index 6b6a2f4eac20bc1884c79a2ce1a99aa604aaa09f..728e2a13c1e70a8651904b7ad31c6fdec6e5963e 100644 |
| --- a/chrome/renderer/spellchecker/spellcheck_worditerator.h |
| +++ b/chrome/renderer/spellchecker/spellcheck_worditerator.h |
| @@ -112,6 +112,17 @@ class SpellcheckCharAttribute { |
| // |
| class SpellcheckWordIterator { |
| public: |
| + enum WordIteratorStatus { |
| + // The end of a sequence of text that the iterator recognizes as characters |
| + // that can form a word. |
| + IS_WORD, |
| + // Non-word characters that the iterator can skip past, such as punctuation, |
| + // whitespace, and characters from another character set. |
| + IS_SKIPPABLE_CHAR, |
|
please use gerrit instead
2015/08/11 22:54:10
IS_SKIPPABLE
Putting "_CHAR" in there might confu
Julius
2015/08/12 20:25:59
Done.
|
| + // The end of the text that the iterator is going over. |
| + IS_END_OF_TEXT |
| + }; |
| + |
| SpellcheckWordIterator(); |
| ~SpellcheckWordIterator(); |
| @@ -130,19 +141,20 @@ class SpellcheckWordIterator { |
| // without calling Initialize(). |
| bool SetText(const base::char16* text, size_t length); |
| - // Retrieves a word (or a contraction), stores its copy to 'word_string', and |
| - // stores the position and the length for input word to 'word_start'. Since |
| - // this function normalizes the output word, the length of 'word_string' may |
| - // be different from the 'word_length'. Therefore, when we call functions that |
| - // changes the input text, such as string16::replace(), we need to use |
| - // 'word_start' and 'word_length' as listed in the following snippet. |
| - // |
| - // while(iterator.GetNextWord(&word, &offset, &length)) |
|
please use gerrit instead
2015/08/11 22:54:10
Keep this example in the comment please.
Julius
2015/08/12 20:25:59
Done.
|
| - // text.replace(offset, length, word); |
| - // |
| - bool GetNextWord(base::string16* word_string, |
| - int* word_start, |
| - int* word_length); |
| + // Advances |iterator_| through |text_| and gets the current status of the |
| + // word iterator within the |text|: |
| + // - Returns IS_WORD if the iterator just found the end of a sequence of word |
|
please use gerrit instead
2015/08/11 22:54:10
Put a newline before a bullet point to make the co
Julius
2015/08/12 20:25:59
Done.
|
| + // characters and it was able to normalize the sequence. This stores the |
| + // normalized string into |word_string| and stores the position and length |
| + // into |word_start| and |word_length| respectively. Keep in mind that |
| + // since this function normalizes the output word, the length of |
| + // |word_string| may be different from the |word_length|. |
| + // - Returns IS_SKIPPABLE_CHAR if the iterator just found a character that |
| + // the iterator can skip past such as punctuation, whitespace, and |
| + // characters from another character set. |
| + // - Returns IS_END_OF_TEXT if the iterator has reached the end of |text_|. |
| + SpellcheckWordIterator::WordIteratorStatus |
| + GetNextWord(base::string16* word_string, int* word_start, int* word_length); |
| // Releases all the resources attached to this object. |
| void Reset(); |