objc2_foundation/generated/
NSPointerArray.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::*;
6
7use crate::*;
8
9extern_class!(
10    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nspointerarray?language=objc)
11    #[unsafe(super(NSObject))]
12    #[derive(Debug, PartialEq, Eq, Hash)]
13    pub struct NSPointerArray;
14);
15
16#[cfg(feature = "NSObject")]
17extern_conformance!(
18    unsafe impl NSCoding for NSPointerArray {}
19);
20
21#[cfg(feature = "NSObject")]
22extern_conformance!(
23    unsafe impl NSCopying for NSPointerArray {}
24);
25
26#[cfg(feature = "NSObject")]
27unsafe impl CopyingHelper for NSPointerArray {
28    type Result = Self;
29}
30
31#[cfg(feature = "NSEnumerator")]
32extern_conformance!(
33    unsafe impl NSFastEnumeration for NSPointerArray {}
34);
35
36extern_conformance!(
37    unsafe impl NSObjectProtocol for NSPointerArray {}
38);
39
40#[cfg(feature = "NSObject")]
41extern_conformance!(
42    unsafe impl NSSecureCoding for NSPointerArray {}
43);
44
45impl NSPointerArray {
46    extern_methods!(
47        #[cfg(feature = "NSPointerFunctions")]
48        #[unsafe(method(initWithOptions:))]
49        #[unsafe(method_family = init)]
50        pub fn initWithOptions(
51            this: Allocated<Self>,
52            options: NSPointerFunctionsOptions,
53        ) -> Retained<Self>;
54
55        #[cfg(feature = "NSPointerFunctions")]
56        #[unsafe(method(initWithPointerFunctions:))]
57        #[unsafe(method_family = init)]
58        pub fn initWithPointerFunctions(
59            this: Allocated<Self>,
60            functions: &NSPointerFunctions,
61        ) -> Retained<Self>;
62
63        #[cfg(feature = "NSPointerFunctions")]
64        #[unsafe(method(pointerArrayWithOptions:))]
65        #[unsafe(method_family = none)]
66        pub fn pointerArrayWithOptions(
67            options: NSPointerFunctionsOptions,
68        ) -> Retained<NSPointerArray>;
69
70        #[cfg(feature = "NSPointerFunctions")]
71        #[unsafe(method(pointerArrayWithPointerFunctions:))]
72        #[unsafe(method_family = none)]
73        pub fn pointerArrayWithPointerFunctions(
74            functions: &NSPointerFunctions,
75        ) -> Retained<NSPointerArray>;
76
77        #[cfg(feature = "NSPointerFunctions")]
78        #[unsafe(method(pointerFunctions))]
79        #[unsafe(method_family = none)]
80        pub fn pointerFunctions(&self) -> Retained<NSPointerFunctions>;
81
82        #[unsafe(method(pointerAtIndex:))]
83        #[unsafe(method_family = none)]
84        pub fn pointerAtIndex(&self, index: NSUInteger) -> *mut c_void;
85
86        /// # Safety
87        ///
88        /// `pointer` must be a valid pointer or null.
89        #[unsafe(method(addPointer:))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn addPointer(&self, pointer: *mut c_void);
92
93        #[unsafe(method(removePointerAtIndex:))]
94        #[unsafe(method_family = none)]
95        pub fn removePointerAtIndex(&self, index: NSUInteger);
96
97        /// # Safety
98        ///
99        /// `item` must be a valid pointer or null.
100        #[unsafe(method(insertPointer:atIndex:))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn insertPointer_atIndex(&self, item: *mut c_void, index: NSUInteger);
103
104        /// # Safety
105        ///
106        /// `item` must be a valid pointer or null.
107        #[unsafe(method(replacePointerAtIndex:withPointer:))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn replacePointerAtIndex_withPointer(
110            &self,
111            index: NSUInteger,
112            item: *mut c_void,
113        );
114
115        #[unsafe(method(compact))]
116        #[unsafe(method_family = none)]
117        pub fn compact(&self);
118
119        #[unsafe(method(count))]
120        #[unsafe(method_family = none)]
121        pub fn count(&self) -> NSUInteger;
122
123        /// Setter for [`count`][Self::count].
124        #[unsafe(method(setCount:))]
125        #[unsafe(method_family = none)]
126        pub fn setCount(&self, count: NSUInteger);
127    );
128}
129
130/// Methods declared on superclass `NSObject`.
131impl NSPointerArray {
132    extern_methods!(
133        #[unsafe(method(init))]
134        #[unsafe(method_family = init)]
135        pub fn init(this: Allocated<Self>) -> Retained<Self>;
136
137        #[unsafe(method(new))]
138        #[unsafe(method_family = new)]
139        pub fn new() -> Retained<Self>;
140    );
141}
142
143impl DefaultRetained for NSPointerArray {
144    #[inline]
145    fn default_retained() -> Retained<Self> {
146        Self::new()
147    }
148}
149
150/// NSPointerArrayConveniences.
151impl NSPointerArray {
152    extern_methods!(
153        #[deprecated = "GC no longer supported"]
154        #[unsafe(method(pointerArrayWithStrongObjects))]
155        #[unsafe(method_family = none)]
156        pub fn pointerArrayWithStrongObjects() -> Retained<AnyObject>;
157
158        #[deprecated = "GC no longer supported"]
159        #[unsafe(method(pointerArrayWithWeakObjects))]
160        #[unsafe(method_family = none)]
161        pub fn pointerArrayWithWeakObjects() -> Retained<AnyObject>;
162
163        #[unsafe(method(strongObjectsPointerArray))]
164        #[unsafe(method_family = none)]
165        pub fn strongObjectsPointerArray() -> Retained<NSPointerArray>;
166
167        #[unsafe(method(weakObjectsPointerArray))]
168        #[unsafe(method_family = none)]
169        pub fn weakObjectsPointerArray() -> Retained<NSPointerArray>;
170
171        #[cfg(feature = "NSArray")]
172        #[unsafe(method(allObjects))]
173        #[unsafe(method_family = none)]
174        pub fn allObjects(&self) -> Retained<NSArray>;
175    );
176}