00001
00002
00003
00004
00005
00006 #ifndef UBRK_H
00007 #define UBRK_H
00008
00009 #include "unicode/utypes.h"
00010 #include "unicode/uloc.h"
00011
00016 #ifndef UBRK_TYPEDEF_UBREAK_ITERATOR
00017 # define UBRK_TYPEDEF_UBREAK_ITERATOR
00018
00022 typedef void UBreakIterator;
00023 #endif
00024
00025 #if !UCONFIG_NO_BREAK_ITERATION
00026
00027 #include "unicode/parseerr.h"
00028
00187 typedef enum UBreakIteratorType {
00189 UBRK_CHARACTER,
00191 UBRK_WORD,
00193 UBRK_LINE,
00195 UBRK_SENTENCE,
00204 UBRK_TITLE
00205 } UBreakIteratorType;
00206
00210 #define UBRK_DONE ((int32_t) -1)
00211
00212
00221 typedef enum UWordBreak {
00224 UBRK_WORD_NONE = 0,
00226 UBRK_WORD_NONE_LIMIT = 100,
00228 UBRK_WORD_NUMBER = 100,
00230 UBRK_WORD_NUMBER_LIMIT = 200,
00233 UBRK_WORD_LETTER = 200,
00235 UBRK_WORD_LETTER_LIMIT = 300,
00237 UBRK_WORD_KANA = 300,
00239 UBRK_WORD_KANA_LIMIT = 400,
00241 UBRK_WORD_IDEO = 400,
00243 UBRK_WORD_IDEO_LIMIT = 500
00244 } UWordBreak;
00245
00254 typedef enum ULineBreakTag {
00257 UBRK_LINE_SOFT = 0,
00259 UBRK_LINE_SOFT_LIMIT = 100,
00261 UBRK_LINE_HARD = 100,
00263 UBRK_LINE_HARD_LIMIT = 200
00264 } ULineBreakTag;
00265
00266
00267
00276 typedef enum USentenceBreakTag {
00281 UBRK_SENTENCE_TERM = 0,
00283 UBRK_SENTENCE_TERM_LIMIT = 100,
00288 UBRK_SENTENCE_SEP = 100,
00290 UBRK_SENTENCE_SEP_LIMIT = 200
00292 } USentenceBreakTag;
00293
00294
00309 U_CAPI UBreakIterator* U_EXPORT2
00310 ubrk_open(UBreakIteratorType type,
00311 const char *locale,
00312 const UChar *text,
00313 int32_t textLength,
00314 UErrorCode *status);
00315
00331 U_CAPI UBreakIterator* U_EXPORT2
00332 ubrk_openRules(const UChar *rules,
00333 int32_t rulesLength,
00334 const UChar *text,
00335 int32_t textLength,
00336 UParseError *parseErr,
00337 UErrorCode *status);
00338
00355 U_CAPI UBreakIterator * U_EXPORT2
00356 ubrk_safeClone(
00357 const UBreakIterator *bi,
00358 void *stackBuffer,
00359 int32_t *pBufferSize,
00360 UErrorCode *status);
00361
00366 #define U_BRK_SAFECLONE_BUFFERSIZE 512
00367
00374 U_CAPI void U_EXPORT2
00375 ubrk_close(UBreakIterator *bi);
00376
00385 U_CAPI void U_EXPORT2
00386 ubrk_setText(UBreakIterator* bi,
00387 const UChar* text,
00388 int32_t textLength,
00389 UErrorCode* status);
00390
00399 U_CAPI int32_t U_EXPORT2
00400 ubrk_current(const UBreakIterator *bi);
00401
00411 U_CAPI int32_t U_EXPORT2
00412 ubrk_next(UBreakIterator *bi);
00413
00423 U_CAPI int32_t U_EXPORT2
00424 ubrk_previous(UBreakIterator *bi);
00425
00434 U_CAPI int32_t U_EXPORT2
00435 ubrk_first(UBreakIterator *bi);
00436
00447 U_CAPI int32_t U_EXPORT2
00448 ubrk_last(UBreakIterator *bi);
00449
00459 U_CAPI int32_t U_EXPORT2
00460 ubrk_preceding(UBreakIterator *bi,
00461 int32_t offset);
00462
00472 U_CAPI int32_t U_EXPORT2
00473 ubrk_following(UBreakIterator *bi,
00474 int32_t offset);
00475
00485 U_CAPI const char* U_EXPORT2
00486 ubrk_getAvailable(int32_t index);
00487
00496 U_CAPI int32_t U_EXPORT2
00497 ubrk_countAvailable(void);
00498
00499
00509 U_CAPI UBool U_EXPORT2
00510 ubrk_isBoundary(UBreakIterator *bi, int32_t offset);
00511
00521 U_CAPI int32_t U_EXPORT2
00522 ubrk_getRuleStatus(UBreakIterator *bi);
00523
00533 U_CAPI const char* U_EXPORT2
00534 ubrk_getLocaleByType(const UBreakIterator *bi, ULocDataLocaleType type, UErrorCode* status);
00535
00536
00537 #endif
00538
00539 #endif