Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSData.d @ 1:8b48be5454ce
The internal cocoa classes compile now
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Tue, 19 Aug 2008 17:35:17 +0200 |
parents | 380af2bdd8e5 |
children | f565d3a95c0a |
comparison
equal
deleted
inserted
replaced
0:380af2bdd8e5 | 1:8b48be5454ce |
---|---|
35 super(id); | 35 super(id); |
36 } | 36 } |
37 | 37 |
38 public void* bytes () | 38 public void* bytes () |
39 { | 39 { |
40 return OS.objc_msgSend(this.id, OS.sel_bytes); | 40 return cast(void*) OS.objc_msgSend(this.id_, OS.sel_bytes); |
41 } | 41 } |
42 | 42 |
43 public static id data () | 43 public static id data () |
44 { | 44 { |
45 objc.id result = OS.objc_msgSend(OS.class_NSData, OS.sel_data); | 45 objc.id result = OS.objc_msgSend(OS.class_NSData, OS.sel_data); |
64 return result !is null ? new id(result) : null; | 64 return result !is null ? new id(result) : null; |
65 } | 65 } |
66 | 66 |
67 public static id static_dataWithContentsOfFile_ (NSString path) | 67 public static id static_dataWithContentsOfFile_ (NSString path) |
68 { | 68 { |
69 objc.id result = OS.objc_msgSend(OS.class_NSData, OS.sel_dataWithContentsOfFile_1, path !is null ? path.id : null); | 69 objc.id result = OS.objc_msgSend(OS.class_NSData, OS.sel_dataWithContentsOfFile_1, path !is null ? path.id_ : null); |
70 return result !is null ? new id(result) : null; | 70 return result !is null ? new id(result) : null; |
71 } | 71 } |
72 | 72 |
73 public static id static_dataWithContentsOfFile_options_error_ (NSString path, NSUInteger readOptionsMask, objc.id** errorPtr) | 73 public static id static_dataWithContentsOfFile_options_error_ (NSString path, NSUInteger readOptionsMask, objc.id** errorPtr) |
74 { | 74 { |
75 objc.id result = OS.objc_msgSend(OS.class_NSData, OS.sel_dataWithContentsOfFile_1options_1error_1, path !is null ? path.id : null, | 75 objc.id result = OS.objc_msgSend(OS.class_NSData, OS.sel_dataWithContentsOfFile_1options_1error_1, path !is null ? path.id_ : null, |
76 readOptionsMask, errorPtr); | 76 readOptionsMask, errorPtr); |
77 return result !is null ? new id(result) : null; | 77 return result !is null ? new id(result) : null; |
78 } | 78 } |
79 | 79 |
80 public static id dataWithContentsOfMappedFile (NSString path) | 80 public static id dataWithContentsOfMappedFile (NSString path) |
81 { | 81 { |
82 objc.id result = OS.objc_msgSend(OS.class_NSData, OS.sel_dataWithContentsOfMappedFile_1, path !is null ? path.id : null); | 82 objc.id result = OS.objc_msgSend(OS.class_NSData, OS.sel_dataWithContentsOfMappedFile_1, path !is null ? path.id_ : null); |
83 return result !is null ? new id(result) : null; | 83 return result !is null ? new id(result) : null; |
84 } | 84 } |
85 | 85 |
86 public static id static_dataWithContentsOfURL_ (NSURL url) | 86 public static id static_dataWithContentsOfURL_ (NSURL url) |
87 { | 87 { |
88 objc.id result = OS.objc_msgSend(OS.class_NSData, OS.sel_dataWithContentsOfURL_1, url !is null ? url.id : null); | 88 objc.id result = OS.objc_msgSend(OS.class_NSData, OS.sel_dataWithContentsOfURL_1, url !is null ? url.id_ : null); |
89 return result !is null ? new id(result) : null; | 89 return result !is null ? new id(result) : null; |
90 } | 90 } |
91 | 91 |
92 public static id static_dataWithContentsOfURL_options_error_ (NSURL url, NSUInteger readOptionsMask, objc.id** errorPtr) | 92 public static id static_dataWithContentsOfURL_options_error_ (NSURL url, NSUInteger readOptionsMask, objc.id** errorPtr) |
93 { | 93 { |
94 objc.id result = OS.objc_msgSend(OS.class_NSData, OS.sel_dataWithContentsOfURL_1options_1error_1, url !is null ? url.id : null, | 94 objc.id result = OS.objc_msgSend(OS.class_NSData, OS.sel_dataWithContentsOfURL_1options_1error_1, url !is null ? url.id_ : null, |
95 readOptionsMask, errorPtr); | 95 readOptionsMask, errorPtr); |
96 return result !is null ? new id(result) : null; | 96 return result !is null ? new id(result) : null; |
97 } | 97 } |
98 | 98 |
99 public static id dataWithData (NSData data) | 99 public static id dataWithData (NSData data) |
100 { | 100 { |
101 objc.id result = OS.objc_msgSend(OS.class_NSData, OS.sel_dataWithData_1, data !is null ? data.id : null); | 101 objc.id result = OS.objc_msgSend(OS.class_NSData, OS.sel_dataWithData_1, data !is null ? data.id_ : null); |
102 return result !is null ? new id(result) : null; | 102 return result !is null ? new id(result) : null; |
103 } | 103 } |
104 | 104 |
105 public NSString description () | 105 public NSString description () |
106 { | 106 { |
107 objc.id result = OS.objc_msgSend(this.id, OS.sel_description); | 107 objc.id result = OS.objc_msgSend(this.id_, OS.sel_description); |
108 return result !is null ? new NSString(result) : null; | 108 return result !is null ? new NSString(result) : null; |
109 } | 109 } |
110 | 110 |
111 public void getBytes_ (void* buffer) | 111 public void getBytes_ (void* buffer) |
112 { | 112 { |
113 OS.objc_msgSend(this.id, OS.sel_getBytes_1, buffer); | 113 OS.objc_msgSend(this.id_, OS.sel_getBytes_1, buffer); |
114 } | 114 } |
115 | 115 |
116 public void getBytes_length_ (void* buffer, NSUInteger length) | 116 public void getBytes_length_ (void* buffer, NSUInteger length) |
117 { | 117 { |
118 OS.objc_msgSend(this.id, OS.sel_getBytes_1length_1, buffer, length); | 118 OS.objc_msgSend(this.id_, OS.sel_getBytes_1length_1, buffer, length); |
119 } | 119 } |
120 | 120 |
121 public void getBytes_range_ (void* buffer, NSRange range) | 121 public void getBytes_range_ (void* buffer, NSRange range) |
122 { | 122 { |
123 OS.objc_msgSend(this.id, OS.sel_getBytes_1range_1, buffer, range); | 123 OS.objc_msgSend(this.id_, OS.sel_getBytes_1range_1, buffer, range); |
124 } | 124 } |
125 | 125 |
126 public NSData initWithBytes (void* bytes, NSUInteger length) | 126 public NSData initWithBytes (void* bytes, NSUInteger length) |
127 { | 127 { |
128 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithBytes_1length_1, bytes, length); | 128 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithBytes_1length_1, bytes, length); |
129 return result !is null ? this : null; | 129 return result !is null ? this : null; |
130 } | 130 } |
131 | 131 |
132 public NSData initWithBytesNoCopy_length_ (void* bytes, NSUInteger length) | 132 public NSData initWithBytesNoCopy_length_ (void* bytes, NSUInteger length) |
133 { | 133 { |
134 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithBytesNoCopy_1length_1, bytes, length); | 134 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithBytesNoCopy_1length_1, bytes, length); |
135 return result !is null ? this : null; | 135 return result !is null ? this : null; |
136 } | 136 } |
137 | 137 |
138 public NSData initWithBytesNoCopy_length_freeWhenDone_ (void* bytes, NSUInteger length, bool b) | 138 public NSData initWithBytesNoCopy_length_freeWhenDone_ (void* bytes, NSUInteger length, bool b) |
139 { | 139 { |
140 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithBytesNoCopy_1length_1freeWhenDone_1, bytes, length, b); | 140 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithBytesNoCopy_1length_1freeWhenDone_1, bytes, length, b); |
141 return result !is null ? this : null; | 141 return result !is null ? this : null; |
142 } | 142 } |
143 | 143 |
144 public NSData initWithContentsOfFile_ (NSString path) | 144 public NSData initWithContentsOfFile_ (NSString path) |
145 { | 145 { |
146 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithContentsOfFile_1, path !is null ? path.id : null); | 146 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithContentsOfFile_1, path !is null ? path.id_ : null); |
147 return result !is null ? this : null; | 147 return result !is null ? this : null; |
148 } | 148 } |
149 | 149 |
150 public NSData initWithContentsOfFile_options_error_ (NSString path, NSUInteger readOptionsMask, objc.id** errorPtr) | 150 public NSData initWithContentsOfFile_options_error_ (NSString path, NSUInteger readOptionsMask, objc.id** errorPtr) |
151 { | 151 { |
152 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithContentsOfFile_1options_1error_1, path !is null ? path.id : null, readOptionsMask, | 152 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithContentsOfFile_1options_1error_1, path !is null ? path.id_ : null, readOptionsMask, |
153 errorPtr); | 153 errorPtr); |
154 return result !is null ? this : null; | 154 return result !is null ? this : null; |
155 } | 155 } |
156 | 156 |
157 public NSData initWithContentsOfMappedFile (NSString path) | 157 public NSData initWithContentsOfMappedFile (NSString path) |
158 { | 158 { |
159 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithContentsOfMappedFile_1, path !is null ? path.id : null); | 159 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithContentsOfMappedFile_1, path !is null ? path.id_ : null); |
160 return result !is null ? this : null; | 160 return result !is null ? this : null; |
161 } | 161 } |
162 | 162 |
163 public NSData initWithContentsOfURL_ (NSURL url) | 163 public NSData initWithContentsOfURL_ (NSURL url) |
164 { | 164 { |
165 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithContentsOfURL_1, url !is null ? url.id : null); | 165 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithContentsOfURL_1, url !is null ? url.id_ : null); |
166 return result !is null ? this : null; | 166 return result !is null ? this : null; |
167 } | 167 } |
168 | 168 |
169 public NSData initWithContentsOfURL_options_error_ (NSURL url, NSUInteger readOptionsMask, objc.id** errorPtr) | 169 public NSData initWithContentsOfURL_options_error_ (NSURL url, NSUInteger readOptionsMask, objc.id** errorPtr) |
170 { | 170 { |
171 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithContentsOfURL_1options_1error_1, url !is null ? url.id : null, readOptionsMask, | 171 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithContentsOfURL_1options_1error_1, url !is null ? url.id_ : null, readOptionsMask, |
172 errorPtr); | 172 errorPtr); |
173 return result !is null ? this : null; | 173 return result !is null ? this : null; |
174 } | 174 } |
175 | 175 |
176 public NSData initWithData (NSData data) | 176 public NSData initWithData (NSData data) |
177 { | 177 { |
178 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithData_1, data !is null ? data.id : null); | 178 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithData_1, data !is null ? data.id_ : null); |
179 return result !is null ? this : null; | 179 return result !is null ? this : null; |
180 } | 180 } |
181 | 181 |
182 public bool isEqualToData (NSData other) | 182 public bool isEqualToData (NSData other) |
183 { | 183 { |
184 return OS.objc_msgSend(this.id, OS.sel_isEqualToData_1, other !is null ? other.id : null) !is null; | 184 return OS.objc_msgSend(this.id_, OS.sel_isEqualToData_1, other !is null ? other.id_ : null) !is null; |
185 } | 185 } |
186 | 186 |
187 public NSUInteger length () | 187 public NSUInteger length () |
188 { | 188 { |
189 return OS.objc_msgSend(this.id, OS.sel_length); | 189 return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_length); |
190 } | 190 } |
191 | 191 |
192 public NSData subdataWithRange (NSRange range) | 192 public NSData subdataWithRange (NSRange range) |
193 { | 193 { |
194 objc.id result = OS.objc_msgSend(this.id, OS.sel_subdataWithRange_1, range); | 194 objc.id result = OS.objc_msgSend(this.id_, OS.sel_subdataWithRange_1, range); |
195 return result is this.id ? this : (result !is null ? new NSData(result) : null); | 195 return result is this.id_ ? this : (result !is null ? new NSData(result) : null); |
196 } | 196 } |
197 | 197 |
198 public bool writeToFile_atomically_ (NSString path, bool useAuxiliaryFile) | 198 public bool writeToFile_atomically_ (NSString path, bool useAuxiliaryFile) |
199 { | 199 { |
200 return OS.objc_msgSend(this.id, OS.sel_writeToFile_1atomically_1, path !is null ? path.id : null, useAuxiliaryFile) !is null; | 200 return OS.objc_msgSend(this.id_, OS.sel_writeToFile_1atomically_1, path !is null ? path.id_ : null, useAuxiliaryFile) !is null; |
201 } | 201 } |
202 | 202 |
203 public bool writeToFile_options_error_ (NSString path, NSUInteger writeOptionsMask, objc.id** errorPtr) | 203 public bool writeToFile_options_error_ (NSString path, NSUInteger writeOptionsMask, objc.id** errorPtr) |
204 { | 204 { |
205 return OS.objc_msgSend(this.id, OS.sel_writeToFile_1options_1error_1, path !is null ? path.id : null, writeOptionsMask, errorPtr) !is null; | 205 return OS.objc_msgSend(this.id_, OS.sel_writeToFile_1options_1error_1, path !is null ? path.id_ : null, writeOptionsMask, errorPtr) !is null; |
206 } | 206 } |
207 | 207 |
208 public bool writeToURL_atomically_ (NSURL url, bool atomically) | 208 public bool writeToURL_atomically_ (NSURL url, bool atomically) |
209 { | 209 { |
210 return OS.objc_msgSend(this.id, OS.sel_writeToURL_1atomically_1, url !is null ? url.id : null, atomically) !is null; | 210 return OS.objc_msgSend(this.id_, OS.sel_writeToURL_1atomically_1, url !is null ? url.id_ : null, atomically) !is null; |
211 } | 211 } |
212 | 212 |
213 public bool writeToURL_options_error_ (NSURL url, NSUInteger writeOptionsMask, objc.id** errorPtr) | 213 public bool writeToURL_options_error_ (NSURL url, NSUInteger writeOptionsMask, objc.id** errorPtr) |
214 { | 214 { |
215 return OS.objc_msgSend(this.id, OS.sel_writeToURL_1options_1error_1, url !is null ? url.id : null, writeOptionsMask, errorPtr) !is null; | 215 return OS.objc_msgSend(this.id_, OS.sel_writeToURL_1options_1error_1, url !is null ? url.id_ : null, writeOptionsMask, errorPtr) !is null; |
216 } | 216 } |
217 | 217 |
218 } | 218 } |