tizen 2.4 release
[external/libunistring.git] / lib / unilbrk.h
1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 /* Line breaking of Unicode strings.
3    Copyright (C) 2001-2003, 2005-2014 Free Software Foundation, Inc.
4    Written by Bruno Haible <bruno@clisp.org>, 2001.
5
6    This program is free software: you can redistribute it and/or modify it
7    under the terms of the GNU Lesser General Public License as published
8    by the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
15
16    You should have received a copy of the GNU Lesser General Public License
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
18
19 #ifndef _UNILBRK_H
20 #define _UNILBRK_H
21
22 /* Get size_t.  */
23 #include <stddef.h>
24
25 #include "unitypes.h"
26
27 /* Get locale_charset() declaration.  */
28 #include <unistring/localcharset.h>
29
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35
36 /* These functions are locale dependent.  The encoding argument identifies
37    the encoding (e.g. "ISO-8859-2" for Polish).  */
38
39
40 /* Line breaking.  */
41
42 enum
43 {
44   UC_BREAK_UNDEFINED,
45   UC_BREAK_PROHIBITED,
46   UC_BREAK_POSSIBLE,
47   UC_BREAK_MANDATORY,
48   UC_BREAK_HYPHENATION
49 };
50
51 /* Determine the line break points in S, and store the result at p[0..n-1].
52    p[i] = UC_BREAK_MANDATORY means that s[i] is a line break character.
53    p[i] = UC_BREAK_POSSIBLE means that a line break may be inserted between
54           s[i-1] and s[i].
55    p[i] = UC_BREAK_HYPHENATION means that a hyphen and a line break may be
56           inserted between s[i-1] and s[i].  But beware of language dependent
57           hyphenation rules.
58    p[i] = UC_BREAK_PROHIBITED means that s[i-1] and s[i] must not be separated.
59  */
60 extern void
61        u8_possible_linebreaks (const uint8_t *s, size_t n,
62                                const char *encoding, char *p);
63 extern void
64        u16_possible_linebreaks (const uint16_t *s, size_t n,
65                                 const char *encoding, char *p);
66 extern void
67        u32_possible_linebreaks (const uint32_t *s, size_t n,
68                                 const char *encoding, char *p);
69 extern void
70        ulc_possible_linebreaks (const char *s, size_t n,
71                                 const char *encoding, char *p);
72
73 /* Choose the best line breaks, assuming the uc_width function.
74    The string is s[0..n-1].  The maximum number of columns per line is given
75    as WIDTH.  The starting column of the string is given as START_COLUMN.
76    If the algorithm shall keep room after the last piece, they can be given
77    as AT_END_COLUMNS.
78    o is an optional override; if o[i] != UC_BREAK_UNDEFINED, o[i] takes
79    precedence over p[i] as returned by the *_possible_linebreaks function.
80    The given ENCODING is used for disambiguating widths in uc_width.
81    Return the column after the end of the string, and store the result at
82    p[0..n-1].
83  */
84 extern int
85        u8_width_linebreaks (const uint8_t *s, size_t n, int width,
86                             int start_column, int at_end_columns,
87                             const char *o, const char *encoding,
88                             char *p);
89 extern int
90        u16_width_linebreaks (const uint16_t *s, size_t n, int width,
91                              int start_column, int at_end_columns,
92                              const char *o, const char *encoding,
93                              char *p);
94 extern int
95        u32_width_linebreaks (const uint32_t *s, size_t n, int width,
96                              int start_column, int at_end_columns,
97                              const char *o, const char *encoding,
98                              char *p);
99 extern int
100        ulc_width_linebreaks (const char *s, size_t n, int width,
101                              int start_column, int at_end_columns,
102                              const char *o, const char *encoding,
103                              char *p);
104
105
106 #ifdef __cplusplus
107 }
108 #endif
109
110
111 #endif /* _UNILBRK_H */