Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSMutableDictionary.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.NSMutableDictionary; | |
15 | |
16 import dwt.internal.cocoa.id; | |
17 import dwt.internal.cocoa.NSArray; | |
18 import dwt.internal.cocoa.NSDictionary; | |
19 import dwt.internal.cocoa.NSInteger; | |
20 import dwt.internal.cocoa.NSString; | |
21 import dwt.internal.cocoa.OS; | |
22 import objc = dwt.internal.objc.runtime; | |
23 | |
24 public class NSMutableDictionary : NSDictionary | |
25 { | |
26 | |
27 public this () | |
28 { | |
29 super(); | |
30 } | |
31 | |
32 public this (objc.id id) | |
33 { | |
34 super(id); | |
35 } | |
36 | |
37 public void addEntriesFromDictionary (NSDictionary otherDictionary) | |
38 { | |
39 OS.objc_msgSend(this.id, OS.sel_addEntriesFromDictionary_1, otherDictionary !is null ? otherDictionary.id : null); | |
40 } | |
41 | |
42 public static NSMutableDictionary dictionaryWithCapacity (NSUInteger numItems) | |
43 { | |
44 objc.id result = OS.objc_msgSend(OS.class_NSMutableDictionary, OS.sel_dictionaryWithCapacity_1, numItems); | |
45 return result !is null ? new NSMutableDictionary(result) : null; | |
46 } | |
47 | |
48 public NSMutableDictionary initWithCapacity (NSUInteger numItems) | |
49 { | |
50 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithCapacity_1, numItems); | |
51 return result !is null ? this : null; | |
52 } | |
53 | |
54 public void removeAllObjects () | |
55 { | |
56 OS.objc_msgSend(this.id, OS.sel_removeAllObjects); | |
57 } | |
58 | |
59 public void removeObjectForKey (id aKey) | |
60 { | |
61 OS.objc_msgSend(this.id, OS.sel_removeObjectForKey_1, aKey !is null ? aKey.id : null); | |
62 } | |
63 | |
64 public void removeObjectsForKeys (NSArray keyArray) | |
65 { | |
66 OS.objc_msgSend(this.id, OS.sel_removeObjectsForKeys_1, keyArray !is null ? keyArray.id : null); | |
67 } | |
68 | |
69 public void setDictionary (NSDictionary otherDictionary) | |
70 { | |
71 OS.objc_msgSend(this.id, OS.sel_setDictionary_1, otherDictionary !is null ? otherDictionary.id : null); | |
72 } | |
73 | |
74 public void setObject (id anObject, id aKey) | |
75 { | |
76 OS.objc_msgSend(this.id, OS.sel_setObject_1forKey_1, anObject !is null ? anObject.id : null, aKey !is null ? aKey.id : null); | |
77 } | |
78 | |
79 public void setObject (id anObject, objc.id aKey) | |
80 { | |
81 OS.objc_msgSend(this.id, OS.sel_setObject_1forKey_1, anObject !is null ? anObject.id : null, aKey); | |
82 } | |
83 | |
84 public void setValue (id value, NSString key) | |
85 { | |
86 OS.objc_msgSend(this.id, OS.sel_setValue_1forKey_1, value !is null ? value.id : null, key !is null ? key.id : null); | |
87 } | |
88 | |
89 } |