- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- Search for |

- File List
- Globals

# usearch.h

Go to the documentation of this file.

    00001 /*
    00002 **********************************************************************
    00003 *   Copyright (C) 2001-2008 IBM and others. All rights reserved.
    00004 **********************************************************************
    00005 *   Date        Name        Description
    00006 *  06/28/2001   synwee      Creation.
    00007 **********************************************************************
    00008 */
    00009 #ifndef USEARCH_H
    00010 #define USEARCH_H
    00011
    00012 #include "unicode/utypes.h"
    00013
    00014 #if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION
    00015
    00016 #include "unicode/ucol.h"
    00017 #include "unicode/ucoleitr.h"
    00018 #include "unicode/ubrk.h"
    00019
    00139 #define USEARCH_DONE -1
    00140
    00145 struct UStringSearch;
    00150 typedef struct UStringSearch UStringSearch;
    00151
    00155 typedef enum {
    00157     USEARCH_OVERLAP,
    00162     USEARCH_CANONICAL_MATCH,
    00163     USEARCH_ATTRIBUTE_COUNT
    00164 } USearchAttribute;
    00165
    00169 typedef enum {
    00171     USEARCH_DEFAULT = -1,
    00173     USEARCH_OFF,
    00175     USEARCH_ON,
    00176     USEARCH_ATTRIBUTE_VALUE_COUNT
    00177 } USearchAttributeValue;
    00178
    00179 /* open and close ------------------------------------------------------ */
    00180
    00203 U_STABLE UStringSearch * U_EXPORT2 usearch_open(const UChar          *pattern,
    00204                                               int32_t         patternlength,
    00205                                         const UChar          *text,
    00206                                               int32_t         textlength,
    00207                                         const char           *locale,
    00208                                               UBreakIterator *breakiter,
    00209                                               UErrorCode     *status);
    00210
    00235 U_STABLE UStringSearch * U_EXPORT2 usearch_openFromCollator(
    00236                                          const UChar *pattern,
    00237                                                int32_t         patternlength,
    00238                                          const UChar          *text,
    00239                                                int32_t         textlength,
    00240                                          const UCollator      *collator,
    00241                                                UBreakIterator *breakiter,
    00242                                                UErrorCode     *status);
    00243
    00250 U_STABLE void U_EXPORT2 usearch_close(UStringSearch *searchiter);
    00251
    00252 /* get and set methods -------------------------------------------------- */
    00253
    00269 U_STABLE void U_EXPORT2 usearch_setOffset(UStringSearch *strsrch,
    00270                                         int32_t    position,
    00271                                         UErrorCode    *status);
    00272
    00281 U_STABLE int32_t U_EXPORT2 usearch_getOffset(const UStringSearch *strsrch);
    00282
    00294 U_STABLE void U_EXPORT2 usearch_setAttribute(UStringSearch         *strsrch,
    00295                                            USearchAttribute       attribute,
    00296                                            USearchAttributeValue  value,
    00297                                            UErrorCode            *status);
    00298
    00307 U_STABLE USearchAttributeValue U_EXPORT2 usearch_getAttribute(
    00308                                          const UStringSearch    *strsrch,
    00309                                                USearchAttribute  attribute);
    00310
    00330 U_STABLE int32_t U_EXPORT2 usearch_getMatchedStart(
    00331                                                const UStringSearch *strsrch);
    00332
    00350 U_STABLE int32_t U_EXPORT2 usearch_getMatchedLength(
    00351                                                const UStringSearch *strsrch);
    00352
    00378 U_STABLE int32_t U_EXPORT2 usearch_getMatchedText(const UStringSearch *strsrch,
    00379                                             UChar         *result,
    00380                                             int32_t        resultCapacity,
    00381                                             UErrorCode    *status);
    00382
    00383 #if !UCONFIG_NO_BREAK_ITERATION
    00384
    00400 U_STABLE void U_EXPORT2 usearch_setBreakIterator(UStringSearch  *strsrch,
    00401                                                UBreakIterator *breakiter,
    00402                                                UErrorCode     *status);
    00403
    00415 U_STABLE const UBreakIterator * U_EXPORT2 usearch_getBreakIterator(
    00416                                               const UStringSearch *strsrch);
    00417
    00418 #endif
    00419
    00433 U_STABLE void U_EXPORT2 usearch_setText(      UStringSearch *strsrch,
    00434                                       const UChar         *text,
    00435                                             int32_t        textlength,
    00436                                             UErrorCode    *status);
    00437
    00446 U_STABLE const UChar * U_EXPORT2 usearch_getText(const UStringSearch *strsrch,
    00447                                                int32_t       *length);
    00448
    00459 U_STABLE UCollator * U_EXPORT2 usearch_getCollator(
    00460                                                const UStringSearch *strsrch);
    00461
    00472 U_STABLE void U_EXPORT2 usearch_setCollator(      UStringSearch *strsrch,
    00473                                           const UCollator     *collator,
    00474                                                 UErrorCode    *status);
    00475
    00488 U_STABLE void U_EXPORT2 usearch_setPattern(      UStringSearch *strsrch,
    00489                                          const UChar         *pattern,
    00490                                                int32_t        patternlength,
    00491                                                UErrorCode    *status);
    00492
    00501 U_STABLE const UChar * U_EXPORT2 usearch_getPattern(
    00502                                                const UStringSearch *strsrch,
    00503                                                      int32_t       *length);
    00504
    00505 /* methods ------------------------------------------------------------- */
    00506
    00522 U_STABLE int32_t U_EXPORT2 usearch_first(UStringSearch *strsrch,
    00523                                            UErrorCode    *status);
    00524
    00546 U_STABLE int32_t U_EXPORT2 usearch_following(UStringSearch *strsrch,
    00547                                                int32_t    position,
    00548                                                UErrorCode    *status);
    00549
    00565 U_STABLE int32_t U_EXPORT2 usearch_last(UStringSearch *strsrch,
    00566                                           UErrorCode    *status);
    00567
    00588 U_STABLE int32_t U_EXPORT2 usearch_preceding(UStringSearch *strsrch,
    00589                                                int32_t    position,
    00590                                                UErrorCode    *status);
    00591
    00609 U_STABLE int32_t U_EXPORT2 usearch_next(UStringSearch *strsrch,
    00610                                           UErrorCode    *status);
    00611
    00629 U_STABLE int32_t U_EXPORT2 usearch_previous(UStringSearch *strsrch,
    00630                                               UErrorCode    *status);
    00631
    00642 U_STABLE void U_EXPORT2 usearch_reset(UStringSearch *strsrch);
    00643
    00698 U_INTERNAL UBool U_EXPORT2 usearch_search(UStringSearch *strsrch,
    00699                                           int32_t        startIdx,
    00700                                           int32_t        *matchStart,
    00701                                           int32_t        *matchLimit,
    00702                                           UErrorCode     *status);
    00703
    00758 U_INTERNAL UBool U_EXPORT2 usearch_searchBackwards(UStringSearch *strsrch,
    00759                                                    int32_t        startIdx,
    00760                                                    int32_t        *matchStart,
    00761                                                    int32_t        *matchLimit,
    00762                                                    UErrorCode     *status);
    00763
    00764 #endif /* #if !UCONFIG_NO_COLLATION  && !UCONFIG_NO_BREAK_ITERATION */
    00765
    00766 #endif