ICU 58.2 58.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

ubrk.h
Go to the documentation of this file.
1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 ******************************************************************************
5 * Copyright (C) 1996-2015, International Business Machines Corporation and others.
6 * All Rights Reserved.
7 ******************************************************************************
8 */
9
10 #ifndef UBRK_H
11 #define UBRK_H
12
13 #include "unicode/utypes.h"
14 #include "unicode/uloc.h"
15 #include "unicode/utext.h"
16 #include "unicode/localpointer.h"
17
22 #ifndef UBRK_TYPEDEF_UBREAK_ITERATOR
23 # define UBRK_TYPEDEF_UBREAK_ITERATOR
24
28 typedef struct UBreakIterator UBreakIterator;
29 #endif
30
31 #if !UCONFIG_NO_BREAK_ITERATION
32
33 #include "unicode/parseerr.h"
34
99 typedef enum UBreakIteratorType {
101 UBRK_CHARACTER = 0,
103 UBRK_WORD = 1,
105 UBRK_LINE = 2,
107 UBRK_SENTENCE = 3,
108
109 #ifndef U_HIDE_DEPRECATED_API
110
118 UBRK_TITLE = 4,
123 UBRK_COUNT = 5
124 #endif // U_HIDE_DEPRECATED_API
125 } UBreakIteratorType;
126
130 #define UBRK_DONE ((int32_t) -1)
131
132
144 typedef enum UWordBreak {
147 UBRK_WORD_NONE = 0,
149 UBRK_WORD_NONE_LIMIT = 100,
151 UBRK_WORD_NUMBER = 100,
153 UBRK_WORD_NUMBER_LIMIT = 200,
156 UBRK_WORD_LETTER = 200,
158 UBRK_WORD_LETTER_LIMIT = 300,
160 UBRK_WORD_KANA = 300,
162 UBRK_WORD_KANA_LIMIT = 400,
164 UBRK_WORD_IDEO = 400,
166 UBRK_WORD_IDEO_LIMIT = 500
167 } UWordBreak;
168
180 typedef enum ULineBreakTag {
183 UBRK_LINE_SOFT = 0,
185 UBRK_LINE_SOFT_LIMIT = 100,
187 UBRK_LINE_HARD = 100,
189 UBRK_LINE_HARD_LIMIT = 200
190 } ULineBreakTag;
191
192
193
205 typedef enum USentenceBreakTag {
210 UBRK_SENTENCE_TERM = 0,
212 UBRK_SENTENCE_TERM_LIMIT = 100,
217 UBRK_SENTENCE_SEP = 100,
219 UBRK_SENTENCE_SEP_LIMIT = 200
221 } USentenceBreakTag;
222
223
240 U_STABLE UBreakIterator* U_EXPORT2
241 ubrk_open(UBreakIteratorType type,
242 const char *locale,
243 const UChar *text,
244 int32_t textLength,
245 UErrorCode *status);
246
262 U_STABLE UBreakIterator* U_EXPORT2
263 ubrk_openRules(const UChar *rules,
264 int32_t rulesLength,
265 const UChar *text,
266 int32_t textLength,
267 UParseError *parseErr,
268 UErrorCode *status);
269
288 U_STABLE UBreakIterator * U_EXPORT2
289 ubrk_safeClone(
290 const UBreakIterator *bi,
291 void *stackBuffer,
292 int32_t *pBufferSize,
293 UErrorCode *status);
294
295 #ifndef U_HIDE_DEPRECATED_API
296
301 #define U_BRK_SAFECLONE_BUFFERSIZE 1
302
303 #endif /* U_HIDE_DEPRECATED_API */
304
311 U_STABLE void U_EXPORT2
312 ubrk_close(UBreakIterator *bi);
313
314 #if U_SHOW_CPLUSPLUS_API
315
316 U_NAMESPACE_BEGIN
317
327 U_DEFINE_LOCAL_OPEN_POINTER(LocalUBreakIteratorPointer, UBreakIterator, ubrk_close);
328
329 U_NAMESPACE_END
330
331 #endif
332
345 U_STABLE void U_EXPORT2
346 ubrk_setText(UBreakIterator* bi,
347 const UChar* text,
348 int32_t textLength,
349 UErrorCode* status);
350
351
369 U_STABLE void U_EXPORT2
370 ubrk_setUText(UBreakIterator* bi,
371 UText* text,
372 UErrorCode* status);
373
374
375
384 U_STABLE int32_t U_EXPORT2
385 ubrk_current(const UBreakIterator *bi);
386
396 U_STABLE int32_t U_EXPORT2
397 ubrk_next(UBreakIterator *bi);
398
408 U_STABLE int32_t U_EXPORT2
409 ubrk_previous(UBreakIterator *bi);
410
418 U_STABLE int32_t U_EXPORT2
419 ubrk_first(UBreakIterator *bi);
420
430 U_STABLE int32_t U_EXPORT2
431 ubrk_last(UBreakIterator *bi);
432
442 U_STABLE int32_t U_EXPORT2
443 ubrk_preceding(UBreakIterator *bi,
444 int32_t offset);
445
455 U_STABLE int32_t U_EXPORT2
456 ubrk_following(UBreakIterator *bi,
457 int32_t offset);
458
468 U_STABLE const char* U_EXPORT2
469 ubrk_getAvailable(int32_t index);
470
479 U_STABLE int32_t U_EXPORT2
480 ubrk_countAvailable(void);
481
482
492 U_STABLE UBool U_EXPORT2
493 ubrk_isBoundary(UBreakIterator *bi, int32_t offset);
494
504 U_STABLE int32_t U_EXPORT2
505 ubrk_getRuleStatus(UBreakIterator *bi);
506
524 U_STABLE int32_t U_EXPORT2
525 ubrk_getRuleStatusVec(UBreakIterator *bi, int32_t *fillInVec, int32_t capacity, UErrorCode *status);
526
536 U_STABLE const char* U_EXPORT2
537 ubrk_getLocaleByType(const UBreakIterator *bi, ULocDataLocaleType type, UErrorCode* status);
538
564 U_STABLE void U_EXPORT2
565 ubrk_refreshUText(UBreakIterator *bi,
566 UText *text,
567 UErrorCode *status);
568
569 #endif /* #if !UCONFIG_NO_BREAK_ITERATION */
570
571 #endif
UBreakIterator
struct UBreakIterator UBreakIterator
Opaque type representing an ICU Break iterator object.
Definition: ubrk.h:28
UBRK_SENTENCE_SEP
Tag value for for sentences that do not contain an ending sentence terminator (&#39;. ...
Definition: ubrk.h:217
ubrk_safeClone
UBreakIterator * ubrk_safeClone(const UBreakIterator *bi, void *stackBuffer, int32_t *pBufferSize, UErrorCode *status)
Thread safe cloning operation.
UBRK_WORD_KANA_LIMIT
Tag value for words containing kana characters, upper limit.
Definition: ubrk.h:162
UBRK_WORD_IDEO
Tag value for words containing ideographic characters, lower limit.
Definition: ubrk.h:164
ubrk_setUText
void ubrk_setUText(UBreakIterator *bi, UText *text, UErrorCode *status)
Sets an existing iterator to point to a new piece of text.
UBRK_WORD_LETTER_LIMIT
Tag value for words containing letters, upper limit.
Definition: ubrk.h:158
ubrk_next
int32_t ubrk_next(UBreakIterator *bi)
Advance the iterator to the boundary following the current boundary.
ubrk_refreshUText
void ubrk_refreshUText(UBreakIterator *bi, UText *text, UErrorCode *status)
Set the subject text string upon which the break iterator is operating without changing any other asp...
UBRK_LINE_HARD_LIMIT
Upper bound for hard line breaks.
Definition: ubrk.h:189
UBRK_WORD_KANA
Tag value for words containing kana characters, lower limit.
Definition: ubrk.h:160
UBRK_CHARACTER
Character breaks.
Definition: ubrk.h:101
ULineBreakTag
ULineBreakTag
Enum constants for the line break tags returned by getRuleStatus().
Definition: ubrk.h:180
UWordBreak
UWordBreak
Enum constants for the word break tags returned by getRuleStatus().
Definition: ubrk.h:144
USentenceBreakTag
USentenceBreakTag
Enum constants for the sentence break tags returned by getRuleStatus().
Definition: ubrk.h:205
UBRK_LINE_HARD
Tag value for a hard, or mandatory line break.
Definition: ubrk.h:187
UBRK_SENTENCE_TERM_LIMIT
Upper bound for tags for sentences ended by sentence terminators.
Definition: ubrk.h:212
UBreakIteratorType
UBreakIteratorType
The possible types of text boundaries.
Definition: ubrk.h:99
UBRK_SENTENCE_TERM
Tag value for for sentences ending with a sentence terminator (&#39;.
Definition: ubrk.h:210
ubrk_open
UBreakIterator * ubrk_open(UBreakIteratorType type, const char *locale, const UChar *text, int32_t textLength, UErrorCode *status)
Open a new UBreakIterator for locating text boundaries for a specified locale.
UBRK_WORD
Word breaks.
Definition: ubrk.h:103
ubrk_getRuleStatusVec
int32_t ubrk_getRuleStatusVec(UBreakIterator *bi, int32_t *fillInVec, int32_t capacity, UErrorCode *status)
Get the statuses from the break rules that determined the most recently returned break position...
ubrk_first
int32_t ubrk_first(UBreakIterator *bi)
Set the iterator position to zero, the start of the text being scanned.
ubrk_preceding
int32_t ubrk_preceding(UBreakIterator *bi, int32_t offset)
Set the iterator position to the first boundary preceding the specified offset.
utext.h
C API: Abstract Unicode Text API.
ubrk_setText
void ubrk_setText(UBreakIterator *bi, const UChar *text, int32_t textLength, UErrorCode *status)
Sets an existing iterator to point to a new piece of text.
ubrk_getAvailable
const char * ubrk_getAvailable(int32_t index)
Get a locale for which text breaking information is available.
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:131
UBRK_WORD_NONE_LIMIT
Upper bound for tags for uncategorized words.
Definition: ubrk.h:149
UBRK_COUNT
One more than the highest normal UBreakIteratorType value.
Definition: ubrk.h:123
UBRK_WORD_NUMBER_LIMIT
Tag value for words that appear to be numbers, upper limit.
Definition: ubrk.h:153
U_DEFINE_LOCAL_OPEN_POINTER
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition: localpointer.h:530
localpointer.h
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
ubrk_previous
int32_t ubrk_previous(UBreakIterator *bi)
Set the iterator position to the boundary preceding the current boundary.
UBRK_LINE_SOFT
Tag value for soft line breaks, positions at which a line break is acceptable but not required...
Definition: ubrk.h:183
LocalUBreakIteratorPointer
"Smart pointer" class, closes a UBreakIterator via ubrk_close().
UBRK_SENTENCE_SEP_LIMIT
Upper bound for tags for sentences ended by a separator.
Definition: ubrk.h:219
ubrk_openRules
UBreakIterator * ubrk_openRules(const UChar *rules, int32_t rulesLength, const UChar *text, int32_t textLength, UParseError *parseErr, UErrorCode *status)
Open a new UBreakIterator for locating text boundaries using specified breaking rules.
ubrk_countAvailable
int32_t ubrk_countAvailable(void)
Determine how many locales have text breaking information available.
ubrk_last
int32_t ubrk_last(UBreakIterator *bi)
Set the iterator position to the index immediately beyond the last character in the text being scanne...
UChar
uint16_t UChar
Define UChar to be UCHAR_TYPE, if that is #defined (for example, to char16_t), or wchar_t if that is ...
Definition: umachine.h:337
ubrk_getRuleStatus
int32_t ubrk_getRuleStatus(UBreakIterator *bi)
Return the status from the break rule that determined the most recently returned break position...
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:132
ubrk_getLocaleByType
const char * ubrk_getLocaleByType(const UBreakIterator *bi, ULocDataLocaleType type, UErrorCode *status)
Return the locale of the break iterator.
parseerr.h
C API: Parse Error Information.
ubrk_current
int32_t ubrk_current(const UBreakIterator *bi)
Determine the most recently-returned text boundary.
UBRK_WORD_NONE
Tag value for "words" that do not fit into any of other categories.
Definition: ubrk.h:147
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:396
ULocDataLocaleType
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested...
Definition: uloc.h:338
UBRK_LINE
Line breaks.
Definition: ubrk.h:105
UBRK_SENTENCE
Sentence breaks.
Definition: ubrk.h:107
UText
UText struct.
Definition: utext.h:1345
UParseError
A UParseError struct is used to returned detailed information about parsing errors.
Definition: parseerr.h:58
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
ubrk_close
void ubrk_close(UBreakIterator *bi)
Close a UBreakIterator.
UBRK_WORD_LETTER
Tag value for words that contain letters, excluding hiragana, katakana or ideographic characters...
Definition: ubrk.h:156
UBRK_WORD_NUMBER
Tag value for words that appear to be numbers, lower limit.
Definition: ubrk.h:151
UBRK_LINE_SOFT_LIMIT
Upper bound for soft line breaks.
Definition: ubrk.h:185
UBRK_TITLE
Title Case breaks The iterator created using this type locates title boundaries as described for Unic...
Definition: ubrk.h:118
ubrk_isBoundary
UBool ubrk_isBoundary(UBreakIterator *bi, int32_t offset)
Returns true if the specfied position is a boundary position.
ubrk_following
int32_t ubrk_following(UBreakIterator *bi, int32_t offset)
Advance the iterator to the first boundary following the specified offset.
U_STABLE
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:134
UBRK_WORD_IDEO_LIMIT
Tag value for words containing ideographic characters, upper limit.
Definition: ubrk.h:166
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:259
uloc.h
C API: Locale.