Constants

Constants

Constants
Predefined count for use with Search and Replace methods to specify all matches are to be replaced.
Declared In
RegexKitDefines.h

Error Domains

extern NSString * const RKRegexErrorDomain;
extern NSString * const RKRegexPCRELibraryErrorDomain;
Constants
RegexKit Framework errors.
PCRE Library errors.
Declared In
RegexKitTypes.h

Error Keys in User Info Dictionaries

extern NSString * const RKAbreviatedRegexStringErrorKey;
extern NSString * const RKArrayIndexErrorKey;
extern NSString * const RKAttributedRegexStringErrorKey;
extern NSString * const RKCollectionErrorKey;
extern NSString * const RKCompileErrorCodeErrorKey;
extern NSString * const RKCompileErrorCodeStringErrorKey;
extern NSString * const RKCompileOptionArrayErrorKey;
extern NSString * const RKCompileOptionArrayStringErrorKey;
extern NSString * const RKCompileOptionErrorKey;
extern NSString * const RKObjectErrorKey;
extern NSString * const RKRegexLibraryErrorKey;
extern NSString * const RKRegexLibraryErrorStringErrorKey;
extern NSString * const RKRegexStringErrorKey;
extern NSString * const RKRegexStringErrorRangeErrorKey;
Constants
The corresponding value is a NSAttributedString that contains the string from RKAbreviatedRegexStringErrorKey with attributes highlightling the location of the error. Intended for errors displayed to the user in which there is only a limited amount of space available or the display of a lengthy regular expression may be inappropriate.
The corresponding value is a truncated version of the regular expression that caused the error which is composed of a small number of characters to the left and to the right of the position that caused the error. Intended for errors displayed to the user in which there is only a limited amount of space available or the display of a lengthy regular expression may be inappropriate.
The corresponding value is a NSValue of the NSRange of the character in RKAbreviatedRegexStringErrorKey that caused the error.
The corresponding value is a NSNumber containing the array index for the regular expression that caused the error. This error key is only set by the sorted regex collection methods.
The corresponding value is a NSAttributedString that contains the regular expression that caused the error with attributes highlightling the location of the error.
The corresponding value is the collection that contains the regular expression that caused the error. This error key is only set by the sorted regex collection methods.
The corresponding value is a NSNumber of the RKCompileErrorCode for the regular expression that caused the error.
The corresponding value is a NSString representation of the RKCompileErrorCode for the regular expression that caused the error.
The corresponding value is a NSArray of NSString objects representing the RKCompileOption bits for the regular expression that cause the error.
The corresponding value is a NSString representation of the RKCompileOption bits joined together with the C bitwise OR operator for the regular expression that cause the error.
The corresponding value is a NSNumber containing the RKCompileOption for the regular expression that cause the error.
The corresponding value is the regular expression object from the collection that caused the error. This error key is only set by the sorted regex collection methods.
The corresponding value is the regular expression library that caused the error.
The corresponding value is the error string provided by the regular expression library that caused the error.
The corresponding value is the regular expression that caused the error.
The corresponding value is a NSValue with the NSRange of RKRegexStringErrorKey where the error occurred.
Declared In
RegexKitTypes.h

Exceptions

extern NSString * const RKRegexCaptureReferenceException;
extern NSString * const RKRegexSyntaxErrorException;
extern NSString * const RKRegexUnsupportedException;
Constants
Name of the exception that occurs when a capture reference (ie, $1) has an error.
Name of the exception that occurs when the regular expression to be compiled with the given options has an error.
Name of the exception that occurs when an unsupported feature or option is used.
Declared In
RegexKitTypes.h

Preprocessor Macros

Preprocessor definition to enable RegexKit specific DTrace probe points.
#define ENABLE_DTRACE_INSTRUMENTATION
Discussion

This preprocessor define enables support for RegexKit specific DTrace probe points.

Declared In
RegexKitDefines.h
Preprocessor definition to enable Mac OS X 10.5 (Leopard) Garbage Collection.
#define ENABLE_MACOSX_GARBAGE_COLLECTION
Discussion

This preprocessor define enables support for Garbage Collection on Mac OS X 10.5 (Leopard). Traditional retain / release functionality remains allowing the framework to be used in either Garbage Collected enabled applications or reference counting applications. The framework dynamically picks which mode to use at run-time base on whether or not the Garbage Collection system is active.

Declared In
RegexKitDefines.h
Preprocessor definition for cross-platform NSInteger functionality.
#define RKInteger NSInteger
Discussion

On Mac OS X 10.5 this is defined to be NSInteger, otherwise it is defined as int.

This is done as a preprocessor macro so that it is rewritten in to the proper type for the build environment for type checking.

Declared In
RegexKitDefines.h
Preprocessor definition for cross-platform NSIntegerMax functionality.
#define RKIntegerMax NSIntegerMax
Discussion

On Mac OS X 10.5 this is defined to be NSIntegerMax, otherwise it is defined as INT_MAX.

Declared In
RegexKitDefines.h
Preprocessor definition for cross-platform NSIntegerMin functionality.
#define RKIntegerMin NSIntegerMin
Discussion

On Mac OS X 10.5 this is defined to be NSIntegerMin, otherwise it is defined as INT_MIN.

Declared In
RegexKitDefines.h
Preprocessor definition for making functions static inline.
#define RKREGEX_STATIC_INLINE static __inline__ __attribute__((always_inline))
Discussion

RKREGEX_STATIC_INLINE is a wrapper around GCC 4+ directives to always static inline.

Borrowed from Mac OS X NSObjCRuntime.h FOUNDATION_STATIC_INLINE to be portable to GNUstep.

Evaluates to static __inline__ for compilers other than GCC 4+.

Declared In
RegexKitDefines.h
Preprocessor definition for cross-platform NSUInteger functionality.
#define RKUIntegerMax NSUIntegerMax
Discussion

On Mac OS X 10.5 this is defined to be NSUInteger, otherwise it is defined as unsigned int.

This is done as a preprocessor macro so that it is rewritten in to the proper type for the build environment for type checking.

Declared In
RegexKitDefines.h
Preprocessor definition for cross-platform NSUIntegerMax functionality.
#define RKUIntegerMax NSUIntegerMax
Discussion

On Mac OS X 10.5 this is defined to be NSUIntegerMax, otherwise it is defined as UINT_MAX.

Declared In
RegexKitDefines.h
Macro wrapper around GCC __attribute__ syntax.
#define RK_ATTRIBUTES(attr,...) __attribute__((attr, ##__VA_ARGS__))
Discussion

When a compiler other than GCC 4+ is used, RK_ATTRIBUTES evaluates to an empty string, removing itself and its arguments from the code to be compiled.

Declared In
RegexKitDefines.h
Macro wrapper around C99 keywords.
#define RK_C99(keyword) keyword
Discussion

RK_C99 is a wrapper for C99 standard keywords that are not compatible with previous C standards, such as C89.

This is used almost exclusively to wrap the C99 restrict keyword.

Declared In
RegexKitDefines.h
Macro to assist the compiler by providing branch prediction information.
#define RK_EXPECTED(cond,expect) __builtin_expect(cond, expect)
Parameters
  • cond
    The boolean conditional statement to be evaluated, for example (aPtr == NULL).
  • expect
    The expected result of the conditional statement, expressed as a 0 or a 1.
Discussion
Important:
RK_EXPECTED should only be used when the likelihood of the prediction is nearly certain. DO NOT GUESS.

RK_EXPECTED is a wrapper around the GCC 4+ built-in function __builtin_expect, which is used to provide the compiler with branch prediction information for conditional statements. If a compiler other than GCC 4+ is used then the macro leaves the conditional expression unaltered.

An example of an appropriate use is parameter validation checks at the start of a function, such as (aPtr == NULL). Since callers are always expected to pass a valid pointer, the likelyhood of the conditional evaluating to true is extremely unlikely. This allows the compiler to schedule instructions to minimize branch miss-prediction penalties. For example:

if(RK_EXPECTED((aPtr == NULL), 0)) { abort(); }
Declared In
RegexKitDefines.h
Compile time check for functions and methods that support a varying number of arguments that must be terminated with a NULL or nil as the last argument.
#define RK_REQUIRES_NIL_TERMINATION NS_REQUIRES_NIL_TERMINATION
Discussion

Supported on Mac OS X 10.5 and later.

Declared In
RegexKitDefines.h

Regular Expression Libraries

extern NSString * const RKRegexPCRELibrary;
Constants
The PCRE regular expression pattern matching library.
Declared In
RegexKitTypes.h
 
RegexKit project hosted by: