Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSMutableString.d @ 0:380af2bdd8e5
Upload of whole dwt tree
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 17:00:02 +0200 |
parents | |
children | 8b48be5454ce |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:380af2bdd8e5 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2007 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * | |
11 * Port to the D Programming language: | |
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | |
13 *******************************************************************************/ | |
14 module dwt.internal.cocoa.NSMutableString; | |
15 | |
16 import dwt.internal.cocoa.NSInteger; | |
17 import dwt.internal.cocoa.NSString; | |
18 import dwt.internal.cocoa.OS; | |
19 import objc = dwt.internal.objc.runtime; | |
20 | |
21 public class NSMutableString : NSString | |
22 { | |
23 | |
24 public this () | |
25 { | |
26 super(); | |
27 } | |
28 | |
29 public this (objc.id id) | |
30 { | |
31 super(id); | |
32 } | |
33 | |
34 public void appendFormat (NSString appendFormat) | |
35 { | |
36 OS.objc_msgSend(this.id, OS.sel_appendFormat_1, appendFormat !is null ? appendFormat.id : null); | |
37 } | |
38 | |
39 public void appendString (NSString aString) | |
40 { | |
41 OS.objc_msgSend(this.id, OS.sel_appendString_1, aString !is null ? aString.id : null); | |
42 } | |
43 | |
44 public void deleteCharactersInRange (NSRange range) | |
45 { | |
46 OS.objc_msgSend(this.id, OS.sel_deleteCharactersInRange_1, range); | |
47 } | |
48 | |
49 public NSMutableString initWithCapacity (NSUInteger capacity) | |
50 { | |
51 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithCapacity_1, capacity); | |
52 return result !is null ? this : null; | |
53 } | |
54 | |
55 public void insertString (NSString aString, NSUInteger loc) | |
56 { | |
57 OS.objc_msgSend(this.id, OS.sel_insertString_1atIndex_1, aString !is null ? aString.id : null, loc); | |
58 } | |
59 | |
60 public void replaceCharactersInRange (NSRange range, NSString aString) | |
61 { | |
62 OS.objc_msgSend(this.id, OS.sel_replaceCharactersInRange_1withString_1, range, aString !is null ? aString.id : null); | |
63 } | |
64 | |
65 public NSUInteger replaceOccurrencesOfString (NSString target, NSString replacement, int options, NSRange searchRange) | |
66 { | |
67 return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_replaceOccurrencesOfString_1withString_1options_1range_1, target !is null ? target.id : null, | |
68 replacement !is null ? replacement.id : null, options, searchRange); | |
69 } | |
70 | |
71 public void setString (NSString aString) | |
72 { | |
73 OS.objc_msgSend(this.id, OS.sel_setString_1, aString !is null ? aString.id : null); | |
74 } | |
75 | |
76 public static id stringWithCapacity (NSUInteger capacity) | |
77 { | |
78 objc.id result = OS.objc_msgSend(OS.class_NSMutableString, OS.sel_stringWithCapacity_1, capacity); | |
79 return result !is null ? new id(result) : null; | |
80 } | |
81 | |
82 } |