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