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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;

use crate::*;

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFileCoordinatorReadingOptions(pub NSUInteger);
bitflags::bitflags! {
    impl NSFileCoordinatorReadingOptions: NSUInteger {
        const NSFileCoordinatorReadingWithoutChanges = 1<<0;
        const NSFileCoordinatorReadingResolvesSymbolicLink = 1<<1;
        const NSFileCoordinatorReadingImmediatelyAvailableMetadataOnly = 1<<2;
        const NSFileCoordinatorReadingForUploading = 1<<3;
    }
}

unsafe impl Encode for NSFileCoordinatorReadingOptions {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSFileCoordinatorReadingOptions {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFileCoordinatorWritingOptions(pub NSUInteger);
bitflags::bitflags! {
    impl NSFileCoordinatorWritingOptions: NSUInteger {
        const NSFileCoordinatorWritingForDeleting = 1<<0;
        const NSFileCoordinatorWritingForMoving = 1<<1;
        const NSFileCoordinatorWritingForMerging = 1<<2;
        const NSFileCoordinatorWritingForReplacing = 1<<3;
        const NSFileCoordinatorWritingContentIndependentMetadataOnly = 1<<4;
    }
}

unsafe impl Encode for NSFileCoordinatorWritingOptions {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSFileCoordinatorWritingOptions {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSFileAccessIntent;

    unsafe impl ClassType for NSFileAccessIntent {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl Send for NSFileAccessIntent {}

unsafe impl Sync for NSFileAccessIntent {}

unsafe impl NSObjectProtocol for NSFileAccessIntent {}

extern_methods!(
    unsafe impl NSFileAccessIntent {
        #[cfg(feature = "NSURL")]
        #[method_id(@__retain_semantics Other readingIntentWithURL:options:)]
        pub unsafe fn readingIntentWithURL_options(
            url: &NSURL,
            options: NSFileCoordinatorReadingOptions,
        ) -> Retained<Self>;

        #[cfg(feature = "NSURL")]
        #[method_id(@__retain_semantics Other writingIntentWithURL:options:)]
        pub unsafe fn writingIntentWithURL_options(
            url: &NSURL,
            options: NSFileCoordinatorWritingOptions,
        ) -> Retained<Self>;

        #[cfg(feature = "NSURL")]
        #[method_id(@__retain_semantics Other URL)]
        pub unsafe fn URL(&self) -> Retained<NSURL>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl NSFileAccessIntent {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSFileCoordinator;

    unsafe impl ClassType for NSFileCoordinator {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl NSObjectProtocol for NSFileCoordinator {}

extern_methods!(
    unsafe impl NSFileCoordinator {
        #[cfg(feature = "NSFilePresenter")]
        #[method(addFilePresenter:)]
        pub unsafe fn addFilePresenter(file_presenter: &ProtocolObject<dyn NSFilePresenter>);

        #[cfg(feature = "NSFilePresenter")]
        #[method(removeFilePresenter:)]
        pub unsafe fn removeFilePresenter(file_presenter: &ProtocolObject<dyn NSFilePresenter>);

        #[cfg(all(feature = "NSArray", feature = "NSFilePresenter"))]
        #[method_id(@__retain_semantics Other filePresenters)]
        pub unsafe fn filePresenters() -> Retained<NSArray<ProtocolObject<dyn NSFilePresenter>>>;

        #[cfg(feature = "NSFilePresenter")]
        #[method_id(@__retain_semantics Init initWithFilePresenter:)]
        pub unsafe fn initWithFilePresenter(
            this: Allocated<Self>,
            file_presenter_or_nil: Option<&ProtocolObject<dyn NSFilePresenter>>,
        ) -> Retained<Self>;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other purposeIdentifier)]
        pub unsafe fn purposeIdentifier(&self) -> Retained<NSString>;

        #[cfg(feature = "NSString")]
        #[method(setPurposeIdentifier:)]
        pub unsafe fn setPurposeIdentifier(&self, purpose_identifier: &NSString);

        #[cfg(all(
            feature = "NSArray",
            feature = "NSError",
            feature = "NSOperation",
            feature = "block2"
        ))]
        #[method(coordinateAccessWithIntents:queue:byAccessor:)]
        pub unsafe fn coordinateAccessWithIntents_queue_byAccessor(
            &self,
            intents: &NSArray<NSFileAccessIntent>,
            queue: &NSOperationQueue,
            accessor: &block2::Block<dyn Fn(*mut NSError)>,
        );

        #[cfg(all(feature = "NSError", feature = "NSURL", feature = "block2"))]
        #[method(coordinateReadingItemAtURL:options:error:byAccessor:)]
        pub unsafe fn coordinateReadingItemAtURL_options_error_byAccessor(
            &self,
            url: &NSURL,
            options: NSFileCoordinatorReadingOptions,
            out_error: Option<&mut Option<Retained<NSError>>>,
            reader: &block2::Block<dyn Fn(NonNull<NSURL>) + '_>,
        );

        #[cfg(all(feature = "NSError", feature = "NSURL", feature = "block2"))]
        #[method(coordinateWritingItemAtURL:options:error:byAccessor:)]
        pub unsafe fn coordinateWritingItemAtURL_options_error_byAccessor(
            &self,
            url: &NSURL,
            options: NSFileCoordinatorWritingOptions,
            out_error: Option<&mut Option<Retained<NSError>>>,
            writer: &block2::Block<dyn Fn(NonNull<NSURL>) + '_>,
        );

        #[cfg(all(feature = "NSError", feature = "NSURL", feature = "block2"))]
        #[method(coordinateReadingItemAtURL:options:writingItemAtURL:options:error:byAccessor:)]
        pub unsafe fn coordinateReadingItemAtURL_options_writingItemAtURL_options_error_byAccessor(
            &self,
            reading_url: &NSURL,
            reading_options: NSFileCoordinatorReadingOptions,
            writing_url: &NSURL,
            writing_options: NSFileCoordinatorWritingOptions,
            out_error: Option<&mut Option<Retained<NSError>>>,
            reader_writer: &block2::Block<dyn Fn(NonNull<NSURL>, NonNull<NSURL>) + '_>,
        );

        #[cfg(all(feature = "NSError", feature = "NSURL", feature = "block2"))]
        #[method(coordinateWritingItemAtURL:options:writingItemAtURL:options:error:byAccessor:)]
        pub unsafe fn coordinateWritingItemAtURL_options_writingItemAtURL_options_error_byAccessor(
            &self,
            url1: &NSURL,
            options1: NSFileCoordinatorWritingOptions,
            url2: &NSURL,
            options2: NSFileCoordinatorWritingOptions,
            out_error: Option<&mut Option<Retained<NSError>>>,
            writer: &block2::Block<dyn Fn(NonNull<NSURL>, NonNull<NSURL>) + '_>,
        );

        #[cfg(all(
            feature = "NSArray",
            feature = "NSError",
            feature = "NSURL",
            feature = "block2"
        ))]
        #[method(prepareForReadingItemsAtURLs:options:writingItemsAtURLs:options:error:byAccessor:)]
        pub unsafe fn prepareForReadingItemsAtURLs_options_writingItemsAtURLs_options_error_byAccessor(
            &self,
            reading_ur_ls: &NSArray<NSURL>,
            reading_options: NSFileCoordinatorReadingOptions,
            writing_ur_ls: &NSArray<NSURL>,
            writing_options: NSFileCoordinatorWritingOptions,
            out_error: Option<&mut Option<Retained<NSError>>>,
            batch_accessor: &block2::Block<dyn Fn(NonNull<block2::Block<dyn Fn()>>) + '_>,
        );

        #[cfg(feature = "NSURL")]
        #[method(itemAtURL:willMoveToURL:)]
        pub unsafe fn itemAtURL_willMoveToURL(&self, old_url: &NSURL, new_url: &NSURL);

        #[cfg(feature = "NSURL")]
        #[method(itemAtURL:didMoveToURL:)]
        pub unsafe fn itemAtURL_didMoveToURL(&self, old_url: &NSURL, new_url: &NSURL);

        #[cfg(all(feature = "NSSet", feature = "NSString", feature = "NSURL"))]
        #[method(itemAtURL:didChangeUbiquityAttributes:)]
        pub unsafe fn itemAtURL_didChangeUbiquityAttributes(
            &self,
            url: &NSURL,
            attributes: &NSSet<NSURLResourceKey>,
        );

        #[method(cancel)]
        pub unsafe fn cancel(&self);
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl NSFileCoordinator {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);