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 pub static NSHTTPPropertyStatusCodeKey: Option<&'static NSString>;
13}
14
15extern "C" {
16 #[cfg(feature = "NSString")]
18 pub static NSHTTPPropertyStatusReasonKey: Option<&'static NSString>;
19}
20
21extern "C" {
22 #[cfg(feature = "NSString")]
24 pub static NSHTTPPropertyServerHTTPVersionKey: Option<&'static NSString>;
25}
26
27extern "C" {
28 #[cfg(feature = "NSString")]
30 pub static NSHTTPPropertyRedirectionHeadersKey: Option<&'static NSString>;
31}
32
33extern "C" {
34 #[cfg(feature = "NSString")]
36 pub static NSHTTPPropertyErrorPageDataKey: Option<&'static NSString>;
37}
38
39extern "C" {
40 #[cfg(feature = "NSString")]
42 pub static NSHTTPPropertyHTTPProxy: Option<&'static NSString>;
43}
44
45extern "C" {
46 #[cfg(feature = "NSString")]
48 pub static NSFTPPropertyUserLoginKey: Option<&'static NSString>;
49}
50
51extern "C" {
52 #[cfg(feature = "NSString")]
54 pub static NSFTPPropertyUserPasswordKey: Option<&'static NSString>;
55}
56
57extern "C" {
58 #[cfg(feature = "NSString")]
60 pub static NSFTPPropertyActiveTransferModeKey: Option<&'static NSString>;
61}
62
63extern "C" {
64 #[cfg(feature = "NSString")]
66 pub static NSFTPPropertyFileOffsetKey: Option<&'static NSString>;
67}
68
69extern "C" {
70 #[cfg(feature = "NSString")]
72 pub static NSFTPPropertyFTPProxy: Option<&'static NSString>;
73}
74
75#[repr(transparent)]
78#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
79pub struct NSURLHandleStatus(pub NSUInteger);
80impl NSURLHandleStatus {
81 #[doc(alias = "NSURLHandleNotLoaded")]
82 pub const NotLoaded: Self = Self(0);
83 #[doc(alias = "NSURLHandleLoadSucceeded")]
84 pub const LoadSucceeded: Self = Self(1);
85 #[doc(alias = "NSURLHandleLoadInProgress")]
86 pub const LoadInProgress: Self = Self(2);
87 #[doc(alias = "NSURLHandleLoadFailed")]
88 pub const LoadFailed: Self = Self(3);
89}
90
91unsafe impl Encode for NSURLHandleStatus {
92 const ENCODING: Encoding = NSUInteger::ENCODING;
93}
94
95unsafe impl RefEncode for NSURLHandleStatus {
96 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
97}
98
99extern_protocol!(
100 #[deprecated]
102 pub unsafe trait NSURLHandleClient {
103 #[cfg(feature = "NSData")]
104 #[deprecated]
105 #[unsafe(method(URLHandle:resourceDataDidBecomeAvailable:))]
106 #[unsafe(method_family = none)]
107 unsafe fn URLHandle_resourceDataDidBecomeAvailable(
108 &self,
109 sender: Option<&NSURLHandle>,
110 new_bytes: Option<&NSData>,
111 );
112
113 #[deprecated]
114 #[unsafe(method(URLHandleResourceDidBeginLoading:))]
115 #[unsafe(method_family = none)]
116 unsafe fn URLHandleResourceDidBeginLoading(&self, sender: Option<&NSURLHandle>);
117
118 #[deprecated]
119 #[unsafe(method(URLHandleResourceDidFinishLoading:))]
120 #[unsafe(method_family = none)]
121 unsafe fn URLHandleResourceDidFinishLoading(&self, sender: Option<&NSURLHandle>);
122
123 #[deprecated]
124 #[unsafe(method(URLHandleResourceDidCancelLoading:))]
125 #[unsafe(method_family = none)]
126 unsafe fn URLHandleResourceDidCancelLoading(&self, sender: Option<&NSURLHandle>);
127
128 #[cfg(feature = "NSString")]
129 #[deprecated]
130 #[unsafe(method(URLHandle:resourceDidFailLoadingWithReason:))]
131 #[unsafe(method_family = none)]
132 unsafe fn URLHandle_resourceDidFailLoadingWithReason(
133 &self,
134 sender: Option<&NSURLHandle>,
135 reason: Option<&NSString>,
136 );
137 }
138);
139
140extern_class!(
141 #[unsafe(super(NSObject))]
143 #[derive(Debug, PartialEq, Eq, Hash)]
144 pub struct NSURLHandle;
145);
146
147extern_conformance!(
148 unsafe impl NSObjectProtocol for NSURLHandle {}
149);
150
151impl NSURLHandle {
152 extern_methods!(
153 #[deprecated]
154 #[unsafe(method(registerURLHandleClass:))]
155 #[unsafe(method_family = none)]
156 pub unsafe fn registerURLHandleClass(an_url_handle_subclass: Option<&AnyClass>);
157
158 #[cfg(feature = "NSURL")]
159 #[deprecated]
160 #[unsafe(method(URLHandleClassForURL:))]
161 #[unsafe(method_family = none)]
162 pub unsafe fn URLHandleClassForURL(an_url: Option<&NSURL>) -> Option<&'static AnyClass>;
163
164 #[deprecated]
165 #[unsafe(method(status))]
166 #[unsafe(method_family = none)]
167 pub unsafe fn status(&self) -> NSURLHandleStatus;
168
169 #[cfg(feature = "NSString")]
170 #[deprecated]
171 #[unsafe(method(failureReason))]
172 #[unsafe(method_family = none)]
173 pub unsafe fn failureReason(&self) -> Option<Retained<NSString>>;
174
175 #[deprecated]
176 #[unsafe(method(addClient:))]
177 #[unsafe(method_family = none)]
178 pub unsafe fn addClient(&self, client: Option<&ProtocolObject<dyn NSURLHandleClient>>);
179
180 #[deprecated]
181 #[unsafe(method(removeClient:))]
182 #[unsafe(method_family = none)]
183 pub unsafe fn removeClient(&self, client: Option<&ProtocolObject<dyn NSURLHandleClient>>);
184
185 #[deprecated]
186 #[unsafe(method(loadInBackground))]
187 #[unsafe(method_family = none)]
188 pub unsafe fn loadInBackground(&self);
189
190 #[deprecated]
191 #[unsafe(method(cancelLoadInBackground))]
192 #[unsafe(method_family = none)]
193 pub unsafe fn cancelLoadInBackground(&self);
194
195 #[cfg(feature = "NSData")]
196 #[deprecated]
197 #[unsafe(method(resourceData))]
198 #[unsafe(method_family = none)]
199 pub unsafe fn resourceData(&self) -> Option<Retained<NSData>>;
200
201 #[cfg(feature = "NSData")]
202 #[deprecated]
203 #[unsafe(method(availableResourceData))]
204 #[unsafe(method_family = none)]
205 pub unsafe fn availableResourceData(&self) -> Option<Retained<NSData>>;
206
207 #[deprecated]
208 #[unsafe(method(expectedResourceDataSize))]
209 #[unsafe(method_family = none)]
210 pub unsafe fn expectedResourceDataSize(&self) -> c_longlong;
211
212 #[deprecated]
213 #[unsafe(method(flushCachedData))]
214 #[unsafe(method_family = none)]
215 pub unsafe fn flushCachedData(&self);
216
217 #[cfg(feature = "NSString")]
218 #[deprecated]
219 #[unsafe(method(backgroundLoadDidFailWithReason:))]
220 #[unsafe(method_family = none)]
221 pub unsafe fn backgroundLoadDidFailWithReason(&self, reason: Option<&NSString>);
222
223 #[cfg(feature = "NSData")]
224 #[deprecated]
225 #[unsafe(method(didLoadBytes:loadComplete:))]
226 #[unsafe(method_family = none)]
227 pub unsafe fn didLoadBytes_loadComplete(&self, new_bytes: Option<&NSData>, yorn: bool);
228
229 #[cfg(feature = "NSURL")]
230 #[deprecated]
231 #[unsafe(method(canInitWithURL:))]
232 #[unsafe(method_family = none)]
233 pub unsafe fn canInitWithURL(an_url: Option<&NSURL>) -> bool;
234
235 #[cfg(feature = "NSURL")]
236 #[deprecated]
237 #[unsafe(method(cachedHandleForURL:))]
238 #[unsafe(method_family = none)]
239 pub unsafe fn cachedHandleForURL(an_url: Option<&NSURL>) -> Option<Retained<NSURLHandle>>;
240
241 #[cfg(feature = "NSURL")]
242 #[deprecated]
243 #[unsafe(method(initWithURL:cached:))]
244 #[unsafe(method_family = init)]
245 pub unsafe fn initWithURL_cached(
246 this: Allocated<Self>,
247 an_url: Option<&NSURL>,
248 will_cache: bool,
249 ) -> Option<Retained<Self>>;
250
251 #[cfg(feature = "NSString")]
252 #[deprecated]
253 #[unsafe(method(propertyForKey:))]
254 #[unsafe(method_family = none)]
255 pub unsafe fn propertyForKey(
256 &self,
257 property_key: Option<&NSString>,
258 ) -> Option<Retained<AnyObject>>;
259
260 #[cfg(feature = "NSString")]
261 #[deprecated]
262 #[unsafe(method(propertyForKeyIfAvailable:))]
263 #[unsafe(method_family = none)]
264 pub unsafe fn propertyForKeyIfAvailable(
265 &self,
266 property_key: Option<&NSString>,
267 ) -> Option<Retained<AnyObject>>;
268
269 #[cfg(feature = "NSString")]
270 #[deprecated]
271 #[unsafe(method(writeProperty:forKey:))]
272 #[unsafe(method_family = none)]
273 pub unsafe fn writeProperty_forKey(
274 &self,
275 property_value: Option<&AnyObject>,
276 property_key: Option<&NSString>,
277 ) -> bool;
278
279 #[cfg(feature = "NSData")]
280 #[deprecated]
281 #[unsafe(method(writeData:))]
282 #[unsafe(method_family = none)]
283 pub unsafe fn writeData(&self, data: Option<&NSData>) -> bool;
284
285 #[cfg(feature = "NSData")]
286 #[deprecated]
287 #[unsafe(method(loadInForeground))]
288 #[unsafe(method_family = none)]
289 pub unsafe fn loadInForeground(&self) -> Option<Retained<NSData>>;
290
291 #[deprecated]
292 #[unsafe(method(beginLoadInBackground))]
293 #[unsafe(method_family = none)]
294 pub unsafe fn beginLoadInBackground(&self);
295
296 #[deprecated]
297 #[unsafe(method(endLoadInBackground))]
298 #[unsafe(method_family = none)]
299 pub unsafe fn endLoadInBackground(&self);
300 );
301}
302
303impl NSURLHandle {
305 extern_methods!(
306 #[unsafe(method(init))]
307 #[unsafe(method_family = init)]
308 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
309
310 #[unsafe(method(new))]
311 #[unsafe(method_family = new)]
312 pub unsafe fn new() -> Retained<Self>;
313 );
314}