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
00244 U_CAPI
void U_EXPORT2 usearch_setOffset(UStringSearch *strsrch,
00245 int32_t position,
00246 UErrorCode *status);
00247
00255 U_CAPI int32_t U_EXPORT2 usearch_getOffset(
const UStringSearch *strsrch);
00256
00268 U_CAPI
void U_EXPORT2 usearch_setAttribute(UStringSearch *strsrch,
00269 USearchAttribute attribute,
00270 USearchAttributeValue value,
00271 UErrorCode *status);
00272
00281 U_CAPI USearchAttributeValue U_EXPORT2 usearch_getAttribute(
00282
const UStringSearch *strsrch,
00283 USearchAttribute attribute);
00284
00299 U_CAPI int32_t U_EXPORT2 usearch_getMatchedStart(
00300
const UStringSearch *strsrch);
00301
00314 U_CAPI int32_t U_EXPORT2 usearch_getMatchedLength(
00315
const UStringSearch *strsrch);
00316
00337 U_CAPI int32_t U_EXPORT2 usearch_getMatchedText(
const UStringSearch *strsrch,
00338 UChar *result,
00339 int32_t resultCapacity,
00340 UErrorCode *status);
00341
00357 U_CAPI
void U_EXPORT2 usearch_setBreakIterator(UStringSearch *strsrch,
00358 UBreakIterator *breakiter,
00359 UErrorCode *status);
00360
00372 U_CAPI
const UBreakIterator * U_EXPORT2 usearch_getBreakIterator(
00373
const UStringSearch *strsrch);
00374
00388 U_CAPI
void U_EXPORT2 usearch_setText( UStringSearch *strsrch,
00389
const UChar *text,
00390 int32_t textlength,
00391 UErrorCode *status);
00392
00401 U_CAPI
const UChar * U_EXPORT2 usearch_getText(
const UStringSearch *strsrch,
00402 int32_t *length);
00403
00414 U_CAPI
UCollator * U_EXPORT2 usearch_getCollator(
00415
const UStringSearch *strsrch);
00416
00427 U_CAPI
void U_EXPORT2 usearch_setCollator( UStringSearch *strsrch,
00428
const UCollator *collator,
00429 UErrorCode *status);
00430
00443 U_CAPI
void U_EXPORT2 usearch_setPattern( UStringSearch *strsrch,
00444
const UChar *pattern,
00445 int32_t patternlength,
00446 UErrorCode *status);
00447
00456 U_CAPI
const UChar * U_EXPORT2 usearch_getPattern(
00457
const UStringSearch *strsrch,
00458 int32_t *length);
00459
00460
00461
00475 U_CAPI int32_t U_EXPORT2 usearch_first(UStringSearch *strsrch,
00476 UErrorCode *status);
00477
00496 U_CAPI int32_t U_EXPORT2 usearch_following(UStringSearch *strsrch,
00497 int32_t position,
00498 UErrorCode *status);
00499
00513 U_CAPI int32_t U_EXPORT2 usearch_last(UStringSearch *strsrch,
00514 UErrorCode *status);
00515
00533 U_CAPI int32_t U_EXPORT2 usearch_preceding(UStringSearch *strsrch,
00534 int32_t position,
00535 UErrorCode *status);
00536
00552 U_CAPI int32_t U_EXPORT2 usearch_next(UStringSearch *strsrch,
00553 UErrorCode *status);
00554
00569 U_CAPI int32_t U_EXPORT2 usearch_previous(UStringSearch *strsrch,
00570 UErrorCode *status);
00571
00581 U_CAPI
void U_EXPORT2 usearch_reset(UStringSearch *strsrch);
00582
00583
#endif
00584
00585