objc2_core_location/generated/
CLRegion.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/clregionstate?language=objc)
11// NS_CLOSED_ENUM
12#[repr(isize)] // NSInteger
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub enum CLRegionState {
15    #[doc(alias = "CLRegionStateUnknown")]
16    Unknown = 0,
17    #[doc(alias = "CLRegionStateInside")]
18    Inside = 1,
19    #[doc(alias = "CLRegionStateOutside")]
20    Outside = 2,
21}
22
23unsafe impl Encode for CLRegionState {
24    const ENCODING: Encoding = NSInteger::ENCODING;
25}
26
27unsafe impl RefEncode for CLRegionState {
28    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
29}
30
31/// [Apple's documentation](https://developer.apple.com/documentation/corelocation/clproximity?language=objc)
32// NS_ENUM
33#[repr(transparent)]
34#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
35pub struct CLProximity(pub NSInteger);
36impl CLProximity {
37    #[doc(alias = "CLProximityUnknown")]
38    pub const Unknown: Self = Self(0);
39    #[doc(alias = "CLProximityImmediate")]
40    pub const Immediate: Self = Self(1);
41    #[doc(alias = "CLProximityNear")]
42    pub const Near: Self = Self(2);
43    #[doc(alias = "CLProximityFar")]
44    pub const Far: Self = Self(3);
45}
46
47unsafe impl Encode for CLProximity {
48    const ENCODING: Encoding = NSInteger::ENCODING;
49}
50
51unsafe impl RefEncode for CLProximity {
52    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
53}
54
55extern_class!(
56    /// [Apple's documentation](https://developer.apple.com/documentation/corelocation/clregion?language=objc)
57    #[unsafe(super(NSObject))]
58    #[derive(Debug, PartialEq, Eq, Hash)]
59    pub struct CLRegion;
60);
61
62extern_conformance!(
63    unsafe impl NSCoding for CLRegion {}
64);
65
66extern_conformance!(
67    unsafe impl NSCopying for CLRegion {}
68);
69
70unsafe impl CopyingHelper for CLRegion {
71    type Result = Self;
72}
73
74extern_conformance!(
75    unsafe impl NSObjectProtocol for CLRegion {}
76);
77
78extern_conformance!(
79    unsafe impl NSSecureCoding for CLRegion {}
80);
81
82impl CLRegion {
83    extern_methods!(
84        #[cfg(feature = "CLLocation")]
85        #[deprecated = "Please see CLCircularRegion"]
86        #[unsafe(method(initCircularRegionWithCenter:radius:identifier:))]
87        #[unsafe(method_family = init)]
88        pub unsafe fn initCircularRegionWithCenter_radius_identifier(
89            this: Allocated<Self>,
90            center: CLLocationCoordinate2D,
91            radius: CLLocationDistance,
92            identifier: &NSString,
93        ) -> Retained<Self>;
94
95        #[cfg(feature = "CLLocation")]
96        #[deprecated = "Please see CLCircularRegion"]
97        #[unsafe(method(center))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn center(&self) -> CLLocationCoordinate2D;
100
101        #[cfg(feature = "CLLocation")]
102        #[deprecated = "Please see CLCircularRegion"]
103        #[unsafe(method(radius))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn radius(&self) -> CLLocationDistance;
106
107        #[unsafe(method(identifier))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn identifier(&self) -> Retained<NSString>;
110
111        #[unsafe(method(notifyOnEntry))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn notifyOnEntry(&self) -> bool;
114
115        /// Setter for [`notifyOnEntry`][Self::notifyOnEntry].
116        #[unsafe(method(setNotifyOnEntry:))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn setNotifyOnEntry(&self, notify_on_entry: bool);
119
120        #[unsafe(method(notifyOnExit))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn notifyOnExit(&self) -> bool;
123
124        /// Setter for [`notifyOnExit`][Self::notifyOnExit].
125        #[unsafe(method(setNotifyOnExit:))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn setNotifyOnExit(&self, notify_on_exit: bool);
128
129        #[cfg(feature = "CLLocation")]
130        #[deprecated = "Please see CLCircularRegion"]
131        #[unsafe(method(containsCoordinate:))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn containsCoordinate(&self, coordinate: CLLocationCoordinate2D) -> bool;
134    );
135}
136
137/// Methods declared on superclass `NSObject`.
138impl CLRegion {
139    extern_methods!(
140        #[unsafe(method(init))]
141        #[unsafe(method_family = init)]
142        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
143
144        #[unsafe(method(new))]
145        #[unsafe(method_family = new)]
146        pub unsafe fn new() -> Retained<Self>;
147    );
148}