objc2_foundation/generated/
NSSortDescriptor.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/nssortdescriptor?language=objc)
11    #[unsafe(super(NSObject))]
12    #[derive(Debug, PartialEq, Eq, Hash)]
13    pub struct NSSortDescriptor;
14);
15
16#[cfg(feature = "NSObject")]
17extern_conformance!(
18    unsafe impl NSCoding for NSSortDescriptor {}
19);
20
21#[cfg(feature = "NSObject")]
22extern_conformance!(
23    unsafe impl NSCopying for NSSortDescriptor {}
24);
25
26#[cfg(feature = "NSObject")]
27unsafe impl CopyingHelper for NSSortDescriptor {
28    type Result = Self;
29}
30
31extern_conformance!(
32    unsafe impl NSObjectProtocol for NSSortDescriptor {}
33);
34
35#[cfg(feature = "NSObject")]
36extern_conformance!(
37    unsafe impl NSSecureCoding for NSSortDescriptor {}
38);
39
40impl NSSortDescriptor {
41    extern_methods!(
42        #[cfg(feature = "NSString")]
43        #[unsafe(method(sortDescriptorWithKey:ascending:))]
44        #[unsafe(method_family = none)]
45        pub unsafe fn sortDescriptorWithKey_ascending(
46            key: Option<&NSString>,
47            ascending: bool,
48        ) -> Retained<Self>;
49
50        #[cfg(feature = "NSString")]
51        #[unsafe(method(sortDescriptorWithKey:ascending:selector:))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn sortDescriptorWithKey_ascending_selector(
54            key: Option<&NSString>,
55            ascending: bool,
56            selector: Option<Sel>,
57        ) -> Retained<Self>;
58
59        #[cfg(feature = "NSString")]
60        #[unsafe(method(initWithKey:ascending:))]
61        #[unsafe(method_family = init)]
62        pub unsafe fn initWithKey_ascending(
63            this: Allocated<Self>,
64            key: Option<&NSString>,
65            ascending: bool,
66        ) -> Retained<Self>;
67
68        #[cfg(feature = "NSString")]
69        #[unsafe(method(initWithKey:ascending:selector:))]
70        #[unsafe(method_family = init)]
71        pub unsafe fn initWithKey_ascending_selector(
72            this: Allocated<Self>,
73            key: Option<&NSString>,
74            ascending: bool,
75            selector: Option<Sel>,
76        ) -> Retained<Self>;
77
78        #[cfg(feature = "NSCoder")]
79        #[unsafe(method(initWithCoder:))]
80        #[unsafe(method_family = init)]
81        pub unsafe fn initWithCoder(
82            this: Allocated<Self>,
83            coder: &NSCoder,
84        ) -> Option<Retained<Self>>;
85
86        #[cfg(feature = "NSString")]
87        #[unsafe(method(key))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn key(&self) -> Option<Retained<NSString>>;
90
91        #[unsafe(method(ascending))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn ascending(&self) -> bool;
94
95        #[unsafe(method(selector))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn selector(&self) -> Option<Sel>;
98
99        #[unsafe(method(allowEvaluation))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn allowEvaluation(&self);
102
103        #[cfg(all(feature = "NSObjCRuntime", feature = "NSString", feature = "block2"))]
104        #[unsafe(method(sortDescriptorWithKey:ascending:comparator:))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn sortDescriptorWithKey_ascending_comparator(
107            key: Option<&NSString>,
108            ascending: bool,
109            cmptr: NSComparator,
110        ) -> Retained<Self>;
111
112        #[cfg(all(feature = "NSObjCRuntime", feature = "NSString", feature = "block2"))]
113        #[unsafe(method(initWithKey:ascending:comparator:))]
114        #[unsafe(method_family = init)]
115        pub unsafe fn initWithKey_ascending_comparator(
116            this: Allocated<Self>,
117            key: Option<&NSString>,
118            ascending: bool,
119            cmptr: NSComparator,
120        ) -> Retained<Self>;
121
122        #[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
123        #[unsafe(method(comparator))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn comparator(&self) -> NSComparator;
126
127        #[cfg(feature = "NSObjCRuntime")]
128        #[unsafe(method(compareObject:toObject:))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn compareObject_toObject(
131            &self,
132            object1: &AnyObject,
133            object2: &AnyObject,
134        ) -> NSComparisonResult;
135
136        #[unsafe(method(reversedSortDescriptor))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn reversedSortDescriptor(&self) -> Retained<AnyObject>;
139    );
140}
141
142/// Methods declared on superclass `NSObject`.
143impl NSSortDescriptor {
144    extern_methods!(
145        #[unsafe(method(init))]
146        #[unsafe(method_family = init)]
147        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
148
149        #[unsafe(method(new))]
150        #[unsafe(method_family = new)]
151        pub unsafe fn new() -> Retained<Self>;
152    );
153}
154
155/// NSSortDescriptorSorting.
156#[cfg(feature = "NSSet")]
157impl<ObjectType: Message> NSSet<ObjectType> {
158    extern_methods!(
159        #[cfg(feature = "NSArray")]
160        #[unsafe(method(sortedArrayUsingDescriptors:))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn sortedArrayUsingDescriptors(
163            &self,
164            sort_descriptors: &NSArray<NSSortDescriptor>,
165        ) -> Retained<NSArray<ObjectType>>;
166    );
167}
168
169/// NSSortDescriptorSorting.
170#[cfg(feature = "NSArray")]
171impl<ObjectType: Message> NSArray<ObjectType> {
172    extern_methods!(
173        #[unsafe(method(sortedArrayUsingDescriptors:))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn sortedArrayUsingDescriptors(
176            &self,
177            sort_descriptors: &NSArray<NSSortDescriptor>,
178        ) -> Retained<NSArray<ObjectType>>;
179    );
180}
181
182/// NSSortDescriptorSorting.
183#[cfg(feature = "NSArray")]
184impl<ObjectType: Message> NSMutableArray<ObjectType> {
185    extern_methods!(
186        #[unsafe(method(sortUsingDescriptors:))]
187        #[unsafe(method_family = none)]
188        pub unsafe fn sortUsingDescriptors(&self, sort_descriptors: &NSArray<NSSortDescriptor>);
189    );
190}
191
192/// NSKeyValueSorting.
193#[cfg(feature = "NSOrderedSet")]
194impl<ObjectType: Message> NSOrderedSet<ObjectType> {
195    extern_methods!(
196        #[cfg(feature = "NSArray")]
197        #[unsafe(method(sortedArrayUsingDescriptors:))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn sortedArrayUsingDescriptors(
200            &self,
201            sort_descriptors: &NSArray<NSSortDescriptor>,
202        ) -> Retained<NSArray<ObjectType>>;
203    );
204}
205
206/// NSKeyValueSorting.
207#[cfg(feature = "NSOrderedSet")]
208impl<ObjectType: Message> NSMutableOrderedSet<ObjectType> {
209    extern_methods!(
210        #[cfg(feature = "NSArray")]
211        #[unsafe(method(sortUsingDescriptors:))]
212        #[unsafe(method_family = none)]
213        pub unsafe fn sortUsingDescriptors(&self, sort_descriptors: &NSArray<NSSortDescriptor>);
214    );
215}