ICU 62.1 62.1
ubrk.h
Go to the documentation of this file.
1// © 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"
17
22#ifndef UBRK_TYPEDEF_UBREAK_ITERATOR
23# define UBRK_TYPEDEF_UBREAK_ITERATOR
29#endif
30
31#if !UCONFIG_NO_BREAK_ITERATION
32
33#include "unicode/parseerr.h"
34
99typedef enum UBreakIteratorType {
108
109#ifndef U_HIDE_DEPRECATED_API
123 UBRK_COUNT = 5
124#endif // U_HIDE_DEPRECATED_API
126
130#define UBRK_DONE ((int32_t) -1)
131
132
168
191
192
193
222
223
241U_STABLE UBreakIterator* U_EXPORT2
243 const char *locale,
244 const UChar *text,
245 int32_t textLength,
246 UErrorCode *status);
247
263U_STABLE UBreakIterator* U_EXPORT2
265 int32_t rulesLength,
266 const UChar *text,
267 int32_t textLength,
268 UParseError *parseErr,
269 UErrorCode *status);
270
291U_STABLE UBreakIterator* U_EXPORT2
292ubrk_openBinaryRules(const uint8_t *binaryRules, int32_t rulesLength,
293 const UChar * text, int32_t textLength,
294 UErrorCode * status);
295
314U_STABLE UBreakIterator * U_EXPORT2
316 const UBreakIterator *bi,
317 void *stackBuffer,
318 int32_t *pBufferSize,
319 UErrorCode *status);
320
321#ifndef U_HIDE_DEPRECATED_API
322
327#define U_BRK_SAFECLONE_BUFFERSIZE 1
328
329#endif /* U_HIDE_DEPRECATED_API */
330
337U_STABLE void U_EXPORT2
339
340#if U_SHOW_CPLUSPLUS_API
341
343
354
356
357#endif
358
371U_STABLE void U_EXPORT2
373 const UChar* text,
374 int32_t textLength,
375 UErrorCode* status);
376
377
395U_STABLE void U_EXPORT2
397 UText* text,
398 UErrorCode* status);
399
400
401
410U_STABLE int32_t U_EXPORT2
412
422U_STABLE int32_t U_EXPORT2
424
434U_STABLE int32_t U_EXPORT2
436
444U_STABLE int32_t U_EXPORT2
446
456U_STABLE int32_t U_EXPORT2
458
468U_STABLE int32_t U_EXPORT2
470 int32_t offset);
471
481U_STABLE int32_t U_EXPORT2
483 int32_t offset);
484
494U_STABLE const char* U_EXPORT2
495ubrk_getAvailable(int32_t index);
496
505U_STABLE int32_t U_EXPORT2
507
508
518U_STABLE UBool U_EXPORT2
519ubrk_isBoundary(UBreakIterator *bi, int32_t offset);
520
530U_STABLE int32_t U_EXPORT2
532
550U_STABLE int32_t U_EXPORT2
551ubrk_getRuleStatusVec(UBreakIterator *bi, int32_t *fillInVec, int32_t capacity, UErrorCode *status);
552
562U_STABLE const char* U_EXPORT2
564
590U_STABLE void U_EXPORT2
592 UText *text,
593 UErrorCode *status);
594
595
621U_STABLE int32_t U_EXPORT2
623 uint8_t * binaryRules, int32_t rulesCapacity,
624 UErrorCode * status);
625
626#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
627
628#endif
"Smart pointer" class, closes a UBreakIterator via ubrk_close().
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
C API: Parse Error Information.
A UParseError struct is used to returned detailed information about parsing errors.
Definition parseerr.h:58
UText struct.
Definition utext.h:1345
UBreakIteratorType
The possible types of text boundaries.
Definition ubrk.h:99
@ UBRK_WORD
Word breaks.
Definition ubrk.h:103
@ UBRK_TITLE
Title Case breaks The iterator created using this type locates title boundaries as described for Unic...
Definition ubrk.h:118
@ UBRK_CHARACTER
Character breaks.
Definition ubrk.h:101
@ UBRK_COUNT
One more than the highest normal UBreakIteratorType value.
Definition ubrk.h:123
@ UBRK_LINE
Line breaks.
Definition ubrk.h:105
@ UBRK_SENTENCE
Sentence breaks.
Definition ubrk.h:107
int32_t ubrk_next(UBreakIterator *bi)
Advance the iterator to the boundary following the current boundary.
int32_t ubrk_last(UBreakIterator *bi)
Set the iterator position to the index immediately beyond the last character in the text being scanne...
int32_t ubrk_first(UBreakIterator *bi)
Set the iterator position to zero, the start of the text being scanned.
int32_t ubrk_previous(UBreakIterator *bi)
Set the iterator position to the boundary preceding the current boundary.
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.
int32_t ubrk_getRuleStatus(UBreakIterator *bi)
Return the status from the break rule that determined the most recently returned break position.
UBreakIterator * ubrk_openBinaryRules(const uint8_t *binaryRules, int32_t rulesLength, const UChar *text, int32_t textLength, UErrorCode *status)
Open a new UBreakIterator for locating text boundaries using precompiled binary rules.
int32_t ubrk_following(UBreakIterator *bi, int32_t offset)
Advance the iterator to the first boundary following the specified offset.
int32_t ubrk_current(const UBreakIterator *bi)
Determine the most recently-returned text boundary.
void ubrk_close(UBreakIterator *bi)
Close a UBreakIterator.
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.
UBool ubrk_isBoundary(UBreakIterator *bi, int32_t offset)
Returns true if the specified position is a boundary position.
const char * ubrk_getAvailable(int32_t index)
Get a locale for which text breaking information is available.
int32_t ubrk_getBinaryRules(UBreakIterator *bi, uint8_t *binaryRules, int32_t rulesCapacity, UErrorCode *status)
Get a compiled binary version of the rules specifying the behavior of a UBreakIterator.
int32_t ubrk_countAvailable(void)
Determine how many locales have text breaking information available.
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.
ULineBreakTag
Enum constants for the line break tags returned by getRuleStatus().
Definition ubrk.h:180
@ UBRK_LINE_SOFT
Tag value for soft line breaks, positions at which a line break is acceptable but not required
Definition ubrk.h:183
@ UBRK_LINE_HARD
Tag value for a hard, or mandatory line break
Definition ubrk.h:187
@ UBRK_LINE_HARD_LIMIT
Upper bound for hard line breaks.
Definition ubrk.h:189
@ UBRK_LINE_SOFT_LIMIT
Upper bound for soft line breaks.
Definition ubrk.h:185
const char * ubrk_getLocaleByType(const UBreakIterator *bi, ULocDataLocaleType type, UErrorCode *status)
Return the locale of the break iterator.
void ubrk_setUText(UBreakIterator *bi, UText *text, UErrorCode *status)
Sets an existing iterator to point to a new piece of text.
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...
int32_t ubrk_preceding(UBreakIterator *bi, int32_t offset)
Set the iterator position to the first boundary preceding the specified offset.
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.
USentenceBreakTag
Enum constants for the sentence break tags returned by getRuleStatus().
Definition ubrk.h:205
@ UBRK_SENTENCE_TERM_LIMIT
Upper bound for tags for sentences ended by sentence terminators.
Definition ubrk.h:212
@ UBRK_SENTENCE_SEP
Tag value for for sentences that do not contain an ending sentence terminator ('.
Definition ubrk.h:217
@ UBRK_SENTENCE_TERM
Tag value for for sentences ending with a sentence terminator ('.
Definition ubrk.h:210
@ UBRK_SENTENCE_SEP_LIMIT
Upper bound for tags for sentences ended by a separator.
Definition ubrk.h:219
UBreakIterator * ubrk_safeClone(const UBreakIterator *bi, void *stackBuffer, int32_t *pBufferSize, UErrorCode *status)
Thread safe cloning operation.
struct UBreakIterator UBreakIterator
Opaque type representing an ICU Break iterator object.
Definition ubrk.h:28
UWordBreak
Enum constants for the word break tags returned by getRuleStatus().
Definition ubrk.h:144
@ UBRK_WORD_IDEO
Tag value for words containing ideographic characters, lower limit.
Definition ubrk.h:164
@ UBRK_WORD_NUMBER
Tag value for words that appear to be numbers, lower limit.
Definition ubrk.h:151
@ UBRK_WORD_NONE_LIMIT
Upper bound for tags for uncategorized words.
Definition ubrk.h:149
@ UBRK_WORD_LETTER_LIMIT
Tag value for words containing letters, upper limit
Definition ubrk.h:158
@ UBRK_WORD_KANA
Tag value for words containing kana characters, lower limit.
Definition ubrk.h:160
@ UBRK_WORD_KANA_LIMIT
Tag value for words containing kana characters, upper limit.
Definition ubrk.h:162
@ UBRK_WORD_IDEO_LIMIT
Tag value for words containing ideographic characters, upper limit.
Definition ubrk.h:166
@ UBRK_WORD_NONE
Tag value for "words" that do not fit into any of other categories.
Definition ubrk.h:147
@ UBRK_WORD_NUMBER_LIMIT
Tag value for words that appear to be numbers, upper limit.
Definition ubrk.h:153
@ UBRK_WORD_LETTER
Tag value for words that contain letters, excluding hiragana, katakana or ideographic characters,...
Definition ubrk.h:156
C API: Locale.
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested,...
Definition uloc.h:338
int8_t UBool
The ICU boolean type.
Definition umachine.h:236
uint16_t UChar
The base type for UTF-16 code units and pointers.
Definition umachine.h:353
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition umachine.h:111
C API: Abstract Unicode Text API.
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
Definition utypes.h:396
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition uversion.h:138
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition uversion.h:137