comparison dwt/internal/cocoa/NSSet.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.NSSet;
15
16 import dwt.internal.cocoa.id;
17 import dwt.internal.cocoa.NSArray;
18 import dwt.internal.cocoa.NSEnumerator;
19 import dwt.internal.cocoa.NSInteger;
20 import dwt.internal.cocoa.NSKeyValueObserving;
21 import dwt.internal.cocoa.NSObject;
22 import dwt.internal.cocoa.NSPredicate;
23 import dwt.internal.cocoa.NSString;
24 import dwt.internal.cocoa.OS;
25 import objc = dwt.internal.objc.runtime;
26
27 public class NSSet : NSObject
28 {
29
30 public this ()
31 {
32 super();
33 }
34
35 public this (objc.id id)
36 {
37 super(id);
38 }
39
40 public void addObserver (NSObject observer, NSString keyPath, NSKeyValueObservingOptions options, void* context)
41 {
42 OS.objc_msgSend(this.id, OS.sel_addObserver_1forKeyPath_1options_1context_1, observer !is null ? observer.id : null,
43 keyPath !is null ? keyPath.id : null, options, context);
44 }
45
46 public NSArray allObjects ()
47 {
48 objc.id result = OS.objc_msgSend(this.id, OS.sel_allObjects);
49 return result !is null ? new NSArray(result) : null;
50 }
51
52 public id anyObject ()
53 {
54 objc.id result = OS.objc_msgSend(this.id, OS.sel_anyObject);
55 return result !is null ? new id(result) : null;
56 }
57
58 public bool containsObject (id anObject)
59 {
60 return OS.objc_msgSend(this.id, OS.sel_containsObject_1, anObject !is null ? anObject.id : null) !is null;
61 }
62
63 public NSUInteger count ()
64 {
65 return OS.objc_msgSend(this.id, OS.sel_count);
66 }
67
68 public NSString description ()
69 {
70 objc.id result = OS.objc_msgSend(this.id, OS.sel_description);
71 return result !is null ? new NSString(result) : null;
72 }
73
74 public NSString descriptionWithLocale (id locale)
75 {
76 objc.id result = OS.objc_msgSend(this.id, OS.sel_descriptionWithLocale_1, locale !is null ? locale.id : null);
77 return result !is null ? new NSString(result) : null;
78 }
79
80 public NSSet filteredSetUsingPredicate (NSPredicate predicate)
81 {
82 objc.id result = OS.objc_msgSend(this.id, OS.sel_filteredSetUsingPredicate_1, predicate !is null ? predicate.id : null);
83 return result is this.id ? this : (result !is null ? new NSSet(result) : null);
84 }
85
86 public NSSet initWithArray (NSArray array)
87 {
88 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithArray_1, array !is null ? array.id : null);
89 return result !is null ? this : null;
90 }
91
92 public NSSet initWithObjects_ (id initWithObjects)
93 {
94 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithObjects_1, initWithObjects !is null ? initWithObjects.id : null);
95 return result !is null ? this : null;
96 }
97
98 public NSSet initWithObjects_count_ (objc.id* objects, NSUInteger cnt)
99 {
100 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithObjects_1count_1, objects, cnt);
101 return result !is null ? this : null;
102 }
103
104 public NSSet initWithSet_ (NSSet set)
105 {
106 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithSet_1, set !is null ? set.id : null);
107 return result !is null ? this : null;
108 }
109
110 public NSSet initWithSet_copyItems_ (NSSet set, bool flag)
111 {
112 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithSet_1copyItems_1, set !is null ? set.id : null, flag);
113 return result !is null ? this : null;
114 }
115
116 public bool intersectsSet (NSSet otherSet)
117 {
118 return OS.objc_msgSend(this.id, OS.sel_intersectsSet_1, otherSet !is null ? otherSet.id : null) !is null;
119 }
120
121 public bool isEqualToSet (NSSet otherSet)
122 {
123 return OS.objc_msgSend(this.id, OS.sel_isEqualToSet_1, otherSet !is null ? otherSet.id : null) !is null;
124 }
125
126 public bool isSubsetOfSet (NSSet otherSet)
127 {
128 return OS.objc_msgSend(this.id, OS.sel_isSubsetOfSet_1, otherSet !is null ? otherSet.id : null) !is null;
129 }
130
131 public void makeObjectsPerformSelector_ (objc.SEL aSelector)
132 {
133 OS.objc_msgSend(this.id, OS.sel_makeObjectsPerformSelector_1, aSelector);
134 }
135
136 public void makeObjectsPerformSelector_withObject_ (objc.SEL aSelector, id argument)
137 {
138 OS.objc_msgSend(this.id, OS.sel_makeObjectsPerformSelector_1withObject_1, aSelector, argument !is null ? argument.id : null);
139 }
140
141 public id member (id object)
142 {
143 objc.id result = OS.objc_msgSend(this.id, OS.sel_member_1, object !is null ? object.id : null);
144 return result !is null ? new id(result) : null;
145 }
146
147 public NSEnumerator objectEnumerator ()
148 {
149 objc.id result = OS.objc_msgSend(this.id, OS.sel_objectEnumerator);
150 return result !is null ? new NSEnumerator(result) : null;
151 }
152
153 public void removeObserver (NSObject observer, NSString keyPath)
154 {
155 OS.objc_msgSend(this.id, OS.sel_removeObserver_1forKeyPath_1, observer !is null ? observer.id : null, keyPath !is null ? keyPath.id : null);
156 }
157
158 public static id set ()
159 {
160 objc.id result = OS.objc_msgSend(OS.class_NSSet, OS.sel_set);
161 return result !is null ? new id(result) : null;
162 }
163
164 public NSSet setByAddingObject (id anObject)
165 {
166 objc.id result = OS.objc_msgSend(this.id, OS.sel_setByAddingObject_1, anObject !is null ? anObject.id : null);
167 return result is this.id ? this : (result !is null ? new NSSet(result) : null);
168 }
169
170 public NSSet setByAddingObjectsFromArray (NSArray other)
171 {
172 objc.id result = OS.objc_msgSend(this.id, OS.sel_setByAddingObjectsFromArray_1, other !is null ? other.id : null);
173 return result is this.id ? this : (result !is null ? new NSSet(result) : null);
174 }
175
176 public NSSet setByAddingObjectsFromSet (NSSet other)
177 {
178 objc.id result = OS.objc_msgSend(this.id, OS.sel_setByAddingObjectsFromSet_1, other !is null ? other.id : null);
179 return result is this.id ? this : (result !is null ? new NSSet(result) : null);
180 }
181
182 public void setValue (id value, NSString key)
183 {
184 OS.objc_msgSend(this.id, OS.sel_setValue_1forKey_1, value !is null ? value.id : null, key !is null ? key.id : null);
185 }
186
187 public static id setWithArray (NSArray array)
188 {
189 objc.id result = OS.objc_msgSend(OS.class_NSSet, OS.sel_setWithArray_1, array !is null ? array.id : null);
190 return result !is null ? new id(result) : null;
191 }
192
193 public static id setWithObject (id object)
194 {
195 objc.id result = OS.objc_msgSend(OS.class_NSSet, OS.sel_setWithObject_1, object !is null ? object.id : null);
196 return result !is null ? new id(result) : null;
197 }
198
199 public static id static_setWithObjects_ (id setWithObjects)
200 {
201 objc.id result = OS.objc_msgSend(OS.class_NSSet, OS.sel_setWithObjects_1, setWithObjects !is null ? setWithObjects.id : null);
202 return result !is null ? new id(result) : null;
203 }
204
205 public static id static_setWithObjects_count_ (objc.id* objects, NSUInteger cnt)
206 {
207 objc.id result = OS.objc_msgSend(OS.class_NSSet, OS.sel_setWithObjects_1count_1, objects, cnt);
208 return result !is null ? new id(result) : null;
209 }
210
211 public static id setWithSet (NSSet set)
212 {
213 objc.id result = OS.objc_msgSend(OS.class_NSSet, OS.sel_setWithSet_1, set !is null ? set.id : null);
214 return result !is null ? new id(result) : null;
215 }
216
217 public id valueForKey (NSString key)
218 {
219 objc.id result = OS.objc_msgSend(this.id, OS.sel_valueForKey_1, key !is null ? key.id : null);
220 return result !is null ? new id(result) : null;
221 }
222
223 }