1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
//! 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;
}