1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;

use crate::*;

extern_class!(
    pub struct NSValue;

    unsafe impl ClassType for NSValue {
        type Super = NSObject;
        type Mutability = Immutable;
    }
);

#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSValue {}

#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSValue {}

unsafe impl NSObjectProtocol for NSValue {}

#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSValue {}

extern_methods!(
    unsafe impl NSValue {
        #[method(getValue:size:)]
        pub unsafe fn getValue_size(&self, value: NonNull<c_void>, size: NSUInteger);

        #[method(objCType)]
        pub fn objCType(&self) -> NonNull<c_char>;

        #[method_id(@__retain_semantics Init initWithBytes:objCType:)]
        pub unsafe fn initWithBytes_objCType(
            this: Allocated<Self>,
            value: NonNull<c_void>,
            r#type: NonNull<c_char>,
        ) -> Retained<Self>;

        #[cfg(feature = "NSCoder")]
        #[method_id(@__retain_semantics Init initWithCoder:)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;
    }
);

extern_methods!(
    /// NSValueCreation
    unsafe impl NSValue {
        #[method_id(@__retain_semantics Other valueWithBytes:objCType:)]
        pub unsafe fn valueWithBytes_objCType(
            value: NonNull<c_void>,
            r#type: NonNull<c_char>,
        ) -> Retained<NSValue>;

        #[method_id(@__retain_semantics Other value:withObjCType:)]
        pub unsafe fn value_withObjCType(
            value: NonNull<c_void>,
            r#type: NonNull<c_char>,
        ) -> Retained<NSValue>;
    }
);

extern_methods!(
    /// NSValueExtensionMethods
    unsafe impl NSValue {
        #[method_id(@__retain_semantics Other valueWithNonretainedObject:)]
        pub unsafe fn valueWithNonretainedObject(
            an_object: Option<&AnyObject>,
        ) -> Retained<NSValue>;

        #[method_id(@__retain_semantics Other nonretainedObjectValue)]
        pub unsafe fn nonretainedObjectValue(&self) -> Option<Retained<AnyObject>>;

        #[method_id(@__retain_semantics Other valueWithPointer:)]
        pub unsafe fn valueWithPointer(pointer: *mut c_void) -> Retained<NSValue>;

        #[method(pointerValue)]
        pub unsafe fn pointerValue(&self) -> *mut c_void;

        #[method(isEqualToValue:)]
        pub fn isEqualToValue(&self, value: &NSValue) -> bool;
    }
);

extern_class!(
    pub struct NSNumber;

    unsafe impl ClassType for NSNumber {
        #[inherits(NSObject)]
        type Super = NSValue;
        type Mutability = Immutable;
    }
);

unsafe impl Send for NSNumber {}

unsafe impl Sync for NSNumber {}

#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSNumber {}

#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSNumber {}

unsafe impl NSObjectProtocol for NSNumber {}

#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSNumber {}

extern_methods!(
    unsafe impl NSNumber {
        #[cfg(feature = "NSCoder")]
        #[method_id(@__retain_semantics Init initWithCoder:)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;

        #[method_id(@__retain_semantics Init initWithChar:)]
        pub fn initWithChar(this: Allocated<Self>, value: c_char) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Init initWithUnsignedChar:)]
        pub fn initWithUnsignedChar(this: Allocated<Self>, value: c_uchar) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Init initWithShort:)]
        pub fn initWithShort(this: Allocated<Self>, value: c_short) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Init initWithUnsignedShort:)]
        pub fn initWithUnsignedShort(this: Allocated<Self>, value: c_ushort) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Init initWithInt:)]
        pub fn initWithInt(this: Allocated<Self>, value: c_int) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Init initWithUnsignedInt:)]
        pub fn initWithUnsignedInt(this: Allocated<Self>, value: c_uint) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Init initWithLong:)]
        pub fn initWithLong(this: Allocated<Self>, value: c_long) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Init initWithUnsignedLong:)]
        pub fn initWithUnsignedLong(this: Allocated<Self>, value: c_ulong) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Init initWithLongLong:)]
        pub fn initWithLongLong(this: Allocated<Self>, value: c_longlong) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Init initWithUnsignedLongLong:)]
        pub fn initWithUnsignedLongLong(
            this: Allocated<Self>,
            value: c_ulonglong,
        ) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Init initWithFloat:)]
        pub fn initWithFloat(this: Allocated<Self>, value: c_float) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Init initWithDouble:)]
        pub fn initWithDouble(this: Allocated<Self>, value: c_double) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Init initWithBool:)]
        pub fn initWithBool(this: Allocated<Self>, value: bool) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Init initWithInteger:)]
        pub fn initWithInteger(this: Allocated<Self>, value: NSInteger) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Init initWithUnsignedInteger:)]
        pub fn initWithUnsignedInteger(
            this: Allocated<Self>,
            value: NSUInteger,
        ) -> Retained<NSNumber>;

        #[method(charValue)]
        pub fn charValue(&self) -> c_char;

        #[method(unsignedCharValue)]
        pub fn unsignedCharValue(&self) -> c_uchar;

        #[method(shortValue)]
        pub fn shortValue(&self) -> c_short;

        #[method(unsignedShortValue)]
        pub fn unsignedShortValue(&self) -> c_ushort;

        #[method(intValue)]
        pub fn intValue(&self) -> c_int;

        #[method(unsignedIntValue)]
        pub fn unsignedIntValue(&self) -> c_uint;

        #[method(longValue)]
        pub fn longValue(&self) -> c_long;

        #[method(unsignedLongValue)]
        pub fn unsignedLongValue(&self) -> c_ulong;

        #[method(longLongValue)]
        pub fn longLongValue(&self) -> c_longlong;

        #[method(unsignedLongLongValue)]
        pub fn unsignedLongLongValue(&self) -> c_ulonglong;

        #[method(floatValue)]
        pub fn floatValue(&self) -> c_float;

        #[method(doubleValue)]
        pub fn doubleValue(&self) -> c_double;

        #[method(boolValue)]
        pub fn boolValue(&self) -> bool;

        #[method(integerValue)]
        pub fn integerValue(&self) -> NSInteger;

        #[method(unsignedIntegerValue)]
        pub fn unsignedIntegerValue(&self) -> NSUInteger;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other stringValue)]
        pub fn stringValue(&self) -> Retained<NSString>;

        #[cfg(feature = "NSObjCRuntime")]
        #[method(compare:)]
        pub fn compare(&self, other_number: &NSNumber) -> NSComparisonResult;

        #[method(isEqualToNumber:)]
        pub fn isEqualToNumber(&self, number: &NSNumber) -> bool;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other descriptionWithLocale:)]
        pub unsafe fn descriptionWithLocale(
            &self,
            locale: Option<&AnyObject>,
        ) -> Retained<NSString>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSValue`
    unsafe impl NSNumber {
        #[method_id(@__retain_semantics Init initWithBytes:objCType:)]
        pub unsafe fn initWithBytes_objCType(
            this: Allocated<Self>,
            value: NonNull<c_void>,
            r#type: NonNull<c_char>,
        ) -> Retained<Self>;
    }
);

extern_methods!(
    /// NSNumberCreation
    unsafe impl NSNumber {
        #[method_id(@__retain_semantics Other numberWithChar:)]
        pub fn numberWithChar(value: c_char) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Other numberWithUnsignedChar:)]
        pub fn numberWithUnsignedChar(value: c_uchar) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Other numberWithShort:)]
        pub fn numberWithShort(value: c_short) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Other numberWithUnsignedShort:)]
        pub fn numberWithUnsignedShort(value: c_ushort) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Other numberWithInt:)]
        pub fn numberWithInt(value: c_int) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Other numberWithUnsignedInt:)]
        pub fn numberWithUnsignedInt(value: c_uint) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Other numberWithLong:)]
        pub fn numberWithLong(value: c_long) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Other numberWithUnsignedLong:)]
        pub fn numberWithUnsignedLong(value: c_ulong) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Other numberWithLongLong:)]
        pub fn numberWithLongLong(value: c_longlong) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Other numberWithUnsignedLongLong:)]
        pub fn numberWithUnsignedLongLong(value: c_ulonglong) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Other numberWithFloat:)]
        pub fn numberWithFloat(value: c_float) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Other numberWithDouble:)]
        pub fn numberWithDouble(value: c_double) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Other numberWithBool:)]
        pub fn numberWithBool(value: bool) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Other numberWithInteger:)]
        pub fn numberWithInteger(value: NSInteger) -> Retained<NSNumber>;

        #[method_id(@__retain_semantics Other numberWithUnsignedInteger:)]
        pub fn numberWithUnsignedInteger(value: NSUInteger) -> Retained<NSNumber>;
    }
);

extern_methods!(
    /// NSDeprecated
    unsafe impl NSValue {
        #[deprecated]
        #[method(getValue:)]
        pub unsafe fn getValue(&self, value: NonNull<c_void>);
    }
);