ICU 4.6  4.6
uregex.h
Go to the documentation of this file.
00001 /*
00002 **********************************************************************
00003 *   Copyright (C) 2004-2010, 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 
00418 U_STABLE UBool U_EXPORT2 
00419 uregex_matches(URegularExpression *regexp,
00420                 int32_t            startIndex,
00421                 UErrorCode        *status);
00422 
00427 U_DRAFT UBool U_EXPORT2 
00428 uregex_matches64(URegularExpression *regexp,
00429                  int64_t            startIndex,
00430                  UErrorCode        *status);
00431 
00455 U_STABLE UBool U_EXPORT2 
00456 uregex_lookingAt(URegularExpression *regexp,
00457                  int32_t             startIndex,
00458                  UErrorCode         *status);
00459 
00464 U_DRAFT UBool U_EXPORT2 
00465 uregex_lookingAt64(URegularExpression *regexp,
00466                    int64_t             startIndex,
00467                    UErrorCode         *status);
00468 
00488 U_STABLE UBool U_EXPORT2 
00489 uregex_find(URegularExpression *regexp,
00490             int32_t             startIndex, 
00491             UErrorCode         *status);
00492 
00497 U_DRAFT UBool U_EXPORT2 
00498 uregex_find64(URegularExpression *regexp,
00499               int64_t             startIndex, 
00500               UErrorCode         *status);
00501 
00515 U_STABLE UBool U_EXPORT2 
00516 uregex_findNext(URegularExpression *regexp,
00517                 UErrorCode         *status);
00518 
00526 U_STABLE int32_t U_EXPORT2 
00527 uregex_groupCount(URegularExpression *regexp,
00528                   UErrorCode         *status);
00529 
00546 U_STABLE int32_t U_EXPORT2 
00547 uregex_group(URegularExpression *regexp,
00548              int32_t             groupNum,
00549              UChar              *dest,
00550              int32_t             destCapacity,
00551              UErrorCode          *status);
00552 
00553 
00576 U_DRAFT UText * U_EXPORT2 
00577 uregex_groupUText(URegularExpression *regexp,
00578                   int32_t             groupNum,
00579                   UText              *dest,
00580                   int64_t            *groupLength,
00581                   UErrorCode         *status);
00582 
00583 
00601 U_INTERNAL UText * U_EXPORT2 
00602 uregex_groupUTextDeep(URegularExpression *regexp,
00603                   int32_t             groupNum,
00604                   UText              *dest,
00605                   UErrorCode         *status);
00606 
00621 U_STABLE int32_t U_EXPORT2 
00622 uregex_start(URegularExpression *regexp,
00623              int32_t             groupNum,
00624              UErrorCode          *status);
00625 
00630 U_DRAFT int64_t U_EXPORT2 
00631 uregex_start64(URegularExpression *regexp,
00632                int32_t             groupNum,
00633                UErrorCode          *status);
00634 
00648 U_STABLE int32_t U_EXPORT2 
00649 uregex_end(URegularExpression   *regexp,
00650            int32_t               groupNum,
00651            UErrorCode           *status);
00652 
00657 U_DRAFT int64_t U_EXPORT2 
00658 uregex_end64(URegularExpression *regexp,
00659              int32_t               groupNum,
00660              UErrorCode           *status);
00661 
00675 U_STABLE void U_EXPORT2 
00676 uregex_reset(URegularExpression    *regexp,
00677              int32_t               index,
00678              UErrorCode            *status);
00679              
00684 U_DRAFT void U_EXPORT2 
00685 uregex_reset64(URegularExpression  *regexp,
00686                int64_t               index,
00687                UErrorCode            *status);
00688 
00708 U_STABLE void U_EXPORT2
00709 uregex_setRegion(URegularExpression   *regexp,
00710                  int32_t               regionStart,
00711                  int32_t               regionLimit,
00712                  UErrorCode           *status);
00713 
00718 U_DRAFT void U_EXPORT2 
00719 uregex_setRegion64(URegularExpression *regexp,
00720                  int64_t               regionStart,
00721                  int64_t               regionLimit,
00722                  UErrorCode           *status);
00723 
00729 U_DRAFT void U_EXPORT2 
00730 uregex_setRegionAndStart(URegularExpression *regexp,
00731                  int64_t               regionStart,
00732                  int64_t               regionLimit,
00733                  int64_t               startIndex,
00734                  UErrorCode           *status);
00735 
00745 U_STABLE int32_t U_EXPORT2
00746 uregex_regionStart(const  URegularExpression   *regexp,
00747                           UErrorCode           *status);
00748 
00753 U_DRAFT int64_t U_EXPORT2 
00754 uregex_regionStart64(const  URegularExpression   *regexp,
00755                             UErrorCode           *status);
00756 
00767 U_STABLE int32_t U_EXPORT2
00768 uregex_regionEnd(const  URegularExpression   *regexp,
00769                         UErrorCode           *status);
00770 
00775 U_DRAFT int64_t U_EXPORT2 
00776 uregex_regionEnd64(const  URegularExpression   *regexp,
00777                           UErrorCode           *status);
00778 
00789 U_STABLE UBool U_EXPORT2
00790 uregex_hasTransparentBounds(const  URegularExpression   *regexp,
00791                                    UErrorCode           *status);
00792 
00793 
00813 U_STABLE void U_EXPORT2  
00814 uregex_useTransparentBounds(URegularExpression   *regexp, 
00815                             UBool                b,
00816                             UErrorCode           *status);
00817 
00818 
00828 U_STABLE UBool U_EXPORT2
00829 uregex_hasAnchoringBounds(const  URegularExpression   *regexp,
00830                                  UErrorCode           *status);
00831 
00832 
00846 U_STABLE void U_EXPORT2
00847 uregex_useAnchoringBounds(URegularExpression   *regexp,
00848                           UBool                 b,
00849                           UErrorCode           *status);
00850 
00861 U_STABLE UBool U_EXPORT2
00862 uregex_hitEnd(const  URegularExpression   *regexp,
00863                      UErrorCode           *status);
00864 
00876 U_STABLE UBool U_EXPORT2   
00877 uregex_requireEnd(const  URegularExpression   *regexp,
00878                          UErrorCode           *status);
00879 
00880 
00881 
00882 
00883 
00908 U_STABLE int32_t U_EXPORT2 
00909 uregex_replaceAll(URegularExpression    *regexp,
00910                   const UChar           *replacementText,
00911                   int32_t                replacementLength,
00912                   UChar                 *destBuf,
00913                   int32_t                destCapacity,
00914                   UErrorCode            *status);
00915 
00937 U_DRAFT UText * U_EXPORT2 
00938 uregex_replaceAllUText(URegularExpression *regexp,
00939                        UText              *replacement,
00940                        UText              *dest,
00941                        UErrorCode         *status);
00942 
00967 U_STABLE int32_t U_EXPORT2 
00968 uregex_replaceFirst(URegularExpression  *regexp,
00969                     const UChar         *replacementText,
00970                     int32_t              replacementLength,
00971                     UChar               *destBuf,
00972                     int32_t              destCapacity,
00973                     UErrorCode          *status);
00974 
00996 U_DRAFT UText * U_EXPORT2 
00997 uregex_replaceFirstUText(URegularExpression *regexp,
00998                          UText              *replacement,
00999                          UText              *dest,
01000                          UErrorCode         *status);
01001 
01002 
01049 U_STABLE int32_t U_EXPORT2 
01050 uregex_appendReplacement(URegularExpression    *regexp,
01051                          const UChar           *replacementText,
01052                          int32_t                replacementLength,
01053                          UChar                **destBuf,
01054                          int32_t               *destCapacity,
01055                          UErrorCode            *status);
01056 
01057 
01080 U_DRAFT void U_EXPORT2 
01081 uregex_appendReplacementUText(URegularExpression    *regexp,
01082                               UText                 *replacementText,
01083                               UText                 *dest,
01084                               UErrorCode            *status);
01085 
01086 
01111 U_STABLE int32_t U_EXPORT2 
01112 uregex_appendTail(URegularExpression    *regexp,
01113                   UChar                **destBuf,
01114                   int32_t               *destCapacity,
01115                   UErrorCode            *status);
01116                   
01117 
01133 U_DRAFT UText * U_EXPORT2 
01134 uregex_appendTailUText(URegularExpression    *regexp,
01135                        UText                 *dest,
01136                        UErrorCode            *status);
01137 
01138 
01139 
01194 U_STABLE int32_t U_EXPORT2 
01195 uregex_split(   URegularExpression      *regexp,
01196                   UChar                 *destBuf,
01197                   int32_t                destCapacity,
01198                   int32_t               *requiredCapacity,
01199                   UChar                 *destFields[],
01200                   int32_t                destFieldsCapacity,
01201                   UErrorCode            *status);
01202 
01203 
01230 U_DRAFT int32_t U_EXPORT2 
01231 uregex_splitUText(URegularExpression    *regexp,
01232                   UText                 *destFields[],
01233                   int32_t                destFieldsCapacity,
01234                   UErrorCode            *status);
01235 
01236 
01237 
01238 
01261 U_STABLE void U_EXPORT2
01262 uregex_setTimeLimit(URegularExpression      *regexp,
01263                     int32_t                  limit,
01264                     UErrorCode              *status);
01265 
01275 U_STABLE int32_t U_EXPORT2
01276 uregex_getTimeLimit(const URegularExpression      *regexp,
01277                           UErrorCode              *status);
01278 
01299 U_STABLE void U_EXPORT2
01300 uregex_setStackLimit(URegularExpression      *regexp,
01301                      int32_t                  limit,
01302                      UErrorCode              *status);
01303 
01311 U_STABLE int32_t U_EXPORT2
01312 uregex_getStackLimit(const URegularExpression      *regexp,
01313                            UErrorCode              *status);
01314 
01315 
01334 U_CDECL_BEGIN
01335 typedef UBool U_CALLCONV URegexMatchCallback (
01336                    const void *context,
01337                    int32_t     steps);
01338 U_CDECL_END
01339 
01354 U_STABLE void U_EXPORT2
01355 uregex_setMatchCallback(URegularExpression      *regexp,
01356                         URegexMatchCallback     *callback,
01357                         const void              *context,
01358                         UErrorCode              *status);
01359 
01360 
01372 U_STABLE void U_EXPORT2
01373 uregex_getMatchCallback(const URegularExpression    *regexp,
01374                         URegexMatchCallback        **callback,
01375                         const void                 **context,
01376                         UErrorCode                  *status);
01377 
01378 
01409 U_CDECL_BEGIN
01410 typedef UBool U_CALLCONV URegexFindProgressCallback (
01411                    const void *context,
01412                    int64_t     matchIndex);
01413 U_CDECL_END
01414 
01426 U_DRAFT void U_EXPORT2
01427 uregex_setFindProgressCallback(URegularExpression              *regexp,
01428                                 URegexFindProgressCallback      *callback,
01429                                 const void                      *context,
01430                                 UErrorCode                      *status);
01431 
01432 
01444 U_DRAFT void U_EXPORT2
01445 uregex_getFindProgressCallback(const URegularExpression          *regexp,
01446                                 URegexFindProgressCallback        **callback,
01447                                 const void                        **context,
01448                                 UErrorCode                        *status);
01449 
01450 #endif   /*  !UCONFIG_NO_REGULAR_EXPRESSIONS  */
01451 #endif   /*  UREGEX_H  */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines