| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Lars Knoll <lars@trolltech.com> | 2 * Copyright (C) 2006 Lars Knoll <lars@trolltech.com> |
| 3 * Copyright (C) 2007, 2011, 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2007, 2011, 2012 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
| 14 * | 14 * |
| 15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
| 16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
| 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
| 19 * | 19 * |
| 20 */ | 20 */ |
| 21 | 21 |
| 22 #ifndef TextBreakIterator_h | 22 #ifndef TextBreakIterator_h |
| 23 #define TextBreakIterator_h | 23 #define TextBreakIterator_h |
| 24 | 24 |
| 25 #include "wtf/text/AtomicString.h" | 25 #include "wtf/text/AtomicString.h" |
| 26 #include "wtf/unicode/Unicode.h" | 26 #include "wtf/unicode/Unicode.h" |
| 27 | 27 |
| 28 namespace WebCore { | 28 namespace WebCore { |
| 29 | 29 |
| 30 class TextBreakIterator; | 30 typedef icu::BreakIterator TextBreakIterator; |
| 31 | 31 |
| 32 // Note: The returned iterator is good only until you get another iterator, with
the exception of acquireLineBreakIterator. | 32 // Note: The returned iterator is good only until you get another iterator, with
the exception of acquireLineBreakIterator. |
| 33 | 33 |
| 34 // This is similar to character break iterator in most cases, but is subject to | 34 // This is similar to character break iterator in most cases, but is subject to |
| 35 // platform UI conventions. One notable example where this can be different | 35 // platform UI conventions. One notable example where this can be different |
| 36 // from character break iterator is Thai prepend characters, see bug 24342. | 36 // from character break iterator is Thai prepend characters, see bug 24342. |
| 37 // Use this for insertion point and selection manipulations. | 37 // Use this for insertion point and selection manipulations. |
| 38 TextBreakIterator* cursorMovementIterator(const UChar*, int length); | 38 TextBreakIterator* cursorMovementIterator(const UChar*, int length); |
| 39 | 39 |
| 40 TextBreakIterator* wordBreakIterator(const String&, int start, int length); | 40 TextBreakIterator* wordBreakIterator(const String&, int start, int length); |
| 41 TextBreakIterator* wordBreakIterator(const UChar*, int length); | 41 TextBreakIterator* wordBreakIterator(const UChar*, int length); |
| 42 TextBreakIterator* acquireLineBreakIterator(const LChar*, int length, const Atom
icString& locale, const UChar* priorContext, unsigned priorContextLength); | 42 TextBreakIterator* acquireLineBreakIterator(const LChar*, int length, const Atom
icString& locale, const UChar* priorContext, unsigned priorContextLength); |
| 43 TextBreakIterator* acquireLineBreakIterator(const UChar*, int length, const Atom
icString& locale, const UChar* priorContext, unsigned priorContextLength); | 43 TextBreakIterator* acquireLineBreakIterator(const UChar*, int length, const Atom
icString& locale, const UChar* priorContext, unsigned priorContextLength); |
| 44 void releaseLineBreakIterator(TextBreakIterator*); | 44 void releaseLineBreakIterator(TextBreakIterator*); |
| 45 TextBreakIterator* sentenceBreakIterator(const UChar*, int length); | 45 TextBreakIterator* sentenceBreakIterator(const UChar*, int length); |
| 46 | 46 |
| 47 int textBreakFirst(TextBreakIterator*); | |
| 48 int textBreakLast(TextBreakIterator*); | |
| 49 int textBreakNext(TextBreakIterator*); | |
| 50 int textBreakPrevious(TextBreakIterator*); | |
| 51 int textBreakCurrent(TextBreakIterator*); | |
| 52 int textBreakPreceding(TextBreakIterator*, int); | |
| 53 int textBreakFollowing(TextBreakIterator*, int); | |
| 54 bool isTextBreak(TextBreakIterator*, int); | |
| 55 bool isWordTextBreak(TextBreakIterator*); | 47 bool isWordTextBreak(TextBreakIterator*); |
| 56 | 48 |
| 57 const int TextBreakDone = -1; | 49 const int TextBreakDone = -1; |
| 58 | 50 |
| 59 class LazyLineBreakIterator { | 51 class LazyLineBreakIterator { |
| 60 public: | 52 public: |
| 61 LazyLineBreakIterator() | 53 LazyLineBreakIterator() |
| 62 : m_iterator(0) | 54 : m_iterator(0) |
| 63 , m_cachedPriorContext(0) | 55 , m_cachedPriorContext(0) |
| 64 , m_cachedPriorContextLength(0) | 56 , m_cachedPriorContextLength(0) |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 // of a non-combining character and following combining characters is | 225 // of a non-combining character and following combining characters is |
| 234 // counted as 1 grapheme cluster. | 226 // counted as 1 grapheme cluster. |
| 235 unsigned numGraphemeClusters(const String&); | 227 unsigned numGraphemeClusters(const String&); |
| 236 // Returns the number of characters which will be less than or equal to | 228 // Returns the number of characters which will be less than or equal to |
| 237 // the specified grapheme cluster length. | 229 // the specified grapheme cluster length. |
| 238 unsigned numCharactersInGraphemeClusters(const String&, unsigned); | 230 unsigned numCharactersInGraphemeClusters(const String&, unsigned); |
| 239 | 231 |
| 240 } | 232 } |
| 241 | 233 |
| 242 #endif | 234 #endif |
| OLD | NEW |