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