objc2_gameplay_kit/generated/
GKCompositeBehavior.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    /// [Apple's documentation](https://developer.apple.com/documentation/gameplaykit/gkcompositebehavior?language=objc)
12    #[unsafe(super(GKBehavior, NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    #[cfg(feature = "GKBehavior")]
15    pub struct GKCompositeBehavior;
16);
17
18#[cfg(feature = "GKBehavior")]
19extern_conformance!(
20    unsafe impl NSCopying for GKCompositeBehavior {}
21);
22
23#[cfg(feature = "GKBehavior")]
24unsafe impl CopyingHelper for GKCompositeBehavior {
25    type Result = Self;
26}
27
28#[cfg(feature = "GKBehavior")]
29extern_conformance!(
30    unsafe impl NSFastEnumeration for GKCompositeBehavior {}
31);
32
33#[cfg(feature = "GKBehavior")]
34extern_conformance!(
35    unsafe impl NSObjectProtocol for GKCompositeBehavior {}
36);
37
38#[cfg(feature = "GKBehavior")]
39impl GKCompositeBehavior {
40    extern_methods!(
41        /// Number of sub-behaviors in this behavior
42        #[unsafe(method(behaviorCount))]
43        #[unsafe(method_family = none)]
44        pub unsafe fn behaviorCount(&self) -> NSInteger;
45
46        /// Creates a behavior with an array of sub-behaviors
47        #[unsafe(method(behaviorWithBehaviors:))]
48        #[unsafe(method_family = none)]
49        pub unsafe fn behaviorWithBehaviors(behaviors: &NSArray<GKBehavior>) -> Retained<Self>;
50
51        /// Creates a behavior with two associated arrays of sub-behaviors and weights
52        #[unsafe(method(behaviorWithBehaviors:andWeights:))]
53        #[unsafe(method_family = none)]
54        pub unsafe fn behaviorWithBehaviors_andWeights(
55            behaviors: &NSArray<GKBehavior>,
56            weights: &NSArray<NSNumber>,
57        ) -> Retained<Self>;
58
59        /// Adds a new sub-behavior or changes the weight of the existing sub-behavior in this behavior.
60        /// If the sub-behavior  does not exist in this behavior, it is added.
61        ///
62        /// Parameter `weight`: the weight for this goal
63        ///
64        /// Parameter `behavior`: the sub-behavior who's weight to change
65        #[unsafe(method(setWeight:forBehavior:))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn setWeight_forBehavior(&self, weight: c_float, behavior: &GKBehavior);
68
69        /// Gets the current weight for a given sub-behavior.
70        ///
71        /// Returns: the weight of the sub-behavior, or 0 if there is no such sub-behavior on this behavior
72        #[unsafe(method(weightForBehavior:))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn weightForBehavior(&self, behavior: &GKBehavior) -> c_float;
75
76        /// Remove the indicated sub-behavior from this behavior.
77        ///
78        /// Parameter `behavior`: the sub-behavior to be removed
79        #[unsafe(method(removeBehavior:))]
80        #[unsafe(method_family = none)]
81        pub unsafe fn removeBehavior(&self, behavior: &GKBehavior);
82
83        /// Removes all the sub-behavior on the behavior.
84        #[unsafe(method(removeAllBehaviors))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn removeAllBehaviors(&self);
87
88        /// Supports getting behaviors via a [int] subscript.
89        #[unsafe(method(objectAtIndexedSubscript:))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn objectAtIndexedSubscript(&self, idx: NSUInteger) -> Retained<GKBehavior>;
92
93        /// Supports setting a weight via a [behavior] subscript.
94        #[unsafe(method(setObject:forKeyedSubscript:))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn setObject_forKeyedSubscript(&self, weight: &NSNumber, behavior: &GKBehavior);
97
98        /// Supports getting a weight via a [behavior] subscript.
99        #[unsafe(method(objectForKeyedSubscript:))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn objectForKeyedSubscript(&self, behavior: &GKBehavior) -> Retained<NSNumber>;
102    );
103}
104
105/// Methods declared on superclass `GKBehavior`.
106#[cfg(feature = "GKBehavior")]
107impl GKCompositeBehavior {
108    extern_methods!(
109        #[cfg(feature = "GKGoal")]
110        /// Creates a behavior with a single goal and weight
111        #[unsafe(method(behaviorWithGoal:weight:))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn behaviorWithGoal_weight(goal: &GKGoal, weight: c_float) -> Retained<Self>;
114
115        #[cfg(feature = "GKGoal")]
116        /// Creates a behavior with an array of goals.  All weights are set to 1.0f
117        #[unsafe(method(behaviorWithGoals:))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn behaviorWithGoals(goals: &NSArray<GKGoal>) -> Retained<Self>;
120
121        #[cfg(feature = "GKGoal")]
122        /// Creates a behavior with two associated arrays of goals and weights
123        #[unsafe(method(behaviorWithGoals:andWeights:))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn behaviorWithGoals_andWeights(
126            goals: &NSArray<GKGoal>,
127            weights: &NSArray<NSNumber>,
128        ) -> Retained<Self>;
129
130        #[cfg(feature = "GKGoal")]
131        /// Creates a behavior with a dictionary of goal/weight pairs
132        #[unsafe(method(behaviorWithWeightedGoals:))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn behaviorWithWeightedGoals(
135            weighted_goals: &NSDictionary<GKGoal, NSNumber>,
136        ) -> Retained<Self>;
137    );
138}
139
140/// Methods declared on superclass `NSObject`.
141#[cfg(feature = "GKBehavior")]
142impl GKCompositeBehavior {
143    extern_methods!(
144        #[unsafe(method(init))]
145        #[unsafe(method_family = init)]
146        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
147
148        #[unsafe(method(new))]
149        #[unsafe(method_family = new)]
150        pub unsafe fn new() -> Retained<Self>;
151    );
152}