00001
00002
00003
00004
00005
00006
00007
00008
00009
#ifndef USEARCH_H
00010
#define USEARCH_H
00011
00012
#include "unicode/utypes.h"
00013
00014
#if !UCONFIG_NO_COLLATION
00015
00016
#include "unicode/ucol.h"
00017
#include "unicode/ucoleitr.h"
00018
#include "unicode/ubrk.h"
00019
00136 #define USEARCH_DONE -1
00137
00142
struct UStringSearch;
00147 typedef struct UStringSearch UStringSearch;
00148
00152 typedef enum {
00154
USEARCH_OVERLAP,
00159
USEARCH_CANONICAL_MATCH,
00160 USEARCH_ATTRIBUTE_COUNT
00161 }
USearchAttribute;
00162
00166 typedef enum {
00168
USEARCH_DEFAULT = -1,
00170
USEARCH_OFF,
00172
USEARCH_ON,
00173 USEARCH_ATTRIBUTE_VALUE_COUNT
00174 }
USearchAttributeValue;
00175
00176
00177
00200
U_CAPI UStringSearch * U_EXPORT2
usearch_open(
const UChar *pattern,
00201 int32_t patternlength,
00202
const UChar *text,
00203 int32_t textlength,
00204
const char *locale,
00205 UBreakIterator *breakiter,
00206 UErrorCode *status);
00207
00230
U_CAPI UStringSearch * U_EXPORT2
usearch_openFromCollator(
00231
const UChar *pattern,
00232 int32_t patternlength,
00233
const UChar *text,
00234 int32_t textlength,
00235
const UCollator *collator,
00236 UBreakIterator *breakiter,
00237 UErrorCode *status);
00238
00245
U_CAPI void U_EXPORT2
usearch_close(UStringSearch *searchiter);
00246
00247
00248
00264
U_CAPI void U_EXPORT2
usearch_setOffset(UStringSearch *strsrch,
00265 int32_t position,
00266 UErrorCode *status);
00267
00276
U_CAPI int32_t U_EXPORT2
usearch_getOffset(
const UStringSearch *strsrch);
00277
00289
U_CAPI void U_EXPORT2
usearch_setAttribute(UStringSearch *strsrch,
00290 USearchAttribute attribute,
00291 USearchAttributeValue value,
00292 UErrorCode *status);
00293
00302
U_CAPI USearchAttributeValue U_EXPORT2
usearch_getAttribute(
00303
const UStringSearch *strsrch,
00304 USearchAttribute attribute);
00305
00325
U_CAPI int32_t U_EXPORT2
usearch_getMatchedStart(
00326
const UStringSearch *strsrch);
00327
00345
U_CAPI int32_t U_EXPORT2
usearch_getMatchedLength(
00346
const UStringSearch *strsrch);
00347
00373
U_CAPI int32_t U_EXPORT2
usearch_getMatchedText(
const UStringSearch *strsrch,
00374 UChar *result,
00375 int32_t resultCapacity,
00376 UErrorCode *status);
00377
00378
#if !UCONFIG_NO_BREAK_ITERATION
00379
00395
U_CAPI void U_EXPORT2
usearch_setBreakIterator(UStringSearch *strsrch,
00396 UBreakIterator *breakiter,
00397 UErrorCode *status);
00398
00410
U_CAPI const UBreakIterator * U_EXPORT2
usearch_getBreakIterator(
00411
const UStringSearch *strsrch);
00412
00413
#endif
00414
00428
U_CAPI void U_EXPORT2
usearch_setText( UStringSearch *strsrch,
00429
const UChar *text,
00430 int32_t textlength,
00431 UErrorCode *status);
00432
00441
U_CAPI const UChar * U_EXPORT2
usearch_getText(
const UStringSearch *strsrch,
00442 int32_t *length);
00443
00454
U_CAPI UCollator * U_EXPORT2
usearch_getCollator(
00455
const UStringSearch *strsrch);
00456
00467
U_CAPI void U_EXPORT2
usearch_setCollator( UStringSearch *strsrch,
00468
const UCollator *collator,
00469 UErrorCode *status);
00470
00483
U_CAPI void U_EXPORT2
usearch_setPattern( UStringSearch *strsrch,
00484
const UChar *pattern,
00485 int32_t patternlength,
00486 UErrorCode *status);
00487
00496
U_CAPI const UChar * U_EXPORT2
usearch_getPattern(
00497
const UStringSearch *strsrch,
00498 int32_t *length);
00499
00500
00501
00517
U_CAPI int32_t U_EXPORT2
usearch_first(UStringSearch *strsrch,
00518 UErrorCode *status);
00519
00541
U_CAPI int32_t U_EXPORT2
usearch_following(UStringSearch *strsrch,
00542 int32_t position,
00543 UErrorCode *status);
00544
00560
U_CAPI int32_t U_EXPORT2
usearch_last(UStringSearch *strsrch,
00561 UErrorCode *status);
00562
00583
U_CAPI int32_t U_EXPORT2
usearch_preceding(UStringSearch *strsrch,
00584 int32_t position,
00585 UErrorCode *status);
00586
00604
U_CAPI int32_t U_EXPORT2
usearch_next(UStringSearch *strsrch,
00605 UErrorCode *status);
00606
00624
U_CAPI int32_t U_EXPORT2
usearch_previous(UStringSearch *strsrch,
00625 UErrorCode *status);
00626
00637
U_CAPI void U_EXPORT2
usearch_reset(UStringSearch *strsrch);
00638
00639
#endif
00640
00641
#endif