objc2_foundation/generated/
NSIndexPath.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/nsindexpath?language=objc)
11    #[unsafe(super(NSObject))]
12    #[derive(Debug, PartialEq, Eq, Hash)]
13    pub struct NSIndexPath;
14);
15
16#[cfg(feature = "NSObject")]
17unsafe impl NSCoding for NSIndexPath {}
18
19#[cfg(feature = "NSObject")]
20unsafe impl NSCopying for NSIndexPath {}
21
22#[cfg(feature = "NSObject")]
23unsafe impl CopyingHelper for NSIndexPath {
24    type Result = Self;
25}
26
27unsafe impl NSObjectProtocol for NSIndexPath {}
28
29#[cfg(feature = "NSObject")]
30unsafe impl NSSecureCoding for NSIndexPath {}
31
32impl NSIndexPath {
33    extern_methods!(
34        #[unsafe(method(indexPathWithIndex:))]
35        #[unsafe(method_family = none)]
36        pub unsafe fn indexPathWithIndex(index: NSUInteger) -> Retained<Self>;
37
38        #[unsafe(method(indexPathWithIndexes:length:))]
39        #[unsafe(method_family = none)]
40        pub unsafe fn indexPathWithIndexes_length(
41            indexes: *mut NSUInteger,
42            length: NSUInteger,
43        ) -> Retained<Self>;
44
45        #[unsafe(method(initWithIndexes:length:))]
46        #[unsafe(method_family = init)]
47        pub unsafe fn initWithIndexes_length(
48            this: Allocated<Self>,
49            indexes: *mut NSUInteger,
50            length: NSUInteger,
51        ) -> Retained<Self>;
52
53        #[unsafe(method(initWithIndex:))]
54        #[unsafe(method_family = init)]
55        pub unsafe fn initWithIndex(this: Allocated<Self>, index: NSUInteger) -> Retained<Self>;
56
57        #[unsafe(method(indexPathByAddingIndex:))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn indexPathByAddingIndex(&self, index: NSUInteger) -> Retained<NSIndexPath>;
60
61        #[unsafe(method(indexPathByRemovingLastIndex))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn indexPathByRemovingLastIndex(&self) -> Retained<NSIndexPath>;
64
65        #[unsafe(method(indexAtPosition:))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn indexAtPosition(&self, position: NSUInteger) -> NSUInteger;
68
69        #[unsafe(method(length))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn length(&self) -> NSUInteger;
72
73        #[cfg(feature = "NSRange")]
74        /// Copies the indexes stored in this index path from the positions specified by positionRange into indexes.
75        ///
76        /// Parameter `indexes`: Buffer of at least as many NSUIntegers as specified by the length of positionRange. On return, this memory will hold the index path's indexes.
77        ///
78        /// Parameter `positionRange`: A range of valid positions within this index path.  If the location plus the length of positionRange is greater than the length of this index path, this method raises an NSRangeException.
79        ///
80        /// It is the developer’s responsibility to allocate the memory for the C array.
81        #[unsafe(method(getIndexes:range:))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn getIndexes_range(
84            &self,
85            indexes: NonNull<NSUInteger>,
86            position_range: NSRange,
87        );
88
89        #[cfg(feature = "NSObjCRuntime")]
90        #[unsafe(method(compare:))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn compare(&self, other_object: &NSIndexPath) -> NSComparisonResult;
93    );
94}
95
96/// Methods declared on superclass `NSObject`.
97impl NSIndexPath {
98    extern_methods!(
99        #[unsafe(method(init))]
100        #[unsafe(method_family = init)]
101        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
102
103        #[unsafe(method(new))]
104        #[unsafe(method_family = new)]
105        pub unsafe fn new() -> Retained<Self>;
106    );
107}
108
109/// NSDeprecated.
110impl NSIndexPath {
111    extern_methods!(
112        /// This method is unsafe because it could potentially cause buffer overruns. You should use -getIndexes:range: instead.
113        #[deprecated]
114        #[unsafe(method(getIndexes:))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn getIndexes(&self, indexes: NonNull<NSUInteger>);
117    );
118}