uregex.h

Go to the documentation of this file.
00001 /*
00002 **********************************************************************
00003 *   Copyright (C) 2004-2012, 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     
00075     UREGEX_LITERAL = 16,
00076 
00081     UREGEX_MULTILINE        = 8,
00082     
00088     UREGEX_UNIX_LINES = 1,
00089 
00097     UREGEX_UWORD            = 256,
00098 
00106      UREGEX_ERROR_ON_UNKNOWN_ESCAPES = 512
00107 
00108 }  URegexpFlag;
00109 
00132 U_STABLE URegularExpression * U_EXPORT2
00133 uregex_open( const  UChar          *pattern,
00134                     int32_t         patternLength,
00135                     uint32_t        flags,
00136                     UParseError    *pe,
00137                     UErrorCode     *status);
00138 
00162 U_STABLE URegularExpression *  U_EXPORT2
00163 uregex_openUText(UText          *pattern,
00164                  uint32_t        flags,
00165                  UParseError    *pe,
00166                  UErrorCode     *status);
00167 
00191 #if !UCONFIG_NO_CONVERSION
00192 U_STABLE URegularExpression * U_EXPORT2
00193 uregex_openC( const char           *pattern,
00194                     uint32_t        flags,
00195                     UParseError    *pe,
00196                     UErrorCode     *status);
00197 #endif
00198 
00199 
00200 
00208 U_STABLE void U_EXPORT2 
00209 uregex_close(URegularExpression *regexp);
00210 
00211 #if U_SHOW_CPLUSPLUS_API
00212 
00213 U_NAMESPACE_BEGIN
00214 
00224 U_DEFINE_LOCAL_OPEN_POINTER(LocalURegularExpressionPointer, URegularExpression, uregex_close);
00225 
00226 U_NAMESPACE_END
00227 
00228 #endif
00229 
00248 U_STABLE URegularExpression * U_EXPORT2 
00249 uregex_clone(const URegularExpression *regexp, UErrorCode *status);
00250 
00268 U_STABLE const UChar * U_EXPORT2 
00269 uregex_pattern(const URegularExpression *regexp,
00270                      int32_t            *patLength,
00271                      UErrorCode         *status);
00272 
00284 U_STABLE UText * U_EXPORT2 
00285 uregex_patternUText(const URegularExpression *regexp,
00286                           UErrorCode         *status);
00287 
00296 U_STABLE int32_t U_EXPORT2 
00297 uregex_flags(const  URegularExpression   *regexp,
00298                     UErrorCode           *status);
00299 
00300 
00321 U_STABLE void U_EXPORT2 
00322 uregex_setText(URegularExpression *regexp,
00323                const UChar        *text,
00324                int32_t             textLength,
00325                UErrorCode         *status);
00326 
00327 
00344 U_STABLE void U_EXPORT2 
00345 uregex_setUText(URegularExpression *regexp,
00346                 UText              *text,
00347                 UErrorCode         *status);
00348 
00369 U_STABLE const UChar * U_EXPORT2 
00370 uregex_getText(URegularExpression *regexp,
00371                int32_t            *textLength,
00372                UErrorCode         *status);
00373 
00390 U_STABLE UText * U_EXPORT2 
00391 uregex_getUText(URegularExpression *regexp,
00392                 UText              *dest,
00393                 UErrorCode         *status);
00394 
00420 U_STABLE void U_EXPORT2 
00421 uregex_refreshUText(URegularExpression *regexp,
00422                     UText              *text,
00423                     UErrorCode         *status);
00424 
00445 U_STABLE UBool U_EXPORT2 
00446 uregex_matches(URegularExpression *regexp,
00447                 int32_t            startIndex,
00448                 UErrorCode        *status);
00449 
00471 U_STABLE UBool U_EXPORT2 
00472 uregex_matches64(URegularExpression *regexp,
00473                  int64_t            startIndex,
00474                  UErrorCode        *status);
00475 
00499 U_STABLE UBool U_EXPORT2 
00500 uregex_lookingAt(URegularExpression *regexp,
00501                  int32_t             startIndex,
00502                  UErrorCode         *status);
00503 
00528 U_STABLE UBool U_EXPORT2 
00529 uregex_lookingAt64(URegularExpression *regexp,
00530                    int64_t             startIndex,
00531                    UErrorCode         *status);
00532 
00552 U_STABLE UBool U_EXPORT2 
00553 uregex_find(URegularExpression *regexp,
00554             int32_t             startIndex, 
00555             UErrorCode         *status);
00556 
00577 U_STABLE UBool U_EXPORT2 
00578 uregex_find64(URegularExpression *regexp,
00579               int64_t             startIndex, 
00580               UErrorCode         *status);
00581 
00595 U_STABLE UBool U_EXPORT2 
00596 uregex_findNext(URegularExpression *regexp,
00597                 UErrorCode         *status);
00598 
00606 U_STABLE int32_t U_EXPORT2 
00607 uregex_groupCount(URegularExpression *regexp,
00608                   UErrorCode         *status);
00609 
00626 U_STABLE int32_t U_EXPORT2 
00627 uregex_group(URegularExpression *regexp,
00628              int32_t             groupNum,
00629              UChar              *dest,
00630              int32_t             destCapacity,
00631              UErrorCode          *status);
00632 
00655 U_STABLE UText * U_EXPORT2 
00656 uregex_groupUText(URegularExpression *regexp,
00657                   int32_t             groupNum,
00658                   UText              *dest,
00659                   int64_t            *groupLength,
00660                   UErrorCode         *status);
00661 
00662 #ifndef U_HIDE_INTERNAL_API
00663 
00680 U_INTERNAL UText * U_EXPORT2 
00681 uregex_groupUTextDeep(URegularExpression *regexp,
00682                   int32_t             groupNum,
00683                   UText              *dest,
00684                   UErrorCode         *status);
00685 #endif  /* U_HIDE_INTERNAL_API */
00686 
00701 U_STABLE int32_t U_EXPORT2 
00702 uregex_start(URegularExpression *regexp,
00703              int32_t             groupNum,
00704              UErrorCode          *status);
00705 
00721 U_STABLE int64_t U_EXPORT2 
00722 uregex_start64(URegularExpression *regexp,
00723                int32_t             groupNum,
00724                UErrorCode          *status);
00725 
00739 U_STABLE int32_t U_EXPORT2 
00740 uregex_end(URegularExpression   *regexp,
00741            int32_t               groupNum,
00742            UErrorCode           *status);
00743 
00758 U_STABLE int64_t U_EXPORT2 
00759 uregex_end64(URegularExpression *regexp,
00760              int32_t               groupNum,
00761              UErrorCode           *status);
00762 
00776 U_STABLE void U_EXPORT2 
00777 uregex_reset(URegularExpression    *regexp,
00778              int32_t               index,
00779              UErrorCode            *status);
00780 
00795 U_STABLE void U_EXPORT2 
00796 uregex_reset64(URegularExpression  *regexp,
00797                int64_t               index,
00798                UErrorCode            *status);
00799 
00820 U_STABLE void U_EXPORT2
00821 uregex_setRegion(URegularExpression   *regexp,
00822                  int32_t               regionStart,
00823                  int32_t               regionLimit,
00824                  UErrorCode           *status);
00825 
00847 U_STABLE void U_EXPORT2 
00848 uregex_setRegion64(URegularExpression *regexp,
00849                  int64_t               regionStart,
00850                  int64_t               regionLimit,
00851                  UErrorCode           *status);
00852 
00867 U_STABLE void U_EXPORT2 
00868 uregex_setRegionAndStart(URegularExpression *regexp,
00869                  int64_t               regionStart,
00870                  int64_t               regionLimit,
00871                  int64_t               startIndex,
00872                  UErrorCode           *status);
00873 
00883 U_STABLE int32_t U_EXPORT2
00884 uregex_regionStart(const  URegularExpression   *regexp,
00885                           UErrorCode           *status);
00886 
00897 U_STABLE int64_t U_EXPORT2 
00898 uregex_regionStart64(const  URegularExpression   *regexp,
00899                             UErrorCode           *status);
00900 
00911 U_STABLE int32_t U_EXPORT2
00912 uregex_regionEnd(const  URegularExpression   *regexp,
00913                         UErrorCode           *status);
00914 
00926 U_STABLE int64_t U_EXPORT2 
00927 uregex_regionEnd64(const  URegularExpression   *regexp,
00928                           UErrorCode           *status);
00929 
00940 U_STABLE UBool U_EXPORT2
00941 uregex_hasTransparentBounds(const  URegularExpression   *regexp,
00942                                    UErrorCode           *status);
00943 
00944 
00964 U_STABLE void U_EXPORT2  
00965 uregex_useTransparentBounds(URegularExpression   *regexp, 
00966                             UBool                b,
00967                             UErrorCode           *status);
00968 
00969 
00979 U_STABLE UBool U_EXPORT2
00980 uregex_hasAnchoringBounds(const  URegularExpression   *regexp,
00981                                  UErrorCode           *status);
00982 
00983 
00997 U_STABLE void U_EXPORT2
00998 uregex_useAnchoringBounds(URegularExpression   *regexp,
00999                           UBool                 b,
01000                           UErrorCode           *status);
01001 
01012 U_STABLE UBool U_EXPORT2
01013 uregex_hitEnd(const  URegularExpression   *regexp,
01014                      UErrorCode           *status);
01015 
01027 U_STABLE UBool U_EXPORT2   
01028 uregex_requireEnd(const  URegularExpression   *regexp,
01029                          UErrorCode           *status);
01030 
01031 
01032 
01033 
01034 
01059 U_STABLE int32_t U_EXPORT2 
01060 uregex_replaceAll(URegularExpression    *regexp,
01061                   const UChar           *replacementText,
01062                   int32_t                replacementLength,
01063                   UChar                 *destBuf,
01064                   int32_t                destCapacity,
01065                   UErrorCode            *status);
01066 
01088 U_STABLE UText * U_EXPORT2 
01089 uregex_replaceAllUText(URegularExpression *regexp,
01090                        UText              *replacement,
01091                        UText              *dest,
01092                        UErrorCode         *status);
01093 
01118 U_STABLE int32_t U_EXPORT2 
01119 uregex_replaceFirst(URegularExpression  *regexp,
01120                     const UChar         *replacementText,
01121                     int32_t              replacementLength,
01122                     UChar               *destBuf,
01123                     int32_t              destCapacity,
01124                     UErrorCode          *status);
01125 
01147 U_STABLE UText * U_EXPORT2 
01148 uregex_replaceFirstUText(URegularExpression *regexp,
01149                          UText              *replacement,
01150                          UText              *dest,
01151                          UErrorCode         *status);
01152 
01199 U_STABLE int32_t U_EXPORT2 
01200 uregex_appendReplacement(URegularExpression    *regexp,
01201                          const UChar           *replacementText,
01202                          int32_t                replacementLength,
01203                          UChar                **destBuf,
01204                          int32_t               *destCapacity,
01205                          UErrorCode            *status);
01206 
01229 U_STABLE void U_EXPORT2 
01230 uregex_appendReplacementUText(URegularExpression    *regexp,
01231                               UText                 *replacementText,
01232                               UText                 *dest,
01233                               UErrorCode            *status);
01234 
01259 U_STABLE int32_t U_EXPORT2 
01260 uregex_appendTail(URegularExpression    *regexp,
01261                   UChar                **destBuf,
01262                   int32_t               *destCapacity,
01263                   UErrorCode            *status);
01264 
01283 U_STABLE UText * U_EXPORT2 
01284 uregex_appendTailUText(URegularExpression    *regexp,
01285                        UText                 *dest,
01286                        UErrorCode            *status);
01287 
01339 U_STABLE int32_t U_EXPORT2 
01340 uregex_split(   URegularExpression      *regexp,
01341                   UChar                 *destBuf,
01342                   int32_t                destCapacity,
01343                   int32_t               *requiredCapacity,
01344                   UChar                 *destFields[],
01345                   int32_t                destFieldsCapacity,
01346                   UErrorCode            *status);
01347 
01374 U_STABLE int32_t U_EXPORT2 
01375 uregex_splitUText(URegularExpression    *regexp,
01376                   UText                 *destFields[],
01377                   int32_t                destFieldsCapacity,
01378                   UErrorCode            *status);
01379 
01402 U_STABLE void U_EXPORT2
01403 uregex_setTimeLimit(URegularExpression      *regexp,
01404                     int32_t                  limit,
01405                     UErrorCode              *status);
01406 
01416 U_STABLE int32_t U_EXPORT2
01417 uregex_getTimeLimit(const URegularExpression      *regexp,
01418                           UErrorCode              *status);
01419 
01440 U_STABLE void U_EXPORT2
01441 uregex_setStackLimit(URegularExpression      *regexp,
01442                      int32_t                  limit,
01443                      UErrorCode              *status);
01444 
01452 U_STABLE int32_t U_EXPORT2
01453 uregex_getStackLimit(const URegularExpression      *regexp,
01454                            UErrorCode              *status);
01455 
01456 
01475 U_CDECL_BEGIN
01476 typedef UBool U_CALLCONV URegexMatchCallback (
01477                    const void *context,
01478                    int32_t     steps);
01479 U_CDECL_END
01480 
01495 U_STABLE void U_EXPORT2
01496 uregex_setMatchCallback(URegularExpression      *regexp,
01497                         URegexMatchCallback     *callback,
01498                         const void              *context,
01499                         UErrorCode              *status);
01500 
01501 
01513 U_STABLE void U_EXPORT2
01514 uregex_getMatchCallback(const URegularExpression    *regexp,
01515                         URegexMatchCallback        **callback,
01516                         const void                 **context,
01517                         UErrorCode                  *status);
01518 
01549 U_CDECL_BEGIN
01550 typedef UBool U_CALLCONV URegexFindProgressCallback (
01551                    const void *context,
01552                    int64_t     matchIndex);
01553 U_CDECL_END
01554 
01555 
01567 U_STABLE void U_EXPORT2
01568 uregex_setFindProgressCallback(URegularExpression              *regexp,
01569                                 URegexFindProgressCallback      *callback,
01570                                 const void                      *context,
01571                                 UErrorCode                      *status);
01572 
01584 U_STABLE void U_EXPORT2
01585 uregex_getFindProgressCallback(const URegularExpression          *regexp,
01586                                 URegexFindProgressCallback        **callback,
01587                                 const void                        **context,
01588                                 UErrorCode                        *status);
01589 
01590 #endif   /*  !UCONFIG_NO_REGULAR_EXPRESSIONS  */
01591 #endif   /*  UREGEX_H  */

Generated on 25 Nov 2014 for ICU 50.1.2 by  doxygen 1.4.7