//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;

use crate::*;

extern "C" {
    /// *************    Generic Exception names        **************
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsgenericexception?language=objc)
    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
    pub static NSGenericException: &'static NSExceptionName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsrangeexception?language=objc)
    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
    pub static NSRangeException: &'static NSExceptionName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsinvalidargumentexception?language=objc)
    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
    pub static NSInvalidArgumentException: &'static NSExceptionName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsinternalinconsistencyexception?language=objc)
    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
    pub static NSInternalInconsistencyException: &'static NSExceptionName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsmallocexception?language=objc)
    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
    pub static NSMallocException: &'static NSExceptionName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsobjectinaccessibleexception?language=objc)
    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
    pub static NSObjectInaccessibleException: &'static NSExceptionName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsobjectnotavailableexception?language=objc)
    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
    pub static NSObjectNotAvailableException: &'static NSExceptionName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsdestinationinvalidexception?language=objc)
    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
    pub static NSDestinationInvalidException: &'static NSExceptionName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsporttimeoutexception?language=objc)
    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
    pub static NSPortTimeoutException: &'static NSExceptionName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsinvalidsendportexception?language=objc)
    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
    pub static NSInvalidSendPortException: &'static NSExceptionName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsinvalidreceiveportexception?language=objc)
    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
    pub static NSInvalidReceivePortException: &'static NSExceptionName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsportsendexception?language=objc)
    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
    pub static NSPortSendException: &'static NSExceptionName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsportreceiveexception?language=objc)
    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
    pub static NSPortReceiveException: &'static NSExceptionName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsoldstyleexception?language=objc)
    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
    pub static NSOldStyleException: &'static NSExceptionName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsinconsistentarchiveexception?language=objc)
    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
    pub static NSInconsistentArchiveException: &'static NSExceptionName;
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsexception?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(PartialEq, Eq, Hash)]
    pub struct NSException;
);

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

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

#[cfg(feature = "NSObject")]
unsafe impl CopyingHelper for NSException {
    type Result = Self;
}

unsafe impl NSObjectProtocol for NSException {}

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

impl NSException {
    extern_methods!(
        #[cfg(all(
            feature = "NSDictionary",
            feature = "NSObjCRuntime",
            feature = "NSString"
        ))]
        #[unsafe(method(exceptionWithName:reason:userInfo:))]
        #[unsafe(method_family = none)]
        pub unsafe fn exceptionWithName_reason_userInfo(
            name: &NSExceptionName,
            reason: Option<&NSString>,
            user_info: Option<&NSDictionary>,
        ) -> Retained<NSException>;

        #[cfg(all(
            feature = "NSDictionary",
            feature = "NSObjCRuntime",
            feature = "NSString"
        ))]
        #[unsafe(method(initWithName:reason:userInfo:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithName_reason_userInfo(
            this: Allocated<Self>,
            a_name: &NSExceptionName,
            a_reason: Option<&NSString>,
            a_user_info: Option<&NSDictionary>,
        ) -> Retained<Self>;

        #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
        #[unsafe(method(name))]
        #[unsafe(method_family = none)]
        pub fn name(&self) -> Retained<NSExceptionName>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(reason))]
        #[unsafe(method_family = none)]
        pub fn reason(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSDictionary")]
        #[unsafe(method(userInfo))]
        #[unsafe(method_family = none)]
        pub fn userInfo(&self) -> Option<Retained<NSDictionary>>;

        #[cfg(all(feature = "NSArray", feature = "NSValue"))]
        #[unsafe(method(callStackReturnAddresses))]
        #[unsafe(method_family = none)]
        pub unsafe fn callStackReturnAddresses(&self) -> Retained<NSArray<NSNumber>>;

        #[cfg(all(feature = "NSArray", feature = "NSString"))]
        #[unsafe(method(callStackSymbols))]
        #[unsafe(method_family = none)]
        pub unsafe fn callStackSymbols(&self) -> Retained<NSArray<NSString>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSException {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// NSExceptionRaisingConveniences.
impl NSException {
    extern_methods!();
}

/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsuncaughtexceptionhandler?language=objc)
pub type NSUncaughtExceptionHandler = core::ffi::c_void;

extern "C-unwind" {
    pub fn NSGetUncaughtExceptionHandler() -> *mut NSUncaughtExceptionHandler;
}

extern "C-unwind" {
    pub fn NSSetUncaughtExceptionHandler(param1: *mut NSUncaughtExceptionHandler);
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsassertionhandlerkey?language=objc)
    #[cfg(feature = "NSString")]
    pub static NSAssertionHandlerKey: &'static NSString;
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsassertionhandler?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSAssertionHandler;
);

unsafe impl NSObjectProtocol for NSAssertionHandler {}

impl NSAssertionHandler {
    extern_methods!(
        #[unsafe(method(currentHandler))]
        #[unsafe(method_family = none)]
        pub unsafe fn currentHandler() -> Retained<NSAssertionHandler>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSAssertionHandler {
    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>;
    );
}
