objc2_core_location/generated/
CLLocation.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/corelocation/cllocationdegrees?language=objc)
11pub type CLLocationDegrees = c_double;
12
13/// [Apple's documentation](https://developer.apple.com/documentation/corelocation/cllocationaccuracy?language=objc)
14pub type CLLocationAccuracy = c_double;
15
16/// [Apple's documentation](https://developer.apple.com/documentation/corelocation/cllocationspeed?language=objc)
17pub type CLLocationSpeed = c_double;
18
19/// [Apple's documentation](https://developer.apple.com/documentation/corelocation/cllocationspeedaccuracy?language=objc)
20pub type CLLocationSpeedAccuracy = c_double;
21
22/// [Apple's documentation](https://developer.apple.com/documentation/corelocation/cllocationdirection?language=objc)
23pub type CLLocationDirection = c_double;
24
25/// [Apple's documentation](https://developer.apple.com/documentation/corelocation/cllocationdirectionaccuracy?language=objc)
26pub type CLLocationDirectionAccuracy = c_double;
27
28/// [Apple's documentation](https://developer.apple.com/documentation/corelocation/cllocationcoordinate2d?language=objc)
29#[repr(C)]
30#[derive(Clone, Copy, Debug, PartialEq)]
31pub struct CLLocationCoordinate2D {
32    pub latitude: CLLocationDegrees,
33    pub longitude: CLLocationDegrees,
34}
35
36unsafe impl Encode for CLLocationCoordinate2D {
37    const ENCODING: Encoding = Encoding::Struct(
38        "CLLocationCoordinate2D",
39        &[<CLLocationDegrees>::ENCODING, <CLLocationDegrees>::ENCODING],
40    );
41}
42
43unsafe impl RefEncode for CLLocationCoordinate2D {
44    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
45}
46
47/// [Apple's documentation](https://developer.apple.com/documentation/corelocation/cllocationdistance?language=objc)
48pub type CLLocationDistance = c_double;
49
50extern "C" {
51    /// [Apple's documentation](https://developer.apple.com/documentation/corelocation/kcldistancefilternone?language=objc)
52    pub static kCLDistanceFilterNone: CLLocationDistance;
53}
54
55extern "C" {
56    /// [Apple's documentation](https://developer.apple.com/documentation/corelocation/kcllocationaccuracybestfornavigation?language=objc)
57    pub static kCLLocationAccuracyBestForNavigation: CLLocationAccuracy;
58}
59
60extern "C" {
61    /// [Apple's documentation](https://developer.apple.com/documentation/corelocation/kcllocationaccuracybest?language=objc)
62    pub static kCLLocationAccuracyBest: CLLocationAccuracy;
63}
64
65extern "C" {
66    /// [Apple's documentation](https://developer.apple.com/documentation/corelocation/kcllocationaccuracynearesttenmeters?language=objc)
67    pub static kCLLocationAccuracyNearestTenMeters: CLLocationAccuracy;
68}
69
70extern "C" {
71    /// [Apple's documentation](https://developer.apple.com/documentation/corelocation/kcllocationaccuracyhundredmeters?language=objc)
72    pub static kCLLocationAccuracyHundredMeters: CLLocationAccuracy;
73}
74
75extern "C" {
76    /// [Apple's documentation](https://developer.apple.com/documentation/corelocation/kcllocationaccuracykilometer?language=objc)
77    pub static kCLLocationAccuracyKilometer: CLLocationAccuracy;
78}
79
80extern "C" {
81    /// [Apple's documentation](https://developer.apple.com/documentation/corelocation/kcllocationaccuracythreekilometers?language=objc)
82    pub static kCLLocationAccuracyThreeKilometers: CLLocationAccuracy;
83}
84
85extern "C" {
86    /// [Apple's documentation](https://developer.apple.com/documentation/corelocation/kcllocationaccuracyreduced?language=objc)
87    pub static kCLLocationAccuracyReduced: CLLocationAccuracy;
88}
89
90extern "C" {
91    /// [Apple's documentation](https://developer.apple.com/documentation/corelocation/cllocationdistancemax?language=objc)
92    pub static CLLocationDistanceMax: CLLocationDistance;
93}
94
95extern "C" {
96    /// [Apple's documentation](https://developer.apple.com/documentation/corelocation/cltimeintervalmax?language=objc)
97    pub static CLTimeIntervalMax: NSTimeInterval;
98}
99
100extern "C" {
101    /// [Apple's documentation](https://developer.apple.com/documentation/corelocation/kcllocationcoordinate2dinvalid?language=objc)
102    pub static kCLLocationCoordinate2DInvalid: CLLocationCoordinate2D;
103}
104
105impl CLLocationCoordinate2D {
106    #[doc(alias = "CLLocationCoordinate2DIsValid")]
107    #[inline]
108    pub unsafe fn is_valid(self: CLLocationCoordinate2D) -> bool {
109        extern "C-unwind" {
110            fn CLLocationCoordinate2DIsValid(coord: CLLocationCoordinate2D) -> Bool;
111        }
112        unsafe { CLLocationCoordinate2DIsValid(self) }.as_bool()
113    }
114
115    #[doc(alias = "CLLocationCoordinate2DMake")]
116    #[inline]
117    pub unsafe fn new(
118        latitude: CLLocationDegrees,
119        longitude: CLLocationDegrees,
120    ) -> CLLocationCoordinate2D {
121        extern "C-unwind" {
122            fn CLLocationCoordinate2DMake(
123                latitude: CLLocationDegrees,
124                longitude: CLLocationDegrees,
125            ) -> CLLocationCoordinate2D;
126        }
127        unsafe { CLLocationCoordinate2DMake(latitude, longitude) }
128    }
129}
130
131extern_class!(
132    /// [Apple's documentation](https://developer.apple.com/documentation/corelocation/clfloor?language=objc)
133    #[unsafe(super(NSObject))]
134    #[derive(Debug, PartialEq, Eq, Hash)]
135    pub struct CLFloor;
136);
137
138extern_conformance!(
139    unsafe impl NSCoding for CLFloor {}
140);
141
142extern_conformance!(
143    unsafe impl NSCopying for CLFloor {}
144);
145
146unsafe impl CopyingHelper for CLFloor {
147    type Result = Self;
148}
149
150extern_conformance!(
151    unsafe impl NSObjectProtocol for CLFloor {}
152);
153
154extern_conformance!(
155    unsafe impl NSSecureCoding for CLFloor {}
156);
157
158impl CLFloor {
159    extern_methods!(
160        #[unsafe(method(level))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn level(&self) -> NSInteger;
163    );
164}
165
166/// Methods declared on superclass `NSObject`.
167impl CLFloor {
168    extern_methods!(
169        #[unsafe(method(init))]
170        #[unsafe(method_family = init)]
171        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
172
173        #[unsafe(method(new))]
174        #[unsafe(method_family = new)]
175        pub unsafe fn new() -> Retained<Self>;
176    );
177}
178
179extern_class!(
180    /// [Apple's documentation](https://developer.apple.com/documentation/corelocation/cllocationsourceinformation?language=objc)
181    #[unsafe(super(NSObject))]
182    #[derive(Debug, PartialEq, Eq, Hash)]
183    pub struct CLLocationSourceInformation;
184);
185
186extern_conformance!(
187    unsafe impl NSCoding for CLLocationSourceInformation {}
188);
189
190extern_conformance!(
191    unsafe impl NSCopying for CLLocationSourceInformation {}
192);
193
194unsafe impl CopyingHelper for CLLocationSourceInformation {
195    type Result = Self;
196}
197
198extern_conformance!(
199    unsafe impl NSObjectProtocol for CLLocationSourceInformation {}
200);
201
202extern_conformance!(
203    unsafe impl NSSecureCoding for CLLocationSourceInformation {}
204);
205
206impl CLLocationSourceInformation {
207    extern_methods!(
208        #[unsafe(method(initWithSoftwareSimulationState:andExternalAccessoryState:))]
209        #[unsafe(method_family = init)]
210        pub unsafe fn initWithSoftwareSimulationState_andExternalAccessoryState(
211            this: Allocated<Self>,
212            is_software: bool,
213            is_accessory: bool,
214        ) -> Retained<Self>;
215
216        #[unsafe(method(isSimulatedBySoftware))]
217        #[unsafe(method_family = none)]
218        pub unsafe fn isSimulatedBySoftware(&self) -> bool;
219
220        #[unsafe(method(isProducedByAccessory))]
221        #[unsafe(method_family = none)]
222        pub unsafe fn isProducedByAccessory(&self) -> bool;
223    );
224}
225
226/// Methods declared on superclass `NSObject`.
227impl CLLocationSourceInformation {
228    extern_methods!(
229        #[unsafe(method(init))]
230        #[unsafe(method_family = init)]
231        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
232
233        #[unsafe(method(new))]
234        #[unsafe(method_family = new)]
235        pub unsafe fn new() -> Retained<Self>;
236    );
237}
238
239extern_class!(
240    /// [Apple's documentation](https://developer.apple.com/documentation/corelocation/cllocation?language=objc)
241    #[unsafe(super(NSObject))]
242    #[derive(Debug, PartialEq, Eq, Hash)]
243    pub struct CLLocation;
244);
245
246unsafe impl Send for CLLocation {}
247
248unsafe impl Sync for CLLocation {}
249
250extern_conformance!(
251    unsafe impl NSCoding for CLLocation {}
252);
253
254extern_conformance!(
255    unsafe impl NSCopying for CLLocation {}
256);
257
258unsafe impl CopyingHelper for CLLocation {
259    type Result = Self;
260}
261
262extern_conformance!(
263    unsafe impl NSObjectProtocol for CLLocation {}
264);
265
266extern_conformance!(
267    unsafe impl NSSecureCoding for CLLocation {}
268);
269
270impl CLLocation {
271    extern_methods!(
272        #[unsafe(method(initWithLatitude:longitude:))]
273        #[unsafe(method_family = init)]
274        pub unsafe fn initWithLatitude_longitude(
275            this: Allocated<Self>,
276            latitude: CLLocationDegrees,
277            longitude: CLLocationDegrees,
278        ) -> Retained<Self>;
279
280        #[unsafe(method(initWithCoordinate:altitude:horizontalAccuracy:verticalAccuracy:timestamp:))]
281        #[unsafe(method_family = init)]
282        pub unsafe fn initWithCoordinate_altitude_horizontalAccuracy_verticalAccuracy_timestamp(
283            this: Allocated<Self>,
284            coordinate: CLLocationCoordinate2D,
285            altitude: CLLocationDistance,
286            h_accuracy: CLLocationAccuracy,
287            v_accuracy: CLLocationAccuracy,
288            timestamp: &NSDate,
289        ) -> Retained<Self>;
290
291        #[unsafe(method(initWithCoordinate:altitude:horizontalAccuracy:verticalAccuracy:course:speed:timestamp:))]
292        #[unsafe(method_family = init)]
293        pub unsafe fn initWithCoordinate_altitude_horizontalAccuracy_verticalAccuracy_course_speed_timestamp(
294            this: Allocated<Self>,
295            coordinate: CLLocationCoordinate2D,
296            altitude: CLLocationDistance,
297            h_accuracy: CLLocationAccuracy,
298            v_accuracy: CLLocationAccuracy,
299            course: CLLocationDirection,
300            speed: CLLocationSpeed,
301            timestamp: &NSDate,
302        ) -> Retained<Self>;
303
304        #[unsafe(method(initWithCoordinate:altitude:horizontalAccuracy:verticalAccuracy:course:courseAccuracy:speed:speedAccuracy:timestamp:))]
305        #[unsafe(method_family = init)]
306        pub unsafe fn initWithCoordinate_altitude_horizontalAccuracy_verticalAccuracy_course_courseAccuracy_speed_speedAccuracy_timestamp(
307            this: Allocated<Self>,
308            coordinate: CLLocationCoordinate2D,
309            altitude: CLLocationDistance,
310            h_accuracy: CLLocationAccuracy,
311            v_accuracy: CLLocationAccuracy,
312            course: CLLocationDirection,
313            course_accuracy: CLLocationDirectionAccuracy,
314            speed: CLLocationSpeed,
315            speed_accuracy: CLLocationSpeedAccuracy,
316            timestamp: &NSDate,
317        ) -> Retained<Self>;
318
319        #[unsafe(method(initWithCoordinate:altitude:horizontalAccuracy:verticalAccuracy:course:courseAccuracy:speed:speedAccuracy:timestamp:sourceInfo:))]
320        #[unsafe(method_family = init)]
321        pub unsafe fn initWithCoordinate_altitude_horizontalAccuracy_verticalAccuracy_course_courseAccuracy_speed_speedAccuracy_timestamp_sourceInfo(
322            this: Allocated<Self>,
323            coordinate: CLLocationCoordinate2D,
324            altitude: CLLocationDistance,
325            h_accuracy: CLLocationAccuracy,
326            v_accuracy: CLLocationAccuracy,
327            course: CLLocationDirection,
328            course_accuracy: CLLocationDirectionAccuracy,
329            speed: CLLocationSpeed,
330            speed_accuracy: CLLocationSpeedAccuracy,
331            timestamp: &NSDate,
332            source_info: &CLLocationSourceInformation,
333        ) -> Retained<Self>;
334
335        #[unsafe(method(coordinate))]
336        #[unsafe(method_family = none)]
337        pub unsafe fn coordinate(&self) -> CLLocationCoordinate2D;
338
339        #[unsafe(method(altitude))]
340        #[unsafe(method_family = none)]
341        pub unsafe fn altitude(&self) -> CLLocationDistance;
342
343        #[unsafe(method(ellipsoidalAltitude))]
344        #[unsafe(method_family = none)]
345        pub unsafe fn ellipsoidalAltitude(&self) -> CLLocationDistance;
346
347        #[unsafe(method(horizontalAccuracy))]
348        #[unsafe(method_family = none)]
349        pub unsafe fn horizontalAccuracy(&self) -> CLLocationAccuracy;
350
351        #[unsafe(method(verticalAccuracy))]
352        #[unsafe(method_family = none)]
353        pub unsafe fn verticalAccuracy(&self) -> CLLocationAccuracy;
354
355        #[unsafe(method(course))]
356        #[unsafe(method_family = none)]
357        pub unsafe fn course(&self) -> CLLocationDirection;
358
359        #[unsafe(method(courseAccuracy))]
360        #[unsafe(method_family = none)]
361        pub unsafe fn courseAccuracy(&self) -> CLLocationDirectionAccuracy;
362
363        #[unsafe(method(speed))]
364        #[unsafe(method_family = none)]
365        pub unsafe fn speed(&self) -> CLLocationSpeed;
366
367        #[unsafe(method(speedAccuracy))]
368        #[unsafe(method_family = none)]
369        pub unsafe fn speedAccuracy(&self) -> CLLocationSpeedAccuracy;
370
371        #[unsafe(method(timestamp))]
372        #[unsafe(method_family = none)]
373        pub unsafe fn timestamp(&self) -> Retained<NSDate>;
374
375        #[unsafe(method(floor))]
376        #[unsafe(method_family = none)]
377        pub unsafe fn floor(&self) -> Option<Retained<CLFloor>>;
378
379        #[unsafe(method(sourceInformation))]
380        #[unsafe(method_family = none)]
381        pub unsafe fn sourceInformation(&self) -> Option<Retained<CLLocationSourceInformation>>;
382    );
383}
384
385/// Methods declared on superclass `NSObject`.
386impl CLLocation {
387    extern_methods!(
388        #[unsafe(method(init))]
389        #[unsafe(method_family = init)]
390        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
391
392        #[unsafe(method(new))]
393        #[unsafe(method_family = new)]
394        pub unsafe fn new() -> Retained<Self>;
395    );
396}
397
398#[deprecated = "renamed to `CLLocationCoordinate2D::is_valid`"]
399#[inline]
400pub unsafe extern "C-unwind" fn CLLocationCoordinate2DIsValid(
401    coord: CLLocationCoordinate2D,
402) -> bool {
403    extern "C-unwind" {
404        fn CLLocationCoordinate2DIsValid(coord: CLLocationCoordinate2D) -> Bool;
405    }
406    unsafe { CLLocationCoordinate2DIsValid(coord) }.as_bool()
407}
408
409extern "C-unwind" {
410    #[deprecated = "renamed to `CLLocationCoordinate2D::new`"]
411    pub fn CLLocationCoordinate2DMake(
412        latitude: CLLocationDegrees,
413        longitude: CLLocationDegrees,
414    ) -> CLLocationCoordinate2D;
415}