• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2006 Lars Knoll <lars@trolltech.com>
3  * Copyright (C) 2007 Apple Inc. All rights reserved.
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
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  *
20  */
21 
22 #ifndef TextBreakIterator_h
23 #define TextBreakIterator_h
24 
25 #include <wtf/unicode/Unicode.h>
26 
27 namespace WebCore {
28 
29     class TextBreakIterator;
30 
31     // Note: The returned iterator is good only until you get another iterator.
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.
37     TextBreakIterator* characterBreakIterator(const UChar*, int length);
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 
45     TextBreakIterator* wordBreakIterator(const UChar*, int length);
46     TextBreakIterator* lineBreakIterator(const UChar*, int length);
47     TextBreakIterator* sentenceBreakIterator(const UChar*, int length);
48 
49     int textBreakFirst(TextBreakIterator*);
50     int textBreakNext(TextBreakIterator*);
51     int textBreakCurrent(TextBreakIterator*);
52     int textBreakPreceding(TextBreakIterator*, int);
53     int textBreakFollowing(TextBreakIterator*, int);
54     bool isTextBreak(TextBreakIterator*, int);
55 
56     const int TextBreakDone = -1;
57 
58 }
59 
60 #endif
61