objc2_foundation/generated/
NSURLHandle.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9extern "C" {
10 #[cfg(feature = "NSString")]
12 #[deprecated]
13 pub static NSHTTPPropertyStatusCodeKey: Option<&'static NSString>;
14}
15
16extern "C" {
17 #[cfg(feature = "NSString")]
19 #[deprecated]
20 pub static NSHTTPPropertyStatusReasonKey: Option<&'static NSString>;
21}
22
23extern "C" {
24 #[cfg(feature = "NSString")]
26 #[deprecated]
27 pub static NSHTTPPropertyServerHTTPVersionKey: Option<&'static NSString>;
28}
29
30extern "C" {
31 #[cfg(feature = "NSString")]
33 #[deprecated]
34 pub static NSHTTPPropertyRedirectionHeadersKey: Option<&'static NSString>;
35}
36
37extern "C" {
38 #[cfg(feature = "NSString")]
40 #[deprecated]
41 pub static NSHTTPPropertyErrorPageDataKey: Option<&'static NSString>;
42}
43
44extern "C" {
45 #[cfg(feature = "NSString")]
47 #[deprecated]
48 pub static NSHTTPPropertyHTTPProxy: Option<&'static NSString>;
49}
50
51extern "C" {
52 #[cfg(feature = "NSString")]
54 #[deprecated]
55 pub static NSFTPPropertyUserLoginKey: Option<&'static NSString>;
56}
57
58extern "C" {
59 #[cfg(feature = "NSString")]
61 #[deprecated]
62 pub static NSFTPPropertyUserPasswordKey: Option<&'static NSString>;
63}
64
65extern "C" {
66 #[cfg(feature = "NSString")]
68 #[deprecated]
69 pub static NSFTPPropertyActiveTransferModeKey: Option<&'static NSString>;
70}
71
72extern "C" {
73 #[cfg(feature = "NSString")]
75 #[deprecated]
76 pub static NSFTPPropertyFileOffsetKey: Option<&'static NSString>;
77}
78
79extern "C" {
80 #[cfg(feature = "NSString")]
82 #[deprecated]
83 pub static NSFTPPropertyFTPProxy: Option<&'static NSString>;
84}
85
86#[repr(transparent)]
89#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
90pub struct NSURLHandleStatus(pub NSUInteger);
91impl NSURLHandleStatus {
92 #[doc(alias = "NSURLHandleNotLoaded")]
93 pub const NotLoaded: Self = Self(0);
94 #[doc(alias = "NSURLHandleLoadSucceeded")]
95 pub const LoadSucceeded: Self = Self(1);
96 #[doc(alias = "NSURLHandleLoadInProgress")]
97 pub const LoadInProgress: Self = Self(2);
98 #[doc(alias = "NSURLHandleLoadFailed")]
99 pub const LoadFailed: Self = Self(3);
100}
101
102unsafe impl Encode for NSURLHandleStatus {
103 const ENCODING: Encoding = NSUInteger::ENCODING;
104}
105
106unsafe impl RefEncode for NSURLHandleStatus {
107 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
108}
109
110extern_protocol!(
111 #[deprecated]
113 pub unsafe trait NSURLHandleClient {
114 #[cfg(feature = "NSData")]
115 #[deprecated]
120 #[unsafe(method(URLHandle:resourceDataDidBecomeAvailable:))]
121 #[unsafe(method_family = none)]
122 unsafe fn URLHandle_resourceDataDidBecomeAvailable(
123 &self,
124 sender: Option<&NSURLHandle>,
125 new_bytes: Option<&NSData>,
126 );
127
128 #[deprecated]
132 #[unsafe(method(URLHandleResourceDidBeginLoading:))]
133 #[unsafe(method_family = none)]
134 unsafe fn URLHandleResourceDidBeginLoading(&self, sender: Option<&NSURLHandle>);
135
136 #[deprecated]
140 #[unsafe(method(URLHandleResourceDidFinishLoading:))]
141 #[unsafe(method_family = none)]
142 unsafe fn URLHandleResourceDidFinishLoading(&self, sender: Option<&NSURLHandle>);
143
144 #[deprecated]
148 #[unsafe(method(URLHandleResourceDidCancelLoading:))]
149 #[unsafe(method_family = none)]
150 unsafe fn URLHandleResourceDidCancelLoading(&self, sender: Option<&NSURLHandle>);
151
152 #[cfg(feature = "NSString")]
153 #[deprecated]
158 #[unsafe(method(URLHandle:resourceDidFailLoadingWithReason:))]
159 #[unsafe(method_family = none)]
160 unsafe fn URLHandle_resourceDidFailLoadingWithReason(
161 &self,
162 sender: Option<&NSURLHandle>,
163 reason: Option<&NSString>,
164 );
165 }
166);
167
168extern_class!(
169 #[unsafe(super(NSObject))]
171 #[derive(Debug, PartialEq, Eq, Hash)]
172 pub struct NSURLHandle;
173);
174
175extern_conformance!(
176 unsafe impl NSObjectProtocol for NSURLHandle {}
177);
178
179impl NSURLHandle {
180 extern_methods!(
181 #[deprecated]
186 #[unsafe(method(registerURLHandleClass:))]
187 #[unsafe(method_family = none)]
188 pub unsafe fn registerURLHandleClass(an_url_handle_subclass: Option<&AnyClass>);
189
190 #[cfg(feature = "NSURL")]
191 #[deprecated]
195 #[unsafe(method(URLHandleClassForURL:))]
196 #[unsafe(method_family = none)]
197 pub unsafe fn URLHandleClassForURL(an_url: Option<&NSURL>) -> Option<&'static AnyClass>;
198
199 #[deprecated]
200 #[unsafe(method(status))]
201 #[unsafe(method_family = none)]
202 pub fn status(&self) -> NSURLHandleStatus;
203
204 #[cfg(feature = "NSString")]
205 #[deprecated]
206 #[unsafe(method(failureReason))]
207 #[unsafe(method_family = none)]
208 pub fn failureReason(&self) -> Option<Retained<NSString>>;
209
210 #[deprecated]
214 #[unsafe(method(addClient:))]
215 #[unsafe(method_family = none)]
216 pub unsafe fn addClient(&self, client: Option<&ProtocolObject<dyn NSURLHandleClient>>);
217
218 #[deprecated]
222 #[unsafe(method(removeClient:))]
223 #[unsafe(method_family = none)]
224 pub unsafe fn removeClient(&self, client: Option<&ProtocolObject<dyn NSURLHandleClient>>);
225
226 #[deprecated]
227 #[unsafe(method(loadInBackground))]
228 #[unsafe(method_family = none)]
229 pub fn loadInBackground(&self);
230
231 #[deprecated]
232 #[unsafe(method(cancelLoadInBackground))]
233 #[unsafe(method_family = none)]
234 pub fn cancelLoadInBackground(&self);
235
236 #[cfg(feature = "NSData")]
237 #[deprecated]
238 #[unsafe(method(resourceData))]
239 #[unsafe(method_family = none)]
240 pub fn resourceData(&self) -> Option<Retained<NSData>>;
241
242 #[cfg(feature = "NSData")]
243 #[deprecated]
244 #[unsafe(method(availableResourceData))]
245 #[unsafe(method_family = none)]
246 pub fn availableResourceData(&self) -> Option<Retained<NSData>>;
247
248 #[deprecated]
249 #[unsafe(method(expectedResourceDataSize))]
250 #[unsafe(method_family = none)]
251 pub fn expectedResourceDataSize(&self) -> c_longlong;
252
253 #[deprecated]
254 #[unsafe(method(flushCachedData))]
255 #[unsafe(method_family = none)]
256 pub fn flushCachedData(&self);
257
258 #[cfg(feature = "NSString")]
259 #[deprecated]
263 #[unsafe(method(backgroundLoadDidFailWithReason:))]
264 #[unsafe(method_family = none)]
265 pub unsafe fn backgroundLoadDidFailWithReason(&self, reason: Option<&NSString>);
266
267 #[cfg(feature = "NSData")]
268 #[deprecated]
272 #[unsafe(method(didLoadBytes:loadComplete:))]
273 #[unsafe(method_family = none)]
274 pub unsafe fn didLoadBytes_loadComplete(&self, new_bytes: Option<&NSData>, yorn: bool);
275
276 #[cfg(feature = "NSURL")]
277 #[deprecated]
281 #[unsafe(method(canInitWithURL:))]
282 #[unsafe(method_family = none)]
283 pub unsafe fn canInitWithURL(an_url: Option<&NSURL>) -> bool;
284
285 #[cfg(feature = "NSURL")]
286 #[deprecated]
290 #[unsafe(method(cachedHandleForURL:))]
291 #[unsafe(method_family = none)]
292 pub unsafe fn cachedHandleForURL(an_url: Option<&NSURL>) -> Option<Retained<NSURLHandle>>;
293
294 #[cfg(feature = "NSURL")]
295 #[deprecated]
299 #[unsafe(method(initWithURL:cached:))]
300 #[unsafe(method_family = init)]
301 pub unsafe fn initWithURL_cached(
302 this: Allocated<Self>,
303 an_url: Option<&NSURL>,
304 will_cache: bool,
305 ) -> Option<Retained<Self>>;
306
307 #[cfg(feature = "NSString")]
308 #[deprecated]
312 #[unsafe(method(propertyForKey:))]
313 #[unsafe(method_family = none)]
314 pub unsafe fn propertyForKey(
315 &self,
316 property_key: Option<&NSString>,
317 ) -> Option<Retained<AnyObject>>;
318
319 #[cfg(feature = "NSString")]
320 #[deprecated]
324 #[unsafe(method(propertyForKeyIfAvailable:))]
325 #[unsafe(method_family = none)]
326 pub unsafe fn propertyForKeyIfAvailable(
327 &self,
328 property_key: Option<&NSString>,
329 ) -> Option<Retained<AnyObject>>;
330
331 #[cfg(feature = "NSString")]
332 #[deprecated]
338 #[unsafe(method(writeProperty:forKey:))]
339 #[unsafe(method_family = none)]
340 pub unsafe fn writeProperty_forKey(
341 &self,
342 property_value: Option<&AnyObject>,
343 property_key: Option<&NSString>,
344 ) -> bool;
345
346 #[cfg(feature = "NSData")]
347 #[deprecated]
351 #[unsafe(method(writeData:))]
352 #[unsafe(method_family = none)]
353 pub unsafe fn writeData(&self, data: Option<&NSData>) -> bool;
354
355 #[cfg(feature = "NSData")]
356 #[deprecated]
357 #[unsafe(method(loadInForeground))]
358 #[unsafe(method_family = none)]
359 pub fn loadInForeground(&self) -> Option<Retained<NSData>>;
360
361 #[deprecated]
362 #[unsafe(method(beginLoadInBackground))]
363 #[unsafe(method_family = none)]
364 pub fn beginLoadInBackground(&self);
365
366 #[deprecated]
367 #[unsafe(method(endLoadInBackground))]
368 #[unsafe(method_family = none)]
369 pub fn endLoadInBackground(&self);
370 );
371}
372
373impl NSURLHandle {
375 extern_methods!(
376 #[unsafe(method(init))]
377 #[unsafe(method_family = init)]
378 pub fn init(this: Allocated<Self>) -> Retained<Self>;
379
380 #[unsafe(method(new))]
381 #[unsafe(method_family = new)]
382 pub fn new() -> Retained<Self>;
383 );
384}
385
386impl DefaultRetained for NSURLHandle {
387 #[inline]
388 fn default_retained() -> Retained<Self> {
389 Self::new()
390 }
391}