objc2-gameplay-kit 0.3.2

Bindings to the GameplayKit 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!(
    /// Representation of a directed graph of GKGraphNodes
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/gameplaykit/gkgraph?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct GKGraph;
);

extern_conformance!(
    unsafe impl NSCoding for GKGraph {}
);

extern_conformance!(
    unsafe impl NSCopying for GKGraph {}
);

unsafe impl CopyingHelper for GKGraph {
    type Result = Self;
}

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

extern_conformance!(
    unsafe impl NSSecureCoding for GKGraph {}
);

impl GKGraph {
    extern_methods!(
        #[cfg(feature = "GKGraphNode")]
        /// The list of nodes in this graph
        #[unsafe(method(nodes))]
        #[unsafe(method_family = none)]
        pub unsafe fn nodes(&self) -> Option<Retained<NSArray<GKGraphNode>>>;

        #[cfg(feature = "GKGraphNode")]
        /// Creates a graph with the provided array of nodes.
        ///
        /// Parameter `nodes`: the nodes to create the graph with
        #[unsafe(method(graphWithNodes:))]
        #[unsafe(method_family = none)]
        pub unsafe fn graphWithNodes(nodes: &NSArray<GKGraphNode>) -> Retained<Self>;

        #[cfg(feature = "GKGraphNode")]
        #[unsafe(method(initWithNodes:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithNodes(
            this: Allocated<Self>,
            nodes: &NSArray<GKGraphNode>,
        ) -> Retained<Self>;

        #[cfg(feature = "GKGraphNode")]
        /// Connects the node to this graph via the lowest cost node to reach in this graph
        ///
        /// Parameter `node`: the node to connect
        ///
        /// Parameter `bidirectional`: should the connection be bidirectional? Otherwise it is one way connected into the graph
        #[unsafe(method(connectNodeToLowestCostNode:bidirectional:))]
        #[unsafe(method_family = none)]
        pub unsafe fn connectNodeToLowestCostNode_bidirectional(
            &self,
            node: &GKGraphNode,
            bidirectional: bool,
        );

        #[cfg(feature = "GKGraphNode")]
        /// Removes nodes from this graph.
        /// All connections starting and/or ending with this node are removed.
        ///
        /// Parameter `nodes`: an array of nodes to be removed
        #[unsafe(method(removeNodes:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeNodes(&self, nodes: &NSArray<GKGraphNode>);

        #[cfg(feature = "GKGraphNode")]
        /// Adds nodes to this graph.  No new connections are added.
        /// If the node already exists in this graph this does nothing.
        ///
        /// Parameter `nodes`: and array of nodes to be added
        #[unsafe(method(addNodes:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addNodes(&self, nodes: &NSArray<GKGraphNode>);

        #[cfg(feature = "GKGraphNode")]
        /// Attempts to find the optimal path between the two nodes indicated.
        /// If such a path exists, it is returned in start to end order.
        /// If it doesn't exist, the array returned will be empty.
        /// Asserts if neither of these nodes are in this graph.  Use [GKGraphNode findPathFromNode:] instead.
        ///
        /// Parameter `startNode`: node to start pathing from
        ///
        /// Parameter `endNode`: goal node of the pathfinding attempt
        #[unsafe(method(findPathFromNode:toNode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn findPathFromNode_toNode(
            &self,
            start_node: &GKGraphNode,
            end_node: &GKGraphNode,
        ) -> Retained<NSArray<GKGraphNode>>;
    );
}

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