use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
pub const NSLogAndHandleEveryExceptionMask: c_uint = NSLogUncaughtExceptionMask
| NSLogUncaughtSystemExceptionMask
| NSLogUncaughtRuntimeErrorMask
| NSHandleUncaughtExceptionMask
| NSHandleUncaughtSystemExceptionMask
| NSHandleUncaughtRuntimeErrorMask
| NSLogTopLevelExceptionMask
| NSHandleTopLevelExceptionMask
| NSLogOtherExceptionMask
| NSHandleOtherExceptionMask;
pub const NSHangOnEveryExceptionMask: c_uint = NSHangOnUncaughtExceptionMask
| NSHangOnUncaughtSystemExceptionMask
| NSHangOnUncaughtRuntimeErrorMask
| NSHangOnTopLevelExceptionMask
| NSHangOnOtherExceptionMask;
extern "C" {
pub static NSUncaughtSystemExceptionException: Option<&'static NSString>;
}
extern "C" {
pub static NSUncaughtRuntimeErrorException: Option<&'static NSString>;
}
extern "C" {
pub static NSStackTraceKey: Option<&'static NSString>;
}
impl NSExceptionHandler {
#[doc(alias = "NSExceptionHandlerResume")]
#[inline]
pub unsafe fn resume() {
extern "C-unwind" {
fn NSExceptionHandlerResume();
}
unsafe { NSExceptionHandlerResume() }
}
}
pub const NSLogUncaughtExceptionMask: c_uint = 1 << 0;
pub const NSHandleUncaughtExceptionMask: c_uint = 1 << 1;
pub const NSLogUncaughtSystemExceptionMask: c_uint = 1 << 2;
pub const NSHandleUncaughtSystemExceptionMask: c_uint = 1 << 3;
pub const NSLogUncaughtRuntimeErrorMask: c_uint = 1 << 4;
pub const NSHandleUncaughtRuntimeErrorMask: c_uint = 1 << 5;
pub const NSLogTopLevelExceptionMask: c_uint = 1 << 6;
pub const NSHandleTopLevelExceptionMask: c_uint = 1 << 7;
pub const NSLogOtherExceptionMask: c_uint = 1 << 8;
pub const NSHandleOtherExceptionMask: c_uint = 1 << 9;
pub const NSHangOnUncaughtExceptionMask: c_uint = 1 << 0;
pub const NSHangOnUncaughtSystemExceptionMask: c_uint = 1 << 1;
pub const NSHangOnUncaughtRuntimeErrorMask: c_uint = 1 << 2;
pub const NSHangOnTopLevelExceptionMask: c_uint = 1 << 3;
pub const NSHangOnOtherExceptionMask: c_uint = 1 << 4;
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSExceptionHandler;
);
extern_conformance!(
unsafe impl NSObjectProtocol for NSExceptionHandler {}
);
impl NSExceptionHandler {
extern_methods!(
#[unsafe(method(defaultExceptionHandler))]
#[unsafe(method_family = none)]
pub unsafe fn defaultExceptionHandler() -> Option<Retained<NSExceptionHandler>>;
#[unsafe(method(setExceptionHandlingMask:))]
#[unsafe(method_family = none)]
pub unsafe fn setExceptionHandlingMask(&self, a_mask: NSUInteger);
#[unsafe(method(exceptionHandlingMask))]
#[unsafe(method_family = none)]
pub unsafe fn exceptionHandlingMask(&self) -> NSUInteger;
#[unsafe(method(setExceptionHangingMask:))]
#[unsafe(method_family = none)]
pub unsafe fn setExceptionHangingMask(&self, a_mask: NSUInteger);
#[unsafe(method(exceptionHangingMask))]
#[unsafe(method_family = none)]
pub unsafe fn exceptionHangingMask(&self) -> NSUInteger;
#[unsafe(method(setDelegate:))]
#[unsafe(method_family = none)]
pub unsafe fn setDelegate(&self, an_object: Option<&AnyObject>);
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub unsafe fn delegate(&self) -> Option<Retained<AnyObject>>;
);
}
impl NSExceptionHandler {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
mod private_NSObjectNSExceptionHandlerDelegate {
pub trait Sealed {}
}
#[doc(alias = "NSExceptionHandlerDelegate")]
pub unsafe trait NSObjectNSExceptionHandlerDelegate:
ClassType + Sized + private_NSObjectNSExceptionHandlerDelegate::Sealed
{
extern_methods!(
#[unsafe(method(exceptionHandler:shouldLogException:mask:))]
#[unsafe(method_family = none)]
unsafe fn exceptionHandler_shouldLogException_mask(
&self,
sender: Option<&NSExceptionHandler>,
exception: Option<&NSException>,
a_mask: NSUInteger,
) -> bool;
#[unsafe(method(exceptionHandler:shouldHandleException:mask:))]
#[unsafe(method_family = none)]
unsafe fn exceptionHandler_shouldHandleException_mask(
&self,
sender: Option<&NSExceptionHandler>,
exception: Option<&NSException>,
a_mask: NSUInteger,
) -> bool;
);
}
impl private_NSObjectNSExceptionHandlerDelegate::Sealed for NSObject {}
unsafe impl NSObjectNSExceptionHandlerDelegate for NSObject {}
extern "C-unwind" {
#[deprecated = "renamed to `NSExceptionHandler::resume`"]
pub fn NSExceptionHandlerResume();
}