Imported Upstream version 0.9.3
[platform/upstream/libunistring.git] / doc / uniwbrk.texi
1 @node uniwbrk.h
2 @chapter Word breaks in strings @code{<uniwbrk.h>}
3
4 @cindex word breaks
5 @cindex breaks, word
6 This include file declares functions for determining where in a string
7 ``words'' start and end.  Here ``words'' are not necessarily the same as
8 entities that can be looked up in dictionaries, but rather groups of
9 consecutive characters that should not be split by text processing
10 operations.
11
12 @menu
13 * Word breaks in a string::
14 * Word break property::
15 @end menu
16
17 @node Word breaks in a string
18 @section Word breaks in a string
19
20 The following functions determine the word breaks in a string.
21
22 @deftypefun void u8_wordbreaks (const uint8_t *@var{s}, size_t @var{n}, char *@var{p})
23 @deftypefunx void u16_wordbreaks (const uint16_t *@var{s}, size_t @var{n}, char *@var{p})
24 @deftypefunx void u32_wordbreaks (const uint32_t *@var{s}, size_t @var{n}, char *@var{p})
25 @deftypefunx void ulc_wordbreaks (const char *@var{s}, size_t @var{n}, char *@var{p})
26 Determines the word break points in @var{s}, an array of @var{n} units, and
27 stores the result at @code{@var{p}[0..@var{n}-1]}.
28 @table @asis
29 @item @code{@var{p}[i] = 1}
30 means that there is a word boundary between @code{@var{s}[i-1]} and
31 @code{@var{s}[i]}.
32 @item @code{@var{p}[i] = 0}
33 means that @code{@var{s}[i-1]} and @code{@var{s}[i]} must not be separated.
34 @end table
35 @code{@var{p}[0]} is always set to 0.  If an application wants to consider a
36 word break to be present at the beginning of the string (before
37 @code{@var{s}[0]}) or at the end of the string (after
38 @code{@var{s}[0..@var{n}-1]}), it has to treat these cases explicitly.
39 @end deftypefun
40
41 @node Word break property
42 @section Word break property
43
44 This is a more low-level API.  The word break property is a property defined
45 in Unicode Standard Annex #29, section ``Word Boundaries'', see
46 @url{http://www.unicode.org/reports/tr29/#Word_Boundaries}.@texnl{}  It is
47 used for determining the word breaks in a string.
48
49 The following are the possible values of the word break property.  More values
50 may be added in the future.
51
52 @deftypevr Constant int WBP_OTHER
53 @deftypevrx Constant int WBP_CR
54 @deftypevrx Constant int WBP_LF
55 @deftypevrx Constant int WBP_NEWLINE
56 @deftypevrx Constant int WBP_EXTEND
57 @deftypevrx Constant int WBP_FORMAT
58 @deftypevrx Constant int WBP_KATAKANA
59 @deftypevrx Constant int WBP_ALETTER
60 @deftypevrx Constant int WBP_MIDNUMLET
61 @deftypevrx Constant int WBP_MIDLETTER
62 @deftypevrx Constant int WBP_MIDNUM
63 @deftypevrx Constant int WBP_NUMERIC
64 @deftypevrx Constant int WBP_EXTENDNUMLET
65 @end deftypevr
66
67 The following function looks up the word break property of a character.
68
69 @deftypefun int uc_wordbreak_property (ucs4_t @var{uc})
70 Returns the Word_Break property of a Unicode character.
71 @end deftypefun