| 1 |
// |
|---|
| 2 |
// NSStringICUAdditions.h |
|---|
| 3 |
// CocoaICU |
|---|
| 4 |
// |
|---|
| 5 |
// Created by Aaron Evans on 11/19/06. |
|---|
| 6 |
// Copyright 2006 Aaron Evans. All rights reserved. |
|---|
| 7 |
// |
|---|
| 8 |
|
|---|
| 9 |
#import <Cocoa/Cocoa.h> |
|---|
| 10 |
@class ICUPattern; |
|---|
| 11 |
|
|---|
| 12 |
@interface NSString (NSStringICUAdditions) |
|---|
| 13 |
|
|---|
| 14 |
/*! |
|---|
| 15 |
@method nativeUTF16Encoding |
|---|
| 16 |
@abstract The native UTF16 encoding on the given machine. |
|---|
| 17 |
@discussion The native UTF16 encoding on the given machine. |
|---|
| 18 |
*/ |
|---|
| 19 |
+(NSStringEncoding)nativeUTF16Encoding; |
|---|
| 20 |
|
|---|
| 21 |
/*! |
|---|
| 22 |
@method stringWithICUString: |
|---|
| 23 |
@abstract Create an NSString from a UTF16 encoded string. |
|---|
| 24 |
@discussion Create an NSString from a UTF16 encoded string. |
|---|
| 25 |
*/ |
|---|
| 26 |
+(NSString *)stringWithICUString:(void *)utf16EncodedString; |
|---|
| 27 |
|
|---|
| 28 |
/*! |
|---|
| 29 |
@method UTF16String |
|---|
| 30 |
@abstract Returns a UTF16 encoded string in the native encoding. |
|---|
| 31 |
@discussion This string has a retain policy equivalent to UTF8String. In |
|---|
| 32 |
other words, if you want to keep this string around beyond the given autorelease |
|---|
| 33 |
context, you need to copy the returned string. |
|---|
| 34 |
*/ |
|---|
| 35 |
-(void *)UTF16String; |
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
/*! |
|---|
| 39 |
@method copyUTF16String |
|---|
| 40 |
@abstract returns a copy |
|---|
| 41 |
@discussion Returns a UTF16 encoded string in the native encoding. The returned |
|---|
| 42 |
buffer must eventually be freed. |
|---|
| 43 |
*/ |
|---|
| 44 |
-(void *)copyUTF16String; |
|---|
| 45 |
|
|---|
| 46 |
/*! |
|---|
| 47 |
@method findPattern: |
|---|
| 48 |
@abstract Finds the given expression and and groups. |
|---|
| 49 |
@discussion Returns the match and any grouped matches in the returned |
|---|
| 50 |
array. The first element of the array is the entire match and subsequent |
|---|
| 51 |
elements are the groups in the order the matches occur. |
|---|
| 52 |
*/ |
|---|
| 53 |
-(NSArray *)findPattern:(NSString *)aRegex; |
|---|
| 54 |
|
|---|
| 55 |
/*! |
|---|
| 56 |
@method componentsSeparatedByPattern: |
|---|
| 57 |
@abstract Returns the components separated by the given pattern. |
|---|
| 58 |
@discussion Break a string into components where components separated |
|---|
| 59 |
by occurrences of the given pattern. |
|---|
| 60 |
*/ |
|---|
| 61 |
-(NSArray *)componentsSeparatedByPattern:(NSString *)aRegex; |
|---|
| 62 |
|
|---|
| 63 |
/*! |
|---|
| 64 |
@method replaceOccurrencesOfPattern:withString: |
|---|
| 65 |
@abstract Replace occurrences of the pattern with the replacement text. |
|---|
| 66 |
@discussion Replace occurrences of the pattern with the replacement text. |
|---|
| 67 |
The replacement text may contain backrerferences. |
|---|
| 68 |
*/ |
|---|
| 69 |
-(NSString *)replaceOccurrencesOfPattern:(NSString *)aPattern withString:(NSString *)replacementText; |
|---|
| 70 |
|
|---|
| 71 |
/*! |
|---|
| 72 |
@method matchesPattern: |
|---|
| 73 |
@abstract Returns YES if the string matches the entire pattern. |
|---|
| 74 |
@discussion Returns YES if the string matches the entire pattern. |
|---|
| 75 |
*/ |
|---|
| 76 |
-(BOOL)matchesPattern:(NSString *)aRegex; |
|---|
| 77 |
|
|---|
| 78 |
@end |
|---|