icrate 0.0.1

Bindings to Apple's frameworks
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
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!(
    pub struct NSURLHandleClient;

    unsafe impl ProtocolType for NSURLHandleClient {
        #[method(URLHandle:resourceDataDidBecomeAvailable:)]
        pub unsafe fn URLHandle_resourceDataDidBecomeAvailable(
            &self,
            sender: Option<&NSURLHandle>,
            newBytes: Option<&NSData>,
        );

        #[method(URLHandleResourceDidBeginLoading:)]
        pub unsafe fn URLHandleResourceDidBeginLoading(&self, sender: Option<&NSURLHandle>);

        #[method(URLHandleResourceDidFinishLoading:)]
        pub unsafe fn URLHandleResourceDidFinishLoading(&self, sender: Option<&NSURLHandle>);

        #[method(URLHandleResourceDidCancelLoading:)]
        pub unsafe fn URLHandleResourceDidCancelLoading(&self, sender: Option<&NSURLHandle>);

        #[method(URLHandle:resourceDidFailLoadingWithReason:)]
        pub unsafe fn URLHandle_resourceDidFailLoadingWithReason(
            &self,
            sender: Option<&NSURLHandle>,
            reason: Option<&NSString>,
        );
    }
);

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

    unsafe impl ClassType for NSURLHandle {
        type Super = NSObject;
    }
);

extern_methods!(
    unsafe impl NSURLHandle {
        #[method(registerURLHandleClass:)]
        pub unsafe fn registerURLHandleClass(anURLHandleSubclass: Option<&Class>);

        #[method(URLHandleClassForURL:)]
        pub unsafe fn URLHandleClassForURL(anURL: Option<&NSURL>) -> Option<&'static Class>;

        #[method(status)]
        pub unsafe fn status(&self) -> NSURLHandleStatus;

        #[method_id(@__retain_semantics Other failureReason)]
        pub unsafe fn failureReason(&self) -> Option<Id<NSString, Shared>>;

        #[method(addClient:)]
        pub unsafe fn addClient(&self, client: Option<&NSURLHandleClient>);

        #[method(removeClient:)]
        pub unsafe fn removeClient(&self, client: Option<&NSURLHandleClient>);

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

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

        #[method_id(@__retain_semantics Other resourceData)]
        pub unsafe fn resourceData(&self) -> Option<Id<NSData, Shared>>;

        #[method_id(@__retain_semantics Other availableResourceData)]
        pub unsafe fn availableResourceData(&self) -> Option<Id<NSData, Shared>>;

        #[method(expectedResourceDataSize)]
        pub unsafe fn expectedResourceDataSize(&self) -> c_longlong;

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

        #[method(backgroundLoadDidFailWithReason:)]
        pub unsafe fn backgroundLoadDidFailWithReason(&self, reason: Option<&NSString>);

        #[method(didLoadBytes:loadComplete:)]
        pub unsafe fn didLoadBytes_loadComplete(&self, newBytes: Option<&NSData>, yorn: bool);

        #[method(canInitWithURL:)]
        pub unsafe fn canInitWithURL(anURL: Option<&NSURL>) -> bool;

        #[method_id(@__retain_semantics Other cachedHandleForURL:)]
        pub unsafe fn cachedHandleForURL(anURL: Option<&NSURL>) -> Option<Id<NSURLHandle, Shared>>;

        #[method_id(@__retain_semantics Init initWithURL:cached:)]
        pub unsafe fn initWithURL_cached(
            this: Option<Allocated<Self>>,
            anURL: Option<&NSURL>,
            willCache: bool,
        ) -> Option<Id<Self, Shared>>;

        #[method_id(@__retain_semantics Other propertyForKey:)]
        pub unsafe fn propertyForKey(
            &self,
            propertyKey: Option<&NSString>,
        ) -> Option<Id<Object, Shared>>;

        #[method_id(@__retain_semantics Other propertyForKeyIfAvailable:)]
        pub unsafe fn propertyForKeyIfAvailable(
            &self,
            propertyKey: Option<&NSString>,
        ) -> Option<Id<Object, Shared>>;

        #[method(writeProperty:forKey:)]
        pub unsafe fn writeProperty_forKey(
            &self,
            propertyValue: Option<&Object>,
            propertyKey: Option<&NSString>,
        ) -> bool;

        #[method(writeData:)]
        pub unsafe fn writeData(&self, data: Option<&NSData>) -> bool;

        #[method_id(@__retain_semantics Other loadInForeground)]
        pub unsafe fn loadInForeground(&self) -> Option<Id<NSData, Shared>>;

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

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