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!(
#[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!(
#[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;
}