objc2_foundation/generated/
NSComparisonPredicate.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5
6use crate::*;
7
8/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nscomparisonpredicateoptions?language=objc)
9// NS_OPTIONS
10#[repr(transparent)]
11#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
12pub struct NSComparisonPredicateOptions(pub NSUInteger);
13bitflags::bitflags! {
14    impl NSComparisonPredicateOptions: NSUInteger {
15        #[doc(alias = "NSCaseInsensitivePredicateOption")]
16        const CaseInsensitivePredicateOption = 0x01;
17        #[doc(alias = "NSDiacriticInsensitivePredicateOption")]
18        const DiacriticInsensitivePredicateOption = 0x02;
19        #[doc(alias = "NSNormalizedPredicateOption")]
20        const NormalizedPredicateOption = 0x04;
21    }
22}
23
24unsafe impl Encode for NSComparisonPredicateOptions {
25    const ENCODING: Encoding = NSUInteger::ENCODING;
26}
27
28unsafe impl RefEncode for NSComparisonPredicateOptions {
29    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nscomparisonpredicatemodifier?language=objc)
33// NS_ENUM
34#[repr(transparent)]
35#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
36pub struct NSComparisonPredicateModifier(pub NSUInteger);
37impl NSComparisonPredicateModifier {
38    #[doc(alias = "NSDirectPredicateModifier")]
39    pub const DirectPredicateModifier: Self = Self(0);
40    #[doc(alias = "NSAllPredicateModifier")]
41    pub const AllPredicateModifier: Self = Self(1);
42    #[doc(alias = "NSAnyPredicateModifier")]
43    pub const AnyPredicateModifier: Self = Self(2);
44}
45
46unsafe impl Encode for NSComparisonPredicateModifier {
47    const ENCODING: Encoding = NSUInteger::ENCODING;
48}
49
50unsafe impl RefEncode for NSComparisonPredicateModifier {
51    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
52}
53
54/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nspredicateoperatortype?language=objc)
55// NS_ENUM
56#[repr(transparent)]
57#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
58pub struct NSPredicateOperatorType(pub NSUInteger);
59impl NSPredicateOperatorType {
60    #[doc(alias = "NSLessThanPredicateOperatorType")]
61    pub const LessThanPredicateOperatorType: Self = Self(0);
62    #[doc(alias = "NSLessThanOrEqualToPredicateOperatorType")]
63    pub const LessThanOrEqualToPredicateOperatorType: Self = Self(1);
64    #[doc(alias = "NSGreaterThanPredicateOperatorType")]
65    pub const GreaterThanPredicateOperatorType: Self = Self(2);
66    #[doc(alias = "NSGreaterThanOrEqualToPredicateOperatorType")]
67    pub const GreaterThanOrEqualToPredicateOperatorType: Self = Self(3);
68    #[doc(alias = "NSEqualToPredicateOperatorType")]
69    pub const EqualToPredicateOperatorType: Self = Self(4);
70    #[doc(alias = "NSNotEqualToPredicateOperatorType")]
71    pub const NotEqualToPredicateOperatorType: Self = Self(5);
72    #[doc(alias = "NSMatchesPredicateOperatorType")]
73    pub const MatchesPredicateOperatorType: Self = Self(6);
74    #[doc(alias = "NSLikePredicateOperatorType")]
75    pub const LikePredicateOperatorType: Self = Self(7);
76    #[doc(alias = "NSBeginsWithPredicateOperatorType")]
77    pub const BeginsWithPredicateOperatorType: Self = Self(8);
78    #[doc(alias = "NSEndsWithPredicateOperatorType")]
79    pub const EndsWithPredicateOperatorType: Self = Self(9);
80    #[doc(alias = "NSInPredicateOperatorType")]
81    pub const InPredicateOperatorType: Self = Self(10);
82    #[doc(alias = "NSCustomSelectorPredicateOperatorType")]
83    pub const CustomSelectorPredicateOperatorType: Self = Self(11);
84    #[doc(alias = "NSContainsPredicateOperatorType")]
85    pub const ContainsPredicateOperatorType: Self = Self(99);
86    #[doc(alias = "NSBetweenPredicateOperatorType")]
87    pub const BetweenPredicateOperatorType: Self = Self(100);
88}
89
90unsafe impl Encode for NSPredicateOperatorType {
91    const ENCODING: Encoding = NSUInteger::ENCODING;
92}
93
94unsafe impl RefEncode for NSPredicateOperatorType {
95    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
96}
97
98extern_class!(
99    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nscomparisonpredicate?language=objc)
100    #[unsafe(super(NSPredicate, NSObject))]
101    #[derive(Debug, PartialEq, Eq, Hash)]
102    #[cfg(feature = "NSPredicate")]
103    pub struct NSComparisonPredicate;
104);
105
106#[cfg(all(feature = "NSObject", feature = "NSPredicate"))]
107extern_conformance!(
108    unsafe impl NSCoding for NSComparisonPredicate {}
109);
110
111#[cfg(all(feature = "NSObject", feature = "NSPredicate"))]
112extern_conformance!(
113    unsafe impl NSCopying for NSComparisonPredicate {}
114);
115
116#[cfg(all(feature = "NSObject", feature = "NSPredicate"))]
117unsafe impl CopyingHelper for NSComparisonPredicate {
118    type Result = Self;
119}
120
121#[cfg(feature = "NSPredicate")]
122extern_conformance!(
123    unsafe impl NSObjectProtocol for NSComparisonPredicate {}
124);
125
126#[cfg(all(feature = "NSObject", feature = "NSPredicate"))]
127extern_conformance!(
128    unsafe impl NSSecureCoding for NSComparisonPredicate {}
129);
130
131#[cfg(feature = "NSPredicate")]
132impl NSComparisonPredicate {
133    extern_methods!(
134        #[cfg(feature = "NSExpression")]
135        #[unsafe(method(predicateWithLeftExpression:rightExpression:modifier:type:options:))]
136        #[unsafe(method_family = none)]
137        pub fn predicateWithLeftExpression_rightExpression_modifier_type_options(
138            lhs: &NSExpression,
139            rhs: &NSExpression,
140            modifier: NSComparisonPredicateModifier,
141            r#type: NSPredicateOperatorType,
142            options: NSComparisonPredicateOptions,
143        ) -> Retained<NSComparisonPredicate>;
144
145        #[cfg(feature = "NSExpression")]
146        /// # Safety
147        ///
148        /// `selector` must be a valid selector.
149        #[unsafe(method(predicateWithLeftExpression:rightExpression:customSelector:))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn predicateWithLeftExpression_rightExpression_customSelector(
152            lhs: &NSExpression,
153            rhs: &NSExpression,
154            selector: Sel,
155        ) -> Retained<NSComparisonPredicate>;
156
157        #[cfg(feature = "NSExpression")]
158        #[unsafe(method(initWithLeftExpression:rightExpression:modifier:type:options:))]
159        #[unsafe(method_family = init)]
160        pub fn initWithLeftExpression_rightExpression_modifier_type_options(
161            this: Allocated<Self>,
162            lhs: &NSExpression,
163            rhs: &NSExpression,
164            modifier: NSComparisonPredicateModifier,
165            r#type: NSPredicateOperatorType,
166            options: NSComparisonPredicateOptions,
167        ) -> Retained<Self>;
168
169        #[cfg(feature = "NSExpression")]
170        /// # Safety
171        ///
172        /// `selector` must be a valid selector.
173        #[unsafe(method(initWithLeftExpression:rightExpression:customSelector:))]
174        #[unsafe(method_family = init)]
175        pub unsafe fn initWithLeftExpression_rightExpression_customSelector(
176            this: Allocated<Self>,
177            lhs: &NSExpression,
178            rhs: &NSExpression,
179            selector: Sel,
180        ) -> Retained<Self>;
181
182        #[cfg(feature = "NSCoder")]
183        /// # Safety
184        ///
185        /// `coder` possibly has further requirements.
186        #[unsafe(method(initWithCoder:))]
187        #[unsafe(method_family = init)]
188        pub unsafe fn initWithCoder(
189            this: Allocated<Self>,
190            coder: &NSCoder,
191        ) -> Option<Retained<Self>>;
192
193        #[unsafe(method(predicateOperatorType))]
194        #[unsafe(method_family = none)]
195        pub fn predicateOperatorType(&self) -> NSPredicateOperatorType;
196
197        #[unsafe(method(comparisonPredicateModifier))]
198        #[unsafe(method_family = none)]
199        pub fn comparisonPredicateModifier(&self) -> NSComparisonPredicateModifier;
200
201        #[cfg(feature = "NSExpression")]
202        #[unsafe(method(leftExpression))]
203        #[unsafe(method_family = none)]
204        pub fn leftExpression(&self) -> Retained<NSExpression>;
205
206        #[cfg(feature = "NSExpression")]
207        #[unsafe(method(rightExpression))]
208        #[unsafe(method_family = none)]
209        pub fn rightExpression(&self) -> Retained<NSExpression>;
210
211        #[unsafe(method(customSelector))]
212        #[unsafe(method_family = none)]
213        pub fn customSelector(&self) -> Option<Sel>;
214
215        #[unsafe(method(options))]
216        #[unsafe(method_family = none)]
217        pub fn options(&self) -> NSComparisonPredicateOptions;
218    );
219}
220
221/// Methods declared on superclass `NSObject`.
222#[cfg(feature = "NSPredicate")]
223impl NSComparisonPredicate {
224    extern_methods!(
225        #[unsafe(method(init))]
226        #[unsafe(method_family = init)]
227        pub fn init(this: Allocated<Self>) -> Retained<Self>;
228
229        #[unsafe(method(new))]
230        #[unsafe(method_family = new)]
231        pub fn new() -> Retained<Self>;
232    );
233}
234
235#[cfg(feature = "NSPredicate")]
236impl DefaultRetained for NSComparisonPredicate {
237    #[inline]
238    fn default_retained() -> Retained<Self> {
239        Self::new()
240    }
241}