00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef UBRK_H
00011 #define UBRK_H
00012
00013 #include "unicode/utypes.h"
00014 #include "unicode/uloc.h"
00015 #include "unicode/utext.h"
00016
00017 #if U_SHOW_CPLUSPLUS_API
00018 #include "unicode/localpointer.h"
00019 #endif // U_SHOW_CPLUSPLUS_API
00020
00025 #ifndef UBRK_TYPEDEF_UBREAK_ITERATOR
00026 # define UBRK_TYPEDEF_UBREAK_ITERATOR
00027
00031 typedef struct UBreakIterator UBreakIterator;
00032 #endif
00033
00034 #if !UCONFIG_NO_BREAK_ITERATION
00035
00036 #include "unicode/parseerr.h"
00037
00102 typedef enum UBreakIteratorType {
00104 UBRK_CHARACTER = 0,
00106 UBRK_WORD = 1,
00108 UBRK_LINE = 2,
00110 UBRK_SENTENCE = 3,
00111
00112 #ifndef U_HIDE_DEPRECATED_API
00113
00121 UBRK_TITLE = 4,
00126 UBRK_COUNT = 5
00127 #endif // U_HIDE_DEPRECATED_API
00128 } UBreakIteratorType;
00129
00133 #define UBRK_DONE ((int32_t) -1)
00134
00135
00147 typedef enum UWordBreak {
00150 UBRK_WORD_NONE = 0,
00152 UBRK_WORD_NONE_LIMIT = 100,
00154 UBRK_WORD_NUMBER = 100,
00156 UBRK_WORD_NUMBER_LIMIT = 200,
00159 UBRK_WORD_LETTER = 200,
00161 UBRK_WORD_LETTER_LIMIT = 300,
00163 UBRK_WORD_KANA = 300,
00165 UBRK_WORD_KANA_LIMIT = 400,
00167 UBRK_WORD_IDEO = 400,
00169 UBRK_WORD_IDEO_LIMIT = 500
00170 } UWordBreak;
00171
00183 typedef enum ULineBreakTag {
00186 UBRK_LINE_SOFT = 0,
00188 UBRK_LINE_SOFT_LIMIT = 100,
00190 UBRK_LINE_HARD = 100,
00192 UBRK_LINE_HARD_LIMIT = 200
00193 } ULineBreakTag;
00194
00195
00196
00208 typedef enum USentenceBreakTag {
00213 UBRK_SENTENCE_TERM = 0,
00215 UBRK_SENTENCE_TERM_LIMIT = 100,
00220 UBRK_SENTENCE_SEP = 100,
00222 UBRK_SENTENCE_SEP_LIMIT = 200
00224 } USentenceBreakTag;
00225
00226
00244 U_CAPI UBreakIterator* U_EXPORT2
00245 ubrk_open(UBreakIteratorType type,
00246 const char *locale,
00247 const UChar *text,
00248 int32_t textLength,
00249 UErrorCode *status);
00250
00266 U_CAPI UBreakIterator* U_EXPORT2
00267 ubrk_openRules(const UChar *rules,
00268 int32_t rulesLength,
00269 const UChar *text,
00270 int32_t textLength,
00271 UParseError *parseErr,
00272 UErrorCode *status);
00273
00294 U_CAPI UBreakIterator* U_EXPORT2
00295 ubrk_openBinaryRules(const uint8_t *binaryRules, int32_t rulesLength,
00296 const UChar * text, int32_t textLength,
00297 UErrorCode * status);
00298
00299 #ifndef U_HIDE_DEPRECATED_API
00300
00320 U_DEPRECATED UBreakIterator * U_EXPORT2
00321 ubrk_safeClone(
00322 const UBreakIterator *bi,
00323 void *stackBuffer,
00324 int32_t *pBufferSize,
00325 UErrorCode *status);
00326
00327 #endif
00328
00336 U_CAPI UBreakIterator * U_EXPORT2
00337 ubrk_clone(const UBreakIterator *bi,
00338 UErrorCode *status);
00339
00340 #ifndef U_HIDE_DEPRECATED_API
00341
00346 #define U_BRK_SAFECLONE_BUFFERSIZE 1
00347
00348 #endif
00349
00356 U_CAPI void U_EXPORT2
00357 ubrk_close(UBreakIterator *bi);
00358
00359 #if U_SHOW_CPLUSPLUS_API
00360
00361 U_NAMESPACE_BEGIN
00362
00372 U_DEFINE_LOCAL_OPEN_POINTER(LocalUBreakIteratorPointer, UBreakIterator, ubrk_close);
00373
00374 U_NAMESPACE_END
00375
00376 #endif
00377
00390 U_CAPI void U_EXPORT2
00391 ubrk_setText(UBreakIterator* bi,
00392 const UChar* text,
00393 int32_t textLength,
00394 UErrorCode* status);
00395
00396
00414 U_CAPI void U_EXPORT2
00415 ubrk_setUText(UBreakIterator* bi,
00416 UText* text,
00417 UErrorCode* status);
00418
00419
00420
00429 U_CAPI int32_t U_EXPORT2
00430 ubrk_current(const UBreakIterator *bi);
00431
00441 U_CAPI int32_t U_EXPORT2
00442 ubrk_next(UBreakIterator *bi);
00443
00453 U_CAPI int32_t U_EXPORT2
00454 ubrk_previous(UBreakIterator *bi);
00455
00463 U_CAPI int32_t U_EXPORT2
00464 ubrk_first(UBreakIterator *bi);
00465
00475 U_CAPI int32_t U_EXPORT2
00476 ubrk_last(UBreakIterator *bi);
00477
00487 U_CAPI int32_t U_EXPORT2
00488 ubrk_preceding(UBreakIterator *bi,
00489 int32_t offset);
00490
00500 U_CAPI int32_t U_EXPORT2
00501 ubrk_following(UBreakIterator *bi,
00502 int32_t offset);
00503
00513 U_CAPI const char* U_EXPORT2
00514 ubrk_getAvailable(int32_t index);
00515
00524 U_CAPI int32_t U_EXPORT2
00525 ubrk_countAvailable(void);
00526
00527
00537 U_CAPI UBool U_EXPORT2
00538 ubrk_isBoundary(UBreakIterator *bi, int32_t offset);
00539
00549 U_CAPI int32_t U_EXPORT2
00550 ubrk_getRuleStatus(UBreakIterator *bi);
00551
00569 U_CAPI int32_t U_EXPORT2
00570 ubrk_getRuleStatusVec(UBreakIterator *bi, int32_t *fillInVec, int32_t capacity, UErrorCode *status);
00571
00581 U_CAPI const char* U_EXPORT2
00582 ubrk_getLocaleByType(const UBreakIterator *bi, ULocDataLocaleType type, UErrorCode* status);
00583
00609 U_CAPI void U_EXPORT2
00610 ubrk_refreshUText(UBreakIterator *bi,
00611 UText *text,
00612 UErrorCode *status);
00613
00614
00640 U_CAPI int32_t U_EXPORT2
00641 ubrk_getBinaryRules(UBreakIterator *bi,
00642 uint8_t * binaryRules, int32_t rulesCapacity,
00643 UErrorCode * status);
00644
00645 #endif
00646
00647 #endif