objc2_foundation/generated/
NSFileCoordinator.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9#[repr(transparent)]
12#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
13pub struct NSFileCoordinatorReadingOptions(pub NSUInteger);
14bitflags::bitflags! {
15 impl NSFileCoordinatorReadingOptions: NSUInteger {
16 #[doc(alias = "NSFileCoordinatorReadingWithoutChanges")]
17 const WithoutChanges = 1<<0;
18 #[doc(alias = "NSFileCoordinatorReadingResolvesSymbolicLink")]
19 const ResolvesSymbolicLink = 1<<1;
20 #[doc(alias = "NSFileCoordinatorReadingImmediatelyAvailableMetadataOnly")]
21 const ImmediatelyAvailableMetadataOnly = 1<<2;
22 #[doc(alias = "NSFileCoordinatorReadingForUploading")]
23 const ForUploading = 1<<3;
24 }
25}
26
27unsafe impl Encode for NSFileCoordinatorReadingOptions {
28 const ENCODING: Encoding = NSUInteger::ENCODING;
29}
30
31unsafe impl RefEncode for NSFileCoordinatorReadingOptions {
32 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
33}
34
35#[repr(transparent)]
38#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
39pub struct NSFileCoordinatorWritingOptions(pub NSUInteger);
40bitflags::bitflags! {
41 impl NSFileCoordinatorWritingOptions: NSUInteger {
42 #[doc(alias = "NSFileCoordinatorWritingForDeleting")]
43 const ForDeleting = 1<<0;
44 #[doc(alias = "NSFileCoordinatorWritingForMoving")]
45 const ForMoving = 1<<1;
46 #[doc(alias = "NSFileCoordinatorWritingForMerging")]
47 const ForMerging = 1<<2;
48 #[doc(alias = "NSFileCoordinatorWritingForReplacing")]
49 const ForReplacing = 1<<3;
50 #[doc(alias = "NSFileCoordinatorWritingContentIndependentMetadataOnly")]
51 const ContentIndependentMetadataOnly = 1<<4;
52 }
53}
54
55unsafe impl Encode for NSFileCoordinatorWritingOptions {
56 const ENCODING: Encoding = NSUInteger::ENCODING;
57}
58
59unsafe impl RefEncode for NSFileCoordinatorWritingOptions {
60 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
61}
62
63extern_class!(
64 #[unsafe(super(NSObject))]
66 #[derive(Debug, PartialEq, Eq, Hash)]
67 pub struct NSFileAccessIntent;
68);
69
70unsafe impl Send for NSFileAccessIntent {}
71
72unsafe impl Sync for NSFileAccessIntent {}
73
74extern_conformance!(
75 unsafe impl NSObjectProtocol for NSFileAccessIntent {}
76);
77
78impl NSFileAccessIntent {
79 extern_methods!(
80 #[cfg(feature = "NSURL")]
81 #[unsafe(method(readingIntentWithURL:options:))]
82 #[unsafe(method_family = none)]
83 pub fn readingIntentWithURL_options(
84 url: &NSURL,
85 options: NSFileCoordinatorReadingOptions,
86 ) -> Retained<Self>;
87
88 #[cfg(feature = "NSURL")]
89 #[unsafe(method(writingIntentWithURL:options:))]
90 #[unsafe(method_family = none)]
91 pub fn writingIntentWithURL_options(
92 url: &NSURL,
93 options: NSFileCoordinatorWritingOptions,
94 ) -> Retained<Self>;
95
96 #[cfg(feature = "NSURL")]
97 #[unsafe(method(URL))]
98 #[unsafe(method_family = none)]
99 pub fn URL(&self) -> Retained<NSURL>;
100 );
101}
102
103impl NSFileAccessIntent {
105 extern_methods!(
106 #[unsafe(method(init))]
107 #[unsafe(method_family = init)]
108 pub fn init(this: Allocated<Self>) -> Retained<Self>;
109
110 #[unsafe(method(new))]
111 #[unsafe(method_family = new)]
112 pub fn new() -> Retained<Self>;
113 );
114}
115
116impl DefaultRetained for NSFileAccessIntent {
117 #[inline]
118 fn default_retained() -> Retained<Self> {
119 Self::new()
120 }
121}
122
123extern_class!(
124 #[unsafe(super(NSObject))]
126 #[derive(Debug, PartialEq, Eq, Hash)]
127 pub struct NSFileCoordinator;
128);
129
130extern_conformance!(
131 unsafe impl NSObjectProtocol for NSFileCoordinator {}
132);
133
134impl NSFileCoordinator {
135 extern_methods!(
136 #[cfg(feature = "NSFilePresenter")]
137 #[unsafe(method(addFilePresenter:))]
138 #[unsafe(method_family = none)]
139 pub fn addFilePresenter(file_presenter: &ProtocolObject<dyn NSFilePresenter>);
140
141 #[cfg(feature = "NSFilePresenter")]
142 #[unsafe(method(removeFilePresenter:))]
143 #[unsafe(method_family = none)]
144 pub fn removeFilePresenter(file_presenter: &ProtocolObject<dyn NSFilePresenter>);
145
146 #[cfg(all(feature = "NSArray", feature = "NSFilePresenter"))]
147 #[unsafe(method(filePresenters))]
148 #[unsafe(method_family = none)]
149 pub fn filePresenters() -> Retained<NSArray<ProtocolObject<dyn NSFilePresenter>>>;
150
151 #[cfg(feature = "NSFilePresenter")]
152 #[unsafe(method(initWithFilePresenter:))]
153 #[unsafe(method_family = init)]
154 pub fn initWithFilePresenter(
155 this: Allocated<Self>,
156 file_presenter_or_nil: Option<&ProtocolObject<dyn NSFilePresenter>>,
157 ) -> Retained<Self>;
158
159 #[cfg(feature = "NSString")]
160 #[unsafe(method(purposeIdentifier))]
161 #[unsafe(method_family = none)]
162 pub fn purposeIdentifier(&self) -> Retained<NSString>;
163
164 #[cfg(feature = "NSString")]
165 #[unsafe(method(setPurposeIdentifier:))]
169 #[unsafe(method_family = none)]
170 pub fn setPurposeIdentifier(&self, purpose_identifier: &NSString);
171
172 #[cfg(all(
173 feature = "NSArray",
174 feature = "NSError",
175 feature = "NSOperation",
176 feature = "block2"
177 ))]
178 #[unsafe(method(coordinateAccessWithIntents:queue:byAccessor:))]
183 #[unsafe(method_family = none)]
184 pub unsafe fn coordinateAccessWithIntents_queue_byAccessor(
185 &self,
186 intents: &NSArray<NSFileAccessIntent>,
187 queue: &NSOperationQueue,
188 accessor: &block2::DynBlock<dyn Fn(*mut NSError)>,
189 );
190
191 #[cfg(all(feature = "NSError", feature = "NSURL", feature = "block2"))]
192 #[unsafe(method(coordinateReadingItemAtURL:options:error:byAccessor:))]
193 #[unsafe(method_family = none)]
194 pub fn coordinateReadingItemAtURL_options_error_byAccessor(
195 &self,
196 url: &NSURL,
197 options: NSFileCoordinatorReadingOptions,
198 out_error: Option<&mut Option<Retained<NSError>>>,
199 reader: &block2::DynBlock<dyn Fn(NonNull<NSURL>) + '_>,
200 );
201
202 #[cfg(all(feature = "NSError", feature = "NSURL", feature = "block2"))]
203 #[unsafe(method(coordinateWritingItemAtURL:options:error:byAccessor:))]
204 #[unsafe(method_family = none)]
205 pub fn coordinateWritingItemAtURL_options_error_byAccessor(
206 &self,
207 url: &NSURL,
208 options: NSFileCoordinatorWritingOptions,
209 out_error: Option<&mut Option<Retained<NSError>>>,
210 writer: &block2::DynBlock<dyn Fn(NonNull<NSURL>) + '_>,
211 );
212
213 #[cfg(all(feature = "NSError", feature = "NSURL", feature = "block2"))]
214 #[unsafe(method(coordinateReadingItemAtURL:options:writingItemAtURL:options:error:byAccessor:))]
215 #[unsafe(method_family = none)]
216 pub fn coordinateReadingItemAtURL_options_writingItemAtURL_options_error_byAccessor(
217 &self,
218 reading_url: &NSURL,
219 reading_options: NSFileCoordinatorReadingOptions,
220 writing_url: &NSURL,
221 writing_options: NSFileCoordinatorWritingOptions,
222 out_error: Option<&mut Option<Retained<NSError>>>,
223 reader_writer: &block2::DynBlock<dyn Fn(NonNull<NSURL>, NonNull<NSURL>) + '_>,
224 );
225
226 #[cfg(all(feature = "NSError", feature = "NSURL", feature = "block2"))]
227 #[unsafe(method(coordinateWritingItemAtURL:options:writingItemAtURL:options:error:byAccessor:))]
228 #[unsafe(method_family = none)]
229 pub fn coordinateWritingItemAtURL_options_writingItemAtURL_options_error_byAccessor(
230 &self,
231 url1: &NSURL,
232 options1: NSFileCoordinatorWritingOptions,
233 url2: &NSURL,
234 options2: NSFileCoordinatorWritingOptions,
235 out_error: Option<&mut Option<Retained<NSError>>>,
236 writer: &block2::DynBlock<dyn Fn(NonNull<NSURL>, NonNull<NSURL>) + '_>,
237 );
238
239 #[cfg(all(
240 feature = "NSArray",
241 feature = "NSError",
242 feature = "NSURL",
243 feature = "block2"
244 ))]
245 #[unsafe(method(prepareForReadingItemsAtURLs:options:writingItemsAtURLs:options:error:byAccessor:))]
249 #[unsafe(method_family = none)]
250 pub unsafe fn prepareForReadingItemsAtURLs_options_writingItemsAtURLs_options_error_byAccessor(
251 &self,
252 reading_ur_ls: &NSArray<NSURL>,
253 reading_options: NSFileCoordinatorReadingOptions,
254 writing_ur_ls: &NSArray<NSURL>,
255 writing_options: NSFileCoordinatorWritingOptions,
256 out_error: Option<&mut Option<Retained<NSError>>>,
257 batch_accessor: &block2::DynBlock<dyn Fn(NonNull<block2::DynBlock<dyn Fn()>>) + '_>,
258 );
259
260 #[cfg(feature = "NSURL")]
261 #[unsafe(method(itemAtURL:willMoveToURL:))]
262 #[unsafe(method_family = none)]
263 pub fn itemAtURL_willMoveToURL(&self, old_url: &NSURL, new_url: &NSURL);
264
265 #[cfg(feature = "NSURL")]
266 #[unsafe(method(itemAtURL:didMoveToURL:))]
267 #[unsafe(method_family = none)]
268 pub fn itemAtURL_didMoveToURL(&self, old_url: &NSURL, new_url: &NSURL);
269
270 #[cfg(all(feature = "NSSet", feature = "NSString", feature = "NSURL"))]
271 #[unsafe(method(itemAtURL:didChangeUbiquityAttributes:))]
272 #[unsafe(method_family = none)]
273 pub fn itemAtURL_didChangeUbiquityAttributes(
274 &self,
275 url: &NSURL,
276 attributes: &NSSet<NSURLResourceKey>,
277 );
278
279 #[unsafe(method(cancel))]
280 #[unsafe(method_family = none)]
281 pub fn cancel(&self);
282 );
283}
284
285impl NSFileCoordinator {
287 extern_methods!(
288 #[unsafe(method(init))]
289 #[unsafe(method_family = init)]
290 pub fn init(this: Allocated<Self>) -> Retained<Self>;
291
292 #[unsafe(method(new))]
293 #[unsafe(method_family = new)]
294 pub fn new() -> Retained<Self>;
295 );
296}
297
298impl DefaultRetained for NSFileCoordinator {
299 #[inline]
300 fn default_retained() -> Retained<Self> {
301 Self::new()
302 }
303}