00001
00002
00003
00004
00005
00006
00007
00008 #ifndef UBRK_H
00009 #define UBRK_H
00010
00011 #include "unicode/utypes.h"
00012 #include "unicode/uloc.h"
00013 #include "unicode/utext.h"
00014 #include "unicode/localpointer.h"
00015
00020 #ifndef UBRK_TYPEDEF_UBREAK_ITERATOR
00021 # define UBRK_TYPEDEF_UBREAK_ITERATOR
00022
00026 typedef struct UBreakIterator UBreakIterator;
00027 #endif
00028
00029 #if !UCONFIG_NO_BREAK_ITERATION
00030
00031 #include "unicode/parseerr.h"
00032
00097 typedef enum UBreakIteratorType {
00099 UBRK_CHARACTER = 0,
00101 UBRK_WORD = 1,
00103 UBRK_LINE = 2,
00105 UBRK_SENTENCE = 3,
00106
00107 #ifndef U_HIDE_DEPRECATED_API
00108
00116 UBRK_TITLE = 4,
00117 #endif
00118 UBRK_COUNT = 5
00119 } UBreakIteratorType;
00120
00124 #define UBRK_DONE ((int32_t) -1)
00125
00126
00135 typedef enum UWordBreak {
00138 UBRK_WORD_NONE = 0,
00140 UBRK_WORD_NONE_LIMIT = 100,
00142 UBRK_WORD_NUMBER = 100,
00144 UBRK_WORD_NUMBER_LIMIT = 200,
00147 UBRK_WORD_LETTER = 200,
00149 UBRK_WORD_LETTER_LIMIT = 300,
00151 UBRK_WORD_KANA = 300,
00153 UBRK_WORD_KANA_LIMIT = 400,
00155 UBRK_WORD_IDEO = 400,
00157 UBRK_WORD_IDEO_LIMIT = 500
00158 } UWordBreak;
00159
00168 typedef enum ULineBreakTag {
00171 UBRK_LINE_SOFT = 0,
00173 UBRK_LINE_SOFT_LIMIT = 100,
00175 UBRK_LINE_HARD = 100,
00177 UBRK_LINE_HARD_LIMIT = 200
00178 } ULineBreakTag;
00179
00180
00181
00190 typedef enum USentenceBreakTag {
00195 UBRK_SENTENCE_TERM = 0,
00197 UBRK_SENTENCE_TERM_LIMIT = 100,
00202 UBRK_SENTENCE_SEP = 100,
00204 UBRK_SENTENCE_SEP_LIMIT = 200
00206 } USentenceBreakTag;
00207
00208
00225 U_STABLE UBreakIterator* U_EXPORT2
00226 ubrk_open(UBreakIteratorType type,
00227 const char *locale,
00228 const UChar *text,
00229 int32_t textLength,
00230 UErrorCode *status);
00231
00247 U_STABLE UBreakIterator* U_EXPORT2
00248 ubrk_openRules(const UChar *rules,
00249 int32_t rulesLength,
00250 const UChar *text,
00251 int32_t textLength,
00252 UParseError *parseErr,
00253 UErrorCode *status);
00254
00273 U_STABLE UBreakIterator * U_EXPORT2
00274 ubrk_safeClone(
00275 const UBreakIterator *bi,
00276 void *stackBuffer,
00277 int32_t *pBufferSize,
00278 UErrorCode *status);
00279
00280 #ifndef U_HIDE_DEPRECATED_API
00281
00286 #define U_BRK_SAFECLONE_BUFFERSIZE 1
00287
00288 #endif
00289
00296 U_STABLE void U_EXPORT2
00297 ubrk_close(UBreakIterator *bi);
00298
00299 #if U_SHOW_CPLUSPLUS_API
00300
00301 U_NAMESPACE_BEGIN
00302
00312 U_DEFINE_LOCAL_OPEN_POINTER(LocalUBreakIteratorPointer, UBreakIterator, ubrk_close);
00313
00314 U_NAMESPACE_END
00315
00316 #endif
00317
00326 U_STABLE void U_EXPORT2
00327 ubrk_setText(UBreakIterator* bi,
00328 const UChar* text,
00329 int32_t textLength,
00330 UErrorCode* status);
00331
00332
00350 U_STABLE void U_EXPORT2
00351 ubrk_setUText(UBreakIterator* bi,
00352 UText* text,
00353 UErrorCode* status);
00354
00355
00356
00365 U_STABLE int32_t U_EXPORT2
00366 ubrk_current(const UBreakIterator *bi);
00367
00377 U_STABLE int32_t U_EXPORT2
00378 ubrk_next(UBreakIterator *bi);
00379
00389 U_STABLE int32_t U_EXPORT2
00390 ubrk_previous(UBreakIterator *bi);
00391
00399 U_STABLE int32_t U_EXPORT2
00400 ubrk_first(UBreakIterator *bi);
00401
00411 U_STABLE int32_t U_EXPORT2
00412 ubrk_last(UBreakIterator *bi);
00413
00423 U_STABLE int32_t U_EXPORT2
00424 ubrk_preceding(UBreakIterator *bi,
00425 int32_t offset);
00426
00436 U_STABLE int32_t U_EXPORT2
00437 ubrk_following(UBreakIterator *bi,
00438 int32_t offset);
00439
00449 U_STABLE const char* U_EXPORT2
00450 ubrk_getAvailable(int32_t index);
00451
00460 U_STABLE int32_t U_EXPORT2
00461 ubrk_countAvailable(void);
00462
00463
00473 U_STABLE UBool U_EXPORT2
00474 ubrk_isBoundary(UBreakIterator *bi, int32_t offset);
00475
00485 U_STABLE int32_t U_EXPORT2
00486 ubrk_getRuleStatus(UBreakIterator *bi);
00487
00505 U_STABLE int32_t U_EXPORT2
00506 ubrk_getRuleStatusVec(UBreakIterator *bi, int32_t *fillInVec, int32_t capacity, UErrorCode *status);
00507
00517 U_STABLE const char* U_EXPORT2
00518 ubrk_getLocaleByType(const UBreakIterator *bi, ULocDataLocaleType type, UErrorCode* status);
00519
00545 U_STABLE void U_EXPORT2
00546 ubrk_refreshUText(UBreakIterator *bi,
00547 UText *text,
00548 UErrorCode *status);
00549
00550 #endif
00551
00552 #endif