use crate::common::*;
use crate::Foundation::*;
extern_static!(NSHTTPPropertyStatusCodeKey: Option<&'static NSString>);
extern_static!(NSHTTPPropertyStatusReasonKey: Option<&'static NSString>);
extern_static!(NSHTTPPropertyServerHTTPVersionKey: Option<&'static NSString>);
extern_static!(NSHTTPPropertyRedirectionHeadersKey: Option<&'static NSString>);
extern_static!(NSHTTPPropertyErrorPageDataKey: Option<&'static NSString>);
extern_static!(NSHTTPPropertyHTTPProxy: Option<&'static NSString>);
extern_static!(NSFTPPropertyUserLoginKey: Option<&'static NSString>);
extern_static!(NSFTPPropertyUserPasswordKey: Option<&'static NSString>);
extern_static!(NSFTPPropertyActiveTransferModeKey: Option<&'static NSString>);
extern_static!(NSFTPPropertyFileOffsetKey: Option<&'static NSString>);
extern_static!(NSFTPPropertyFTPProxy: Option<&'static NSString>);
ns_enum!(
#[underlying(NSUInteger)]
pub enum NSURLHandleStatus {
NSURLHandleNotLoaded = 0,
NSURLHandleLoadSucceeded = 1,
NSURLHandleLoadInProgress = 2,
NSURLHandleLoadFailed = 3,
}
);
extern_protocol!(
#[deprecated]
pub unsafe trait NSURLHandleClient {
#[cfg(all(feature = "Foundation_NSData", feature = "Foundation_NSURLHandle"))]
#[deprecated]
#[method(URLHandle:resourceDataDidBecomeAvailable:)]
unsafe fn URLHandle_resourceDataDidBecomeAvailable(
&self,
sender: Option<&NSURLHandle>,
new_bytes: Option<&NSData>,
);
#[cfg(feature = "Foundation_NSURLHandle")]
#[deprecated]
#[method(URLHandleResourceDidBeginLoading:)]
unsafe fn URLHandleResourceDidBeginLoading(&self, sender: Option<&NSURLHandle>);
#[cfg(feature = "Foundation_NSURLHandle")]
#[deprecated]
#[method(URLHandleResourceDidFinishLoading:)]
unsafe fn URLHandleResourceDidFinishLoading(&self, sender: Option<&NSURLHandle>);
#[cfg(feature = "Foundation_NSURLHandle")]
#[deprecated]
#[method(URLHandleResourceDidCancelLoading:)]
unsafe fn URLHandleResourceDidCancelLoading(&self, sender: Option<&NSURLHandle>);
#[cfg(all(feature = "Foundation_NSString", feature = "Foundation_NSURLHandle"))]
#[deprecated]
#[method(URLHandle:resourceDidFailLoadingWithReason:)]
unsafe fn URLHandle_resourceDidFailLoadingWithReason(
&self,
sender: Option<&NSURLHandle>,
reason: Option<&NSString>,
);
}
unsafe impl ProtocolType for dyn NSURLHandleClient {}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "Foundation_NSURLHandle")]
pub struct NSURLHandle;
#[cfg(feature = "Foundation_NSURLHandle")]
unsafe impl ClassType for NSURLHandle {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "Foundation_NSURLHandle")]
unsafe impl NSObjectProtocol for NSURLHandle {}
extern_methods!(
#[cfg(feature = "Foundation_NSURLHandle")]
unsafe impl NSURLHandle {
#[deprecated]
#[method(registerURLHandleClass:)]
pub unsafe fn registerURLHandleClass(an_url_handle_subclass: Option<&AnyClass>);
#[cfg(feature = "Foundation_NSURL")]
#[deprecated]
#[method(URLHandleClassForURL:)]
pub unsafe fn URLHandleClassForURL(an_url: Option<&NSURL>) -> Option<&'static AnyClass>;
#[deprecated]
#[method(status)]
pub unsafe fn status(&self) -> NSURLHandleStatus;
#[cfg(feature = "Foundation_NSString")]
#[deprecated]
#[method_id(@__retain_semantics Other failureReason)]
pub unsafe fn failureReason(&self) -> Option<Id<NSString>>;
#[deprecated]
#[method(addClient:)]
pub unsafe fn addClient(&self, client: Option<&ProtocolObject<dyn NSURLHandleClient>>);
#[deprecated]
#[method(removeClient:)]
pub unsafe fn removeClient(&self, client: Option<&ProtocolObject<dyn NSURLHandleClient>>);
#[deprecated]
#[method(loadInBackground)]
pub unsafe fn loadInBackground(&self);
#[deprecated]
#[method(cancelLoadInBackground)]
pub unsafe fn cancelLoadInBackground(&self);
#[cfg(feature = "Foundation_NSData")]
#[deprecated]
#[method_id(@__retain_semantics Other resourceData)]
pub unsafe fn resourceData(&self) -> Option<Id<NSData>>;
#[cfg(feature = "Foundation_NSData")]
#[deprecated]
#[method_id(@__retain_semantics Other availableResourceData)]
pub unsafe fn availableResourceData(&self) -> Option<Id<NSData>>;
#[deprecated]
#[method(expectedResourceDataSize)]
pub unsafe fn expectedResourceDataSize(&self) -> c_longlong;
#[deprecated]
#[method(flushCachedData)]
pub unsafe fn flushCachedData(&self);
#[cfg(feature = "Foundation_NSString")]
#[deprecated]
#[method(backgroundLoadDidFailWithReason:)]
pub unsafe fn backgroundLoadDidFailWithReason(&self, reason: Option<&NSString>);
#[cfg(feature = "Foundation_NSData")]
#[deprecated]
#[method(didLoadBytes:loadComplete:)]
pub unsafe fn didLoadBytes_loadComplete(&self, new_bytes: Option<&NSData>, yorn: bool);
#[cfg(feature = "Foundation_NSURL")]
#[deprecated]
#[method(canInitWithURL:)]
pub unsafe fn canInitWithURL(an_url: Option<&NSURL>) -> bool;
#[cfg(feature = "Foundation_NSURL")]
#[deprecated]
#[method_id(@__retain_semantics Other cachedHandleForURL:)]
pub unsafe fn cachedHandleForURL(an_url: Option<&NSURL>) -> Option<Id<NSURLHandle>>;
#[cfg(feature = "Foundation_NSURL")]
#[deprecated]
#[method_id(@__retain_semantics Init initWithURL:cached:)]
pub unsafe fn initWithURL_cached(
this: Allocated<Self>,
an_url: Option<&NSURL>,
will_cache: bool,
) -> Option<Id<Self>>;
#[cfg(feature = "Foundation_NSString")]
#[deprecated]
#[method_id(@__retain_semantics Other propertyForKey:)]
pub unsafe fn propertyForKey(
&self,
property_key: Option<&NSString>,
) -> Option<Id<AnyObject>>;
#[cfg(feature = "Foundation_NSString")]
#[deprecated]
#[method_id(@__retain_semantics Other propertyForKeyIfAvailable:)]
pub unsafe fn propertyForKeyIfAvailable(
&self,
property_key: Option<&NSString>,
) -> Option<Id<AnyObject>>;
#[cfg(feature = "Foundation_NSString")]
#[deprecated]
#[method(writeProperty:forKey:)]
pub unsafe fn writeProperty_forKey(
&self,
property_value: Option<&AnyObject>,
property_key: Option<&NSString>,
) -> bool;
#[cfg(feature = "Foundation_NSData")]
#[deprecated]
#[method(writeData:)]
pub unsafe fn writeData(&self, data: Option<&NSData>) -> bool;
#[cfg(feature = "Foundation_NSData")]
#[deprecated]
#[method_id(@__retain_semantics Other loadInForeground)]
pub unsafe fn loadInForeground(&self) -> Option<Id<NSData>>;
#[deprecated]
#[method(beginLoadInBackground)]
pub unsafe fn beginLoadInBackground(&self);
#[deprecated]
#[method(endLoadInBackground)]
pub unsafe fn endLoadInBackground(&self);
}
);
extern_methods!(
#[cfg(feature = "Foundation_NSURLHandle")]
unsafe impl NSURLHandle {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Id<Self>;
}
);