objc2_foundation/generated/
NSIndexSet.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/nsindexset?language=objc)
11    #[unsafe(super(NSObject))]
12    #[derive(Debug, PartialEq, Eq, Hash)]
13    pub struct NSIndexSet;
14);
15
16#[cfg(feature = "NSObject")]
17unsafe impl NSCoding for NSIndexSet {}
18
19#[cfg(feature = "NSObject")]
20unsafe impl NSCopying for NSIndexSet {}
21
22#[cfg(feature = "NSObject")]
23unsafe impl CopyingHelper for NSIndexSet {
24    type Result = Self;
25}
26
27#[cfg(feature = "NSObject")]
28unsafe impl NSMutableCopying for NSIndexSet {}
29
30#[cfg(feature = "NSObject")]
31unsafe impl MutableCopyingHelper for NSIndexSet {
32    type Result = NSMutableIndexSet;
33}
34
35unsafe impl NSObjectProtocol for NSIndexSet {}
36
37#[cfg(feature = "NSObject")]
38unsafe impl NSSecureCoding for NSIndexSet {}
39
40impl NSIndexSet {
41    extern_methods!(
42        #[unsafe(method(indexSet))]
43        #[unsafe(method_family = none)]
44        pub unsafe fn indexSet() -> Retained<Self>;
45
46        #[unsafe(method(indexSetWithIndex:))]
47        #[unsafe(method_family = none)]
48        pub unsafe fn indexSetWithIndex(value: NSUInteger) -> Retained<Self>;
49
50        #[cfg(feature = "NSRange")]
51        #[unsafe(method(indexSetWithIndexesInRange:))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn indexSetWithIndexesInRange(range: NSRange) -> Retained<Self>;
54
55        #[cfg(feature = "NSRange")]
56        #[unsafe(method(initWithIndexesInRange:))]
57        #[unsafe(method_family = init)]
58        pub unsafe fn initWithIndexesInRange(
59            this: Allocated<Self>,
60            range: NSRange,
61        ) -> Retained<Self>;
62
63        #[unsafe(method(initWithIndexSet:))]
64        #[unsafe(method_family = init)]
65        pub unsafe fn initWithIndexSet(
66            this: Allocated<Self>,
67            index_set: &NSIndexSet,
68        ) -> Retained<Self>;
69
70        #[unsafe(method(initWithIndex:))]
71        #[unsafe(method_family = init)]
72        pub unsafe fn initWithIndex(this: Allocated<Self>, value: NSUInteger) -> Retained<Self>;
73
74        #[unsafe(method(isEqualToIndexSet:))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn isEqualToIndexSet(&self, index_set: &NSIndexSet) -> bool;
77
78        #[unsafe(method(count))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn count(&self) -> NSUInteger;
81
82        #[unsafe(method(firstIndex))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn firstIndex(&self) -> NSUInteger;
85
86        #[unsafe(method(lastIndex))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn lastIndex(&self) -> NSUInteger;
89
90        #[unsafe(method(indexGreaterThanIndex:))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn indexGreaterThanIndex(&self, value: NSUInteger) -> NSUInteger;
93
94        #[unsafe(method(indexLessThanIndex:))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn indexLessThanIndex(&self, value: NSUInteger) -> NSUInteger;
97
98        #[unsafe(method(indexGreaterThanOrEqualToIndex:))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn indexGreaterThanOrEqualToIndex(&self, value: NSUInteger) -> NSUInteger;
101
102        #[unsafe(method(indexLessThanOrEqualToIndex:))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn indexLessThanOrEqualToIndex(&self, value: NSUInteger) -> NSUInteger;
105
106        #[cfg(feature = "NSRange")]
107        #[unsafe(method(getIndexes:maxCount:inIndexRange:))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn getIndexes_maxCount_inIndexRange(
110            &self,
111            index_buffer: NonNull<NSUInteger>,
112            buffer_size: NSUInteger,
113            range: NSRangePointer,
114        ) -> NSUInteger;
115
116        #[cfg(feature = "NSRange")]
117        #[unsafe(method(countOfIndexesInRange:))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn countOfIndexesInRange(&self, range: NSRange) -> NSUInteger;
120
121        #[unsafe(method(containsIndex:))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn containsIndex(&self, value: NSUInteger) -> bool;
124
125        #[cfg(feature = "NSRange")]
126        #[unsafe(method(containsIndexesInRange:))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn containsIndexesInRange(&self, range: NSRange) -> bool;
129
130        #[unsafe(method(containsIndexes:))]
131        #[unsafe(method_family = none)]
132        pub unsafe fn containsIndexes(&self, index_set: &NSIndexSet) -> bool;
133
134        #[cfg(feature = "NSRange")]
135        #[unsafe(method(intersectsIndexesInRange:))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn intersectsIndexesInRange(&self, range: NSRange) -> bool;
138
139        #[cfg(feature = "block2")]
140        #[unsafe(method(enumerateIndexesUsingBlock:))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn enumerateIndexesUsingBlock(
143            &self,
144            block: &block2::Block<dyn Fn(NSUInteger, NonNull<Bool>) + '_>,
145        );
146
147        #[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
148        #[unsafe(method(enumerateIndexesWithOptions:usingBlock:))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn enumerateIndexesWithOptions_usingBlock(
151            &self,
152            opts: NSEnumerationOptions,
153            block: &block2::Block<dyn Fn(NSUInteger, NonNull<Bool>) + '_>,
154        );
155
156        #[cfg(all(feature = "NSObjCRuntime", feature = "NSRange", feature = "block2"))]
157        #[unsafe(method(enumerateIndexesInRange:options:usingBlock:))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn enumerateIndexesInRange_options_usingBlock(
160            &self,
161            range: NSRange,
162            opts: NSEnumerationOptions,
163            block: &block2::Block<dyn Fn(NSUInteger, NonNull<Bool>) + '_>,
164        );
165
166        #[cfg(feature = "block2")]
167        #[unsafe(method(indexPassingTest:))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn indexPassingTest(
170            &self,
171            predicate: &block2::Block<dyn Fn(NSUInteger, NonNull<Bool>) -> Bool + '_>,
172        ) -> NSUInteger;
173
174        #[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
175        #[unsafe(method(indexWithOptions:passingTest:))]
176        #[unsafe(method_family = none)]
177        pub unsafe fn indexWithOptions_passingTest(
178            &self,
179            opts: NSEnumerationOptions,
180            predicate: &block2::Block<dyn Fn(NSUInteger, NonNull<Bool>) -> Bool + '_>,
181        ) -> NSUInteger;
182
183        #[cfg(all(feature = "NSObjCRuntime", feature = "NSRange", feature = "block2"))]
184        #[unsafe(method(indexInRange:options:passingTest:))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn indexInRange_options_passingTest(
187            &self,
188            range: NSRange,
189            opts: NSEnumerationOptions,
190            predicate: &block2::Block<dyn Fn(NSUInteger, NonNull<Bool>) -> Bool + '_>,
191        ) -> NSUInteger;
192
193        #[cfg(feature = "block2")]
194        #[unsafe(method(indexesPassingTest:))]
195        #[unsafe(method_family = none)]
196        pub unsafe fn indexesPassingTest(
197            &self,
198            predicate: &block2::Block<dyn Fn(NSUInteger, NonNull<Bool>) -> Bool + '_>,
199        ) -> Retained<NSIndexSet>;
200
201        #[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
202        #[unsafe(method(indexesWithOptions:passingTest:))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn indexesWithOptions_passingTest(
205            &self,
206            opts: NSEnumerationOptions,
207            predicate: &block2::Block<dyn Fn(NSUInteger, NonNull<Bool>) -> Bool + '_>,
208        ) -> Retained<NSIndexSet>;
209
210        #[cfg(all(feature = "NSObjCRuntime", feature = "NSRange", feature = "block2"))]
211        #[unsafe(method(indexesInRange:options:passingTest:))]
212        #[unsafe(method_family = none)]
213        pub unsafe fn indexesInRange_options_passingTest(
214            &self,
215            range: NSRange,
216            opts: NSEnumerationOptions,
217            predicate: &block2::Block<dyn Fn(NSUInteger, NonNull<Bool>) -> Bool + '_>,
218        ) -> Retained<NSIndexSet>;
219
220        #[cfg(all(feature = "NSRange", feature = "block2"))]
221        #[unsafe(method(enumerateRangesUsingBlock:))]
222        #[unsafe(method_family = none)]
223        pub unsafe fn enumerateRangesUsingBlock(
224            &self,
225            block: &block2::Block<dyn Fn(NSRange, NonNull<Bool>) + '_>,
226        );
227
228        #[cfg(all(feature = "NSObjCRuntime", feature = "NSRange", feature = "block2"))]
229        #[unsafe(method(enumerateRangesWithOptions:usingBlock:))]
230        #[unsafe(method_family = none)]
231        pub unsafe fn enumerateRangesWithOptions_usingBlock(
232            &self,
233            opts: NSEnumerationOptions,
234            block: &block2::Block<dyn Fn(NSRange, NonNull<Bool>) + '_>,
235        );
236
237        #[cfg(all(feature = "NSObjCRuntime", feature = "NSRange", feature = "block2"))]
238        #[unsafe(method(enumerateRangesInRange:options:usingBlock:))]
239        #[unsafe(method_family = none)]
240        pub unsafe fn enumerateRangesInRange_options_usingBlock(
241            &self,
242            range: NSRange,
243            opts: NSEnumerationOptions,
244            block: &block2::Block<dyn Fn(NSRange, NonNull<Bool>) + '_>,
245        );
246    );
247}
248
249/// Methods declared on superclass `NSObject`.
250impl NSIndexSet {
251    extern_methods!(
252        #[unsafe(method(init))]
253        #[unsafe(method_family = init)]
254        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
255
256        #[unsafe(method(new))]
257        #[unsafe(method_family = new)]
258        pub unsafe fn new() -> Retained<Self>;
259    );
260}
261
262extern_class!(
263    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsmutableindexset?language=objc)
264    #[unsafe(super(NSIndexSet, NSObject))]
265    #[derive(Debug, PartialEq, Eq, Hash)]
266    pub struct NSMutableIndexSet;
267);
268
269#[cfg(feature = "NSObject")]
270unsafe impl NSCoding for NSMutableIndexSet {}
271
272#[cfg(feature = "NSObject")]
273unsafe impl NSCopying for NSMutableIndexSet {}
274
275#[cfg(feature = "NSObject")]
276unsafe impl CopyingHelper for NSMutableIndexSet {
277    type Result = NSIndexSet;
278}
279
280#[cfg(feature = "NSObject")]
281unsafe impl NSMutableCopying for NSMutableIndexSet {}
282
283#[cfg(feature = "NSObject")]
284unsafe impl MutableCopyingHelper for NSMutableIndexSet {
285    type Result = Self;
286}
287
288unsafe impl NSObjectProtocol for NSMutableIndexSet {}
289
290#[cfg(feature = "NSObject")]
291unsafe impl NSSecureCoding for NSMutableIndexSet {}
292
293impl NSMutableIndexSet {
294    extern_methods!(
295        #[unsafe(method(addIndexes:))]
296        #[unsafe(method_family = none)]
297        pub unsafe fn addIndexes(&self, index_set: &NSIndexSet);
298
299        #[unsafe(method(removeIndexes:))]
300        #[unsafe(method_family = none)]
301        pub unsafe fn removeIndexes(&self, index_set: &NSIndexSet);
302
303        #[unsafe(method(removeAllIndexes))]
304        #[unsafe(method_family = none)]
305        pub unsafe fn removeAllIndexes(&self);
306
307        #[unsafe(method(addIndex:))]
308        #[unsafe(method_family = none)]
309        pub unsafe fn addIndex(&self, value: NSUInteger);
310
311        #[unsafe(method(removeIndex:))]
312        #[unsafe(method_family = none)]
313        pub unsafe fn removeIndex(&self, value: NSUInteger);
314
315        #[cfg(feature = "NSRange")]
316        #[unsafe(method(addIndexesInRange:))]
317        #[unsafe(method_family = none)]
318        pub unsafe fn addIndexesInRange(&self, range: NSRange);
319
320        #[cfg(feature = "NSRange")]
321        #[unsafe(method(removeIndexesInRange:))]
322        #[unsafe(method_family = none)]
323        pub unsafe fn removeIndexesInRange(&self, range: NSRange);
324
325        #[unsafe(method(shiftIndexesStartingAtIndex:by:))]
326        #[unsafe(method_family = none)]
327        pub unsafe fn shiftIndexesStartingAtIndex_by(&self, index: NSUInteger, delta: NSInteger);
328    );
329}
330
331/// Methods declared on superclass `NSIndexSet`.
332impl NSMutableIndexSet {
333    extern_methods!(
334        #[unsafe(method(indexSet))]
335        #[unsafe(method_family = none)]
336        pub unsafe fn indexSet() -> Retained<Self>;
337
338        #[unsafe(method(indexSetWithIndex:))]
339        #[unsafe(method_family = none)]
340        pub unsafe fn indexSetWithIndex(value: NSUInteger) -> Retained<Self>;
341
342        #[cfg(feature = "NSRange")]
343        #[unsafe(method(indexSetWithIndexesInRange:))]
344        #[unsafe(method_family = none)]
345        pub unsafe fn indexSetWithIndexesInRange(range: NSRange) -> Retained<Self>;
346
347        #[cfg(feature = "NSRange")]
348        #[unsafe(method(initWithIndexesInRange:))]
349        #[unsafe(method_family = init)]
350        pub unsafe fn initWithIndexesInRange(
351            this: Allocated<Self>,
352            range: NSRange,
353        ) -> Retained<Self>;
354
355        #[unsafe(method(initWithIndexSet:))]
356        #[unsafe(method_family = init)]
357        pub unsafe fn initWithIndexSet(
358            this: Allocated<Self>,
359            index_set: &NSIndexSet,
360        ) -> Retained<Self>;
361
362        #[unsafe(method(initWithIndex:))]
363        #[unsafe(method_family = init)]
364        pub unsafe fn initWithIndex(this: Allocated<Self>, value: NSUInteger) -> Retained<Self>;
365    );
366}
367
368/// Methods declared on superclass `NSObject`.
369impl NSMutableIndexSet {
370    extern_methods!(
371        #[unsafe(method(init))]
372        #[unsafe(method_family = init)]
373        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
374
375        #[unsafe(method(new))]
376        #[unsafe(method_family = new)]
377        pub unsafe fn new() -> Retained<Self>;
378    );
379}