objc2-foundation 0.2.2

Bindings to the Foundation framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;

use crate::*;

extern_protocol!(
    pub unsafe trait NSCoding {
        #[cfg(feature = "NSCoder")]
        #[method(encodeWithCoder:)]
        unsafe fn encodeWithCoder(&self, coder: &NSCoder);

        #[cfg(feature = "NSCoder")]
        #[method_id(@__retain_semantics Init initWithCoder:)]
        unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Option<Retained<Self>>;
    }

    unsafe impl ProtocolType for dyn NSCoding {}
);

extern_protocol!(
    pub unsafe trait NSSecureCoding: NSCoding {
        #[method(supportsSecureCoding)]
        unsafe fn supportsSecureCoding() -> bool;
    }

    unsafe impl ProtocolType for dyn NSSecureCoding {}
);

extern_category!(
    /// Category "NSCoderMethods" on [`NSObject`].
    #[doc(alias = "NSCoderMethods")]
    pub unsafe trait NSObjectNSCoderMethods {
        #[method(version)]
        unsafe fn version() -> NSInteger;

        #[method(setVersion:)]
        unsafe fn setVersion(a_version: NSInteger);

        #[method(classForCoder)]
        unsafe fn classForCoder(&self) -> &'static AnyClass;

        #[cfg(feature = "NSCoder")]
        #[method_id(@__retain_semantics Other replacementObjectForCoder:)]
        unsafe fn replacementObjectForCoder(&self, coder: &NSCoder) -> Option<Retained<AnyObject>>;
    }

    unsafe impl NSObjectNSCoderMethods for NSObject {}
);

extern_protocol!(
    pub unsafe trait NSDiscardableContent {
        #[method(beginContentAccess)]
        unsafe fn beginContentAccess(&self) -> bool;

        #[method(endContentAccess)]
        unsafe fn endContentAccess(&self);

        #[method(discardContentIfPossible)]
        unsafe fn discardContentIfPossible(&self);

        #[method(isContentDiscarded)]
        unsafe fn isContentDiscarded(&self) -> bool;
    }

    unsafe impl ProtocolType for dyn NSDiscardableContent {}
);

extern_category!(
    /// Category "NSDiscardableContentProxy" on [`NSObject`].
    #[doc(alias = "NSDiscardableContentProxy")]
    pub unsafe trait NSObjectNSDiscardableContentProxy {
        #[method_id(@__retain_semantics Other autoContentAccessingProxy)]
        unsafe fn autoContentAccessingProxy(&self) -> Retained<AnyObject>;
    }

    unsafe impl NSObjectNSDiscardableContentProxy for NSObject {}
);

extern "C" {
    #[cfg(feature = "NSZone")]
    pub fn NSAllocateObject(
        a_class: &AnyClass,
        extra_bytes: NSUInteger,
        zone: *mut NSZone,
    ) -> NonNull<AnyObject>;
}

extern "C" {
    pub fn NSDeallocateObject(object: &AnyObject);
}

extern "C" {
    #[cfg(feature = "NSZone")]
    #[deprecated = "Not supported"]
    pub fn NSCopyObject(
        object: &AnyObject,
        extra_bytes: NSUInteger,
        zone: *mut NSZone,
    ) -> NonNull<AnyObject>;
}

extern "C" {
    #[cfg(feature = "NSZone")]
    pub fn NSShouldRetainWithZone(an_object: &AnyObject, requested_zone: *mut NSZone) -> Bool;
}

extern "C" {
    pub fn NSIncrementExtraRefCount(object: &AnyObject);
}

extern "C" {
    pub fn NSDecrementExtraRefCountWasZero(object: &AnyObject) -> Bool;
}

extern "C" {
    pub fn NSExtraRefCount(object: &AnyObject) -> NSUInteger;
}