objc2_foundation/generated/
NSValue.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9extern_class!(
10    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsvalue?language=objc)
11    #[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:))]
43        #[unsafe(method_family = none)]
44        pub unsafe fn getValue_size(&self, value: NonNull<c_void>, size: NSUInteger);
45
46        #[unsafe(method(objCType))]
47        #[unsafe(method_family = none)]
48        pub fn objCType(&self) -> NonNull<c_char>;
49
50        #[unsafe(method(initWithBytes:objCType:))]
51        #[unsafe(method_family = init)]
52        pub unsafe fn initWithBytes_objCType(
53            this: Allocated<Self>,
54            value: NonNull<c_void>,
55            r#type: NonNull<c_char>,
56        ) -> Retained<Self>;
57
58        #[cfg(feature = "NSCoder")]
59        #[unsafe(method(initWithCoder:))]
60        #[unsafe(method_family = init)]
61        pub unsafe fn initWithCoder(
62            this: Allocated<Self>,
63            coder: &NSCoder,
64        ) -> Option<Retained<Self>>;
65    );
66}
67
68/// NSValueCreation.
69impl NSValue {
70    extern_methods!(
71        #[unsafe(method(valueWithBytes:objCType:))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn valueWithBytes_objCType(
74            value: NonNull<c_void>,
75            r#type: NonNull<c_char>,
76        ) -> Retained<NSValue>;
77
78        #[unsafe(method(value:withObjCType:))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn value_withObjCType(
81            value: NonNull<c_void>,
82            r#type: NonNull<c_char>,
83        ) -> Retained<NSValue>;
84    );
85}
86
87/// NSValueExtensionMethods.
88impl NSValue {
89    extern_methods!(
90        #[unsafe(method(valueWithNonretainedObject:))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn valueWithNonretainedObject(
93            an_object: Option<&AnyObject>,
94        ) -> Retained<NSValue>;
95
96        #[unsafe(method(nonretainedObjectValue))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn nonretainedObjectValue(&self) -> Option<Retained<AnyObject>>;
99
100        #[unsafe(method(valueWithPointer:))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn valueWithPointer(pointer: *const c_void) -> Retained<NSValue>;
103
104        #[unsafe(method(pointerValue))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn pointerValue(&self) -> *mut c_void;
107
108        #[unsafe(method(isEqualToValue:))]
109        #[unsafe(method_family = none)]
110        pub fn isEqualToValue(&self, value: &NSValue) -> bool;
111    );
112}
113
114extern_class!(
115    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsnumber?language=objc)
116    #[unsafe(super(NSValue, NSObject))]
117
118    pub struct NSNumber;
119);
120
121unsafe impl Send for NSNumber {}
122
123unsafe impl Sync for NSNumber {}
124
125#[cfg(feature = "NSObject")]
126extern_conformance!(
127    unsafe impl NSCoding for NSNumber {}
128);
129
130#[cfg(feature = "NSObject")]
131extern_conformance!(
132    unsafe impl NSCopying for NSNumber {}
133);
134
135#[cfg(feature = "NSObject")]
136unsafe impl CopyingHelper for NSNumber {
137    type Result = Self;
138}
139
140extern_conformance!(
141    unsafe impl NSObjectProtocol for NSNumber {}
142);
143
144#[cfg(feature = "NSObject")]
145extern_conformance!(
146    unsafe impl NSSecureCoding for NSNumber {}
147);
148
149impl NSNumber {
150    extern_methods!(
151        #[cfg(feature = "NSCoder")]
152        #[unsafe(method(initWithCoder:))]
153        #[unsafe(method_family = init)]
154        pub unsafe fn initWithCoder(
155            this: Allocated<Self>,
156            coder: &NSCoder,
157        ) -> Option<Retained<Self>>;
158
159        #[unsafe(method(initWithChar:))]
160        #[unsafe(method_family = init)]
161        pub fn initWithChar(this: Allocated<Self>, value: c_char) -> Retained<NSNumber>;
162
163        #[unsafe(method(initWithUnsignedChar:))]
164        #[unsafe(method_family = init)]
165        pub fn initWithUnsignedChar(this: Allocated<Self>, value: c_uchar) -> Retained<NSNumber>;
166
167        #[unsafe(method(initWithShort:))]
168        #[unsafe(method_family = init)]
169        pub fn initWithShort(this: Allocated<Self>, value: c_short) -> Retained<NSNumber>;
170
171        #[unsafe(method(initWithUnsignedShort:))]
172        #[unsafe(method_family = init)]
173        pub fn initWithUnsignedShort(this: Allocated<Self>, value: c_ushort) -> Retained<NSNumber>;
174
175        #[unsafe(method(initWithInt:))]
176        #[unsafe(method_family = init)]
177        pub fn initWithInt(this: Allocated<Self>, value: c_int) -> Retained<NSNumber>;
178
179        #[unsafe(method(initWithUnsignedInt:))]
180        #[unsafe(method_family = init)]
181        pub fn initWithUnsignedInt(this: Allocated<Self>, value: c_uint) -> Retained<NSNumber>;
182
183        #[unsafe(method(initWithLong:))]
184        #[unsafe(method_family = init)]
185        pub fn initWithLong(this: Allocated<Self>, value: c_long) -> Retained<NSNumber>;
186
187        #[unsafe(method(initWithUnsignedLong:))]
188        #[unsafe(method_family = init)]
189        pub fn initWithUnsignedLong(this: Allocated<Self>, value: c_ulong) -> Retained<NSNumber>;
190
191        #[unsafe(method(initWithLongLong:))]
192        #[unsafe(method_family = init)]
193        pub fn initWithLongLong(this: Allocated<Self>, value: c_longlong) -> Retained<NSNumber>;
194
195        #[unsafe(method(initWithUnsignedLongLong:))]
196        #[unsafe(method_family = init)]
197        pub fn initWithUnsignedLongLong(
198            this: Allocated<Self>,
199            value: c_ulonglong,
200        ) -> Retained<NSNumber>;
201
202        #[unsafe(method(initWithFloat:))]
203        #[unsafe(method_family = init)]
204        pub fn initWithFloat(this: Allocated<Self>, value: c_float) -> Retained<NSNumber>;
205
206        #[unsafe(method(initWithDouble:))]
207        #[unsafe(method_family = init)]
208        pub fn initWithDouble(this: Allocated<Self>, value: c_double) -> Retained<NSNumber>;
209
210        #[unsafe(method(initWithBool:))]
211        #[unsafe(method_family = init)]
212        pub fn initWithBool(this: Allocated<Self>, value: bool) -> Retained<NSNumber>;
213
214        #[unsafe(method(initWithInteger:))]
215        #[unsafe(method_family = init)]
216        pub fn initWithInteger(this: Allocated<Self>, value: NSInteger) -> Retained<NSNumber>;
217
218        #[unsafe(method(initWithUnsignedInteger:))]
219        #[unsafe(method_family = init)]
220        pub fn initWithUnsignedInteger(
221            this: Allocated<Self>,
222            value: NSUInteger,
223        ) -> Retained<NSNumber>;
224
225        #[unsafe(method(charValue))]
226        #[unsafe(method_family = none)]
227        pub fn charValue(&self) -> c_char;
228
229        #[unsafe(method(unsignedCharValue))]
230        #[unsafe(method_family = none)]
231        pub fn unsignedCharValue(&self) -> c_uchar;
232
233        #[unsafe(method(shortValue))]
234        #[unsafe(method_family = none)]
235        pub fn shortValue(&self) -> c_short;
236
237        #[unsafe(method(unsignedShortValue))]
238        #[unsafe(method_family = none)]
239        pub fn unsignedShortValue(&self) -> c_ushort;
240
241        #[unsafe(method(intValue))]
242        #[unsafe(method_family = none)]
243        pub fn intValue(&self) -> c_int;
244
245        #[unsafe(method(unsignedIntValue))]
246        #[unsafe(method_family = none)]
247        pub fn unsignedIntValue(&self) -> c_uint;
248
249        #[unsafe(method(longValue))]
250        #[unsafe(method_family = none)]
251        pub fn longValue(&self) -> c_long;
252
253        #[unsafe(method(unsignedLongValue))]
254        #[unsafe(method_family = none)]
255        pub fn unsignedLongValue(&self) -> c_ulong;
256
257        #[unsafe(method(longLongValue))]
258        #[unsafe(method_family = none)]
259        pub fn longLongValue(&self) -> c_longlong;
260
261        #[unsafe(method(unsignedLongLongValue))]
262        #[unsafe(method_family = none)]
263        pub fn unsignedLongLongValue(&self) -> c_ulonglong;
264
265        #[unsafe(method(floatValue))]
266        #[unsafe(method_family = none)]
267        pub fn floatValue(&self) -> c_float;
268
269        #[unsafe(method(doubleValue))]
270        #[unsafe(method_family = none)]
271        pub fn doubleValue(&self) -> c_double;
272
273        #[unsafe(method(boolValue))]
274        #[unsafe(method_family = none)]
275        pub fn boolValue(&self) -> bool;
276
277        #[unsafe(method(integerValue))]
278        #[unsafe(method_family = none)]
279        pub fn integerValue(&self) -> NSInteger;
280
281        #[unsafe(method(unsignedIntegerValue))]
282        #[unsafe(method_family = none)]
283        pub fn unsignedIntegerValue(&self) -> NSUInteger;
284
285        #[cfg(feature = "NSString")]
286        #[unsafe(method(stringValue))]
287        #[unsafe(method_family = none)]
288        pub fn stringValue(&self) -> Retained<NSString>;
289
290        #[cfg(feature = "NSObjCRuntime")]
291        #[unsafe(method(compare:))]
292        #[unsafe(method_family = none)]
293        pub fn compare(&self, other_number: &NSNumber) -> NSComparisonResult;
294
295        #[unsafe(method(isEqualToNumber:))]
296        #[unsafe(method_family = none)]
297        pub fn isEqualToNumber(&self, number: &NSNumber) -> bool;
298
299        #[cfg(feature = "NSString")]
300        #[unsafe(method(descriptionWithLocale:))]
301        #[unsafe(method_family = none)]
302        pub unsafe fn descriptionWithLocale(
303            &self,
304            locale: Option<&AnyObject>,
305        ) -> Retained<NSString>;
306    );
307}
308
309/// Methods declared on superclass `NSValue`.
310impl NSNumber {
311    extern_methods!(
312        #[unsafe(method(initWithBytes:objCType:))]
313        #[unsafe(method_family = init)]
314        pub unsafe fn initWithBytes_objCType(
315            this: Allocated<Self>,
316            value: NonNull<c_void>,
317            r#type: NonNull<c_char>,
318        ) -> Retained<Self>;
319    );
320}
321
322/// NSNumberCreation.
323impl NSNumber {
324    extern_methods!(
325        #[unsafe(method(numberWithChar:))]
326        #[unsafe(method_family = none)]
327        pub fn numberWithChar(value: c_char) -> Retained<NSNumber>;
328
329        #[unsafe(method(numberWithUnsignedChar:))]
330        #[unsafe(method_family = none)]
331        pub fn numberWithUnsignedChar(value: c_uchar) -> Retained<NSNumber>;
332
333        #[unsafe(method(numberWithShort:))]
334        #[unsafe(method_family = none)]
335        pub fn numberWithShort(value: c_short) -> Retained<NSNumber>;
336
337        #[unsafe(method(numberWithUnsignedShort:))]
338        #[unsafe(method_family = none)]
339        pub fn numberWithUnsignedShort(value: c_ushort) -> Retained<NSNumber>;
340
341        #[unsafe(method(numberWithInt:))]
342        #[unsafe(method_family = none)]
343        pub fn numberWithInt(value: c_int) -> Retained<NSNumber>;
344
345        #[unsafe(method(numberWithUnsignedInt:))]
346        #[unsafe(method_family = none)]
347        pub fn numberWithUnsignedInt(value: c_uint) -> Retained<NSNumber>;
348
349        #[unsafe(method(numberWithLong:))]
350        #[unsafe(method_family = none)]
351        pub fn numberWithLong(value: c_long) -> Retained<NSNumber>;
352
353        #[unsafe(method(numberWithUnsignedLong:))]
354        #[unsafe(method_family = none)]
355        pub fn numberWithUnsignedLong(value: c_ulong) -> Retained<NSNumber>;
356
357        #[unsafe(method(numberWithLongLong:))]
358        #[unsafe(method_family = none)]
359        pub fn numberWithLongLong(value: c_longlong) -> Retained<NSNumber>;
360
361        #[unsafe(method(numberWithUnsignedLongLong:))]
362        #[unsafe(method_family = none)]
363        pub fn numberWithUnsignedLongLong(value: c_ulonglong) -> Retained<NSNumber>;
364
365        #[unsafe(method(numberWithFloat:))]
366        #[unsafe(method_family = none)]
367        pub fn numberWithFloat(value: c_float) -> Retained<NSNumber>;
368
369        #[unsafe(method(numberWithDouble:))]
370        #[unsafe(method_family = none)]
371        pub fn numberWithDouble(value: c_double) -> Retained<NSNumber>;
372
373        #[unsafe(method(numberWithBool:))]
374        #[unsafe(method_family = none)]
375        pub fn numberWithBool(value: bool) -> Retained<NSNumber>;
376
377        #[unsafe(method(numberWithInteger:))]
378        #[unsafe(method_family = none)]
379        pub fn numberWithInteger(value: NSInteger) -> Retained<NSNumber>;
380
381        #[unsafe(method(numberWithUnsignedInteger:))]
382        #[unsafe(method_family = none)]
383        pub fn numberWithUnsignedInteger(value: NSUInteger) -> Retained<NSNumber>;
384    );
385}
386
387/// NSDeprecated.
388impl NSValue {
389    extern_methods!(
390        #[deprecated]
391        #[unsafe(method(getValue:))]
392        #[unsafe(method_family = none)]
393        pub unsafe fn getValue(&self, value: NonNull<c_void>);
394    );
395}