objc2_foundation/generated/
NSValue.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9extern_class!(
10 #[unsafe(super(NSObject))]
12
13 pub struct NSValue;
14);
15
16#[cfg(feature = "NSObject")]
17extern_conformance!(
18 unsafe impl NSCoding for NSValue {}
19);
20
21#[cfg(feature = "NSObject")]
22extern_conformance!(
23 unsafe impl NSCopying for NSValue {}
24);
25
26#[cfg(feature = "NSObject")]
27unsafe impl CopyingHelper for NSValue {
28 type Result = Self;
29}
30
31extern_conformance!(
32 unsafe impl NSObjectProtocol for NSValue {}
33);
34
35#[cfg(feature = "NSObject")]
36extern_conformance!(
37 unsafe impl NSSecureCoding for NSValue {}
38);
39
40impl NSValue {
41 extern_methods!(
42 #[unsafe(method(getValue:size:))]
46 #[unsafe(method_family = none)]
47 pub unsafe fn getValue_size(&self, value: NonNull<c_void>, size: NSUInteger);
48
49 #[unsafe(method(objCType))]
50 #[unsafe(method_family = none)]
51 pub fn objCType(&self) -> NonNull<c_char>;
52
53 #[unsafe(method(initWithBytes:objCType:))]
58 #[unsafe(method_family = init)]
59 pub unsafe fn initWithBytes_objCType(
60 this: Allocated<Self>,
61 value: NonNull<c_void>,
62 r#type: NonNull<c_char>,
63 ) -> Retained<Self>;
64
65 #[cfg(feature = "NSCoder")]
66 #[unsafe(method(initWithCoder:))]
70 #[unsafe(method_family = init)]
71 pub unsafe fn initWithCoder(
72 this: Allocated<Self>,
73 coder: &NSCoder,
74 ) -> Option<Retained<Self>>;
75 );
76}
77
78impl NSValue {
80 extern_methods!(
81 #[unsafe(method(valueWithBytes:objCType:))]
86 #[unsafe(method_family = none)]
87 pub unsafe fn valueWithBytes_objCType(
88 value: NonNull<c_void>,
89 r#type: NonNull<c_char>,
90 ) -> Retained<NSValue>;
91
92 #[unsafe(method(value:withObjCType:))]
97 #[unsafe(method_family = none)]
98 pub unsafe fn value_withObjCType(
99 value: NonNull<c_void>,
100 r#type: NonNull<c_char>,
101 ) -> Retained<NSValue>;
102 );
103}
104
105impl NSValue {
107 extern_methods!(
108 #[unsafe(method(valueWithNonretainedObject:))]
112 #[unsafe(method_family = none)]
113 pub unsafe fn valueWithNonretainedObject(
114 an_object: Option<&AnyObject>,
115 ) -> Retained<NSValue>;
116
117 #[unsafe(method(nonretainedObjectValue))]
118 #[unsafe(method_family = none)]
119 pub unsafe fn nonretainedObjectValue(&self) -> Option<Retained<AnyObject>>;
120
121 #[unsafe(method(valueWithPointer:))]
125 #[unsafe(method_family = none)]
126 pub unsafe fn valueWithPointer(pointer: *const c_void) -> Retained<NSValue>;
127
128 #[unsafe(method(pointerValue))]
129 #[unsafe(method_family = none)]
130 pub unsafe fn pointerValue(&self) -> *mut c_void;
131
132 #[unsafe(method(isEqualToValue:))]
133 #[unsafe(method_family = none)]
134 pub fn isEqualToValue(&self, value: &NSValue) -> bool;
135 );
136}
137
138extern_class!(
139 #[unsafe(super(NSValue, NSObject))]
141
142 pub struct NSNumber;
143);
144
145unsafe impl Send for NSNumber {}
146
147unsafe impl Sync for NSNumber {}
148
149#[cfg(feature = "NSObject")]
150extern_conformance!(
151 unsafe impl NSCoding for NSNumber {}
152);
153
154#[cfg(feature = "NSObject")]
155extern_conformance!(
156 unsafe impl NSCopying for NSNumber {}
157);
158
159#[cfg(feature = "NSObject")]
160unsafe impl CopyingHelper for NSNumber {
161 type Result = Self;
162}
163
164extern_conformance!(
165 unsafe impl NSObjectProtocol for NSNumber {}
166);
167
168#[cfg(feature = "NSObject")]
169extern_conformance!(
170 unsafe impl NSSecureCoding for NSNumber {}
171);
172
173impl NSNumber {
174 extern_methods!(
175 #[cfg(feature = "NSCoder")]
176 #[unsafe(method(initWithCoder:))]
180 #[unsafe(method_family = init)]
181 pub unsafe fn initWithCoder(
182 this: Allocated<Self>,
183 coder: &NSCoder,
184 ) -> Option<Retained<Self>>;
185
186 #[unsafe(method(initWithChar:))]
187 #[unsafe(method_family = init)]
188 pub fn initWithChar(this: Allocated<Self>, value: c_char) -> Retained<NSNumber>;
189
190 #[unsafe(method(initWithUnsignedChar:))]
191 #[unsafe(method_family = init)]
192 pub fn initWithUnsignedChar(this: Allocated<Self>, value: c_uchar) -> Retained<NSNumber>;
193
194 #[unsafe(method(initWithShort:))]
195 #[unsafe(method_family = init)]
196 pub fn initWithShort(this: Allocated<Self>, value: c_short) -> Retained<NSNumber>;
197
198 #[unsafe(method(initWithUnsignedShort:))]
199 #[unsafe(method_family = init)]
200 pub fn initWithUnsignedShort(this: Allocated<Self>, value: c_ushort) -> Retained<NSNumber>;
201
202 #[unsafe(method(initWithInt:))]
203 #[unsafe(method_family = init)]
204 pub fn initWithInt(this: Allocated<Self>, value: c_int) -> Retained<NSNumber>;
205
206 #[unsafe(method(initWithUnsignedInt:))]
207 #[unsafe(method_family = init)]
208 pub fn initWithUnsignedInt(this: Allocated<Self>, value: c_uint) -> Retained<NSNumber>;
209
210 #[unsafe(method(initWithLong:))]
211 #[unsafe(method_family = init)]
212 pub fn initWithLong(this: Allocated<Self>, value: c_long) -> Retained<NSNumber>;
213
214 #[unsafe(method(initWithUnsignedLong:))]
215 #[unsafe(method_family = init)]
216 pub fn initWithUnsignedLong(this: Allocated<Self>, value: c_ulong) -> Retained<NSNumber>;
217
218 #[unsafe(method(initWithLongLong:))]
219 #[unsafe(method_family = init)]
220 pub fn initWithLongLong(this: Allocated<Self>, value: c_longlong) -> Retained<NSNumber>;
221
222 #[unsafe(method(initWithUnsignedLongLong:))]
223 #[unsafe(method_family = init)]
224 pub fn initWithUnsignedLongLong(
225 this: Allocated<Self>,
226 value: c_ulonglong,
227 ) -> Retained<NSNumber>;
228
229 #[unsafe(method(initWithFloat:))]
230 #[unsafe(method_family = init)]
231 pub fn initWithFloat(this: Allocated<Self>, value: c_float) -> Retained<NSNumber>;
232
233 #[unsafe(method(initWithDouble:))]
234 #[unsafe(method_family = init)]
235 pub fn initWithDouble(this: Allocated<Self>, value: c_double) -> Retained<NSNumber>;
236
237 #[unsafe(method(initWithBool:))]
238 #[unsafe(method_family = init)]
239 pub fn initWithBool(this: Allocated<Self>, value: bool) -> Retained<NSNumber>;
240
241 #[unsafe(method(initWithInteger:))]
242 #[unsafe(method_family = init)]
243 pub fn initWithInteger(this: Allocated<Self>, value: NSInteger) -> Retained<NSNumber>;
244
245 #[unsafe(method(initWithUnsignedInteger:))]
246 #[unsafe(method_family = init)]
247 pub fn initWithUnsignedInteger(
248 this: Allocated<Self>,
249 value: NSUInteger,
250 ) -> Retained<NSNumber>;
251
252 #[unsafe(method(charValue))]
253 #[unsafe(method_family = none)]
254 pub fn charValue(&self) -> c_char;
255
256 #[unsafe(method(unsignedCharValue))]
257 #[unsafe(method_family = none)]
258 pub fn unsignedCharValue(&self) -> c_uchar;
259
260 #[unsafe(method(shortValue))]
261 #[unsafe(method_family = none)]
262 pub fn shortValue(&self) -> c_short;
263
264 #[unsafe(method(unsignedShortValue))]
265 #[unsafe(method_family = none)]
266 pub fn unsignedShortValue(&self) -> c_ushort;
267
268 #[unsafe(method(intValue))]
269 #[unsafe(method_family = none)]
270 pub fn intValue(&self) -> c_int;
271
272 #[unsafe(method(unsignedIntValue))]
273 #[unsafe(method_family = none)]
274 pub fn unsignedIntValue(&self) -> c_uint;
275
276 #[unsafe(method(longValue))]
277 #[unsafe(method_family = none)]
278 pub fn longValue(&self) -> c_long;
279
280 #[unsafe(method(unsignedLongValue))]
281 #[unsafe(method_family = none)]
282 pub fn unsignedLongValue(&self) -> c_ulong;
283
284 #[unsafe(method(longLongValue))]
285 #[unsafe(method_family = none)]
286 pub fn longLongValue(&self) -> c_longlong;
287
288 #[unsafe(method(unsignedLongLongValue))]
289 #[unsafe(method_family = none)]
290 pub fn unsignedLongLongValue(&self) -> c_ulonglong;
291
292 #[unsafe(method(floatValue))]
293 #[unsafe(method_family = none)]
294 pub fn floatValue(&self) -> c_float;
295
296 #[unsafe(method(doubleValue))]
297 #[unsafe(method_family = none)]
298 pub fn doubleValue(&self) -> c_double;
299
300 #[unsafe(method(boolValue))]
301 #[unsafe(method_family = none)]
302 pub fn boolValue(&self) -> bool;
303
304 #[unsafe(method(integerValue))]
305 #[unsafe(method_family = none)]
306 pub fn integerValue(&self) -> NSInteger;
307
308 #[unsafe(method(unsignedIntegerValue))]
309 #[unsafe(method_family = none)]
310 pub fn unsignedIntegerValue(&self) -> NSUInteger;
311
312 #[cfg(feature = "NSString")]
313 #[unsafe(method(stringValue))]
314 #[unsafe(method_family = none)]
315 pub fn stringValue(&self) -> Retained<NSString>;
316
317 #[cfg(feature = "NSObjCRuntime")]
318 #[unsafe(method(compare:))]
319 #[unsafe(method_family = none)]
320 pub fn compare(&self, other_number: &NSNumber) -> NSComparisonResult;
321
322 #[unsafe(method(isEqualToNumber:))]
323 #[unsafe(method_family = none)]
324 pub fn isEqualToNumber(&self, number: &NSNumber) -> bool;
325
326 #[cfg(feature = "NSString")]
327 #[unsafe(method(descriptionWithLocale:))]
331 #[unsafe(method_family = none)]
332 pub unsafe fn descriptionWithLocale(
333 &self,
334 locale: Option<&AnyObject>,
335 ) -> Retained<NSString>;
336 );
337}
338
339impl NSNumber {
341 extern_methods!(
342 #[unsafe(method(initWithBytes:objCType:))]
347 #[unsafe(method_family = init)]
348 pub unsafe fn initWithBytes_objCType(
349 this: Allocated<Self>,
350 value: NonNull<c_void>,
351 r#type: NonNull<c_char>,
352 ) -> Retained<Self>;
353 );
354}
355
356impl NSNumber {
358 extern_methods!(
359 #[unsafe(method(numberWithChar:))]
360 #[unsafe(method_family = none)]
361 pub fn numberWithChar(value: c_char) -> Retained<NSNumber>;
362
363 #[unsafe(method(numberWithUnsignedChar:))]
364 #[unsafe(method_family = none)]
365 pub fn numberWithUnsignedChar(value: c_uchar) -> Retained<NSNumber>;
366
367 #[unsafe(method(numberWithShort:))]
368 #[unsafe(method_family = none)]
369 pub fn numberWithShort(value: c_short) -> Retained<NSNumber>;
370
371 #[unsafe(method(numberWithUnsignedShort:))]
372 #[unsafe(method_family = none)]
373 pub fn numberWithUnsignedShort(value: c_ushort) -> Retained<NSNumber>;
374
375 #[unsafe(method(numberWithInt:))]
376 #[unsafe(method_family = none)]
377 pub fn numberWithInt(value: c_int) -> Retained<NSNumber>;
378
379 #[unsafe(method(numberWithUnsignedInt:))]
380 #[unsafe(method_family = none)]
381 pub fn numberWithUnsignedInt(value: c_uint) -> Retained<NSNumber>;
382
383 #[unsafe(method(numberWithLong:))]
384 #[unsafe(method_family = none)]
385 pub fn numberWithLong(value: c_long) -> Retained<NSNumber>;
386
387 #[unsafe(method(numberWithUnsignedLong:))]
388 #[unsafe(method_family = none)]
389 pub fn numberWithUnsignedLong(value: c_ulong) -> Retained<NSNumber>;
390
391 #[unsafe(method(numberWithLongLong:))]
392 #[unsafe(method_family = none)]
393 pub fn numberWithLongLong(value: c_longlong) -> Retained<NSNumber>;
394
395 #[unsafe(method(numberWithUnsignedLongLong:))]
396 #[unsafe(method_family = none)]
397 pub fn numberWithUnsignedLongLong(value: c_ulonglong) -> Retained<NSNumber>;
398
399 #[unsafe(method(numberWithFloat:))]
400 #[unsafe(method_family = none)]
401 pub fn numberWithFloat(value: c_float) -> Retained<NSNumber>;
402
403 #[unsafe(method(numberWithDouble:))]
404 #[unsafe(method_family = none)]
405 pub fn numberWithDouble(value: c_double) -> Retained<NSNumber>;
406
407 #[unsafe(method(numberWithBool:))]
408 #[unsafe(method_family = none)]
409 pub fn numberWithBool(value: bool) -> Retained<NSNumber>;
410
411 #[unsafe(method(numberWithInteger:))]
412 #[unsafe(method_family = none)]
413 pub fn numberWithInteger(value: NSInteger) -> Retained<NSNumber>;
414
415 #[unsafe(method(numberWithUnsignedInteger:))]
416 #[unsafe(method_family = none)]
417 pub fn numberWithUnsignedInteger(value: NSUInteger) -> Retained<NSNumber>;
418 );
419}
420
421impl NSValue {
423 extern_methods!(
424 #[deprecated]
428 #[unsafe(method(getValue:))]
429 #[unsafe(method_family = none)]
430 pub unsafe fn getValue(&self, value: NonNull<c_void>);
431 );
432}