objc2_foundation/generated/
NSException.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9extern "C" {
10 #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
14 pub static NSGenericException: &'static NSExceptionName;
15}
16
17extern "C" {
18 #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
20 pub static NSRangeException: &'static NSExceptionName;
21}
22
23extern "C" {
24 #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
26 pub static NSInvalidArgumentException: &'static NSExceptionName;
27}
28
29extern "C" {
30 #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
32 pub static NSInternalInconsistencyException: &'static NSExceptionName;
33}
34
35extern "C" {
36 #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
38 pub static NSMallocException: &'static NSExceptionName;
39}
40
41extern "C" {
42 #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
44 pub static NSObjectInaccessibleException: &'static NSExceptionName;
45}
46
47extern "C" {
48 #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
50 pub static NSObjectNotAvailableException: &'static NSExceptionName;
51}
52
53extern "C" {
54 #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
56 pub static NSDestinationInvalidException: &'static NSExceptionName;
57}
58
59extern "C" {
60 #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
62 pub static NSPortTimeoutException: &'static NSExceptionName;
63}
64
65extern "C" {
66 #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
68 pub static NSInvalidSendPortException: &'static NSExceptionName;
69}
70
71extern "C" {
72 #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
74 pub static NSInvalidReceivePortException: &'static NSExceptionName;
75}
76
77extern "C" {
78 #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
80 pub static NSPortSendException: &'static NSExceptionName;
81}
82
83extern "C" {
84 #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
86 pub static NSPortReceiveException: &'static NSExceptionName;
87}
88
89extern "C" {
90 #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
92 pub static NSOldStyleException: &'static NSExceptionName;
93}
94
95extern "C" {
96 #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
98 pub static NSInconsistentArchiveException: &'static NSExceptionName;
99}
100
101extern_class!(
102 #[unsafe(super(NSObject))]
104 #[derive(PartialEq, Eq, Hash)]
105 pub struct NSException;
106);
107
108#[cfg(feature = "NSObject")]
109extern_conformance!(
110 unsafe impl NSCoding for NSException {}
111);
112
113#[cfg(feature = "NSObject")]
114extern_conformance!(
115 unsafe impl NSCopying for NSException {}
116);
117
118#[cfg(feature = "NSObject")]
119unsafe impl CopyingHelper for NSException {
120 type Result = Self;
121}
122
123extern_conformance!(
124 unsafe impl NSObjectProtocol for NSException {}
125);
126
127#[cfg(feature = "NSObject")]
128extern_conformance!(
129 unsafe impl NSSecureCoding for NSException {}
130);
131
132impl NSException {
133 extern_methods!(
134 #[cfg(all(
135 feature = "NSDictionary",
136 feature = "NSObjCRuntime",
137 feature = "NSString"
138 ))]
139 #[unsafe(method(exceptionWithName:reason:userInfo:))]
143 #[unsafe(method_family = none)]
144 pub unsafe fn exceptionWithName_reason_userInfo(
145 name: &NSExceptionName,
146 reason: Option<&NSString>,
147 user_info: Option<&NSDictionary>,
148 ) -> Retained<NSException>;
149
150 #[cfg(all(
151 feature = "NSDictionary",
152 feature = "NSObjCRuntime",
153 feature = "NSString"
154 ))]
155 #[unsafe(method(initWithName:reason:userInfo:))]
159 #[unsafe(method_family = init)]
160 pub unsafe fn initWithName_reason_userInfo(
161 this: Allocated<Self>,
162 a_name: &NSExceptionName,
163 a_reason: Option<&NSString>,
164 a_user_info: Option<&NSDictionary>,
165 ) -> Retained<Self>;
166
167 #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
168 #[unsafe(method(name))]
169 #[unsafe(method_family = none)]
170 pub fn name(&self) -> Retained<NSExceptionName>;
171
172 #[cfg(feature = "NSString")]
173 #[unsafe(method(reason))]
174 #[unsafe(method_family = none)]
175 pub fn reason(&self) -> Option<Retained<NSString>>;
176
177 #[cfg(feature = "NSDictionary")]
178 #[unsafe(method(userInfo))]
179 #[unsafe(method_family = none)]
180 pub fn userInfo(&self) -> Option<Retained<NSDictionary>>;
181
182 #[cfg(all(feature = "NSArray", feature = "NSValue"))]
183 #[unsafe(method(callStackReturnAddresses))]
184 #[unsafe(method_family = none)]
185 pub fn callStackReturnAddresses(&self) -> Retained<NSArray<NSNumber>>;
186
187 #[cfg(all(feature = "NSArray", feature = "NSString"))]
188 #[unsafe(method(callStackSymbols))]
189 #[unsafe(method_family = none)]
190 pub fn callStackSymbols(&self) -> Retained<NSArray<NSString>>;
191 );
192}
193
194impl NSException {
196 extern_methods!(
197 #[unsafe(method(init))]
198 #[unsafe(method_family = init)]
199 pub fn init(this: Allocated<Self>) -> Retained<Self>;
200 );
201}
202
203impl NSException {
205 extern_methods!();
206}
207
208pub type NSUncaughtExceptionHandler = core::ffi::c_void;
210
211#[inline]
212pub extern "C-unwind" fn NSGetUncaughtExceptionHandler() -> *mut NSUncaughtExceptionHandler {
213 extern "C-unwind" {
214 fn NSGetUncaughtExceptionHandler() -> *mut NSUncaughtExceptionHandler;
215 }
216 unsafe { NSGetUncaughtExceptionHandler() }
217}
218
219extern "C-unwind" {
220 pub fn NSSetUncaughtExceptionHandler(param1: *mut NSUncaughtExceptionHandler);
224}
225
226extern "C" {
227 #[cfg(feature = "NSString")]
229 pub static NSAssertionHandlerKey: &'static NSString;
230}
231
232extern_class!(
233 #[unsafe(super(NSObject))]
235 #[derive(Debug, PartialEq, Eq, Hash)]
236 pub struct NSAssertionHandler;
237);
238
239extern_conformance!(
240 unsafe impl NSObjectProtocol for NSAssertionHandler {}
241);
242
243impl NSAssertionHandler {
244 extern_methods!(
245 #[unsafe(method(currentHandler))]
246 #[unsafe(method_family = none)]
247 pub fn currentHandler() -> Retained<NSAssertionHandler>;
248 );
249}
250
251impl NSAssertionHandler {
253 extern_methods!(
254 #[unsafe(method(init))]
255 #[unsafe(method_family = init)]
256 pub fn init(this: Allocated<Self>) -> Retained<Self>;
257
258 #[unsafe(method(new))]
259 #[unsafe(method_family = new)]
260 pub fn new() -> Retained<Self>;
261 );
262}
263
264impl DefaultRetained for NSAssertionHandler {
265 #[inline]
266 fn default_retained() -> Retained<Self> {
267 Self::new()
268 }
269}