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