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