00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef USEARCH_H
00012 #define USEARCH_H
00013
00014 #include "unicode/utypes.h"
00015
00016 #if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION
00017
00018 #include "unicode/localpointer.h"
00019 #include "unicode/ucol.h"
00020 #include "unicode/ucoleitr.h"
00021 #include "unicode/ubrk.h"
00022
00147 #define USEARCH_DONE -1
00148
00153 struct UStringSearch;
00158 typedef struct UStringSearch UStringSearch;
00159
00163 typedef enum {
00168 USEARCH_OVERLAP = 0,
00169 #ifndef U_HIDE_DEPRECATED_API
00170
00184 USEARCH_CANONICAL_MATCH = 1,
00185 #endif
00186
00191 USEARCH_ELEMENT_COMPARISON = 2,
00192
00193 #ifndef U_HIDE_DEPRECATED_API
00194
00198 USEARCH_ATTRIBUTE_COUNT = 3
00199 #endif
00200 } USearchAttribute;
00201
00205 typedef enum {
00210 USEARCH_DEFAULT = -1,
00215 USEARCH_OFF,
00220 USEARCH_ON,
00227 USEARCH_STANDARD_ELEMENT_COMPARISON,
00246 USEARCH_PATTERN_BASE_WEIGHT_IS_WILDCARD,
00267 USEARCH_ANY_BASE_WEIGHT_IS_WILDCARD,
00268
00269 #ifndef U_HIDE_DEPRECATED_API
00270
00274 USEARCH_ATTRIBUTE_VALUE_COUNT
00275 #endif
00276 } USearchAttributeValue;
00277
00278
00279
00302 U_STABLE UStringSearch * U_EXPORT2 usearch_open(const UChar *pattern,
00303 int32_t patternlength,
00304 const UChar *text,
00305 int32_t textlength,
00306 const char *locale,
00307 UBreakIterator *breakiter,
00308 UErrorCode *status);
00309
00334 U_STABLE UStringSearch * U_EXPORT2 usearch_openFromCollator(
00335 const UChar *pattern,
00336 int32_t patternlength,
00337 const UChar *text,
00338 int32_t textlength,
00339 const UCollator *collator,
00340 UBreakIterator *breakiter,
00341 UErrorCode *status);
00342
00349 U_STABLE void U_EXPORT2 usearch_close(UStringSearch *searchiter);
00350
00351 #if U_SHOW_CPLUSPLUS_API
00352
00353 U_NAMESPACE_BEGIN
00354
00364 U_DEFINE_LOCAL_OPEN_POINTER(LocalUStringSearchPointer, UStringSearch, usearch_close);
00365
00366 U_NAMESPACE_END
00367
00368 #endif
00369
00370
00371
00387 U_STABLE void U_EXPORT2 usearch_setOffset(UStringSearch *strsrch,
00388 int32_t position,
00389 UErrorCode *status);
00390
00399 U_STABLE int32_t U_EXPORT2 usearch_getOffset(const UStringSearch *strsrch);
00400
00412 U_STABLE void U_EXPORT2 usearch_setAttribute(UStringSearch *strsrch,
00413 USearchAttribute attribute,
00414 USearchAttributeValue value,
00415 UErrorCode *status);
00416
00425 U_STABLE USearchAttributeValue U_EXPORT2 usearch_getAttribute(
00426 const UStringSearch *strsrch,
00427 USearchAttribute attribute);
00428
00448 U_STABLE int32_t U_EXPORT2 usearch_getMatchedStart(
00449 const UStringSearch *strsrch);
00450
00468 U_STABLE int32_t U_EXPORT2 usearch_getMatchedLength(
00469 const UStringSearch *strsrch);
00470
00496 U_STABLE int32_t U_EXPORT2 usearch_getMatchedText(const UStringSearch *strsrch,
00497 UChar *result,
00498 int32_t resultCapacity,
00499 UErrorCode *status);
00500
00501 #if !UCONFIG_NO_BREAK_ITERATION
00502
00518 U_STABLE void U_EXPORT2 usearch_setBreakIterator(UStringSearch *strsrch,
00519 UBreakIterator *breakiter,
00520 UErrorCode *status);
00521
00533 U_STABLE const UBreakIterator * U_EXPORT2 usearch_getBreakIterator(
00534 const UStringSearch *strsrch);
00535
00536 #endif
00537
00551 U_STABLE void U_EXPORT2 usearch_setText( UStringSearch *strsrch,
00552 const UChar *text,
00553 int32_t textlength,
00554 UErrorCode *status);
00555
00564 U_STABLE const UChar * U_EXPORT2 usearch_getText(const UStringSearch *strsrch,
00565 int32_t *length);
00566
00577 U_STABLE UCollator * U_EXPORT2 usearch_getCollator(
00578 const UStringSearch *strsrch);
00579
00590 U_STABLE void U_EXPORT2 usearch_setCollator( UStringSearch *strsrch,
00591 const UCollator *collator,
00592 UErrorCode *status);
00593
00606 U_STABLE void U_EXPORT2 usearch_setPattern( UStringSearch *strsrch,
00607 const UChar *pattern,
00608 int32_t patternlength,
00609 UErrorCode *status);
00610
00619 U_STABLE const UChar * U_EXPORT2 usearch_getPattern(
00620 const UStringSearch *strsrch,
00621 int32_t *length);
00622
00623
00624
00640 U_STABLE int32_t U_EXPORT2 usearch_first(UStringSearch *strsrch,
00641 UErrorCode *status);
00642
00664 U_STABLE int32_t U_EXPORT2 usearch_following(UStringSearch *strsrch,
00665 int32_t position,
00666 UErrorCode *status);
00667
00683 U_STABLE int32_t U_EXPORT2 usearch_last(UStringSearch *strsrch,
00684 UErrorCode *status);
00685
00711 U_STABLE int32_t U_EXPORT2 usearch_preceding(UStringSearch *strsrch,
00712 int32_t position,
00713 UErrorCode *status);
00714
00732 U_STABLE int32_t U_EXPORT2 usearch_next(UStringSearch *strsrch,
00733 UErrorCode *status);
00734
00752 U_STABLE int32_t U_EXPORT2 usearch_previous(UStringSearch *strsrch,
00753 UErrorCode *status);
00754
00765 U_STABLE void U_EXPORT2 usearch_reset(UStringSearch *strsrch);
00766
00767 #ifndef U_HIDE_INTERNAL_API
00768
00822 U_INTERNAL UBool U_EXPORT2 usearch_search(UStringSearch *strsrch,
00823 int32_t startIdx,
00824 int32_t *matchStart,
00825 int32_t *matchLimit,
00826 UErrorCode *status);
00827
00882 U_INTERNAL UBool U_EXPORT2 usearch_searchBackwards(UStringSearch *strsrch,
00883 int32_t startIdx,
00884 int32_t *matchStart,
00885 int32_t *matchLimit,
00886 UErrorCode *status);
00887 #endif
00888
00889 #endif
00890
00891 #endif