objc2-foundation 0.3.2

Bindings to the Foundation framework
Documentation
//! 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_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsportcoder?language=objc)
    #[unsafe(super(NSCoder, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "NSCoder")]
    #[deprecated = "Use NSXPCConnection instead"]
    pub struct NSPortCoder;
);

#[cfg(feature = "NSCoder")]
extern_conformance!(
    unsafe impl NSObjectProtocol for NSPortCoder {}
);

#[cfg(feature = "NSCoder")]
impl NSPortCoder {
    extern_methods!(
        #[deprecated = "Use NSXPCConnection instead"]
        #[unsafe(method(isBycopy))]
        #[unsafe(method_family = none)]
        pub unsafe fn isBycopy(&self) -> bool;

        #[deprecated = "Use NSXPCConnection instead"]
        #[unsafe(method(isByref))]
        #[unsafe(method_family = none)]
        pub unsafe fn isByref(&self) -> bool;

        #[cfg(feature = "NSPort")]
        #[deprecated = "Use NSXPCConnection instead"]
        #[unsafe(method(encodePortObject:))]
        #[unsafe(method_family = none)]
        pub unsafe fn encodePortObject(&self, aport: &NSPort);

        #[cfg(feature = "NSPort")]
        #[deprecated = "Use NSXPCConnection instead"]
        #[unsafe(method(decodePortObject))]
        #[unsafe(method_family = none)]
        pub unsafe fn decodePortObject(&self) -> Option<Retained<NSPort>>;

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

        #[cfg(all(feature = "NSArray", feature = "NSPort"))]
        /// # Safety
        ///
        /// `comps` generic should be of the correct type.
        #[deprecated]
        #[unsafe(method(portCoderWithReceivePort:sendPort:components:))]
        #[unsafe(method_family = none)]
        pub unsafe fn portCoderWithReceivePort_sendPort_components(
            rcv_port: Option<&NSPort>,
            snd_port: Option<&NSPort>,
            comps: Option<&NSArray>,
        ) -> Retained<AnyObject>;

        #[cfg(all(feature = "NSArray", feature = "NSPort"))]
        /// # Safety
        ///
        /// `comps` generic should be of the correct type.
        #[deprecated]
        #[unsafe(method(initWithReceivePort:sendPort:components:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithReceivePort_sendPort_components(
            this: Allocated<Self>,
            rcv_port: Option<&NSPort>,
            snd_port: Option<&NSPort>,
            comps: Option<&NSArray>,
        ) -> Retained<Self>;

        #[deprecated]
        #[unsafe(method(dispatch))]
        #[unsafe(method_family = none)]
        pub unsafe fn dispatch(&self);
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "NSCoder")]
impl NSPortCoder {
    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>;
    );
}