objc2_model_io/generated/
MDLObject.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// Base class for object in a ModelIO asset hierarchy
12    ///
13    /// Includes transformation and bounds info, links to parent and
14    /// children in the hierachy
15    ///
16    /// See also [Apple's documentation](https://developer.apple.com/documentation/modelio/mdlobject?language=objc)
17    #[unsafe(super(NSObject))]
18    #[derive(Debug, PartialEq, Eq, Hash)]
19    pub struct MDLObject;
20);
21
22#[cfg(feature = "MDLTypes")]
23extern_conformance!(
24    unsafe impl MDLNamed for MDLObject {}
25);
26
27extern_conformance!(
28    unsafe impl NSObjectProtocol for MDLObject {}
29);
30
31impl MDLObject {
32    extern_methods!(
33        #[cfg(feature = "MDLTypes")]
34        /// Allows applications to introspect the components on the objects.
35        #[unsafe(method(components))]
36        #[unsafe(method_family = none)]
37        pub unsafe fn components(&self) -> Retained<NSArray<ProtocolObject<dyn MDLComponent>>>;
38
39        #[cfg(feature = "MDLTypes")]
40        /// Extensible component support that allows user of ModelIO to customize
41        /// MDLObjects to fit their format and workflow.
42        ///
43        /// # Safety
44        ///
45        /// `protocol` possibly has further requirements.
46        #[unsafe(method(setComponent:forProtocol:))]
47        #[unsafe(method_family = none)]
48        pub unsafe fn setComponent_forProtocol(
49            &self,
50            component: &ProtocolObject<dyn MDLComponent>,
51            protocol: &AnyProtocol,
52        );
53
54        #[cfg(feature = "MDLTypes")]
55        /// Extensible component support that allows user of ModelIO to customize
56        /// MDLObjects to fit their format and workflow.
57        ///
58        /// # Safety
59        ///
60        /// `protocol` possibly has further requirements.
61        #[unsafe(method(componentConformingToProtocol:))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn componentConformingToProtocol(
64            &self,
65            protocol: &AnyProtocol,
66        ) -> Option<Retained<ProtocolObject<dyn MDLComponent>>>;
67
68        #[cfg(feature = "MDLTypes")]
69        /// Allows shorthand [key] syntax for componentConformingToProtocol:.
70        ///
71        /// Parameter `key`: The protocol that the component conforms to.
72        ///
73        /// See: componentConformingToProtocol:
74        ///
75        /// # Safety
76        ///
77        /// `key` possibly has further requirements.
78        #[unsafe(method(objectForKeyedSubscript:))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn objectForKeyedSubscript(
81            &self,
82            key: &AnyProtocol,
83        ) -> Option<Retained<ProtocolObject<dyn MDLComponent>>>;
84
85        #[cfg(feature = "MDLTypes")]
86        /// Allows shorthand [key] syntax for setComponent:forProtocol:.
87        ///
88        /// Parameter `key`: The protocol that the component conforms to.
89        ///
90        /// See: setComponent:forProtocol:
91        ///
92        /// # Safety
93        ///
94        /// `key` possibly has further requirements.
95        #[unsafe(method(setObject:forKeyedSubscript:))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn setObject_forKeyedSubscript(
98            &self,
99            obj: Option<&ProtocolObject<dyn MDLComponent>>,
100            key: &AnyProtocol,
101        );
102
103        /// Parent object. Nil if no parent.
104        ///
105        /// Set to nil when you remove this from an object container inside the
106        /// parent object.
107        #[unsafe(method(parent))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn parent(&self) -> Option<Retained<MDLObject>>;
110
111        /// Setter for [`parent`][Self::parent].
112        ///
113        /// This is a [weak property][objc2::topics::weak_property].
114        #[unsafe(method(setParent:))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn setParent(&self, parent: Option<&MDLObject>);
117
118        /// Instance object
119        ///
120        /// nil, unless this object refers to original data to be instanced. The
121        /// original data object can be any MDLObject that does not have a parent.
122        /// If an MDLAsset has been created from a data file, any original objects
123        /// parsed from that file will be found in the originals property.
124        /// A typical use of a original and instance might be to have one original
125        /// chair MDLObject, and instance six chairs around a table. The
126        /// transform of each chair would be found on the parent MDLObject, but
127        /// the various items making up the chair would be found in the original
128        /// object.
129        #[unsafe(method(instance))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn instance(&self) -> Option<Retained<MDLObject>>;
132
133        /// Setter for [`instance`][Self::instance].
134        #[unsafe(method(setInstance:))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn setInstance(&self, instance: Option<&MDLObject>);
137
138        /// a string representing a path to the object
139        ///
140        /// a path is of the form /path/to/object where the path is formed by
141        /// concatenating the names of the objects up the parent chain.
142        /// Requesting a path will force any unnamed objects to became uniquely
143        /// named. Any characters outside of [A-Z][a-z][0-9][:-_.] will be
144        /// forced to underscore.
145        #[unsafe(method(path))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn path(&self) -> Retained<NSString>;
148
149        /// Return the object at the specified path, or nil if none exists there
150        #[unsafe(method(objectAtPath:))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn objectAtPath(&self, path: &NSString) -> Retained<MDLObject>;
153
154        #[cfg(feature = "block2")]
155        /// # Safety
156        ///
157        /// - `object_class` probably has further requirements.
158        /// - `stop_pointer` must be a valid pointer.
159        #[unsafe(method(enumerateChildObjectsOfClass:root:usingBlock:stopPointer:))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn enumerateChildObjectsOfClass_root_usingBlock_stopPointer(
162            &self,
163            object_class: &AnyClass,
164            root: &MDLObject,
165            block: &block2::DynBlock<dyn Fn(NonNull<MDLObject>, NonNull<Bool>)>,
166            stop_pointer: NonNull<Bool>,
167        );
168
169        #[cfg(all(feature = "MDLTransform", feature = "MDLTypes"))]
170        /// Short hand property for the MDLTransformComponent.
171        ///
172        /// The default value is nil
173        ///
174        ///
175        /// See: MDLTransformComponent
176        #[unsafe(method(transform))]
177        #[unsafe(method_family = none)]
178        pub unsafe fn transform(
179            &self,
180        ) -> Option<Retained<ProtocolObject<dyn MDLTransformComponent>>>;
181
182        #[cfg(all(feature = "MDLTransform", feature = "MDLTypes"))]
183        /// Setter for [`transform`][Self::transform].
184        #[unsafe(method(setTransform:))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn setTransform(
187            &self,
188            transform: Option<&ProtocolObject<dyn MDLTransformComponent>>,
189        );
190
191        #[cfg(feature = "MDLTypes")]
192        /// Short hand property for the MDLObjectContainerComponent.
193        ///
194        /// The default value is an empty MDLObjectContainer
195        ///
196        ///
197        /// See: MDLObjectContainerComponent
198        #[unsafe(method(children))]
199        #[unsafe(method_family = none)]
200        pub unsafe fn children(&self) -> Retained<ProtocolObject<dyn MDLObjectContainerComponent>>;
201
202        #[cfg(feature = "MDLTypes")]
203        /// Setter for [`children`][Self::children].
204        #[unsafe(method(setChildren:))]
205        #[unsafe(method_family = none)]
206        pub unsafe fn setChildren(
207            &self,
208            children: &ProtocolObject<dyn MDLObjectContainerComponent>,
209        );
210
211        /// Visibility of the node
212        ///
213        /// default is NO
214        #[unsafe(method(hidden))]
215        #[unsafe(method_family = none)]
216        pub unsafe fn hidden(&self) -> bool;
217
218        /// Setter for [`hidden`][Self::hidden].
219        #[unsafe(method(setHidden:))]
220        #[unsafe(method_family = none)]
221        pub unsafe fn setHidden(&self, hidden: bool);
222
223        /// Short hand for adding a child to the current container component and
224        /// setting the parent to this object.
225        ///
226        /// It will create a default container if none exists. If children are
227        /// explicitly disallowed for an object, then add a container component
228        /// that throws on addition.
229        ///
230        ///
231        /// See: MDLObjectContainer
232        #[unsafe(method(addChild:))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn addChild(&self, child: &MDLObject);
235    );
236}
237
238/// Methods declared on superclass `NSObject`.
239impl MDLObject {
240    extern_methods!(
241        #[unsafe(method(init))]
242        #[unsafe(method_family = init)]
243        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
244
245        #[unsafe(method(new))]
246        #[unsafe(method_family = new)]
247        pub unsafe fn new() -> Retained<Self>;
248    );
249}
250
251extern_class!(
252    /// Default container object
253    ///
254    /// Subclass the object container to support custom containers. Such
255    /// custom containers might reference in memory representations, offline
256    /// databases, and so on.
257    ///
258    /// See also [Apple's documentation](https://developer.apple.com/documentation/modelio/mdlobjectcontainer?language=objc)
259    #[unsafe(super(NSObject))]
260    #[derive(Debug, PartialEq, Eq, Hash)]
261    pub struct MDLObjectContainer;
262);
263
264#[cfg(feature = "MDLTypes")]
265extern_conformance!(
266    unsafe impl MDLComponent for MDLObjectContainer {}
267);
268
269#[cfg(feature = "MDLTypes")]
270extern_conformance!(
271    unsafe impl MDLObjectContainerComponent for MDLObjectContainer {}
272);
273
274extern_conformance!(
275    unsafe impl NSFastEnumeration for MDLObjectContainer {}
276);
277
278extern_conformance!(
279    unsafe impl NSObjectProtocol for MDLObjectContainer {}
280);
281
282impl MDLObjectContainer {
283    extern_methods!();
284}
285
286/// Methods declared on superclass `NSObject`.
287impl MDLObjectContainer {
288    extern_methods!(
289        #[unsafe(method(init))]
290        #[unsafe(method_family = init)]
291        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
292
293        #[unsafe(method(new))]
294        #[unsafe(method_family = new)]
295        pub unsafe fn new() -> Retained<Self>;
296    );
297}