usearch.h

Go to the documentation of this file.
00001 /*
00002 **********************************************************************
00003 *   Copyright (C) 2001-2005 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
00015 
00016 #include "unicode/ucol.h"
00017 #include "unicode/ucoleitr.h"
00018 #include "unicode/ubrk.h"
00019 
00136 #define USEARCH_DONE -1
00137 
00142 struct UStringSearch;
00147 typedef struct UStringSearch UStringSearch;
00148 
00152 typedef enum {
00154     USEARCH_OVERLAP,
00159     USEARCH_CANONICAL_MATCH,
00160     USEARCH_ATTRIBUTE_COUNT
00161 } USearchAttribute;
00162 
00166 typedef enum {
00168     USEARCH_DEFAULT = -1,
00170     USEARCH_OFF, 
00172     USEARCH_ON,
00173     USEARCH_ATTRIBUTE_VALUE_COUNT
00174 } USearchAttributeValue;
00175 
00176 /* open and close ------------------------------------------------------ */
00177 
00200 U_STABLE UStringSearch * U_EXPORT2 usearch_open(const UChar          *pattern, 
00201                                               int32_t         patternlength, 
00202                                         const UChar          *text, 
00203                                               int32_t         textlength,
00204                                         const char           *locale,
00205                                               UBreakIterator *breakiter,
00206                                               UErrorCode     *status);
00207 
00232 U_STABLE UStringSearch * U_EXPORT2 usearch_openFromCollator(
00233                                          const UChar *pattern, 
00234                                                int32_t         patternlength,
00235                                          const UChar          *text, 
00236                                                int32_t         textlength,
00237                                          const UCollator      *collator,
00238                                                UBreakIterator *breakiter,
00239                                                UErrorCode     *status);
00240 
00247 U_STABLE void U_EXPORT2 usearch_close(UStringSearch *searchiter);
00248 
00249 /* get and set methods -------------------------------------------------- */
00250 
00266 U_STABLE void U_EXPORT2 usearch_setOffset(UStringSearch *strsrch, 
00267                                         int32_t    position,
00268                                         UErrorCode    *status);
00269 
00278 U_STABLE int32_t U_EXPORT2 usearch_getOffset(const UStringSearch *strsrch);
00279     
00291 U_STABLE void U_EXPORT2 usearch_setAttribute(UStringSearch         *strsrch, 
00292                                            USearchAttribute       attribute,
00293                                            USearchAttributeValue  value,
00294                                            UErrorCode            *status);
00295 
00304 U_STABLE USearchAttributeValue U_EXPORT2 usearch_getAttribute(
00305                                          const UStringSearch    *strsrch,
00306                                                USearchAttribute  attribute);
00307 
00327 U_STABLE int32_t U_EXPORT2 usearch_getMatchedStart(
00328                                                const UStringSearch *strsrch);
00329     
00347 U_STABLE int32_t U_EXPORT2 usearch_getMatchedLength(
00348                                                const UStringSearch *strsrch);
00349 
00375 U_STABLE int32_t U_EXPORT2 usearch_getMatchedText(const UStringSearch *strsrch, 
00376                                             UChar         *result, 
00377                                             int32_t        resultCapacity, 
00378                                             UErrorCode    *status);
00379 
00380 #if !UCONFIG_NO_BREAK_ITERATION
00381 
00397 U_STABLE void U_EXPORT2 usearch_setBreakIterator(UStringSearch  *strsrch, 
00398                                                UBreakIterator *breakiter,
00399                                                UErrorCode     *status);
00400 
00412 U_STABLE const UBreakIterator * U_EXPORT2 usearch_getBreakIterator(
00413                                               const UStringSearch *strsrch);
00414     
00415 #endif
00416     
00430 U_STABLE void U_EXPORT2 usearch_setText(      UStringSearch *strsrch, 
00431                                       const UChar         *text,
00432                                             int32_t        textlength,
00433                                             UErrorCode    *status);
00434 
00443 U_STABLE const UChar * U_EXPORT2 usearch_getText(const UStringSearch *strsrch, 
00444                                                int32_t       *length);
00445 
00456 U_STABLE UCollator * U_EXPORT2 usearch_getCollator(
00457                                                const UStringSearch *strsrch);
00458 
00469 U_STABLE void U_EXPORT2 usearch_setCollator(      UStringSearch *strsrch, 
00470                                           const UCollator     *collator,
00471                                                 UErrorCode    *status);
00472 
00485 U_STABLE void U_EXPORT2 usearch_setPattern(      UStringSearch *strsrch, 
00486                                          const UChar         *pattern,
00487                                                int32_t        patternlength,
00488                                                UErrorCode    *status);
00489 
00498 U_STABLE const UChar * U_EXPORT2 usearch_getPattern(
00499                                                const UStringSearch *strsrch, 
00500                                                      int32_t       *length);
00501 
00502 /* methods ------------------------------------------------------------- */
00503 
00519 U_STABLE int32_t U_EXPORT2 usearch_first(UStringSearch *strsrch, 
00520                                            UErrorCode    *status);
00521 
00543 U_STABLE int32_t U_EXPORT2 usearch_following(UStringSearch *strsrch, 
00544                                                int32_t    position, 
00545                                                UErrorCode    *status);
00546     
00562 U_STABLE int32_t U_EXPORT2 usearch_last(UStringSearch *strsrch, 
00563                                           UErrorCode    *status);
00564 
00585 U_STABLE int32_t U_EXPORT2 usearch_preceding(UStringSearch *strsrch, 
00586                                                int32_t    position, 
00587                                                UErrorCode    *status);
00588     
00606 U_STABLE int32_t U_EXPORT2 usearch_next(UStringSearch *strsrch, 
00607                                           UErrorCode    *status);
00608 
00626 U_STABLE int32_t U_EXPORT2 usearch_previous(UStringSearch *strsrch, 
00627                                               UErrorCode    *status);
00628     
00639 U_STABLE void U_EXPORT2 usearch_reset(UStringSearch *strsrch);
00640 
00641 #endif /* #if !UCONFIG_NO_COLLATION */
00642 
00643 #endif

Generated on Mon Aug 13 07:17:24 2007 for ICU 3.6 by  doxygen 1.5.2