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,
00266 USEARCH_ANY_BASE_WEIGHT_IS_WILDCARD,
00267
00268 #ifndef U_HIDE_DEPRECATED_API
00269
00273 USEARCH_ATTRIBUTE_VALUE_COUNT
00274 #endif
00275 } USearchAttributeValue;
00276
00277
00278
00301 U_STABLE UStringSearch * U_EXPORT2 usearch_open(const UChar *pattern,
00302 int32_t patternlength,
00303 const UChar *text,
00304 int32_t textlength,
00305 const char *locale,
00306 UBreakIterator *breakiter,
00307 UErrorCode *status);
00308
00333 U_STABLE UStringSearch * U_EXPORT2 usearch_openFromCollator(
00334 const UChar *pattern,
00335 int32_t patternlength,
00336 const UChar *text,
00337 int32_t textlength,
00338 const UCollator *collator,
00339 UBreakIterator *breakiter,
00340 UErrorCode *status);
00341
00348 U_STABLE void U_EXPORT2 usearch_close(UStringSearch *searchiter);
00349
00350 #if U_SHOW_CPLUSPLUS_API
00351
00352 U_NAMESPACE_BEGIN
00353
00363 U_DEFINE_LOCAL_OPEN_POINTER(LocalUStringSearchPointer, UStringSearch, usearch_close);
00364
00365 U_NAMESPACE_END
00366
00367 #endif
00368
00369
00370
00386 U_STABLE void U_EXPORT2 usearch_setOffset(UStringSearch *strsrch,
00387 int32_t position,
00388 UErrorCode *status);
00389
00398 U_STABLE int32_t U_EXPORT2 usearch_getOffset(const UStringSearch *strsrch);
00399
00411 U_STABLE void U_EXPORT2 usearch_setAttribute(UStringSearch *strsrch,
00412 USearchAttribute attribute,
00413 USearchAttributeValue value,
00414 UErrorCode *status);
00415
00424 U_STABLE USearchAttributeValue U_EXPORT2 usearch_getAttribute(
00425 const UStringSearch *strsrch,
00426 USearchAttribute attribute);
00427
00447 U_STABLE int32_t U_EXPORT2 usearch_getMatchedStart(
00448 const UStringSearch *strsrch);
00449
00467 U_STABLE int32_t U_EXPORT2 usearch_getMatchedLength(
00468 const UStringSearch *strsrch);
00469
00495 U_STABLE int32_t U_EXPORT2 usearch_getMatchedText(const UStringSearch *strsrch,
00496 UChar *result,
00497 int32_t resultCapacity,
00498 UErrorCode *status);
00499
00500 #if !UCONFIG_NO_BREAK_ITERATION
00501
00517 U_STABLE void U_EXPORT2 usearch_setBreakIterator(UStringSearch *strsrch,
00518 UBreakIterator *breakiter,
00519 UErrorCode *status);
00520
00532 U_STABLE const UBreakIterator * U_EXPORT2 usearch_getBreakIterator(
00533 const UStringSearch *strsrch);
00534
00535 #endif
00536
00550 U_STABLE void U_EXPORT2 usearch_setText( UStringSearch *strsrch,
00551 const UChar *text,
00552 int32_t textlength,
00553 UErrorCode *status);
00554
00563 U_STABLE const UChar * U_EXPORT2 usearch_getText(const UStringSearch *strsrch,
00564 int32_t *length);
00565
00576 U_STABLE UCollator * U_EXPORT2 usearch_getCollator(
00577 const UStringSearch *strsrch);
00578
00589 U_STABLE void U_EXPORT2 usearch_setCollator( UStringSearch *strsrch,
00590 const UCollator *collator,
00591 UErrorCode *status);
00592
00605 U_STABLE void U_EXPORT2 usearch_setPattern( UStringSearch *strsrch,
00606 const UChar *pattern,
00607 int32_t patternlength,
00608 UErrorCode *status);
00609
00618 U_STABLE const UChar * U_EXPORT2 usearch_getPattern(
00619 const UStringSearch *strsrch,
00620 int32_t *length);
00621
00622
00623
00639 U_STABLE int32_t U_EXPORT2 usearch_first(UStringSearch *strsrch,
00640 UErrorCode *status);
00641
00663 U_STABLE int32_t U_EXPORT2 usearch_following(UStringSearch *strsrch,
00664 int32_t position,
00665 UErrorCode *status);
00666
00682 U_STABLE int32_t U_EXPORT2 usearch_last(UStringSearch *strsrch,
00683 UErrorCode *status);
00684
00710 U_STABLE int32_t U_EXPORT2 usearch_preceding(UStringSearch *strsrch,
00711 int32_t position,
00712 UErrorCode *status);
00713
00731 U_STABLE int32_t U_EXPORT2 usearch_next(UStringSearch *strsrch,
00732 UErrorCode *status);
00733
00751 U_STABLE int32_t U_EXPORT2 usearch_previous(UStringSearch *strsrch,
00752 UErrorCode *status);
00753
00764 U_STABLE void U_EXPORT2 usearch_reset(UStringSearch *strsrch);
00765
00766 #ifndef U_HIDE_INTERNAL_API
00767
00821 U_INTERNAL UBool U_EXPORT2 usearch_search(UStringSearch *strsrch,
00822 int32_t startIdx,
00823 int32_t *matchStart,
00824 int32_t *matchLimit,
00825 UErrorCode *status);
00826
00881 U_INTERNAL UBool U_EXPORT2 usearch_searchBackwards(UStringSearch *strsrch,
00882 int32_t startIdx,
00883 int32_t *matchStart,
00884 int32_t *matchLimit,
00885 UErrorCode *status);
00886 #endif
00887
00888 #endif
00889
00890 #endif