| 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_ |
| 11 | 11 |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
| 16 #include "third_party/icu/source/common/unicode/ubrk.h" | |
| 17 #include "third_party/icu/source/common/unicode/uscript.h" | 17 #include "third_party/icu/source/common/unicode/uscript.h" |
| 18 | 18 |
| 19 namespace base { |
| 20 namespace i18n { |
| 21 class BreakIterator; |
| 22 } // namespace i18n |
| 23 } // namespace base |
| 24 |
| 19 // A class which encapsulates language-specific operations used by | 25 // A class which encapsulates language-specific operations used by |
| 20 // SpellcheckWordIterator. When we set the spellchecker language, this class | 26 // SpellcheckWordIterator. When we set the spellchecker language, this class |
| 21 // creates rule sets that filter out the characters not supported by the | 27 // creates rule sets that filter out the characters not supported by the |
| 22 // spellchecker. (Please read the comment in the SpellcheckWordIterator class | 28 // spellchecker. (Please read the comment in the SpellcheckWordIterator class |
| 23 // about how to use this class.) | 29 // about how to use this class.) |
| 24 class SpellcheckCharAttribute { | 30 class SpellcheckCharAttribute { |
| 25 public: | 31 public: |
| 26 SpellcheckCharAttribute(); | 32 SpellcheckCharAttribute(); |
| 27 ~SpellcheckCharAttribute(); | 33 ~SpellcheckCharAttribute(); |
| 28 | 34 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // alternative characters supported by our spellchecker. This function also | 155 // alternative characters supported by our spellchecker. This function also |
| 150 // calls SpellcheckWordIterator::OutputChar() to filter out false-positive | 156 // calls SpellcheckWordIterator::OutputChar() to filter out false-positive |
| 151 // characters. | 157 // characters. |
| 152 bool Normalize(int input_start, | 158 bool Normalize(int input_start, |
| 153 int input_length, | 159 int input_length, |
| 154 base::string16* output_string) const; | 160 base::string16* output_string) const; |
| 155 | 161 |
| 156 // The pointer to the input string from which we are extracting words. | 162 // The pointer to the input string from which we are extracting words. |
| 157 const base::char16* text_; | 163 const base::char16* text_; |
| 158 | 164 |
| 159 // The length of the original string. | |
| 160 int length_; | |
| 161 | |
| 162 // The current position in the original string. | |
| 163 int position_; | |
| 164 | |
| 165 // The language-specific attributes used for filtering out non-word | 165 // The language-specific attributes used for filtering out non-word |
| 166 // characters. | 166 // characters. |
| 167 const SpellcheckCharAttribute* attribute_; | 167 const SpellcheckCharAttribute* attribute_; |
| 168 | 168 |
| 169 // The ICU break iterator. | 169 // The break iterator. |
| 170 UBreakIterator* iterator_; | 170 scoped_ptr<base::i18n::BreakIterator> iterator_; |
| 171 | 171 |
| 172 DISALLOW_COPY_AND_ASSIGN(SpellcheckWordIterator); | 172 DISALLOW_COPY_AND_ASSIGN(SpellcheckWordIterator); |
| 173 }; | 173 }; |
| 174 | 174 |
| 175 #endif // CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_WORDITERATOR_H_ | 175 #endif // CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_WORDITERATOR_H_ |
| 176 | 176 |
| OLD | NEW |