00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef USEARCH_H
00010 #define USEARCH_H
00011
00012 #include "unicode/utypes.h"
00013 #include "unicode/ucol.h"
00014 #include "unicode/ucoleitr.h"
00015 #include "unicode/ubrk.h"
00016
00129 #define USEARCH_DONE -1
00130
00134 struct UStringSearch;
00135 typedef struct UStringSearch UStringSearch;
00136
00137 typedef enum {
00139 USEARCH_OVERLAP,
00144 USEARCH_CANONICAL_MATCH,
00145 USEARCH_ATTRIBUTE_COUNT
00146 } USearchAttribute;
00147
00148 typedef enum {
00150 USEARCH_DEFAULT = -1,
00152 USEARCH_OFF,
00154 USEARCH_ON,
00155 USEARCH_ATTRIBUTE_VALUE_COUNT
00156 } USearchAttributeValue;
00157
00158
00159
00182 U_CAPI UStringSearch * U_EXPORT2 usearch_open(const UChar *pattern,
00183 int32_t patternlength,
00184 const UChar *text,
00185 int32_t textlength,
00186 const char *locale,
00187 UBreakIterator *breakiter,
00188 UErrorCode *status);
00189
00212 U_CAPI UStringSearch * U_EXPORT2 usearch_openFromCollator(
00213 const UChar *pattern,
00214 int32_t patternlength,
00215 const UChar *text,
00216 int32_t textlength,
00217 const UCollator *collator,
00218 UBreakIterator *breakiter,
00219 UErrorCode *status);
00220
00227 U_CAPI void U_EXPORT2 usearch_close(UStringSearch *strsrch);
00228
00229
00230
00246 U_CAPI void U_EXPORT2 usearch_setOffset(UStringSearch *strsrch,
00247 int32_t position,
00248 UErrorCode *status);
00249
00258 U_CAPI int32_t U_EXPORT2 usearch_getOffset(const UStringSearch *strsrch);
00259
00271 U_CAPI void U_EXPORT2 usearch_setAttribute(UStringSearch *strsrch,
00272 USearchAttribute attribute,
00273 USearchAttributeValue value,
00274 UErrorCode *status);
00275
00284 U_CAPI USearchAttributeValue U_EXPORT2 usearch_getAttribute(
00285 const UStringSearch *strsrch,
00286 USearchAttribute attribute);
00287
00307 U_CAPI int32_t U_EXPORT2 usearch_getMatchedStart(
00308 const UStringSearch *strsrch);
00309
00327 U_CAPI int32_t U_EXPORT2 usearch_getMatchedLength(
00328 const UStringSearch *strsrch);
00329
00355 U_CAPI int32_t U_EXPORT2 usearch_getMatchedText(const UStringSearch *strsrch,
00356 UChar *result,
00357 int32_t resultCapacity,
00358 UErrorCode *status);
00359
00375 U_CAPI void U_EXPORT2 usearch_setBreakIterator(UStringSearch *strsrch,
00376 UBreakIterator *breakiter,
00377 UErrorCode *status);
00378
00390 U_CAPI const UBreakIterator * U_EXPORT2 usearch_getBreakIterator(
00391 const UStringSearch *strsrch);
00392
00406 U_CAPI void U_EXPORT2 usearch_setText( UStringSearch *strsrch,
00407 const UChar *text,
00408 int32_t textlength,
00409 UErrorCode *status);
00410
00419 U_CAPI const UChar * U_EXPORT2 usearch_getText(const UStringSearch *strsrch,
00420 int32_t *length);
00421
00432 U_CAPI UCollator * U_EXPORT2 usearch_getCollator(
00433 const UStringSearch *strsrch);
00434
00445 U_CAPI void U_EXPORT2 usearch_setCollator( UStringSearch *strsrch,
00446 const UCollator *collator,
00447 UErrorCode *status);
00448
00461 U_CAPI void U_EXPORT2 usearch_setPattern( UStringSearch *strsrch,
00462 const UChar *pattern,
00463 int32_t patternlength,
00464 UErrorCode *status);
00465
00474 U_CAPI const UChar * U_EXPORT2 usearch_getPattern(
00475 const UStringSearch *strsrch,
00476 int32_t *length);
00477
00478
00479
00495 U_CAPI int32_t U_EXPORT2 usearch_first(UStringSearch *strsrch,
00496 UErrorCode *status);
00497
00519 U_CAPI int32_t U_EXPORT2 usearch_following(UStringSearch *strsrch,
00520 int32_t position,
00521 UErrorCode *status);
00522
00538 U_CAPI int32_t U_EXPORT2 usearch_last(UStringSearch *strsrch,
00539 UErrorCode *status);
00540
00561 U_CAPI int32_t U_EXPORT2 usearch_preceding(UStringSearch *strsrch,
00562 int32_t position,
00563 UErrorCode *status);
00564
00582 U_CAPI int32_t U_EXPORT2 usearch_next(UStringSearch *strsrch,
00583 UErrorCode *status);
00584
00602 U_CAPI int32_t U_EXPORT2 usearch_previous(UStringSearch *strsrch,
00603 UErrorCode *status);
00604
00615 U_CAPI void U_EXPORT2 usearch_reset(UStringSearch *strsrch);
00616
00617 #endif
00618
00619