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 #include "unicode/localpointer.h"
00017
00022 #ifndef UBRK_TYPEDEF_UBREAK_ITERATOR
00023 # define UBRK_TYPEDEF_UBREAK_ITERATOR
00024
00028 typedef struct UBreakIterator UBreakIterator;
00029 #endif
00030
00031 #if !UCONFIG_NO_BREAK_ITERATION
00032
00033 #include "unicode/parseerr.h"
00034
00099 typedef enum UBreakIteratorType {
00101 UBRK_CHARACTER = 0,
00103 UBRK_WORD = 1,
00105 UBRK_LINE = 2,
00107 UBRK_SENTENCE = 3,
00108
00109 #ifndef U_HIDE_DEPRECATED_API
00110
00118 UBRK_TITLE = 4,
00123 UBRK_COUNT = 5
00124 #endif // U_HIDE_DEPRECATED_API
00125 } UBreakIteratorType;
00126
00130 #define UBRK_DONE ((int32_t) -1)
00131
00132
00144 typedef enum UWordBreak {
00147 UBRK_WORD_NONE = 0,
00149 UBRK_WORD_NONE_LIMIT = 100,
00151 UBRK_WORD_NUMBER = 100,
00153 UBRK_WORD_NUMBER_LIMIT = 200,
00156 UBRK_WORD_LETTER = 200,
00158 UBRK_WORD_LETTER_LIMIT = 300,
00160 UBRK_WORD_KANA = 300,
00162 UBRK_WORD_KANA_LIMIT = 400,
00164 UBRK_WORD_IDEO = 400,
00166 UBRK_WORD_IDEO_LIMIT = 500
00167 } UWordBreak;
00168
00180 typedef enum ULineBreakTag {
00183 UBRK_LINE_SOFT = 0,
00185 UBRK_LINE_SOFT_LIMIT = 100,
00187 UBRK_LINE_HARD = 100,
00189 UBRK_LINE_HARD_LIMIT = 200
00190 } ULineBreakTag;
00191
00192
00193
00205 typedef enum USentenceBreakTag {
00210 UBRK_SENTENCE_TERM = 0,
00212 UBRK_SENTENCE_TERM_LIMIT = 100,
00217 UBRK_SENTENCE_SEP = 100,
00219 UBRK_SENTENCE_SEP_LIMIT = 200
00221 } USentenceBreakTag;
00222
00223
00241 U_STABLE UBreakIterator* U_EXPORT2
00242 ubrk_open(UBreakIteratorType type,
00243 const char *locale,
00244 const UChar *text,
00245 int32_t textLength,
00246 UErrorCode *status);
00247
00263 U_STABLE UBreakIterator* U_EXPORT2
00264 ubrk_openRules(const UChar *rules,
00265 int32_t rulesLength,
00266 const UChar *text,
00267 int32_t textLength,
00268 UParseError *parseErr,
00269 UErrorCode *status);
00270
00291 U_STABLE UBreakIterator* U_EXPORT2
00292 ubrk_openBinaryRules(const uint8_t *binaryRules, int32_t rulesLength,
00293 const UChar * text, int32_t textLength,
00294 UErrorCode * status);
00295
00314 U_STABLE UBreakIterator * U_EXPORT2
00315 ubrk_safeClone(
00316 const UBreakIterator *bi,
00317 void *stackBuffer,
00318 int32_t *pBufferSize,
00319 UErrorCode *status);
00320
00321 #ifndef U_HIDE_DEPRECATED_API
00322
00327 #define U_BRK_SAFECLONE_BUFFERSIZE 1
00328
00329 #endif
00330
00337 U_STABLE void U_EXPORT2
00338 ubrk_close(UBreakIterator *bi);
00339
00340 #if U_SHOW_CPLUSPLUS_API
00341
00342 U_NAMESPACE_BEGIN
00343
00353 U_DEFINE_LOCAL_OPEN_POINTER(LocalUBreakIteratorPointer, UBreakIterator, ubrk_close);
00354
00355 U_NAMESPACE_END
00356
00357 #endif
00358
00371 U_STABLE void U_EXPORT2
00372 ubrk_setText(UBreakIterator* bi,
00373 const UChar* text,
00374 int32_t textLength,
00375 UErrorCode* status);
00376
00377
00395 U_STABLE void U_EXPORT2
00396 ubrk_setUText(UBreakIterator* bi,
00397 UText* text,
00398 UErrorCode* status);
00399
00400
00401
00410 U_STABLE int32_t U_EXPORT2
00411 ubrk_current(const UBreakIterator *bi);
00412
00422 U_STABLE int32_t U_EXPORT2
00423 ubrk_next(UBreakIterator *bi);
00424
00434 U_STABLE int32_t U_EXPORT2
00435 ubrk_previous(UBreakIterator *bi);
00436
00444 U_STABLE int32_t U_EXPORT2
00445 ubrk_first(UBreakIterator *bi);
00446
00456 U_STABLE int32_t U_EXPORT2
00457 ubrk_last(UBreakIterator *bi);
00458
00468 U_STABLE int32_t U_EXPORT2
00469 ubrk_preceding(UBreakIterator *bi,
00470 int32_t offset);
00471
00481 U_STABLE int32_t U_EXPORT2
00482 ubrk_following(UBreakIterator *bi,
00483 int32_t offset);
00484
00494 U_STABLE const char* U_EXPORT2
00495 ubrk_getAvailable(int32_t index);
00496
00505 U_STABLE int32_t U_EXPORT2
00506 ubrk_countAvailable(void);
00507
00508
00518 U_STABLE UBool U_EXPORT2
00519 ubrk_isBoundary(UBreakIterator *bi, int32_t offset);
00520
00530 U_STABLE int32_t U_EXPORT2
00531 ubrk_getRuleStatus(UBreakIterator *bi);
00532
00550 U_STABLE int32_t U_EXPORT2
00551 ubrk_getRuleStatusVec(UBreakIterator *bi, int32_t *fillInVec, int32_t capacity, UErrorCode *status);
00552
00562 U_STABLE const char* U_EXPORT2
00563 ubrk_getLocaleByType(const UBreakIterator *bi, ULocDataLocaleType type, UErrorCode* status);
00564
00590 U_STABLE void U_EXPORT2
00591 ubrk_refreshUText(UBreakIterator *bi,
00592 UText *text,
00593 UErrorCode *status);
00594
00595
00621 U_STABLE int32_t U_EXPORT2
00622 ubrk_getBinaryRules(UBreakIterator *bi,
00623 uint8_t * binaryRules, int32_t rulesCapacity,
00624 UErrorCode * status);
00625
00626 #endif
00627
00628 #endif