Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSString.d @ 45:d8635bb48c7c
Merge with SWT 3.5
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 01 Dec 2008 17:07:00 +0100 |
parents | 642f460a0908 |
children | cfa563df4fdd |
comparison
equal
deleted
inserted
replaced
44:ca5e494f2bbf | 45:d8635bb48c7c |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 * Copyright (c) 2007 IBM Corporation and others. | 2 * Copyright (c) 2000, 2008 IBM Corporation and others. |
3 * All rights reserved. This program and the accompanying materials | 3 * All rights reserved. This program and the accompanying materials |
4 * are made available under the terms of the Eclipse Public License v1.0 | 4 * are made available under the terms of the Eclipse Public License v1.0 |
5 * which accompanies this distribution, and is available at | 5 * which accompanies this distribution, and is available at |
6 * http://www.eclipse.org/legal/epl-v10.html | 6 * http://www.eclipse.org/legal/epl-v10.html |
7 * | 7 * |
8 * Contributors: | 8 * Contributors: |
9 * IBM Corporation - initial API and implementation | 9 * IBM Corporation - initial API and implementation |
10 * | 10 * |
11 * Port to the D programming language: | 11 * Port to the D programming language: |
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | 12 * Jacob Carlborg <doob@me.com> |
13 *******************************************************************************/ | 13 *******************************************************************************/ |
14 module dwt.internal.cocoa.NSString; | 14 module dwt.internal.cocoa.NSString; |
15 | 15 |
16 import tango.core.Vararg : va_list; | |
17 import tango.stdc.stringz : toString16z; | |
18 import tango.text.convert.Utf : toString16; | |
19 | |
20 import dwt.dwthelper.utils; | 16 import dwt.dwthelper.utils; |
21 import dwt.internal.cocoa.id; | 17 import cocoa = dwt.internal.cocoa.id; |
22 import dwt.internal.cocoa.NSArray; | |
23 import dwt.internal.cocoa.NSCharacterSet; | |
24 import dwt.internal.cocoa.NSComparisonResult; | |
25 import dwt.internal.cocoa.NSData; | |
26 import dwt.internal.cocoa.NSDictionary; | |
27 import dwt.internal.cocoa.NSInteger; | |
28 import dwt.internal.cocoa.NSLocale; | |
29 import dwt.internal.cocoa.NSObject; | 18 import dwt.internal.cocoa.NSObject; |
30 import dwt.internal.cocoa.NSRange; | 19 import dwt.internal.cocoa.NSRange; |
31 import dwt.internal.cocoa.NSURL; | |
32 import dwt.internal.cocoa.OS; | 20 import dwt.internal.cocoa.OS; |
21 import dwt.internal.objc.cocoa.Cocoa; | |
33 import objc = dwt.internal.objc.runtime; | 22 import objc = dwt.internal.objc.runtime; |
34 | 23 |
35 enum NSStringEncoding : NSUInteger | 24 enum NSStringEncoding : NSUInteger |
36 { | 25 { |
37 NSASCIIStringEncoding = 1, | 26 NSASCIIStringEncoding = 1, |
57 NSUTF32BigEndianStringEncoding = 0x98000100, | 46 NSUTF32BigEndianStringEncoding = 0x98000100, |
58 NSUTF32LittleEndianStringEncoding = 0x9c000100, | 47 NSUTF32LittleEndianStringEncoding = 0x9c000100, |
59 NSProprietaryStringEncoding = 65536 | 48 NSProprietaryStringEncoding = 65536 |
60 } | 49 } |
61 | 50 |
62 alias NSStringEncoding.NSASCIIStringEncoding NSASCIIStringEncoding; | 51 public class NSString : NSObject { |
63 alias NSStringEncoding.NSNEXTSTEPStringEncoding NSNEXTSTEPStringEncoding; | |
64 alias NSStringEncoding.NSJapaneseEUCStringEncoding NSJapaneseEUCStringEncoding; | |
65 alias NSStringEncoding.NSUTF8StringEncoding NSUTF8StringEncoding; | |
66 alias NSStringEncoding.NSISOLatin1StringEncoding NSISOLatin1StringEncoding; | |
67 alias NSStringEncoding.NSSymbolStringEncoding NSSymbolStringEncoding; | |
68 alias NSStringEncoding.NSNonLossyASCIIStringEncoding NSNonLossyASCIIStringEncoding; | |
69 alias NSStringEncoding.NSShiftJISStringEncoding NSShiftJISStringEncoding; | |
70 alias NSStringEncoding.NSISOLatin2StringEncoding NSISOLatin2StringEncoding; | |
71 alias NSStringEncoding.NSUnicodeStringEncoding NSUnicodeStringEncoding; | |
72 alias NSStringEncoding.NSWindowsCP1251StringEncoding NSWindowsCP1251StringEncoding; | |
73 alias NSStringEncoding.NSWindowsCP1252StringEncoding NSWindowsCP1252StringEncoding; | |
74 alias NSStringEncoding.NSWindowsCP1253StringEncoding NSWindowsCP1253StringEncoding; | |
75 alias NSStringEncoding.NSWindowsCP1254StringEncoding NSWindowsCP1254StringEncoding; | |
76 alias NSStringEncoding.NSWindowsCP1250StringEncoding NSWindowsCP1250StringEncoding; | |
77 alias NSStringEncoding.NSISO2022JPStringEncoding NSISO2022JPStringEncoding; | |
78 alias NSStringEncoding.NSMacOSRomanStringEncoding NSMacOSRomanStringEncoding; | |
79 alias NSStringEncoding.NSUTF16BigEndianStringEncoding NSUTF16BigEndianStringEncoding; | |
80 alias NSStringEncoding.NSUTF16LittleEndianStringEncoding NSUTF16LittleEndianStringEncoding; | |
81 alias NSStringEncoding.NSUTF32StringEncoding NSUTF32StringEncoding; | |
82 alias NSStringEncoding.NSUTF32BigEndianStringEncoding NSUTF32BigEndianStringEncoding; | |
83 alias NSStringEncoding.NSUTF32LittleEndianStringEncoding NSUTF32LittleEndianStringEncoding; | |
84 alias NSStringEncoding.NSProprietaryStringEncoding NSProprietaryStringEncoding; | |
85 | 52 |
86 enum NSStringCompareOptions : NSUInteger | 53 public this() { |
87 { | 54 super(); |
88 NSCaseInsensitiveSearch = 1, | |
89 NSLiteralSearch = 2, | |
90 NSBackwardsSearch = 4, | |
91 NSAnchoredSearch = 8, | |
92 NSNumericSearch = 64, | |
93 NSDiacriticInsensitiveSearch = 128, | |
94 NSWidthInsensitiveSearch = 256, | |
95 NSForcedOrderingSearch = 512 | |
96 } | 55 } |
97 | 56 |
98 alias NSStringCompareOptions.NSCaseInsensitiveSearch NSCaseInsensitiveSearch; | 57 public this(objc.id id) { |
99 alias NSStringCompareOptions.NSLiteralSearch NSLiteralSearch; | 58 super(id); |
100 alias NSStringCompareOptions.NSBackwardsSearch NSBackwardsSearch; | |
101 alias NSStringCompareOptions.NSAnchoredSearch NSAnchoredSearch; | |
102 alias NSStringCompareOptions.NSNumericSearch NSNumericSearch; | |
103 alias NSStringCompareOptions.NSDiacriticInsensitiveSearch NSDiacriticInsensitiveSearch; | |
104 alias NSStringCompareOptions.NSWidthInsensitiveSearch NSWidthInsensitiveSearch; | |
105 alias NSStringCompareOptions.NSForcedOrderingSearch NSForcedOrderingSearch; | |
106 | |
107 enum NSStringEncodingConversionOptions : NSUInteger | |
108 { | |
109 NSStringEncodingConversionAllowLossy = 1, | |
110 NSStringEncodingConversionExternalRepresentation = 2 | |
111 } | 59 } |
112 | 60 |
113 alias NSStringEncodingConversionOptions.NSStringEncodingConversionAllowLossy NSStringEncodingConversionAllowLossy; | 61 public this(cocoa.id id) { |
114 alias NSStringEncodingConversionOptions.NSStringEncodingConversionExternalRepresentation NSStringEncodingConversionExternalRepresentation; | 62 super(id); |
63 } | |
115 | 64 |
116 public class NSString : NSObject | 65 public String getString() { |
117 { | 66 wchar[] buffer = new wchar[length()]; |
67 getCharacters(buffer.ptr); | |
68 return buffer.toString(); | |
69 } | |
118 | 70 |
119 public this () | 71 public static NSString stringWith(String str) { |
120 { | 72 char[] buffer = new char[str.length]; |
121 super(); | 73 str.getChars(0, buffer.length, buffer, 0); |
122 } | 74 return stringWithCharacters(buffer.toString16().ptr, buffer.length); |
75 } | |
123 | 76 |
124 public this (objc.id id) | 77 public /*const*/char* UTF8String() { |
125 { | 78 return cast(/*const*/char*) OS.objc_msgSend(this.id, OS.sel_UTF8String); |
126 super(id); | 79 } |
127 } | |
128 | 80 |
129 public /*const*/char* UTF8String () | 81 public wchar characterAtIndex(NSUInteger index) { |
130 { | 82 return cast(wchar) OS.objc_msgSend(this.id, OS.sel_characterAtIndex_, index); |
131 return cast(/*const*/char*) OS.objc_msgSend(this.id_, OS.sel_UTF8String); | 83 } |
132 } | |
133 | 84 |
134 public static NSStringEncoding availableStringEncodings () | 85 public void getCharacters(wchar* buffer) { |
135 { | 86 OS.objc_msgSend(this.id, OS.sel_getCharacters_, buffer); |
136 return cast(NSStringEncoding) OS.objc_msgSend(OS.class_NSString, OS.sel_availableStringEncodings); | 87 } |
137 } | |
138 | 88 |
139 public bool boolValue () | 89 public void getCharacters(wchar* buffer, NSRange aRange) { |
140 { | 90 OS.objc_msgSend(this.id, OS.sel_getCharacters_range_, buffer, aRange); |
141 return OS.objc_msgSend(this.id_, OS.sel_boolValue) !is null; | 91 } |
142 } | |
143 | 92 |
144 public /*const*/char* cString () | 93 public bool isEqualToString(NSString aString) { |
145 { | 94 return OS.objc_msgSend_bool(this.id, OS.sel_isEqualToString_, aString !is null ? aString.id : null); |
146 return cast(/*const*/char*) OS.objc_msgSend(this.id_, OS.sel_cString); | 95 } |
147 } | |
148 | 96 |
149 public NSUInteger cStringLength () | 97 public NSString lastPathComponent() { |
150 { | 98 objc.id result = OS.objc_msgSend(this.id, OS.sel_lastPathComponent); |
151 return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_cStringLength); | 99 return result is this.id ? this : (result !is null ? new NSString(result) : null); |
152 } | 100 } |
153 | 101 |
154 public /*const*/char* cStringUsingEncoding (NSStringEncoding encoding) | 102 public NSUInteger length() { |
155 { | 103 return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_length); |
156 return cast(/*const*/char*) OS.objc_msgSend(this.id_, OS.sel_cStringUsingEncoding_1, encoding); | 104 } |
157 } | |
158 | 105 |
159 public bool canBeConvertedToEncoding (NSStringEncoding encoding) | 106 public NSString lowercaseString() { |
160 { | 107 objc.id result = OS.objc_msgSend(this.id, OS.sel_lowercaseString); |
161 return OS.objc_msgSend(this.id_, OS.sel_canBeConvertedToEncoding_1, encoding) !is null; | 108 return result is this.id ? this : (result !is null ? new NSString(result) : null); |
162 } | 109 } |
163 | 110 |
164 public NSString capitalizedString () | 111 public NSString stringByAddingPercentEscapesUsingEncoding(NSStringEncoding enc) { |
165 { | 112 objc.id result = OS.objc_msgSend(this.id, OS.sel_stringByAddingPercentEscapesUsingEncoding_, enc); |
166 objc.id result = OS.objc_msgSend(this.id_, OS.sel_capitalizedString); | 113 return result is this.id ? this : (result !is null ? new NSString(result) : null); |
167 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | 114 } |
168 } | |
169 | 115 |
170 public NSComparisonResult caseInsensitiveCompare (NSString string) | 116 public NSString stringByAppendingPathComponent(NSString str) { |
171 { | 117 objc.id result = OS.objc_msgSend(this.id, OS.sel_stringByAppendingPathComponent_, str !is null ? str.id : null); |
172 return cast(NSComparisonResult) OS.objc_msgSend(this.id_, OS.sel_caseInsensitiveCompare_1, string !is null ? string.id_ : null); | 118 return result is this.id ? this : (result !is null ? new NSString(result) : null); |
173 } | 119 } |
174 | 120 |
175 public wchar characterAtIndex (NSUInteger index) | 121 public NSString stringByAppendingString(NSString aString) { |
176 { | 122 objc.id result = OS.objc_msgSend(this.id, OS.sel_stringByAppendingString_, aString !is null ? aString.id : null); |
177 return cast(wchar) OS.objc_msgSend(this.id_, OS.sel_characterAtIndex_1, index); | 123 return result is this.id ? this : (result !is null ? new NSString(result) : null); |
178 } | 124 } |
179 | 125 |
180 public NSString commonPrefixWithString (NSString aString, NSStringCompareOptions mask) | 126 public NSString stringByDeletingLastPathComponent() { |
181 { | 127 objc.id result = OS.objc_msgSend(this.id, OS.sel_stringByDeletingLastPathComponent); |
182 objc.id result = OS.objc_msgSend(this.id_, OS.sel_commonPrefixWithString_1options_1, aString !is null ? aString.id_ : null, mask); | 128 return result is this.id ? this : (result !is null ? new NSString(result) : null); |
183 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | 129 } |
184 } | |
185 | 130 |
186 public NSComparisonResult compare_ (NSString string) | 131 public NSString stringByDeletingPathExtension() { |
187 { | 132 objc.id result = OS.objc_msgSend(this.id, OS.sel_stringByDeletingPathExtension); |
188 return cast(NSComparisonResult) OS.objc_msgSend(this.id_, OS.sel_compare_1, string !is null ? string.id_ : null); | 133 return result is this.id ? this : (result !is null ? new NSString(result) : null); |
189 } | 134 } |
190 | 135 |
191 public NSComparisonResult compare_options_ (NSString string, NSStringCompareOptions mask) | 136 public NSString stringByReplacingOccurrencesOfString(NSString target, NSString replacement) { |
192 { | 137 objc.id result = OS.objc_msgSend(this.id, OS.sel_stringByReplacingOccurrencesOfString_withString_, target !is null ? target.id : null, replacement !is null ? replacement.id : null); |
193 return cast(NSComparisonResult) OS.objc_msgSend(this.id_, OS.sel_compare_1options_1, string !is null ? string.id_ : null, mask); | 138 return result is this.id ? this : (result !is null ? new NSString(result) : null); |
194 } | 139 } |
195 | 140 |
196 public NSComparisonResult compare_options_range_ (NSString string, NSStringCompareOptions mask, NSRange compareRange) | 141 public static NSString stringWithCharacters(/*const*/wchar* characters, NSUInteger length) { |
197 { | 142 objc.id result = OS.objc_msgSend(OS.class_NSString, OS.sel_stringWithCharacters_length_, characters, length); |
198 return cast(NSComparisonResult) OS.objc_msgSend(this.id_, OS.sel_compare_1options_1range_1, string !is null ? string.id_ : null, mask, | 143 return result !is null ? new NSString(result) : null; |
199 compareRange); | 144 } |
200 } | |
201 | 145 |
202 public NSComparisonResult compare_options_range_locale_ (NSString string, NSStringCompareOptions mask, NSRange compareRange, id locale) | 146 public static NSString stringWithUTF8String(/*const*/char* nullTerminatedCString) { |
203 { | 147 objc.id result = OS.objc_msgSend(OS.class_NSString, OS.sel_stringWithUTF8String_, nullTerminatedCString); |
204 return cast(NSComparisonResult) OS.objc_msgSend(this.id_, OS.sel_compare_1options_1range_1locale_1, string !is null ? string.id_ : null, mask, | 148 return result !is null ? new NSString(result) : null; |
205 compareRange, locale !is null ? locale.id_ : null); | 149 } |
206 } | |
207 | |
208 public NSUInteger completePathIntoString (/*NSString** */objc.id** outputName, bool flag, /*NSArray** */objc.id** outputArray, | |
209 NSArray filterTypes) | |
210 { | |
211 return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_completePathIntoString_1caseSensitive_1matchesIntoArray_1filterTypes_1, outputName, flag, outputArray, | |
212 filterTypes !is null ? filterTypes.id_ : null); | |
213 } | |
214 | |
215 public NSArray componentsSeparatedByCharactersInSet (NSCharacterSet separator) | |
216 { | |
217 objc.id result = OS.objc_msgSend(this.id_, OS.sel_componentsSeparatedByCharactersInSet_1, separator !is null ? separator.id_ : null); | |
218 return result !is null ? new NSArray(result) : null; | |
219 } | |
220 | |
221 public NSArray componentsSeparatedByString (NSString separator) | |
222 { | |
223 objc.id result = OS.objc_msgSend(this.id_, OS.sel_componentsSeparatedByString_1, separator !is null ? separator.id_ : null); | |
224 return result !is null ? new NSArray(result) : null; | |
225 } | |
226 | |
227 public NSData dataUsingEncoding_ (NSStringEncoding encoding) | |
228 { | |
229 objc.id result = OS.objc_msgSend(this.id_, OS.sel_dataUsingEncoding_1, encoding); | |
230 return result !is null ? new NSData(result) : null; | |
231 } | |
232 | |
233 public NSData dataUsingEncoding_allowLossyConversion_ (NSStringEncoding encoding, bool lossy) | |
234 { | |
235 objc.id result = OS.objc_msgSend(this.id_, OS.sel_dataUsingEncoding_1allowLossyConversion_1, encoding, lossy); | |
236 return result !is null ? new NSData(result) : null; | |
237 } | |
238 | |
239 public NSString decomposedStringWithCanonicalMapping () | |
240 { | |
241 objc.id result = OS.objc_msgSend(this.id_, OS.sel_decomposedStringWithCanonicalMapping); | |
242 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
243 } | |
244 | |
245 public NSString decomposedStringWithCompatibilityMapping () | |
246 { | |
247 objc.id result = OS.objc_msgSend(this.id_, OS.sel_decomposedStringWithCompatibilityMapping); | |
248 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
249 } | |
250 | |
251 public static NSStringEncoding defaultCStringEncoding () | |
252 { | |
253 return cast(NSStringEncoding) OS.objc_msgSend(OS.class_NSString, OS.sel_defaultCStringEncoding); | |
254 } | |
255 | |
256 public NSString description () | |
257 { | |
258 objc.id result = OS.objc_msgSend(this.id_, OS.sel_description); | |
259 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
260 } | |
261 | |
262 public double doubleValue () | |
263 { | |
264 return OS.objc_msgSend_fpret(this.id_, OS.sel_doubleValue); | |
265 } | |
266 | |
267 public NSStringEncoding fastestEncoding () | |
268 { | |
269 return cast(NSStringEncoding) OS.objc_msgSend(this.id_, OS.sel_fastestEncoding); | |
270 } | |
271 | |
272 public /*const*/char* fileSystemRepresentation () | |
273 { | |
274 return cast(/*const*/char*) OS.objc_msgSend(this.id_, OS.sel_fileSystemRepresentation); | |
275 } | |
276 | |
277 public float floatValue () | |
278 { | |
279 return cast(float) OS.objc_msgSend_fpret(this.id_, OS.sel_floatValue); | |
280 } | |
281 | |
282 public bool getBytes (void* buffer, NSUInteger maxBufferCount, NSUInteger* usedBufferCount, NSStringEncoding encoding, NSStringEncodingConversionOptions options, | |
283 NSRange range, NSRangePointer leftover) | |
284 { | |
285 return OS.objc_msgSend(this.id_, OS.sel_getBytes_1maxLength_1usedLength_1encoding_1options_1range_1remainingRange_1, buffer, maxBufferCount, | |
286 usedBufferCount, encoding, options, range, leftover) !is null; | |
287 } | |
288 | |
289 public void getCString_ (/*char* */byte* bytes) | |
290 { | |
291 OS.objc_msgSend(this.id_, OS.sel_getCString_1, bytes); | |
292 } | |
293 | |
294 public void getCString_maxLength_ (/*char* */byte* bytes, NSUInteger maxLength) | |
295 { | |
296 OS.objc_msgSend(this.id_, OS.sel_getCString_1maxLength_1, bytes, maxLength); | |
297 } | |
298 | |
299 public bool getCString_maxLength_encoding_ (/*char* */byte* buffer, NSUInteger maxBufferCount, NSStringEncoding encoding) | |
300 { | |
301 return OS.objc_msgSend(this.id_, OS.sel_getCString_1maxLength_1encoding_1, buffer, maxBufferCount, encoding) !is null; | |
302 } | |
303 | |
304 public void getCString_maxLength_range_remainingRange_ (/*char* */byte* bytes, NSUInteger maxLength, NSRange aRange, NSRangePointer leftoverRange) | |
305 { | |
306 OS.objc_msgSend(this.id_, OS.sel_getCString_1maxLength_1range_1remainingRange_1, bytes, maxLength, aRange, leftoverRange); | |
307 } | |
308 | |
309 public void getCharacters_ (wchar* buffer) | |
310 { | |
311 OS.objc_msgSend(this.id_, OS.sel_getCharacters_1, buffer); | |
312 } | |
313 | |
314 public void getCharacters_range_ (wchar* buffer, NSRange aRange) | |
315 { | |
316 OS.objc_msgSend(this.id_, OS.sel_getCharacters_1range_1, buffer, aRange); | |
317 } | |
318 | |
319 public bool getFileSystemRepresentation (/*char* */byte* cname, NSUInteger max) | |
320 { | |
321 return OS.objc_msgSend(this.id_, OS.sel_getFileSystemRepresentation_1maxLength_1, cname, max) !is null; | |
322 } | |
323 | |
324 public void getLineStart (NSUInteger* startPtr, NSUInteger* lineEndPtr, NSUInteger* contentsEndPtr, NSRange range) | |
325 { | |
326 OS.objc_msgSend(this.id_, OS.sel_getLineStart_1end_1contentsEnd_1forRange_1, startPtr, lineEndPtr, contentsEndPtr, range); | |
327 } | |
328 | |
329 public void getParagraphStart (NSUInteger* startPtr, NSUInteger* parEndPtr, NSUInteger* contentsEndPtr, NSRange range) | |
330 { | |
331 OS.objc_msgSend(this.id_, OS.sel_getParagraphStart_1end_1contentsEnd_1forRange_1, startPtr, parEndPtr, contentsEndPtr, range); | |
332 } | |
333 | |
334 public bool hasPrefix (NSString aString) | |
335 { | |
336 return OS.objc_msgSend(this.id_, OS.sel_hasPrefix_1, aString !is null ? aString.id_ : null) !is null; | |
337 } | |
338 | |
339 public bool hasSuffix (NSString aString) | |
340 { | |
341 return OS.objc_msgSend(this.id_, OS.sel_hasSuffix_1, aString !is null ? aString.id_ : null) !is null; | |
342 } | |
343 | |
344 public NSUInteger hash () | |
345 { | |
346 return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_hash); | |
347 } | |
348 | |
349 public NSString initWithBytes (/*const*/void* bytes, NSUInteger len, NSStringEncoding encoding) | |
350 { | |
351 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithBytes_1length_1encoding_1, bytes, len, encoding); | |
352 return result !is null ? this : null; | |
353 } | |
354 | |
355 public NSString initWithBytesNoCopy (/*const*/void* bytes, NSUInteger len, NSStringEncoding encoding, bool freeBuffer) | |
356 { | |
357 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithBytesNoCopy_1length_1encoding_1freeWhenDone_1, bytes, len, encoding, freeBuffer); | |
358 return result !is null ? this : null; | |
359 } | |
360 | |
361 public NSString initWithCString_ (/*const*/char* bytes) | |
362 { | |
363 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithCString_1, bytes); | |
364 return result !is null ? this : null; | |
365 } | |
366 | |
367 public NSString initWithCString_encoding_ (/*const*/char* nullTerminatedCString, NSStringEncoding encoding) | |
368 { | |
369 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithCString_1encoding_1, nullTerminatedCString, encoding); | |
370 return result !is null ? this : null; | |
371 } | |
372 | |
373 public NSString initWithCString_length_ (/*const*/char* bytes, NSUInteger length) | |
374 { | |
375 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithCString_1length_1, bytes, length); | |
376 return result !is null ? this : null; | |
377 } | |
378 | |
379 public NSString initWithCStringNoCopy (/*const*/char* bytes, NSUInteger length, bool freeBuffer) | |
380 { | |
381 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithCStringNoCopy_1length_1freeWhenDone_1, bytes, length, freeBuffer); | |
382 return result !is null ? this : null; | |
383 } | |
384 | |
385 public NSString initWithCharacters (/*const*/wchar* characters, NSUInteger length) | |
386 { | |
387 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithCharacters_1length_1, characters, length); | |
388 return result !is null ? this : null; | |
389 } | |
390 | |
391 public NSString initWithCharactersNoCopy (/*const*/wchar* characters, NSUInteger length, bool freeBuffer) | |
392 { | |
393 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithCharactersNoCopy_1length_1freeWhenDone_1, characters, length, freeBuffer); | |
394 return result !is null ? this : null; | |
395 } | |
396 | |
397 public NSString initWithContentsOfFile_ (NSString path) | |
398 { | |
399 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithContentsOfFile_1, path !is null ? path.id_ : null); | |
400 return result !is null ? this : null; | |
401 } | |
402 | |
403 public NSString initWithContentsOfFile_encoding_error_ (NSString path, NSStringEncoding enc, /*NSError** */objc.id** error) | |
404 { | |
405 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithContentsOfFile_1encoding_1error_1, path !is null ? path.id_ : null, enc, error); | |
406 return result !is null ? this : null; | |
407 } | |
408 | |
409 public NSString initWithContentsOfFile_usedEncoding_error_ (NSString path, NSStringEncoding enc, /*NSError** */objc.id** error) | |
410 { | |
411 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithContentsOfFile_1usedEncoding_1error_1, path !is null ? path.id_ : null, enc, error); | |
412 return result !is null ? this : null; | |
413 } | |
414 | |
415 public NSString initWithContentsOfURL_ (NSURL url) | |
416 { | |
417 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithContentsOfURL_1, url !is null ? url.id_ : null); | |
418 return result !is null ? this : null; | |
419 } | |
420 | |
421 public NSString initWithContentsOfURL_encoding_error_ (NSURL url, NSStringEncoding enc, /*NSError** */objc.id** error) | |
422 { | |
423 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithContentsOfURL_1encoding_1error_1, url !is null ? url.id_ : null, enc, error); | |
424 return result !is null ? this : null; | |
425 } | |
426 | |
427 public NSString initWithContentsOfURL_usedEncoding_error_ (NSURL url, NSStringEncoding enc, /*NSError** */objc.id** error) | |
428 { | |
429 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithContentsOfURL_1usedEncoding_1error_1, url !is null ? url.id_ : null, enc, error); | |
430 return result !is null ? this : null; | |
431 } | |
432 | |
433 public NSString initWithData (NSData data, NSStringEncoding encoding) | |
434 { | |
435 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithData_1encoding_1, data !is null ? data.id_ : null, encoding); | |
436 return result !is null ? this : null; | |
437 } | |
438 | |
439 public NSString initWithFormat_ (NSString initWithFormat) | |
440 { | |
441 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithFormat_1, initWithFormat !is null ? initWithFormat.id_ : null); | |
442 return result !is null ? this : null; | |
443 } | |
444 | |
445 public NSString initWithFormat_arguments_ (NSString format, va_list argList) | |
446 { | |
447 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithFormat_1arguments_1, format !is null ? format.id_ : null, argList); | |
448 return result !is null ? this : null; | |
449 } | |
450 | |
451 public NSString initWithFormat_locale_ (NSString format, id locale) | |
452 { | |
453 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithFormat_1locale_1, format !is null ? format.id_ : null, | |
454 locale !is null ? locale.id_ : null); | |
455 return result !is null ? this : null; | |
456 } | |
457 | |
458 public NSString initWithFormat_locale_arguments_ (NSString format, id locale, va_list argList) | |
459 { | |
460 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithFormat_1locale_1arguments_1, format !is null ? format.id_ : null, | |
461 locale !is null ? locale.id_ : null, argList); | |
462 return result !is null ? this : null; | |
463 } | |
464 | |
465 public NSString initWithString (NSString aString) | |
466 { | |
467 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithString_1, aString !is null ? aString.id_ : null); | |
468 return result !is null ? this : null; | |
469 } | |
470 | |
471 public NSString initWithUTF8String (/*const*/char* nullTerminatedCString) | |
472 { | |
473 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithUTF8String_1, nullTerminatedCString); | |
474 return result !is null ? this : null; | |
475 } | |
476 | |
477 public int intValue () | |
478 { | |
479 return cast(int) OS.objc_msgSend(this.id_, OS.sel_intValue); | |
480 } | |
481 | |
482 public NSInteger integerValue () | |
483 { | |
484 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_integerValue); | |
485 } | |
486 | |
487 public bool isAbsolutePath () | |
488 { | |
489 return OS.objc_msgSend(this.id_, OS.sel_isAbsolutePath) !is null; | |
490 } | |
491 | |
492 public bool isEqualToString (NSString aString) | |
493 { | |
494 return OS.objc_msgSend(this.id_, OS.sel_isEqualToString_1, aString !is null ? aString.id_ : null) !is null; | |
495 } | |
496 | |
497 public NSString lastPathComponent () | |
498 { | |
499 objc.id result = OS.objc_msgSend(this.id_, OS.sel_lastPathComponent); | |
500 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
501 } | |
502 | |
503 public NSUInteger length () | |
504 { | |
505 return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_length); | |
506 } | |
507 | |
508 public NSUInteger lengthOfBytesUsingEncoding (NSStringEncoding enc) | |
509 { | |
510 return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_lengthOfBytesUsingEncoding_1, enc); | |
511 } | |
512 | |
513 public NSRange lineRangeForRange (NSRange range) | |
514 { | |
515 NSRange result; | |
516 OS.objc_msgSend_struct(&result, this.id_, OS.sel_lineRangeForRange_1, range); | |
517 return result; | |
518 } | |
519 | |
520 public NSComparisonResult localizedCaseInsensitiveCompare (NSString string) | |
521 { | |
522 return cast(NSComparisonResult) OS.objc_msgSend(this.id_, OS.sel_localizedCaseInsensitiveCompare_1, string !is null ? string.id_ : null); | |
523 } | |
524 | |
525 public NSComparisonResult localizedCompare (NSString string) | |
526 { | |
527 return cast(NSComparisonResult) OS.objc_msgSend(this.id_, OS.sel_localizedCompare_1, string !is null ? string.id_ : null); | |
528 } | |
529 | |
530 public static NSString localizedNameOfStringEncoding (NSStringEncoding encoding) | |
531 { | |
532 objc.id result = OS.objc_msgSend(OS.class_NSString, OS.sel_localizedNameOfStringEncoding_1, encoding); | |
533 return result !is null ? new NSString(result) : null; | |
534 } | |
535 | |
536 public static id localizedStringWithFormat (NSString localizedStringWithFormat) | |
537 { | |
538 objc.id result = OS.objc_msgSend(OS.class_NSString, OS.sel_localizedStringWithFormat_1, | |
539 localizedStringWithFormat !is null ? localizedStringWithFormat.id_ : null); | |
540 return result !is null ? new id(result) : null; | |
541 } | |
542 | |
543 public long longLongValue () | |
544 { | |
545 return cast(long) OS.objc_msgSend(this.id_, OS.sel_longLongValue); | |
546 } | |
547 | |
548 public /*const*/char* lossyCString () | |
549 { | |
550 return cast(/*const*/char*) OS.objc_msgSend(this.id_, OS.sel_lossyCString); | |
551 } | |
552 | |
553 public NSString lowercaseString () | |
554 { | |
555 objc.id result = OS.objc_msgSend(this.id_, OS.sel_lowercaseString); | |
556 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
557 } | |
558 | |
559 public NSUInteger maximumLengthOfBytesUsingEncoding (NSStringEncoding enc) | |
560 { | |
561 return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_maximumLengthOfBytesUsingEncoding_1, enc); | |
562 } | |
563 | |
564 public NSRange paragraphRangeForRange (NSRange range) | |
565 { | |
566 NSRange result; | |
567 OS.objc_msgSend_stret(&result, this.id_, OS.sel_paragraphRangeForRange_1, range); | |
568 return result; | |
569 } | |
570 | |
571 public NSArray pathComponents () | |
572 { | |
573 objc.id result = OS.objc_msgSend(this.id_, OS.sel_pathComponents); | |
574 return result !is null ? new NSArray(result) : null; | |
575 } | |
576 | |
577 public NSString pathExtension () | |
578 { | |
579 objc.id result = OS.objc_msgSend(this.id_, OS.sel_pathExtension); | |
580 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
581 } | |
582 | |
583 public static NSString pathWithComponents (NSArray components) | |
584 { | |
585 objc.id result = OS.objc_msgSend(OS.class_NSString, OS.sel_pathWithComponents_1, components !is null ? components.id_ : null); | |
586 return result !is null ? new NSString(result) : null; | |
587 } | |
588 | |
589 public NSString precomposedStringWithCanonicalMapping () | |
590 { | |
591 objc.id result = OS.objc_msgSend(this.id_, OS.sel_precomposedStringWithCanonicalMapping); | |
592 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
593 } | |
594 | |
595 public NSString precomposedStringWithCompatibilityMapping () | |
596 { | |
597 objc.id result = OS.objc_msgSend(this.id_, OS.sel_precomposedStringWithCompatibilityMapping); | |
598 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
599 } | |
600 | |
601 public id propertyList () | |
602 { | |
603 objc.id result = OS.objc_msgSend(this.id_, OS.sel_propertyList); | |
604 return result !is null ? new id(result) : null; | |
605 } | |
606 | |
607 public NSDictionary propertyListFromStringsFileFormat () | |
608 { | |
609 objc.id result = OS.objc_msgSend(this.id_, OS.sel_propertyListFromStringsFileFormat); | |
610 return result !is null ? new NSDictionary(result) : null; | |
611 } | |
612 | |
613 public NSRange rangeOfCharacterFromSet_ (NSCharacterSet aSet) | |
614 { | |
615 NSRange result; | |
616 OS.objc_msgSend_stret(&result, this.id_, OS.sel_rangeOfCharacterFromSet_1, aSet !is null ? aSet.id_ : null); | |
617 return result; | |
618 } | |
619 | |
620 public NSRange rangeOfCharacterFromSet_options_ (NSCharacterSet aSet, NSStringCompareOptions mask) | |
621 { | |
622 NSRange result; | |
623 OS.objc_msgSend_stret(&result, this.id_, OS.sel_rangeOfCharacterFromSet_1options_1, aSet !is null ? aSet.id_ : null, mask); | |
624 return result; | |
625 } | |
626 | |
627 public NSRange rangeOfCharacterFromSet_options_range_ (NSCharacterSet aSet, NSStringCompareOptions mask, NSRange searchRange) | |
628 { | |
629 NSRange result; | |
630 OS.objc_msgSend_stret(&result, this.id_, OS.sel_rangeOfCharacterFromSet_1options_1range_1, aSet !is null ? aSet.id_ : null, mask, searchRange); | |
631 return result; | |
632 } | |
633 | |
634 public NSRange rangeOfComposedCharacterSequenceAtIndex (NSUInteger index) | |
635 { | |
636 NSRange result; | |
637 OS.objc_msgSend_stret(&result, this.id_, OS.sel_rangeOfComposedCharacterSequenceAtIndex_1, index); | |
638 return result; | |
639 } | |
640 | |
641 public NSRange rangeOfComposedCharacterSequencesForRange (NSRange range) | |
642 { | |
643 NSRange result; | |
644 OS.objc_msgSend_stret(&result, this.id_, OS.sel_rangeOfComposedCharacterSequencesForRange_1, range); | |
645 return result; | |
646 } | |
647 | |
648 public NSRange rangeOfString_ (NSString aString) | |
649 { | |
650 NSRange result; | |
651 OS.objc_msgSend_stret(&result, this.id_, OS.sel_rangeOfString_1, aString !is null ? aString.id_ : null); | |
652 return result; | |
653 } | |
654 | |
655 public NSRange rangeOfString_options_ (NSString aString, NSStringCompareOptions mask) | |
656 { | |
657 NSRange result; | |
658 OS.objc_msgSend_stret(&result, this.id_, OS.sel_rangeOfString_1options_1, aString !is null ? aString.id_ : null, mask); | |
659 return result; | |
660 } | |
661 | |
662 public NSRange rangeOfString_options_range_ (NSString aString, NSStringCompareOptions mask, NSRange searchRange) | |
663 { | |
664 NSRange result; | |
665 OS.objc_msgSend_stret(&result, this.id_, OS.sel_rangeOfString_1options_1range_1, aString !is null ? aString.id_ : null, mask, searchRange); | |
666 return result; | |
667 } | |
668 | |
669 public NSRange rangeOfString_options_range_locale_ (NSString aString, NSStringCompareOptions mask, NSRange searchRange, NSLocale locale) | |
670 { | |
671 NSRange result; | |
672 OS.objc_msgSend_stret(&result, this.id_, OS.sel_rangeOfString_1options_1range_1locale_1, aString !is null ? aString.id_ : null, mask, | |
673 searchRange, locale !is null ? locale.id_ : null); | |
674 return result; | |
675 } | |
676 | |
677 public NSStringEncoding smallestEncoding () | |
678 { | |
679 return cast(NSStringEncoding) OS.objc_msgSend(this.id_, OS.sel_smallestEncoding); | |
680 } | |
681 | |
682 public static NSString string () | |
683 { | |
684 objc.id result = OS.objc_msgSend(OS.class_NSString, OS.sel_string); | |
685 return result !is null ? new NSString(result) : null; | |
686 } | |
687 | |
688 public NSString stringByAbbreviatingWithTildeInPath () | |
689 { | |
690 objc.id result = OS.objc_msgSend(this.id_, OS.sel_stringByAbbreviatingWithTildeInPath); | |
691 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
692 } | |
693 | |
694 public NSString stringByAddingPercentEscapesUsingEncoding (NSStringEncoding enc) | |
695 { | |
696 objc.id result = OS.objc_msgSend(this.id_, OS.sel_stringByAddingPercentEscapesUsingEncoding_1, enc); | |
697 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
698 } | |
699 | |
700 public NSString stringByAppendingFormat (NSString stringByAppendingFormat) | |
701 { | |
702 objc.id result = OS.objc_msgSend(this.id_, OS.sel_stringByAppendingFormat_1, | |
703 stringByAppendingFormat !is null ? stringByAppendingFormat.id_ : null); | |
704 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
705 } | |
706 | |
707 public NSString stringByAppendingPathComponent (NSString str) | |
708 { | |
709 objc.id result = OS.objc_msgSend(this.id_, OS.sel_stringByAppendingPathComponent_1, str !is null ? str.id_ : null); | |
710 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
711 } | |
712 | |
713 public NSString stringByAppendingPathExtension (NSString str) | |
714 { | |
715 objc.id result = OS.objc_msgSend(this.id_, OS.sel_stringByAppendingPathExtension_1, str !is null ? str.id_ : null); | |
716 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
717 } | |
718 | |
719 public NSString stringByAppendingString (NSString aString) | |
720 { | |
721 objc.id result = OS.objc_msgSend(this.id_, OS.sel_stringByAppendingString_1, aString !is null ? aString.id_ : null); | |
722 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
723 } | |
724 | |
725 public NSString stringByDeletingLastPathComponent () | |
726 { | |
727 objc.id result = OS.objc_msgSend(this.id_, OS.sel_stringByDeletingLastPathComponent); | |
728 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
729 } | |
730 | |
731 public NSString stringByDeletingPathExtension () | |
732 { | |
733 objc.id result = OS.objc_msgSend(this.id_, OS.sel_stringByDeletingPathExtension); | |
734 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
735 } | |
736 | |
737 public NSString stringByExpandingTildeInPath () | |
738 { | |
739 objc.id result = OS.objc_msgSend(this.id_, OS.sel_stringByExpandingTildeInPath); | |
740 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
741 } | |
742 | |
743 public NSString stringByFoldingWithOptions (NSStringCompareOptions options, NSLocale locale) | |
744 { | |
745 objc.id result = OS.objc_msgSend(this.id_, OS.sel_stringByFoldingWithOptions_1locale_1, options, locale !is null ? locale.id_ : null); | |
746 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
747 } | |
748 | |
749 public NSString stringByPaddingToLength (NSUInteger newLength, NSString padString, NSUInteger padIndex) | |
750 { | |
751 objc.id result = OS.objc_msgSend(this.id_, OS.sel_stringByPaddingToLength_1withString_1startingAtIndex_1, newLength, | |
752 padString !is null ? padString.id_ : null, padIndex); | |
753 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
754 } | |
755 | |
756 public NSString stringByReplacingCharactersInRange (NSRange range, NSString replacement) | |
757 { | |
758 objc.id result = OS.objc_msgSend(this.id_, OS.sel_stringByReplacingCharactersInRange_1withString_1, range, | |
759 replacement !is null ? replacement.id_ : null); | |
760 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
761 } | |
762 | |
763 public NSString stringByReplacingOccurrencesOfString_withString_ (NSString target, NSString replacement) | |
764 { | |
765 objc.id result = OS.objc_msgSend(this.id_, OS.sel_stringByReplacingOccurrencesOfString_1withString_1, target !is null ? target.id_ : null, | |
766 replacement !is null ? replacement.id_ : null); | |
767 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
768 } | |
769 | |
770 public NSString stringByReplacingOccurrencesOfString_withString_options_range_ (NSString target, NSString replacement, NSStringCompareOptions options, | |
771 NSRange searchRange) | |
772 { | |
773 objc.id result = OS.objc_msgSend(this.id_, OS.sel_stringByReplacingOccurrencesOfString_1withString_1options_1range_1, | |
774 target !is null ? target.id_ : null, replacement !is null ? replacement.id_ : null, options, searchRange); | |
775 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
776 } | |
777 | |
778 public NSString stringByReplacingPercentEscapesUsingEncoding (NSStringEncoding enc) | |
779 { | |
780 objc.id result = OS.objc_msgSend(this.id_, OS.sel_stringByReplacingPercentEscapesUsingEncoding_1, enc); | |
781 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
782 } | |
783 | |
784 public NSString stringByResolvingSymlinksInPath () | |
785 { | |
786 objc.id result = OS.objc_msgSend(this.id_, OS.sel_stringByResolvingSymlinksInPath); | |
787 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
788 } | |
789 | |
790 public NSString stringByStandardizingPath () | |
791 { | |
792 objc.id result = OS.objc_msgSend(this.id_, OS.sel_stringByStandardizingPath); | |
793 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
794 } | |
795 | |
796 public NSString stringByTrimmingCharactersInSet (NSCharacterSet set) | |
797 { | |
798 objc.id result = OS.objc_msgSend(this.id_, OS.sel_stringByTrimmingCharactersInSet_1, set !is null ? set.id_ : null); | |
799 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
800 } | |
801 | |
802 public static id static_stringWithCString_ (/*const*/char* bytes) | |
803 { | |
804 objc.id result = OS.objc_msgSend(OS.class_NSString, OS.sel_stringWithCString_1, bytes); | |
805 return result !is null ? new NSString(result) : null; | |
806 } | |
807 | |
808 public static id static_stringWithCString_encoding_ (/*const*/char* cString, NSStringEncoding enc) | |
809 { | |
810 objc.id result = OS.objc_msgSend(OS.class_NSString, OS.sel_stringWithCString_1encoding_1, cString, enc); | |
811 return result !is null ? new NSString(result) : null; | |
812 } | |
813 | |
814 public static NSString static_stringWithCString_length_ (/*const*/char* bytes, NSUInteger length) | |
815 { | |
816 objc.id result = OS.objc_msgSend(OS.class_NSString, OS.sel_stringWithCString_1length_1, bytes, length); | |
817 return result !is null ? new NSString(result) : null; | |
818 } | |
819 | |
820 public static NSString stringWithCharacters (/*const*/wchar* characters, NSUInteger length) | |
821 { | |
822 objc.id result = OS.objc_msgSend(OS.class_NSString, OS.sel_stringWithCharacters_1length_1, characters, length); | |
823 return result !is null ? new NSString(result) : null; | |
824 } | |
825 | |
826 public static NSString stringWith (String str) | |
827 { | |
828 char[] chars = new char[str.length]; | |
829 str.getChars(0, chars.length, chars, 0); | |
830 objc.id result = OS.objc_msgSend(OS.class_NSString, OS.sel_stringWithCharacters_1length_1, toString16z(chars.toString16()), chars.length); | |
831 return result !is null ? new NSString(result) : null; | |
832 } | |
833 | |
834 public static id static_stringWithContentsOfFile_ (NSString path) | |
835 { | |
836 objc.id result = OS.objc_msgSend(OS.class_NSString, OS.sel_stringWithContentsOfFile_1, path !is null ? path.id_ : null); | |
837 return result !is null ? new id(result) : null; | |
838 } | |
839 | |
840 public static id static_stringWithContentsOfFile_encoding_error_ (NSString path, NSStringEncoding enc, /*NSError** */objc.id** error) | |
841 { | |
842 objc.id result = OS.objc_msgSend(OS.class_NSString, OS.sel_stringWithContentsOfFile_1encoding_1error_1, path !is null ? path.id_ : null, enc, | |
843 error); | |
844 return result !is null ? new id(result) : null; | |
845 } | |
846 | |
847 public static id static_stringWithContentsOfFile_usedEncoding_error_ (NSString path, NSStringEncoding enc, /*NSError** */objc.id** error) | |
848 { | |
849 objc.id result = OS.objc_msgSend(OS.class_NSString, OS.sel_stringWithContentsOfFile_1usedEncoding_1error_1, path !is null ? path.id_ : null, | |
850 enc, error); | |
851 return result !is null ? new id(result) : null; | |
852 } | |
853 | |
854 public static id static_stringWithContentsOfURL_ (NSURL url) | |
855 { | |
856 objc.id result = OS.objc_msgSend(OS.class_NSString, OS.sel_stringWithContentsOfURL_1, url !is null ? url.id_ : null); | |
857 return result !is null ? new id(result) : null; | |
858 } | |
859 | |
860 public static id static_stringWithContentsOfURL_encoding_error_ (NSURL url, NSStringEncoding enc, /*NSError** */objc.id** error) | |
861 { | |
862 objc.id result = OS.objc_msgSend(OS.class_NSString, OS.sel_stringWithContentsOfURL_1encoding_1error_1, url !is null ? url.id_ : null, enc, | |
863 error); | |
864 return result !is null ? new id(result) : null; | |
865 } | |
866 | |
867 public static id static_stringWithContentsOfURL_usedEncoding_error_ (NSURL url, NSStringEncoding enc, /*NSError** */objc.id** error) | |
868 { | |
869 objc.id result = OS.objc_msgSend(OS.class_NSString, OS.sel_stringWithContentsOfURL_1usedEncoding_1error_1, url !is null ? url.id_ : null, enc, | |
870 error); | |
871 return result !is null ? new id(result) : null; | |
872 } | |
873 | |
874 public static id stringWithFormat (NSString stringWithFormat) | |
875 { | |
876 objc.id result = OS.objc_msgSend(OS.class_NSString, OS.sel_stringWithFormat_1, stringWithFormat !is null ? stringWithFormat.id_ : null); | |
877 return result !is null ? new id(result) : null; | |
878 } | |
879 | |
880 public static id stringWithString (NSString string) | |
881 { | |
882 objc.id result = OS.objc_msgSend(OS.class_NSString, OS.sel_stringWithString_1, string !is null ? string.id_ : null); | |
883 return result !is null ? new id(result) : null; | |
884 } | |
885 | |
886 public static id stringWithUTF8String (/*const*/char* nullTerminatedCString) | |
887 { | |
888 objc.id result = OS.objc_msgSend(OS.class_NSString, OS.sel_stringWithUTF8String_1, nullTerminatedCString); | |
889 return result !is null ? new id(result) : null; | |
890 } | |
891 | |
892 public NSArray stringsByAppendingPaths (NSArray paths) | |
893 { | |
894 objc.id result = OS.objc_msgSend(this.id_, OS.sel_stringsByAppendingPaths_1, paths !is null ? paths.id_ : null); | |
895 return result !is null ? new NSArray(result) : null; | |
896 } | |
897 | |
898 public NSString substringFromIndex (NSUInteger from) | |
899 { | |
900 objc.id result = OS.objc_msgSend(this.id_, OS.sel_substringFromIndex_1, from); | |
901 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
902 } | |
903 | |
904 public NSString substringToIndex (NSUInteger to) | |
905 { | |
906 objc.id result = OS.objc_msgSend(this.id_, OS.sel_substringToIndex_1, to); | |
907 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
908 } | |
909 | |
910 public NSString substringWithRange (NSRange range) | |
911 { | |
912 objc.id result = OS.objc_msgSend(this.id_, OS.sel_substringWithRange_1, range); | |
913 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
914 } | |
915 | |
916 public NSString uppercaseString () | |
917 { | |
918 objc.id result = OS.objc_msgSend(this.id_, OS.sel_uppercaseString); | |
919 return result is this.id_ ? this : (result !is null ? new NSString(result) : null); | |
920 } | |
921 | |
922 public bool writeToFile_atomically_ (NSString path, bool useAuxiliaryFile) | |
923 { | |
924 return OS.objc_msgSend(this.id_, OS.sel_writeToFile_1atomically_1, path !is null ? path.id_ : null, useAuxiliaryFile) !is null; | |
925 } | |
926 | |
927 public bool writeToFile_atomically_encoding_error_ (NSString path, bool useAuxiliaryFile, NSStringEncoding enc, /*NSError** */objc.id** error) | |
928 { | |
929 return OS.objc_msgSend(this.id_, OS.sel_writeToFile_1atomically_1encoding_1error_1, path !is null ? path.id_ : null, useAuxiliaryFile, enc, | |
930 error) !is null; | |
931 } | |
932 | |
933 public bool writeToURL_atomically_ (NSURL url, bool atomically) | |
934 { | |
935 return OS.objc_msgSend(this.id_, OS.sel_writeToURL_1atomically_1, url !is null ? url.id_ : null, atomically) !is null; | |
936 } | |
937 | |
938 public bool writeToURL_atomically_encoding_error_ (NSURL url, bool useAuxiliaryFile, NSStringEncoding enc, /*NSError** */objc.id** error) | |
939 { | |
940 return OS.objc_msgSend(this.id_, OS.sel_writeToURL_1atomically_1encoding_1error_1, url !is null ? url.id_ : null, useAuxiliaryFile, enc, error) !is null; | |
941 } | |
942 | 150 |
943 } | 151 } |