1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
//! 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>;
);
}