objc2-model-io 0.3.2

Bindings to the ModelIO 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 objc2_foundation::*;

use crate::*;

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/modelio/mdlassetresolver?language=objc)
    pub unsafe trait MDLAssetResolver: NSObjectProtocol {
        #[unsafe(method(canResolveAssetNamed:))]
        #[unsafe(method_family = none)]
        unsafe fn canResolveAssetNamed(&self, name: &NSString) -> bool;

        #[unsafe(method(resolveAssetNamed:))]
        #[unsafe(method_family = none)]
        unsafe fn resolveAssetNamed(&self, name: &NSString) -> Retained<NSURL>;
    }
);

extern_class!(
    /// The relative asset resolver searches for referenced files
    /// by checking the location of the asset for sibling files
    /// satisfying the requested name.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/modelio/mdlrelativeassetresolver?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MDLRelativeAssetResolver;
);

extern_conformance!(
    unsafe impl MDLAssetResolver for MDLRelativeAssetResolver {}
);

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

impl MDLRelativeAssetResolver {
    extern_methods!(
        #[cfg(feature = "MDLAsset")]
        #[unsafe(method(initWithAsset:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithAsset(this: Allocated<Self>, asset: &MDLAsset) -> Retained<Self>;

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

        #[cfg(feature = "MDLAsset")]
        /// Setter for [`asset`][Self::asset].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setAsset:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAsset(&self, asset: Option<&MDLAsset>);
    );
}

/// Methods declared on superclass `NSObject`.
impl MDLRelativeAssetResolver {
    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>;
    );
}

extern_class!(
    /// The path asset resolver searches for referenced files
    /// by prepending path.
    ///
    ///
    /// Path should resolve to a well formed URI. A file system
    /// path might take the form
    /// "
    /// file:///path/to/all/assets/
    ///
    /// A trailing slash is automatically appended to path if
    /// not provided.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/modelio/mdlpathassetresolver?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MDLPathAssetResolver;
);

extern_conformance!(
    unsafe impl MDLAssetResolver for MDLPathAssetResolver {}
);

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

impl MDLPathAssetResolver {
    extern_methods!(
        #[unsafe(method(initWithPath:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithPath(this: Allocated<Self>, path: &NSString) -> Retained<Self>;

        #[unsafe(method(path))]
        #[unsafe(method_family = none)]
        pub unsafe fn path(&self) -> Retained<NSString>;

        /// Setter for [`path`][Self::path].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setPath:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPath(&self, path: &NSString);
    );
}

/// Methods declared on superclass `NSObject`.
impl MDLPathAssetResolver {
    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>;
    );
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/modelio/mdlbundleassetresolver?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MDLBundleAssetResolver;
);

extern_conformance!(
    unsafe impl MDLAssetResolver for MDLBundleAssetResolver {}
);

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

impl MDLBundleAssetResolver {
    extern_methods!(
        #[unsafe(method(initWithBundle:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithBundle(this: Allocated<Self>, path: &NSString) -> Retained<Self>;

        #[unsafe(method(path))]
        #[unsafe(method_family = none)]
        pub unsafe fn path(&self) -> Retained<NSString>;

        /// Setter for [`path`][Self::path].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setPath:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPath(&self, path: &NSString);
    );
}

/// Methods declared on superclass `NSObject`.
impl MDLBundleAssetResolver {
    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>;
    );
}