objc2-foundation 0.3.1

Bindings to the Foundation framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;

use crate::*;

extern_class!(
    /// DEPRECATION NOTICE
    ///
    /// If you’re using `NSHost` to resolve DNS names so that you can connect to a
    /// service, switch to a connect-by-name API, for example, `nw_connection`.
    ///
    /// If you have other DNS resolution needs, switch to
    /// <dns
    /// _sd.h>.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nshost?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated = "Use Network framework instead, see deprecation notice in <Foundation/NSHost.h>"]
    pub struct NSHost;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for NSHost {}
);

impl NSHost {
    extern_methods!(
        #[deprecated = "Use Network framework instead, see deprecation notice in <Foundation/NSHost.h>"]
        #[unsafe(method(currentHost))]
        #[unsafe(method_family = none)]
        pub unsafe fn currentHost() -> Retained<Self>;

        #[cfg(feature = "NSString")]
        #[deprecated = "Use Network framework instead, see deprecation notice in <Foundation/NSHost.h>"]
        #[unsafe(method(hostWithName:))]
        #[unsafe(method_family = none)]
        pub unsafe fn hostWithName(name: Option<&NSString>) -> Retained<Self>;

        #[cfg(feature = "NSString")]
        #[deprecated = "Use Network framework instead, see deprecation notice in <Foundation/NSHost.h>"]
        #[unsafe(method(hostWithAddress:))]
        #[unsafe(method_family = none)]
        pub unsafe fn hostWithAddress(address: &NSString) -> Retained<Self>;

        #[deprecated = "Use Network framework instead, see deprecation notice in <Foundation/NSHost.h>"]
        #[unsafe(method(isEqualToHost:))]
        #[unsafe(method_family = none)]
        pub unsafe fn isEqualToHost(&self, a_host: &NSHost) -> bool;

        #[cfg(feature = "NSString")]
        #[deprecated = "Use Network framework instead, see deprecation notice in <Foundation/NSHost.h>"]
        #[unsafe(method(name))]
        #[unsafe(method_family = none)]
        pub unsafe fn name(&self) -> Option<Retained<NSString>>;

        #[cfg(all(feature = "NSArray", feature = "NSString"))]
        #[deprecated = "Use Network framework instead, see deprecation notice in <Foundation/NSHost.h>"]
        #[unsafe(method(names))]
        #[unsafe(method_family = none)]
        pub unsafe fn names(&self) -> Retained<NSArray<NSString>>;

        #[cfg(feature = "NSString")]
        #[deprecated = "Use Network framework instead, see deprecation notice in <Foundation/NSHost.h>"]
        #[unsafe(method(address))]
        #[unsafe(method_family = none)]
        pub unsafe fn address(&self) -> Option<Retained<NSString>>;

        #[cfg(all(feature = "NSArray", feature = "NSString"))]
        #[deprecated = "Use Network framework instead, see deprecation notice in <Foundation/NSHost.h>"]
        #[unsafe(method(addresses))]
        #[unsafe(method_family = none)]
        pub unsafe fn addresses(&self) -> Retained<NSArray<NSString>>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(localizedName))]
        #[unsafe(method_family = none)]
        pub unsafe fn localizedName(&self) -> Option<Retained<NSString>>;

        #[deprecated = "Caching no longer supported"]
        #[unsafe(method(setHostCacheEnabled:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setHostCacheEnabled(flag: bool);

        #[deprecated = "Caching no longer supported"]
        #[unsafe(method(isHostCacheEnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn isHostCacheEnabled() -> bool;

        #[deprecated = "Caching no longer supported"]
        #[unsafe(method(flushHostCache))]
        #[unsafe(method_family = none)]
        pub unsafe fn flushHostCache();
    );
}

/// Methods declared on superclass `NSObject`.
impl NSHost {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}