Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSMutableArray.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.NSMutableArray; | |
15 | |
16 import dwt.internal.cocoa.id; | |
17 import dwt.internal.cocoa.NSArray; | |
18 import dwt.internal.cocoa.NSIndexSet; | |
19 import dwt.internal.cocoa.NSInteger; | |
20 import dwt.internal.cocoa.NSPredicate; | |
21 import dwt.internal.cocoa.NSRange; | |
22 import dwt.internal.cocoa.OS; | |
23 import objc = dwt.internal.objc.runtime; | |
24 | |
25 public class NSMutableArray : NSArray | |
26 { | |
27 | |
28 public this () | |
29 { | |
30 super(); | |
31 } | |
32 | |
33 public this (objc.id id) | |
34 { | |
35 super(id); | |
36 } | |
37 | |
38 public void addObject (id anObject) | |
39 { | |
40 OS.objc_msgSend(this.id, OS.sel_addObject_1, anObject !is null ? anObject.id : null); | |
41 } | |
42 | |
43 public void addObjectsFromArray (NSArray otherArray) | |
44 { | |
45 OS.objc_msgSend(this.id, OS.sel_addObjectsFromArray_1, otherArray !is null ? otherArray.id : null); | |
46 } | |
47 | |
48 public static id arrayWithCapacity (NSUInteger numItems) | |
49 { | |
50 objc.id result = OS.objc_msgSend(OS.class_NSMutableArray, OS.sel_arrayWithCapacity_1, numItems); | |
51 return result !is null ? new id(result) : null; | |
52 } | |
53 | |
54 public void exchangeObjectAtIndex (NSUInteger idx1, NSUInteger idx2) | |
55 { | |
56 OS.objc_msgSend(this.id, OS.sel_exchangeObjectAtIndex_1withObjectAtIndex_1, idx1, idx2); | |
57 } | |
58 | |
59 public void filterUsingPredicate (NSPredicate predicate) | |
60 { | |
61 OS.objc_msgSend(this.id, OS.sel_filterUsingPredicate_1, predicate !is null ? predicate.id : null); | |
62 } | |
63 | |
64 public NSMutableArray initWithCapacity (NSUInteger numItems) | |
65 { | |
66 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithCapacity_1, numItems); | |
67 return result !is null ? this : null; | |
68 } | |
69 | |
70 public void insertObject (id anObject, NSUInteger index) | |
71 { | |
72 OS.objc_msgSend(this.id, OS.sel_insertObject_1atIndex_1, anObject !is null ? anObject.id : null, index); | |
73 } | |
74 | |
75 public void insertObjects (NSArray objects, NSIndexSet indexes) | |
76 { | |
77 OS.objc_msgSend(this.id, OS.sel_insertObjects_1atIndexes_1, objects !is null ? objects.id : null, indexes !is null ? indexes.id : null); | |
78 } | |
79 | |
80 public void removeAllObjects () | |
81 { | |
82 OS.objc_msgSend(this.id, OS.sel_removeAllObjects); | |
83 } | |
84 | |
85 public void removeLastObject () | |
86 { | |
87 OS.objc_msgSend(this.id, OS.sel_removeLastObject); | |
88 } | |
89 | |
90 public void removeObject_ (id anObject) | |
91 { | |
92 OS.objc_msgSend(this.id, OS.sel_removeObject_1, anObject !is null ? anObject.id : null); | |
93 } | |
94 | |
95 public void removeObject_inRange_ (id anObject, NSRange range) | |
96 { | |
97 OS.objc_msgSend(this.id, OS.sel_removeObject_1inRange_1, anObject !is null ? anObject.id : null, range); | |
98 } | |
99 | |
100 public void removeObjectAtIndex (insertObject index) | |
101 { | |
102 OS.objc_msgSend(this.id, OS.sel_removeObjectAtIndex_1, index); | |
103 } | |
104 | |
105 public void removeObjectIdenticalTo_ (id anObject) | |
106 { | |
107 OS.objc_msgSend(this.id, OS.sel_removeObjectIdenticalTo_1, anObject !is null ? anObject.id : null); | |
108 } | |
109 | |
110 public void removeObjectIdenticalTo_inRange_ (id anObject, NSRange range) | |
111 { | |
112 OS.objc_msgSend(this.id, OS.sel_removeObjectIdenticalTo_1inRange_1, anObject !is null ? anObject.id : null, range); | |
113 } | |
114 | |
115 public void removeObjectsAtIndexes (NSIndexSet indexes) | |
116 { | |
117 OS.objc_msgSend(this.id, OS.sel_removeObjectsAtIndexes_1, indexes !is null ? indexes.id : null); | |
118 } | |
119 | |
120 public void removeObjectsFromIndices (NSUInteger* indices, NSUInteger cnt) | |
121 { | |
122 OS.objc_msgSend(this.id, OS.sel_removeObjectsFromIndices_1numIndices_1, indices, cnt); | |
123 } | |
124 | |
125 public void removeObjectsInArray (NSArray otherArray) | |
126 { | |
127 OS.objc_msgSend(this.id, OS.sel_removeObjectsInArray_1, otherArray !is null ? otherArray.id : null); | |
128 } | |
129 | |
130 public void removeObjectsInRange (NSRange range) | |
131 { | |
132 OS.objc_msgSend(this.id, OS.sel_removeObjectsInRange_1, range); | |
133 } | |
134 | |
135 public void replaceObjectAtIndex (NSUInteger index, id anObject) | |
136 { | |
137 OS.objc_msgSend(this.id, OS.sel_replaceObjectAtIndex_1withObject_1, index, anObject !is null ? anObject.id : null); | |
138 } | |
139 | |
140 public void replaceObjectsAtIndexes (NSIndexSet indexes, NSArray objects) | |
141 { | |
142 OS.objc_msgSend(this.id, OS.sel_replaceObjectsAtIndexes_1withObjects_1, indexes !is null ? indexes.id : null, | |
143 objects !is null ? objects.id : null); | |
144 } | |
145 | |
146 public void replaceObjectsInRange_withObjectsFromArray_ (NSRange range, NSArray otherArray) | |
147 { | |
148 OS.objc_msgSend(this.id, OS.sel_replaceObjectsInRange_1withObjectsFromArray_1, range, otherArray !is null ? otherArray.id : null); | |
149 } | |
150 | |
151 public void replaceObjectsInRange_withObjectsFromArray_range_ (NSRange range, NSArray otherArray, NSRange otherRange) | |
152 { | |
153 OS.objc_msgSend(this.id, OS.sel_replaceObjectsInRange_1withObjectsFromArray_1range_1, range, otherArray !is null ? otherArray.id : null, | |
154 otherRange); | |
155 } | |
156 | |
157 public void setArray (NSArray otherArray) | |
158 { | |
159 OS.objc_msgSend(this.id, OS.sel_setArray_1, otherArray !is null ? otherArray.id : null); | |
160 } | |
161 | |
162 public void sortUsingDescriptors (NSArray sortDescriptors) | |
163 { | |
164 OS.objc_msgSend(this.id, OS.sel_sortUsingDescriptors_1, sortDescriptors !is null ? sortDescriptors.id : null); | |
165 } | |
166 | |
167 public void sortUsingFunction (int function (id, id, void*) compare, void* context) | |
168 { | |
169 OS.objc_msgSend(this.id, OS.sel_sortUsingFunction_1context_1, compare, context); | |
170 } | |
171 | |
172 public void sortUsingSelector (objc.SEL comparator) | |
173 { | |
174 OS.objc_msgSend(this.id, OS.sel_sortUsingSelector_1, comparator); | |
175 } | |
176 | |
177 } |