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