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"))]
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 unsafe 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 #[unsafe(method(predicateWithLeftExpression:rightExpression:customSelector:))]
147 #[unsafe(method_family = none)]
148 pub unsafe fn predicateWithLeftExpression_rightExpression_customSelector(
149 lhs: &NSExpression,
150 rhs: &NSExpression,
151 selector: Sel,
152 ) -> Retained<NSComparisonPredicate>;
153
154 #[cfg(feature = "NSExpression")]
155 #[unsafe(method(initWithLeftExpression:rightExpression:modifier:type:options:))]
156 #[unsafe(method_family = init)]
157 pub unsafe fn initWithLeftExpression_rightExpression_modifier_type_options(
158 this: Allocated<Self>,
159 lhs: &NSExpression,
160 rhs: &NSExpression,
161 modifier: NSComparisonPredicateModifier,
162 r#type: NSPredicateOperatorType,
163 options: NSComparisonPredicateOptions,
164 ) -> Retained<Self>;
165
166 #[cfg(feature = "NSExpression")]
167 #[unsafe(method(initWithLeftExpression:rightExpression:customSelector:))]
168 #[unsafe(method_family = init)]
169 pub unsafe fn initWithLeftExpression_rightExpression_customSelector(
170 this: Allocated<Self>,
171 lhs: &NSExpression,
172 rhs: &NSExpression,
173 selector: Sel,
174 ) -> Retained<Self>;
175
176 #[cfg(feature = "NSCoder")]
177 #[unsafe(method(initWithCoder:))]
178 #[unsafe(method_family = init)]
179 pub unsafe fn initWithCoder(
180 this: Allocated<Self>,
181 coder: &NSCoder,
182 ) -> Option<Retained<Self>>;
183
184 #[unsafe(method(predicateOperatorType))]
185 #[unsafe(method_family = none)]
186 pub unsafe fn predicateOperatorType(&self) -> NSPredicateOperatorType;
187
188 #[unsafe(method(comparisonPredicateModifier))]
189 #[unsafe(method_family = none)]
190 pub unsafe fn comparisonPredicateModifier(&self) -> NSComparisonPredicateModifier;
191
192 #[cfg(feature = "NSExpression")]
193 #[unsafe(method(leftExpression))]
194 #[unsafe(method_family = none)]
195 pub unsafe fn leftExpression(&self) -> Retained<NSExpression>;
196
197 #[cfg(feature = "NSExpression")]
198 #[unsafe(method(rightExpression))]
199 #[unsafe(method_family = none)]
200 pub unsafe fn rightExpression(&self) -> Retained<NSExpression>;
201
202 #[unsafe(method(customSelector))]
203 #[unsafe(method_family = none)]
204 pub unsafe fn customSelector(&self) -> Option<Sel>;
205
206 #[unsafe(method(options))]
207 #[unsafe(method_family = none)]
208 pub unsafe fn options(&self) -> NSComparisonPredicateOptions;
209 );
210}
211
212#[cfg(feature = "NSPredicate")]
214impl NSComparisonPredicate {
215 extern_methods!(
216 #[unsafe(method(init))]
217 #[unsafe(method_family = init)]
218 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
219
220 #[unsafe(method(new))]
221 #[unsafe(method_family = new)]
222 pub unsafe fn new() -> Retained<Self>;
223 );
224}