hyatt | 17b5abdb | 2006-12-09 05:54:29 +0000 | [diff] [blame] | 1 | /* |
hyatt | 17b5abdb | 2006-12-09 05:54:29 +0000 | [diff] [blame] | 2 | * Copyright (C) 2006 Lars Knoll <lars@trolltech.com> |
darin | b5a0e3d | 2007-01-10 00:08:18 +0000 | [diff] [blame] | 3 | * Copyright (C) 2007 Apple Inc. All rights reserved. |
hyatt | 17b5abdb | 2006-12-09 05:54:29 +0000 | [diff] [blame] | 4 | * |
| 5 | * This library is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Library General Public |
| 7 | * License as published by the Free Software Foundation; either |
| 8 | * version 2 of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This library is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * Library General Public License for more details. |
| 14 | * |
| 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 |
ddkilzer | c8eccec | 2007-09-26 02:29:57 +0000 | [diff] [blame] | 17 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 | * Boston, MA 02110-1301, USA. |
hyatt | 17b5abdb | 2006-12-09 05:54:29 +0000 | [diff] [blame] | 19 | * |
| 20 | */ |
darin | 17078f3 | 2007-01-09 14:28:47 +0000 | [diff] [blame] | 21 | |
hyatt | 17b5abdb | 2006-12-09 05:54:29 +0000 | [diff] [blame] | 22 | #ifndef TextBreakIterator_h |
| 23 | #define TextBreakIterator_h |
| 24 | |
darin | 17078f3 | 2007-01-09 14:28:47 +0000 | [diff] [blame] | 25 | #include <wtf/unicode/Unicode.h> |
hyatt | 17b5abdb | 2006-12-09 05:54:29 +0000 | [diff] [blame] | 26 | |
hyatt | 17b5abdb | 2006-12-09 05:54:29 +0000 | [diff] [blame] | 27 | namespace WebCore { |
darin | 17078f3 | 2007-01-09 14:28:47 +0000 | [diff] [blame] | 28 | |
hyatt | 17b5abdb | 2006-12-09 05:54:29 +0000 | [diff] [blame] | 29 | class TextBreakIterator; |
hyatt | 17b5abdb | 2006-12-09 05:54:29 +0000 | [diff] [blame] | 30 | |
ossy@webkit.org | 1dbd788 | 2011-02-24 07:03:30 +0000 | [diff] [blame] | 31 | // Note: The returned iterator is good only until you get another iterator. |
ap@webkit.org | b1be2a7 | 2009-03-06 11:13:10 +0000 | [diff] [blame] | 32 | |
| 33 | // Iterates over "extended grapheme clusters", as defined in UAX #29. |
| 34 | // Note that platform implementations may be less sophisticated - e.g. ICU prior to |
| 35 | // version 4.0 only supports "legacy grapheme clusters". |
| 36 | // Use this for general text processing, e.g. string truncation. |
darin | 17078f3 | 2007-01-09 14:28:47 +0000 | [diff] [blame] | 37 | TextBreakIterator* characterBreakIterator(const UChar*, int length); |
ap@webkit.org | b1be2a7 | 2009-03-06 11:13:10 +0000 | [diff] [blame] | 38 | |
| 39 | // This is similar to character break iterator in most cases, but is subject to |
| 40 | // platform UI conventions. One notable example where this can be different |
| 41 | // from character break iterator is Thai prepend characters, see bug 24342. |
| 42 | // Use this for insertion point and selection manipulations. |
| 43 | TextBreakIterator* cursorMovementIterator(const UChar*, int length); |
| 44 | |
darin | 17078f3 | 2007-01-09 14:28:47 +0000 | [diff] [blame] | 45 | TextBreakIterator* wordBreakIterator(const UChar*, int length); |
ossy@webkit.org | 1dbd788 | 2011-02-24 07:03:30 +0000 | [diff] [blame] | 46 | TextBreakIterator* lineBreakIterator(const UChar*, int length); |
sfalken | 11ce3bf | 2007-05-05 04:08:29 +0000 | [diff] [blame] | 47 | TextBreakIterator* sentenceBreakIterator(const UChar*, int length); |
hyatt | 17b5abdb | 2006-12-09 05:54:29 +0000 | [diff] [blame] | 48 | |
| 49 | int textBreakFirst(TextBreakIterator*); |
eric@webkit.org | 3b23d89 | 2009-11-14 00:09:41 +0000 | [diff] [blame] | 50 | int textBreakLast(TextBreakIterator*); |
hyatt | 17b5abdb | 2006-12-09 05:54:29 +0000 | [diff] [blame] | 51 | int textBreakNext(TextBreakIterator*); |
eric@webkit.org | 3b23d89 | 2009-11-14 00:09:41 +0000 | [diff] [blame] | 52 | int textBreakPrevious(TextBreakIterator*); |
hyatt | 17b5abdb | 2006-12-09 05:54:29 +0000 | [diff] [blame] | 53 | int textBreakCurrent(TextBreakIterator*); |
| 54 | int textBreakPreceding(TextBreakIterator*, int); |
| 55 | int textBreakFollowing(TextBreakIterator*, int); |
aroben | 0d69a3a | 2007-02-21 05:03:02 +0000 | [diff] [blame] | 56 | bool isTextBreak(TextBreakIterator*, int); |
darin | 17078f3 | 2007-01-09 14:28:47 +0000 | [diff] [blame] | 57 | |
| 58 | const int TextBreakDone = -1; |
| 59 | |
hyatt | 17b5abdb | 2006-12-09 05:54:29 +0000 | [diff] [blame] | 60 | } |
darin | 17078f3 | 2007-01-09 14:28:47 +0000 | [diff] [blame] | 61 | |
hyatt | 17b5abdb | 2006-12-09 05:54:29 +0000 | [diff] [blame] | 62 | #endif |