ICU 4.8.1.1  4.8.1.1
uregex.h
Go to the documentation of this file.
00001 /*
00002 **********************************************************************
00003 *   Copyright (C) 2004-2011, International Business Machines
00004 *   Corporation and others.  All Rights Reserved.
00005 **********************************************************************
00006 *   file name:  uregex.h
00007 *   encoding:   US-ASCII
00008 *   indentation:4
00009 *
00010 *   created on: 2004mar09
00011 *   created by: Andy Heninger
00012 *
00013 *   ICU Regular Expressions, API for C
00014 */
00015 
00023 #ifndef UREGEX_H
00024 #define UREGEX_H
00025 
00026 #include "unicode/utext.h"
00027 #include "unicode/utypes.h"
00028 
00029 #if !UCONFIG_NO_REGULAR_EXPRESSIONS
00030 
00031 #include "unicode/localpointer.h"
00032 #include "unicode/parseerr.h"
00033 
00034 struct URegularExpression;
00040 typedef struct URegularExpression URegularExpression;
00041 
00042 
00047 typedef enum URegexpFlag{
00048 
00049 #ifndef U_HIDE_DRAFT_API 
00050 
00053     UREGEX_CANON_EQ         = 128,
00054 #endif
00055 
00056     UREGEX_CASE_INSENSITIVE = 2,
00057 
00059     UREGEX_COMMENTS         = 4,
00060 
00063     UREGEX_DOTALL           = 32,
00064     
00076     UREGEX_LITERAL = 16,
00077 
00082     UREGEX_MULTILINE        = 8,
00083     
00089     UREGEX_UNIX_LINES = 1,
00090 
00098     UREGEX_UWORD            = 256,
00099 
00107      UREGEX_ERROR_ON_UNKNOWN_ESCAPES = 512
00108 
00109 }  URegexpFlag;
00110 
00133 U_STABLE URegularExpression * U_EXPORT2
00134 uregex_open( const  UChar          *pattern,
00135                     int32_t         patternLength,
00136                     uint32_t        flags,
00137                     UParseError    *pe,
00138                     UErrorCode     *status);
00139                     
00163 U_DRAFT URegularExpression *  U_EXPORT2
00164 uregex_openUText(UText          *pattern,
00165                  uint32_t        flags,
00166                  UParseError    *pe,
00167                  UErrorCode     *status);
00168     
00192 #if !UCONFIG_NO_CONVERSION
00193 U_STABLE URegularExpression * U_EXPORT2
00194 uregex_openC( const char           *pattern,
00195                     uint32_t        flags,
00196                     UParseError    *pe,
00197                     UErrorCode     *status);
00198 #endif
00199 
00200 
00201 
00209 U_STABLE void U_EXPORT2 
00210 uregex_close(URegularExpression *regexp);
00211 
00212 #if U_SHOW_CPLUSPLUS_API
00213 
00214 U_NAMESPACE_BEGIN
00215 
00225 U_DEFINE_LOCAL_OPEN_POINTER(LocalURegularExpressionPointer, URegularExpression, uregex_close);
00226 
00227 U_NAMESPACE_END
00228 
00229 #endif
00230 
00249 U_STABLE URegularExpression * U_EXPORT2 
00250 uregex_clone(const URegularExpression *regexp, UErrorCode *status);
00251 
00269 U_STABLE const UChar * U_EXPORT2 
00270 uregex_pattern(const URegularExpression *regexp,
00271                      int32_t            *patLength,
00272                      UErrorCode         *status);
00273 
00285 U_DRAFT UText * U_EXPORT2 
00286 uregex_patternUText(const URegularExpression *regexp,
00287                           UErrorCode         *status);
00288 
00289 
00298 U_STABLE int32_t U_EXPORT2 
00299 uregex_flags(const  URegularExpression   *regexp,
00300                     UErrorCode           *status);
00301 
00302 
00323 U_STABLE void U_EXPORT2 
00324 uregex_setText(URegularExpression *regexp,
00325                const UChar        *text,
00326                int32_t             textLength,
00327                UErrorCode         *status);
00328 
00329 
00346 U_DRAFT void U_EXPORT2 
00347 uregex_setUText(URegularExpression *regexp,
00348                 UText              *text,
00349                 UErrorCode         *status);
00350 
00371 U_STABLE const UChar * U_EXPORT2 
00372 uregex_getText(URegularExpression *regexp,
00373                int32_t            *textLength,
00374                UErrorCode         *status);
00375                
00376                
00393 U_DRAFT UText * U_EXPORT2 
00394 uregex_getUText(URegularExpression *regexp,
00395                 UText              *dest,
00396                 UErrorCode         *status);
00397 
00423 U_DRAFT void U_EXPORT2 
00424 uregex_refreshUText(URegularExpression *regexp,
00425                     UText              *text,
00426                     UErrorCode         *status);
00427 
00448 U_STABLE UBool U_EXPORT2 
00449 uregex_matches(URegularExpression *regexp,
00450                 int32_t            startIndex,
00451                 UErrorCode        *status);
00452 
00474 U_DRAFT UBool U_EXPORT2 
00475 uregex_matches64(URegularExpression *regexp,
00476                  int64_t            startIndex,
00477                  UErrorCode        *status);
00478 
00502 U_STABLE UBool U_EXPORT2 
00503 uregex_lookingAt(URegularExpression *regexp,
00504                  int32_t             startIndex,
00505                  UErrorCode         *status);
00506 
00531 U_DRAFT UBool U_EXPORT2 
00532 uregex_lookingAt64(URegularExpression *regexp,
00533                    int64_t             startIndex,
00534                    UErrorCode         *status);
00535 
00555 U_STABLE UBool U_EXPORT2 
00556 uregex_find(URegularExpression *regexp,
00557             int32_t             startIndex, 
00558             UErrorCode         *status);
00559 
00580 U_DRAFT UBool U_EXPORT2 
00581 uregex_find64(URegularExpression *regexp,
00582               int64_t             startIndex, 
00583               UErrorCode         *status);
00584 
00598 U_STABLE UBool U_EXPORT2 
00599 uregex_findNext(URegularExpression *regexp,
00600                 UErrorCode         *status);
00601 
00609 U_STABLE int32_t U_EXPORT2 
00610 uregex_groupCount(URegularExpression *regexp,
00611                   UErrorCode         *status);
00612 
00629 U_STABLE int32_t U_EXPORT2 
00630 uregex_group(URegularExpression *regexp,
00631              int32_t             groupNum,
00632              UChar              *dest,
00633              int32_t             destCapacity,
00634              UErrorCode          *status);
00635 
00636 
00659 U_DRAFT UText * U_EXPORT2 
00660 uregex_groupUText(URegularExpression *regexp,
00661                   int32_t             groupNum,
00662                   UText              *dest,
00663                   int64_t            *groupLength,
00664                   UErrorCode         *status);
00665 
00666 
00684 U_INTERNAL UText * U_EXPORT2 
00685 uregex_groupUTextDeep(URegularExpression *regexp,
00686                   int32_t             groupNum,
00687                   UText              *dest,
00688                   UErrorCode         *status);
00689 
00704 U_STABLE int32_t U_EXPORT2 
00705 uregex_start(URegularExpression *regexp,
00706              int32_t             groupNum,
00707              UErrorCode          *status);
00708 
00724 U_DRAFT int64_t U_EXPORT2 
00725 uregex_start64(URegularExpression *regexp,
00726                int32_t             groupNum,
00727                UErrorCode          *status);
00728 
00742 U_STABLE int32_t U_EXPORT2 
00743 uregex_end(URegularExpression   *regexp,
00744            int32_t               groupNum,
00745            UErrorCode           *status);
00746 
00761 U_DRAFT int64_t U_EXPORT2 
00762 uregex_end64(URegularExpression *regexp,
00763              int32_t               groupNum,
00764              UErrorCode           *status);
00765 
00779 U_STABLE void U_EXPORT2 
00780 uregex_reset(URegularExpression    *regexp,
00781              int32_t               index,
00782              UErrorCode            *status);
00783              
00798 U_DRAFT void U_EXPORT2 
00799 uregex_reset64(URegularExpression  *regexp,
00800                int64_t               index,
00801                UErrorCode            *status);
00802 
00823 U_STABLE void U_EXPORT2
00824 uregex_setRegion(URegularExpression   *regexp,
00825                  int32_t               regionStart,
00826                  int32_t               regionLimit,
00827                  UErrorCode           *status);
00828 
00850 U_DRAFT void U_EXPORT2 
00851 uregex_setRegion64(URegularExpression *regexp,
00852                  int64_t               regionStart,
00853                  int64_t               regionLimit,
00854                  UErrorCode           *status);
00855 
00870 U_DRAFT void U_EXPORT2 
00871 uregex_setRegionAndStart(URegularExpression *regexp,
00872                  int64_t               regionStart,
00873                  int64_t               regionLimit,
00874                  int64_t               startIndex,
00875                  UErrorCode           *status);
00876 
00886 U_STABLE int32_t U_EXPORT2
00887 uregex_regionStart(const  URegularExpression   *regexp,
00888                           UErrorCode           *status);
00889 
00900 U_DRAFT int64_t U_EXPORT2 
00901 uregex_regionStart64(const  URegularExpression   *regexp,
00902                             UErrorCode           *status);
00903 
00914 U_STABLE int32_t U_EXPORT2
00915 uregex_regionEnd(const  URegularExpression   *regexp,
00916                         UErrorCode           *status);
00917 
00929 U_DRAFT int64_t U_EXPORT2 
00930 uregex_regionEnd64(const  URegularExpression   *regexp,
00931                           UErrorCode           *status);
00932 
00943 U_STABLE UBool U_EXPORT2
00944 uregex_hasTransparentBounds(const  URegularExpression   *regexp,
00945                                    UErrorCode           *status);
00946 
00947 
00967 U_STABLE void U_EXPORT2  
00968 uregex_useTransparentBounds(URegularExpression   *regexp, 
00969                             UBool                b,
00970                             UErrorCode           *status);
00971 
00972 
00982 U_STABLE UBool U_EXPORT2
00983 uregex_hasAnchoringBounds(const  URegularExpression   *regexp,
00984                                  UErrorCode           *status);
00985 
00986 
01000 U_STABLE void U_EXPORT2
01001 uregex_useAnchoringBounds(URegularExpression   *regexp,
01002                           UBool                 b,
01003                           UErrorCode           *status);
01004 
01015 U_STABLE UBool U_EXPORT2
01016 uregex_hitEnd(const  URegularExpression   *regexp,
01017                      UErrorCode           *status);
01018 
01030 U_STABLE UBool U_EXPORT2   
01031 uregex_requireEnd(const  URegularExpression   *regexp,
01032                          UErrorCode           *status);
01033 
01034 
01035 
01036 
01037 
01062 U_STABLE int32_t U_EXPORT2 
01063 uregex_replaceAll(URegularExpression    *regexp,
01064                   const UChar           *replacementText,
01065                   int32_t                replacementLength,
01066                   UChar                 *destBuf,
01067                   int32_t                destCapacity,
01068                   UErrorCode            *status);
01069 
01091 U_DRAFT UText * U_EXPORT2 
01092 uregex_replaceAllUText(URegularExpression *regexp,
01093                        UText              *replacement,
01094                        UText              *dest,
01095                        UErrorCode         *status);
01096 
01121 U_STABLE int32_t U_EXPORT2 
01122 uregex_replaceFirst(URegularExpression  *regexp,
01123                     const UChar         *replacementText,
01124                     int32_t              replacementLength,
01125                     UChar               *destBuf,
01126                     int32_t              destCapacity,
01127                     UErrorCode          *status);
01128 
01150 U_DRAFT UText * U_EXPORT2 
01151 uregex_replaceFirstUText(URegularExpression *regexp,
01152                          UText              *replacement,
01153                          UText              *dest,
01154                          UErrorCode         *status);
01155 
01156 
01203 U_STABLE int32_t U_EXPORT2 
01204 uregex_appendReplacement(URegularExpression    *regexp,
01205                          const UChar           *replacementText,
01206                          int32_t                replacementLength,
01207                          UChar                **destBuf,
01208                          int32_t               *destCapacity,
01209                          UErrorCode            *status);
01210 
01211 
01234 U_DRAFT void U_EXPORT2 
01235 uregex_appendReplacementUText(URegularExpression    *regexp,
01236                               UText                 *replacementText,
01237                               UText                 *dest,
01238                               UErrorCode            *status);
01239 
01240 
01265 U_STABLE int32_t U_EXPORT2 
01266 uregex_appendTail(URegularExpression    *regexp,
01267                   UChar                **destBuf,
01268                   int32_t               *destCapacity,
01269                   UErrorCode            *status);
01270                   
01271 
01290 U_DRAFT UText * U_EXPORT2 
01291 uregex_appendTailUText(URegularExpression    *regexp,
01292                        UText                 *dest,
01293                        UErrorCode            *status);
01294 
01295 
01296 
01348 U_STABLE int32_t U_EXPORT2 
01349 uregex_split(   URegularExpression      *regexp,
01350                   UChar                 *destBuf,
01351                   int32_t                destCapacity,
01352                   int32_t               *requiredCapacity,
01353                   UChar                 *destFields[],
01354                   int32_t                destFieldsCapacity,
01355                   UErrorCode            *status);
01356 
01357 
01384 U_DRAFT int32_t U_EXPORT2 
01385 uregex_splitUText(URegularExpression    *regexp,
01386                   UText                 *destFields[],
01387                   int32_t                destFieldsCapacity,
01388                   UErrorCode            *status);
01389 
01390 
01391 
01392 
01415 U_STABLE void U_EXPORT2
01416 uregex_setTimeLimit(URegularExpression      *regexp,
01417                     int32_t                  limit,
01418                     UErrorCode              *status);
01419 
01429 U_STABLE int32_t U_EXPORT2
01430 uregex_getTimeLimit(const URegularExpression      *regexp,
01431                           UErrorCode              *status);
01432 
01453 U_STABLE void U_EXPORT2
01454 uregex_setStackLimit(URegularExpression      *regexp,
01455                      int32_t                  limit,
01456                      UErrorCode              *status);
01457 
01465 U_STABLE int32_t U_EXPORT2
01466 uregex_getStackLimit(const URegularExpression      *regexp,
01467                            UErrorCode              *status);
01468 
01469 
01488 U_CDECL_BEGIN
01489 typedef UBool U_CALLCONV URegexMatchCallback (
01490                    const void *context,
01491                    int32_t     steps);
01492 U_CDECL_END
01493 
01508 U_STABLE void U_EXPORT2
01509 uregex_setMatchCallback(URegularExpression      *regexp,
01510                         URegexMatchCallback     *callback,
01511                         const void              *context,
01512                         UErrorCode              *status);
01513 
01514 
01526 U_STABLE void U_EXPORT2
01527 uregex_getMatchCallback(const URegularExpression    *regexp,
01528                         URegexMatchCallback        **callback,
01529                         const void                 **context,
01530                         UErrorCode                  *status);
01531 
01532 
01563 U_CDECL_BEGIN
01564 typedef UBool U_CALLCONV URegexFindProgressCallback (
01565                    const void *context,
01566                    int64_t     matchIndex);
01567 U_CDECL_END
01568 
01580 U_DRAFT void U_EXPORT2
01581 uregex_setFindProgressCallback(URegularExpression              *regexp,
01582                                 URegexFindProgressCallback      *callback,
01583                                 const void                      *context,
01584                                 UErrorCode                      *status);
01585 
01586 
01598 U_DRAFT void U_EXPORT2
01599 uregex_getFindProgressCallback(const URegularExpression          *regexp,
01600                                 URegexFindProgressCallback        **callback,
01601                                 const void                        **context,
01602                                 UErrorCode                        *status);
01603 
01604 #endif   /*  !UCONFIG_NO_REGULAR_EXPRESSIONS  */
01605 #endif   /*  UREGEX_H  */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines