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_class!(
    /// Base class for object in a ModelIO asset hierarchy
    ///
    /// Includes transformation and bounds info, links to parent and
    /// children in the hierachy
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/modelio/mdlobject?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MDLObject;
);

#[cfg(feature = "MDLTypes")]
extern_conformance!(
    unsafe impl MDLNamed for MDLObject {}
);

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

impl MDLObject {
    extern_methods!(
        #[cfg(feature = "MDLTypes")]
        /// Allows applications to introspect the components on the objects.
        #[unsafe(method(components))]
        #[unsafe(method_family = none)]
        pub unsafe fn components(&self) -> Retained<NSArray<ProtocolObject<dyn MDLComponent>>>;

        #[cfg(feature = "MDLTypes")]
        /// Extensible component support that allows user of ModelIO to customize
        /// MDLObjects to fit their format and workflow.
        ///
        /// # Safety
        ///
        /// `protocol` possibly has further requirements.
        #[unsafe(method(setComponent:forProtocol:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setComponent_forProtocol(
            &self,
            component: &ProtocolObject<dyn MDLComponent>,
            protocol: &AnyProtocol,
        );

        #[cfg(feature = "MDLTypes")]
        /// Extensible component support that allows user of ModelIO to customize
        /// MDLObjects to fit their format and workflow.
        ///
        /// # Safety
        ///
        /// `protocol` possibly has further requirements.
        #[unsafe(method(componentConformingToProtocol:))]
        #[unsafe(method_family = none)]
        pub unsafe fn componentConformingToProtocol(
            &self,
            protocol: &AnyProtocol,
        ) -> Option<Retained<ProtocolObject<dyn MDLComponent>>>;

        #[cfg(feature = "MDLTypes")]
        /// Allows shorthand [key] syntax for componentConformingToProtocol:.
        ///
        /// Parameter `key`: The protocol that the component conforms to.
        ///
        /// See: componentConformingToProtocol:
        ///
        /// # Safety
        ///
        /// `key` possibly has further requirements.
        #[unsafe(method(objectForKeyedSubscript:))]
        #[unsafe(method_family = none)]
        pub unsafe fn objectForKeyedSubscript(
            &self,
            key: &AnyProtocol,
        ) -> Option<Retained<ProtocolObject<dyn MDLComponent>>>;

        #[cfg(feature = "MDLTypes")]
        /// Allows shorthand [key] syntax for setComponent:forProtocol:.
        ///
        /// Parameter `key`: The protocol that the component conforms to.
        ///
        /// See: setComponent:forProtocol:
        ///
        /// # Safety
        ///
        /// `key` possibly has further requirements.
        #[unsafe(method(setObject:forKeyedSubscript:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setObject_forKeyedSubscript(
            &self,
            obj: Option<&ProtocolObject<dyn MDLComponent>>,
            key: &AnyProtocol,
        );

        /// Parent object. Nil if no parent.
        ///
        /// Set to nil when you remove this from an object container inside the
        /// parent object.
        #[unsafe(method(parent))]
        #[unsafe(method_family = none)]
        pub unsafe fn parent(&self) -> Option<Retained<MDLObject>>;

        /// Setter for [`parent`][Self::parent].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setParent:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setParent(&self, parent: Option<&MDLObject>);

        /// Instance object
        ///
        /// nil, unless this object refers to original data to be instanced. The
        /// original data object can be any MDLObject that does not have a parent.
        /// If an MDLAsset has been created from a data file, any original objects
        /// parsed from that file will be found in the originals property.
        /// A typical use of a original and instance might be to have one original
        /// chair MDLObject, and instance six chairs around a table. The
        /// transform of each chair would be found on the parent MDLObject, but
        /// the various items making up the chair would be found in the original
        /// object.
        #[unsafe(method(instance))]
        #[unsafe(method_family = none)]
        pub unsafe fn instance(&self) -> Option<Retained<MDLObject>>;

        /// Setter for [`instance`][Self::instance].
        #[unsafe(method(setInstance:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setInstance(&self, instance: Option<&MDLObject>);

        /// a string representing a path to the object
        ///
        /// a path is of the form /path/to/object where the path is formed by
        /// concatenating the names of the objects up the parent chain.
        /// Requesting a path will force any unnamed objects to became uniquely
        /// named. Any characters outside of [A-Z][a-z][0-9][:-_.] will be
        /// forced to underscore.
        #[unsafe(method(path))]
        #[unsafe(method_family = none)]
        pub unsafe fn path(&self) -> Retained<NSString>;

        /// Return the object at the specified path, or nil if none exists there
        #[unsafe(method(objectAtPath:))]
        #[unsafe(method_family = none)]
        pub unsafe fn objectAtPath(&self, path: &NSString) -> Retained<MDLObject>;

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// - `object_class` probably has further requirements.
        /// - `stop_pointer` must be a valid pointer.
        #[unsafe(method(enumerateChildObjectsOfClass:root:usingBlock:stopPointer:))]
        #[unsafe(method_family = none)]
        pub unsafe fn enumerateChildObjectsOfClass_root_usingBlock_stopPointer(
            &self,
            object_class: &AnyClass,
            root: &MDLObject,
            block: &block2::DynBlock<dyn Fn(NonNull<MDLObject>, NonNull<Bool>)>,
            stop_pointer: NonNull<Bool>,
        );

        #[cfg(all(feature = "MDLTransform", feature = "MDLTypes"))]
        /// Short hand property for the MDLTransformComponent.
        ///
        /// The default value is nil
        ///
        ///
        /// See: MDLTransformComponent
        #[unsafe(method(transform))]
        #[unsafe(method_family = none)]
        pub unsafe fn transform(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn MDLTransformComponent>>>;

        #[cfg(all(feature = "MDLTransform", feature = "MDLTypes"))]
        /// Setter for [`transform`][Self::transform].
        #[unsafe(method(setTransform:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setTransform(
            &self,
            transform: Option<&ProtocolObject<dyn MDLTransformComponent>>,
        );

        #[cfg(feature = "MDLTypes")]
        /// Short hand property for the MDLObjectContainerComponent.
        ///
        /// The default value is an empty MDLObjectContainer
        ///
        ///
        /// See: MDLObjectContainerComponent
        #[unsafe(method(children))]
        #[unsafe(method_family = none)]
        pub unsafe fn children(&self) -> Retained<ProtocolObject<dyn MDLObjectContainerComponent>>;

        #[cfg(feature = "MDLTypes")]
        /// Setter for [`children`][Self::children].
        #[unsafe(method(setChildren:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setChildren(
            &self,
            children: &ProtocolObject<dyn MDLObjectContainerComponent>,
        );

        /// Visibility of the node
        ///
        /// default is NO
        #[unsafe(method(hidden))]
        #[unsafe(method_family = none)]
        pub unsafe fn hidden(&self) -> bool;

        /// Setter for [`hidden`][Self::hidden].
        #[unsafe(method(setHidden:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setHidden(&self, hidden: bool);

        /// Short hand for adding a child to the current container component and
        /// setting the parent to this object.
        ///
        /// It will create a default container if none exists. If children are
        /// explicitly disallowed for an object, then add a container component
        /// that throws on addition.
        ///
        ///
        /// See: MDLObjectContainer
        #[unsafe(method(addChild:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addChild(&self, child: &MDLObject);
    );
}

/// Methods declared on superclass `NSObject`.
impl MDLObject {
    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!(
    /// Default container object
    ///
    /// Subclass the object container to support custom containers. Such
    /// custom containers might reference in memory representations, offline
    /// databases, and so on.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/modelio/mdlobjectcontainer?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MDLObjectContainer;
);

#[cfg(feature = "MDLTypes")]
extern_conformance!(
    unsafe impl MDLComponent for MDLObjectContainer {}
);

#[cfg(feature = "MDLTypes")]
extern_conformance!(
    unsafe impl MDLObjectContainerComponent for MDLObjectContainer {}
);

extern_conformance!(
    unsafe impl NSFastEnumeration for MDLObjectContainer {}
);

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

impl MDLObjectContainer {
    extern_methods!();
}

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