Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSNumber.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 |
---|---|
34 super(id); | 34 super(id); |
35 } | 35 } |
36 | 36 |
37 public bool boolValue () | 37 public bool boolValue () |
38 { | 38 { |
39 return OS.objc_msgSend(this.id, OS.sel_boolValue) !is null; | 39 return OS.objc_msgSend(this.id_, OS.sel_boolValue) !is null; |
40 } | 40 } |
41 | 41 |
42 public byte charValue () | 42 public byte charValue () |
43 { | 43 { |
44 return cast(byte) OS.objc_msgSend(this.id, OS.sel_charValue); | 44 return cast(byte) OS.objc_msgSend(this.id_, OS.sel_charValue); |
45 } | 45 } |
46 | 46 |
47 public NSComparisonResult compare (NSNumber otherNumber) | 47 public NSComparisonResult compare (NSNumber otherNumber) |
48 { | 48 { |
49 return OS.objc_msgSend(this.id, OS.sel_compare_1, otherNumber !is null ? otherNumber.id : null); | 49 return cast(NSComparisonResult) OS.objc_msgSend(this.id_, OS.sel_compare_1, otherNumber !is null ? otherNumber.id_ : null); |
50 } | 50 } |
51 | 51 |
52 public NSDecimal decimalValue () | 52 public NSDecimal decimalValue () |
53 { | 53 { |
54 NSDecimal result = new NSDecimal(); | 54 NSDecimal result; |
55 OS.objc_msgSend_stret(result, this.id, OS.sel_decimalValue); | 55 OS.objc_msgSend_stret(&result, this.id_, OS.sel_decimalValue); |
56 return result; | 56 return result; |
57 } | 57 } |
58 | 58 |
59 public NSString descriptionWithLocale (id locale) | 59 public NSString descriptionWithLocale (id locale) |
60 { | 60 { |
61 objc.id result = OS.objc_msgSend(this.id, OS.sel_descriptionWithLocale_1, locale !is null ? locale.id : null); | 61 objc.id result = OS.objc_msgSend(this.id_, OS.sel_descriptionWithLocale_1, locale !is null ? locale.id_ : null); |
62 return result !is null ? new NSString(result) : null; | 62 return result !is null ? new NSString(result) : null; |
63 } | 63 } |
64 | 64 |
65 public double doubleValue () | 65 public double doubleValue () |
66 { | 66 { |
67 return OS.objc_msgSend_fpret(this.id, OS.sel_doubleValue); | 67 return OS.objc_msgSend_fpret(this.id_, OS.sel_doubleValue); |
68 } | 68 } |
69 | 69 |
70 public float floatValue () | 70 public float floatValue () |
71 { | 71 { |
72 return cast(float) OS.objc_msgSend_fpret(this.id, OS.sel_floatValue); | 72 return cast(float) OS.objc_msgSend_fpret(this.id_, OS.sel_floatValue); |
73 } | 73 } |
74 | 74 |
75 public id initWithBool (bool value) | 75 public id initWithBool (bool value) |
76 { | 76 { |
77 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithBool_1, value); | 77 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithBool_1, value); |
78 return result !is null ? new id(result) : null; | 78 return result !is null ? new id(result) : null; |
79 } | 79 } |
80 | 80 |
81 public id initWithChar (byte value) | 81 public id initWithChar (byte value) |
82 { | 82 { |
83 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithChar_1, value); | 83 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithChar_1, value); |
84 return result !is null ? new id(result) : null; | 84 return result !is null ? new id(result) : null; |
85 } | 85 } |
86 | 86 |
87 public id initWithDouble (double value) | 87 public id initWithDouble (double value) |
88 { | 88 { |
89 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithDouble_1, value); | 89 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithDouble_1, value); |
90 return result !is null ? new id(result) : null; | 90 return result !is null ? new id(result) : null; |
91 } | 91 } |
92 | 92 |
93 public id initWithFloat (float value) | 93 public id initWithFloat (float value) |
94 { | 94 { |
95 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithFloat_1, value); | 95 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithFloat_1, value); |
96 return result !is null ? new id(result) : null; | 96 return result !is null ? new id(result) : null; |
97 } | 97 } |
98 | 98 |
99 public id initWithInt (int value) | 99 public id initWithInt (int value) |
100 { | 100 { |
101 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithInt_1, value); | 101 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithInt_1, value); |
102 return result !is null ? new id(result) : null; | 102 return result !is null ? new id(result) : null; |
103 } | 103 } |
104 | 104 |
105 public id initWithInteger (int value) | 105 public id initWithInteger (int value) |
106 { | 106 { |
107 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithInteger_1, value); | 107 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithInteger_1, value); |
108 return result !is null ? new id(result) : null; | 108 return result !is null ? new id(result) : null; |
109 } | 109 } |
110 | 110 |
111 public id initWithLong (int value) | 111 public id initWithLong (int value) |
112 { | 112 { |
113 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithLong_1, value); | 113 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithLong_1, value); |
114 return result !is null ? new id(result) : null; | 114 return result !is null ? new id(result) : null; |
115 } | 115 } |
116 | 116 |
117 public id initWithLongLong (long value) | 117 public id initWithLongLong (long value) |
118 { | 118 { |
119 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithLongLong_1, value); | 119 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithLongLong_1, value); |
120 return result !is null ? new id(result) : null; | 120 return result !is null ? new id(result) : null; |
121 } | 121 } |
122 | 122 |
123 public id initWithShort (short value) | 123 public id initWithShort (short value) |
124 { | 124 { |
125 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithShort_1, value); | 125 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithShort_1, value); |
126 return result !is null ? new id(result) : null; | 126 return result !is null ? new id(result) : null; |
127 } | 127 } |
128 | 128 |
129 public id initWithUnsignedChar (ubyte value) | 129 public id initWithUnsignedChar (ubyte value) |
130 { | 130 { |
131 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithUnsignedChar_1, value); | 131 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithUnsignedChar_1, value); |
132 return result !is null ? new id(result) : null; | 132 return result !is null ? new id(result) : null; |
133 } | 133 } |
134 | 134 |
135 public id initWithUnsignedInt (uint value) | 135 public id initWithUnsignedInt (uint value) |
136 { | 136 { |
137 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithUnsignedInt_1, value); | 137 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithUnsignedInt_1, value); |
138 return result !is null ? new id(result) : null; | 138 return result !is null ? new id(result) : null; |
139 } | 139 } |
140 | 140 |
141 public id initWithUnsignedInteger (uint value) | 141 public id initWithUnsignedInteger (uint value) |
142 { | 142 { |
143 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithUnsignedInteger_1, value); | 143 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithUnsignedInteger_1, value); |
144 return result !is null ? new id(result) : null; | 144 return result !is null ? new id(result) : null; |
145 } | 145 } |
146 | 146 |
147 public id initWithUnsignedLong (uint value) | 147 public id initWithUnsignedLong (uint value) |
148 { | 148 { |
149 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithUnsignedLong_1, value); | 149 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithUnsignedLong_1, value); |
150 return result !is null ? new id(result) : null; | 150 return result !is null ? new id(result) : null; |
151 } | 151 } |
152 | 152 |
153 public id initWithUnsignedLongLong (ulong value) | 153 public id initWithUnsignedLongLong (ulong value) |
154 { | 154 { |
155 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithUnsignedLongLong_1, value); | 155 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithUnsignedLongLong_1, value); |
156 return result !is null ? new id(result) : null; | 156 return result !is null ? new id(result) : null; |
157 } | 157 } |
158 | 158 |
159 public id initWithUnsignedShort (ushort value) | 159 public id initWithUnsignedShort (ushort value) |
160 { | 160 { |
161 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithUnsignedShort_1, value); | 161 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithUnsignedShort_1, value); |
162 return result !is null ? new id(result) : null; | 162 return result !is null ? new id(result) : null; |
163 } | 163 } |
164 | 164 |
165 public int intValue () | 165 public int intValue () |
166 { | 166 { |
167 return cast(int)OS.objc_msgSend(this.id, OS.sel_intValue); | 167 return cast(int)OS.objc_msgSend(this.id_, OS.sel_intValue); |
168 } | 168 } |
169 | 169 |
170 public int integerValue () | 170 public int integerValue () |
171 { | 171 { |
172 return cast(int)OS.objc_msgSend(this.id, OS.sel_integerValue); | 172 return cast(int)OS.objc_msgSend(this.id_, OS.sel_integerValue); |
173 } | 173 } |
174 | 174 |
175 public bool isEqualToNumber (NSNumber number) | 175 public bool isEqualToNumber (NSNumber number) |
176 { | 176 { |
177 return OS.objc_msgSend(this.id, OS.sel_isEqualToNumber_1, number !is null ? number.id : null) !is null; | 177 return OS.objc_msgSend(this.id_, OS.sel_isEqualToNumber_1, number !is null ? number.id_ : null) !is null; |
178 } | 178 } |
179 | 179 |
180 public long longLongValue () | 180 public long longLongValue () |
181 { | 181 { |
182 return cast(long) OS.objc_msgSend(this.id, OS.sel_longLongValue); | 182 return cast(long) OS.objc_msgSend(this.id_, OS.sel_longLongValue); |
183 } | 183 } |
184 | 184 |
185 public int longValue () | 185 public int longValue () |
186 { | 186 { |
187 return cast(int)OS.objc_msgSend(this.id, OS.sel_longValue); | 187 return cast(int)OS.objc_msgSend(this.id_, OS.sel_longValue); |
188 } | 188 } |
189 | 189 |
190 public static NSNumber numberWithBool (bool value) | 190 public static NSNumber numberWithBool (bool value) |
191 { | 191 { |
192 objc.id result = OS.objc_msgSend(OS.class_NSNumber, OS.sel_numberWithBool_1, value); | 192 objc.id result = OS.objc_msgSend(OS.class_NSNumber, OS.sel_numberWithBool_1, value); |
277 return result !is null ? new NSNumber(result) : null; | 277 return result !is null ? new NSNumber(result) : null; |
278 } | 278 } |
279 | 279 |
280 public short shortValue () | 280 public short shortValue () |
281 { | 281 { |
282 return cast(short) OS.objc_msgSend(this.id, OS.sel_shortValue); | 282 return cast(short) OS.objc_msgSend(this.id_, OS.sel_shortValue); |
283 } | 283 } |
284 | 284 |
285 public NSString stringValue () | 285 public NSString stringValue () |
286 { | 286 { |
287 objc.id result = OS.objc_msgSend(this.id, OS.sel_stringValue); | 287 objc.id result = OS.objc_msgSend(this.id_, OS.sel_stringValue); |
288 return result !is null ? new NSString(result) : null; | 288 return result !is null ? new NSString(result) : null; |
289 } | 289 } |
290 | 290 |
291 public ubyte unsignedCharValue () | 291 public ubyte unsignedCharValue () |
292 { | 292 { |
293 return cast(ubyte) OS.objc_msgSend(this.id, OS.sel_unsignedCharValue); | 293 return cast(ubyte) OS.objc_msgSend(this.id_, OS.sel_unsignedCharValue); |
294 } | 294 } |
295 | 295 |
296 public uint unsignedIntValue () | 296 public uint unsignedIntValue () |
297 { | 297 { |
298 return cast(uint)OS.objc_msgSend(this.id, OS.sel_unsignedIntValue); | 298 return cast(uint)OS.objc_msgSend(this.id_, OS.sel_unsignedIntValue); |
299 } | 299 } |
300 | 300 |
301 public uint unsignedIntegerValue () | 301 public uint unsignedIntegerValue () |
302 { | 302 { |
303 return cast(uint)OS.objc_msgSend(this.id, OS.sel_unsignedIntegerValue); | 303 return cast(uint)OS.objc_msgSend(this.id_, OS.sel_unsignedIntegerValue); |
304 } | 304 } |
305 | 305 |
306 public ulong unsignedLongLongValue () | 306 public ulong unsignedLongLongValue () |
307 { | 307 { |
308 return cast(ulong) OS.objc_msgSend(this.id, OS.sel_unsignedLongLongValue); | 308 return cast(ulong) OS.objc_msgSend(this.id_, OS.sel_unsignedLongLongValue); |
309 } | 309 } |
310 | 310 |
311 public uint unsignedLongValue () | 311 public uint unsignedLongValue () |
312 { | 312 { |
313 return cast(uint)OS.objc_msgSend(this.id, OS.sel_unsignedLongValue); | 313 return cast(uint)OS.objc_msgSend(this.id_, OS.sel_unsignedLongValue); |
314 } | 314 } |
315 | 315 |
316 public ushort unsignedShortValue () | 316 public ushort unsignedShortValue () |
317 { | 317 { |
318 return cast(ushort) OS.objc_msgSend(this.id, OS.sel_unsignedShortValue); | 318 return cast(ushort) OS.objc_msgSend(this.id_, OS.sel_unsignedShortValue); |
319 } | 319 } |
320 | 320 |
321 } | 321 } |