blob: 17cf5f046c0598465e065e2ad3da932c6d3d6416 [file] [log] [blame]
hyatt17b5abdb2006-12-09 05:54:29 +00001/*
hyatt17b5abdb2006-12-09 05:54:29 +00002 * Copyright (C) 2006 Lars Knoll <lars@trolltech.com>
darinb5a0e3d2007-01-10 00:08:18 +00003 * Copyright (C) 2007 Apple Inc. All rights reserved.
hyatt17b5abdb2006-12-09 05:54:29 +00004 *
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
ddkilzerc8eccec2007-09-26 02:29:57 +000017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
hyatt17b5abdb2006-12-09 05:54:29 +000019 *
20 */
darin17078f32007-01-09 14:28:47 +000021
hyatt17b5abdb2006-12-09 05:54:29 +000022#ifndef TextBreakIterator_h
23#define TextBreakIterator_h
24
darin17078f32007-01-09 14:28:47 +000025#include <wtf/unicode/Unicode.h>
hyatt17b5abdb2006-12-09 05:54:29 +000026
hyatt17b5abdb2006-12-09 05:54:29 +000027namespace WebCore {
darin17078f32007-01-09 14:28:47 +000028
hyatt17b5abdb2006-12-09 05:54:29 +000029 class TextBreakIterator;
hyatt17b5abdb2006-12-09 05:54:29 +000030
ossy@webkit.org1dbd7882011-02-24 07:03:30 +000031 // Note: The returned iterator is good only until you get another iterator.
ap@webkit.orgb1be2a72009-03-06 11:13:10 +000032
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.
darin17078f32007-01-09 14:28:47 +000037 TextBreakIterator* characterBreakIterator(const UChar*, int length);
ap@webkit.orgb1be2a72009-03-06 11:13:10 +000038
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
darin17078f32007-01-09 14:28:47 +000045 TextBreakIterator* wordBreakIterator(const UChar*, int length);
ossy@webkit.org1dbd7882011-02-24 07:03:30 +000046 TextBreakIterator* lineBreakIterator(const UChar*, int length);
sfalken11ce3bf2007-05-05 04:08:29 +000047 TextBreakIterator* sentenceBreakIterator(const UChar*, int length);
hyatt17b5abdb2006-12-09 05:54:29 +000048
49 int textBreakFirst(TextBreakIterator*);
eric@webkit.org3b23d892009-11-14 00:09:41 +000050 int textBreakLast(TextBreakIterator*);
hyatt17b5abdb2006-12-09 05:54:29 +000051 int textBreakNext(TextBreakIterator*);
eric@webkit.org3b23d892009-11-14 00:09:41 +000052 int textBreakPrevious(TextBreakIterator*);
hyatt17b5abdb2006-12-09 05:54:29 +000053 int textBreakCurrent(TextBreakIterator*);
54 int textBreakPreceding(TextBreakIterator*, int);
55 int textBreakFollowing(TextBreakIterator*, int);
aroben0d69a3a2007-02-21 05:03:02 +000056 bool isTextBreak(TextBreakIterator*, int);
darin17078f32007-01-09 14:28:47 +000057
58 const int TextBreakDone = -1;
59
hyatt17b5abdb2006-12-09 05:54:29 +000060}
darin17078f32007-01-09 14:28:47 +000061
hyatt17b5abdb2006-12-09 05:54:29 +000062#endif