objc2_foundation/generated/
NSComparisonPredicate.rs1use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5
6use crate::*;
7
8#[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#[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#[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 #[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"))]
107unsafe impl NSCoding for NSComparisonPredicate {}
108
109#[cfg(all(feature = "NSObject", feature = "NSPredicate"))]
110unsafe impl NSCopying for NSComparisonPredicate {}
111
112#[cfg(all(feature = "NSObject", feature = "NSPredicate"))]
113unsafe impl CopyingHelper for NSComparisonPredicate {
114 type Result = Self;
115}
116
117#[cfg(feature = "NSPredicate")]
118unsafe impl NSObjectProtocol for NSComparisonPredicate {}
119
120#[cfg(all(feature = "NSObject", feature = "NSPredicate"))]
121unsafe impl NSSecureCoding for NSComparisonPredicate {}
122
123#[cfg(feature = "NSPredicate")]
124impl NSComparisonPredicate {
125 extern_methods!(
126 #[cfg(feature = "NSExpression")]
127 #[unsafe(method(predicateWithLeftExpression:rightExpression:modifier:type:options:))]
128 #[unsafe(method_family = none)]
129 pub unsafe fn predicateWithLeftExpression_rightExpression_modifier_type_options(
130 lhs: &NSExpression,
131 rhs: &NSExpression,
132 modifier: NSComparisonPredicateModifier,
133 r#type: NSPredicateOperatorType,
134 options: NSComparisonPredicateOptions,
135 ) -> Retained<NSComparisonPredicate>;
136
137 #[cfg(feature = "NSExpression")]
138 #[unsafe(method(predicateWithLeftExpression:rightExpression:customSelector:))]
139 #[unsafe(method_family = none)]
140 pub unsafe fn predicateWithLeftExpression_rightExpression_customSelector(
141 lhs: &NSExpression,
142 rhs: &NSExpression,
143 selector: Sel,
144 ) -> Retained<NSComparisonPredicate>;
145
146 #[cfg(feature = "NSExpression")]
147 #[unsafe(method(initWithLeftExpression:rightExpression:modifier:type:options:))]
148 #[unsafe(method_family = init)]
149 pub unsafe fn initWithLeftExpression_rightExpression_modifier_type_options(
150 this: Allocated<Self>,
151 lhs: &NSExpression,
152 rhs: &NSExpression,
153 modifier: NSComparisonPredicateModifier,
154 r#type: NSPredicateOperatorType,
155 options: NSComparisonPredicateOptions,
156 ) -> Retained<Self>;
157
158 #[cfg(feature = "NSExpression")]
159 #[unsafe(method(initWithLeftExpression:rightExpression:customSelector:))]
160 #[unsafe(method_family = init)]
161 pub unsafe fn initWithLeftExpression_rightExpression_customSelector(
162 this: Allocated<Self>,
163 lhs: &NSExpression,
164 rhs: &NSExpression,
165 selector: Sel,
166 ) -> Retained<Self>;
167
168 #[cfg(feature = "NSCoder")]
169 #[unsafe(method(initWithCoder:))]
170 #[unsafe(method_family = init)]
171 pub unsafe fn initWithCoder(
172 this: Allocated<Self>,
173 coder: &NSCoder,
174 ) -> Option<Retained<Self>>;
175
176 #[unsafe(method(predicateOperatorType))]
177 #[unsafe(method_family = none)]
178 pub unsafe fn predicateOperatorType(&self) -> NSPredicateOperatorType;
179
180 #[unsafe(method(comparisonPredicateModifier))]
181 #[unsafe(method_family = none)]
182 pub unsafe fn comparisonPredicateModifier(&self) -> NSComparisonPredicateModifier;
183
184 #[cfg(feature = "NSExpression")]
185 #[unsafe(method(leftExpression))]
186 #[unsafe(method_family = none)]
187 pub unsafe fn leftExpression(&self) -> Retained<NSExpression>;
188
189 #[cfg(feature = "NSExpression")]
190 #[unsafe(method(rightExpression))]
191 #[unsafe(method_family = none)]
192 pub unsafe fn rightExpression(&self) -> Retained<NSExpression>;
193
194 #[unsafe(method(customSelector))]
195 #[unsafe(method_family = none)]
196 pub unsafe fn customSelector(&self) -> Option<Sel>;
197
198 #[unsafe(method(options))]
199 #[unsafe(method_family = none)]
200 pub unsafe fn options(&self) -> NSComparisonPredicateOptions;
201 );
202}
203
204#[cfg(feature = "NSPredicate")]
206impl NSComparisonPredicate {
207 extern_methods!(
208 #[unsafe(method(init))]
209 #[unsafe(method_family = init)]
210 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
211
212 #[unsafe(method(new))]
213 #[unsafe(method_family = new)]
214 pub unsafe fn new() -> Retained<Self>;
215 );
216}