Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSPointerArray.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.NSPointerArray; | |
15 | |
16 import dwt.internal.cocoa.NSArray; | |
17 import dwt.internal.cocoa.NSInteger; | |
18 import dwt.internal.cocoa.NSObject; | |
19 import dwt.internal.cocoa.NSPointerFunctions; | |
20 import dwt.internal.cocoa.OS; | |
21 import objc = dwt.internal.objc.runtime; | |
22 | |
23 public class NSPointerArray : NSObject | |
24 { | |
25 | |
26 public this () | |
27 { | |
28 super(); | |
29 } | |
30 | |
31 public this (objc.id id) | |
32 { | |
33 super(id); | |
34 } | |
35 | |
36 public void addPointer (void* pointer) | |
37 { | |
38 OS.objc_msgSend(this.id, OS.sel_addPointer_1, pointer); | |
39 } | |
40 | |
41 public NSArray allObjects () | |
42 { | |
43 objc.id result = OS.objc_msgSend(this.id, OS.sel_allObjects); | |
44 return result !is null ? new NSArray(result) : null; | |
45 } | |
46 | |
47 public void compact () | |
48 { | |
49 OS.objc_msgSend(this.id, OS.sel_compact); | |
50 } | |
51 | |
52 public NSUInteger count () | |
53 { | |
54 return OS.objc_msgSend(this.id, OS.sel_count); | |
55 } | |
56 | |
57 public NSPointerArray initWithOptions (NSPointerFunctionsOptions options) | |
58 { | |
59 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithOptions_1, options); | |
60 return result !is null ? this : null; | |
61 } | |
62 | |
63 public id initWithPointerFunctions (NSPointerFunctions functions) | |
64 { | |
65 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithPointerFunctions_1, functions !is null ? functions.id : null); | |
66 return result !is null ? new id(result) : null; | |
67 } | |
68 | |
69 public void insertPointer (void* item, NSUInteger index) | |
70 { | |
71 OS.objc_msgSend(this.id, OS.sel_insertPointer_1atIndex_1, item, index); | |
72 } | |
73 | |
74 public static id pointerArrayWithOptions (NSPointerFunctionsOptions options) | |
75 { | |
76 objc.id result = OS.objc_msgSend(OS.class_NSPointerArray, OS.sel_pointerArrayWithOptions_1, options); | |
77 return result !is null ? new id(result) : null; | |
78 } | |
79 | |
80 public static id pointerArrayWithPointerFunctions (NSPointerFunctions functions) | |
81 { | |
82 objc.id | |
83 result = OS.objc_msgSend(OS.class_NSPointerArray, OS.sel_pointerArrayWithPointerFunctions_1, functions !is null ? functions.id : null); | |
84 return result !is null ? new id(result) : null; | |
85 } | |
86 | |
87 public static id pointerArrayWithStrongObjects () | |
88 { | |
89 objc.id result = OS.objc_msgSend(OS.class_NSPointerArray, OS.sel_pointerArrayWithStrongObjects); | |
90 return result !is null ? new id(result) : null; | |
91 } | |
92 | |
93 public static id pointerArrayWithWeakObjects () | |
94 { | |
95 objc.id result = OS.objc_msgSend(OS.class_NSPointerArray, OS.sel_pointerArrayWithWeakObjects); | |
96 return result !is null ? new id(result) : null; | |
97 } | |
98 | |
99 public void* pointerAtIndex (NSUInteger index) | |
100 { | |
101 return cast(void*) OS.objc_msgSend(this.id, OS.sel_pointerAtIndex_1, index); | |
102 } | |
103 | |
104 public NSPointerFunctions pointerFunctions () | |
105 { | |
106 objc.id result = OS.objc_msgSend(this.id, OS.sel_pointerFunctions); | |
107 return result !is null ? new NSPointerFunctions(result) : null; | |
108 } | |
109 | |
110 public void removePointerAtIndex (NSUInteger index) | |
111 { | |
112 OS.objc_msgSend(this.id, OS.sel_removePointerAtIndex_1, index); | |
113 } | |
114 | |
115 public void replacePointerAtIndex (NSUInteger index, void* item) | |
116 { | |
117 OS.objc_msgSend(this.id, OS.sel_replacePointerAtIndex_1withPointer_1, index, item); | |
118 } | |
119 | |
120 public void setCount (NSUInteger count) | |
121 { | |
122 OS.objc_msgSend(this.id, OS.sel_setCount_1, count); | |
123 } | |
124 | |
125 } |