objc2_foundation/generated/
NSPredicate.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9extern_class!(
10 #[unsafe(super(NSObject))]
12 #[derive(Debug, PartialEq, Eq, Hash)]
13 pub struct NSPredicate;
14);
15
16#[cfg(feature = "NSObject")]
17extern_conformance!(
18 unsafe impl NSCoding for NSPredicate {}
19);
20
21#[cfg(feature = "NSObject")]
22extern_conformance!(
23 unsafe impl NSCopying for NSPredicate {}
24);
25
26#[cfg(feature = "NSObject")]
27unsafe impl CopyingHelper for NSPredicate {
28 type Result = Self;
29}
30
31extern_conformance!(
32 unsafe impl NSObjectProtocol for NSPredicate {}
33);
34
35#[cfg(feature = "NSObject")]
36extern_conformance!(
37 unsafe impl NSSecureCoding for NSPredicate {}
38);
39
40impl NSPredicate {
41 extern_methods!(
42 #[cfg(all(feature = "NSArray", feature = "NSString"))]
43 #[unsafe(method(predicateWithFormat:argumentArray:))]
47 #[unsafe(method_family = none)]
48 pub unsafe fn predicateWithFormat_argumentArray(
49 predicate_format: &NSString,
50 arguments: Option<&NSArray>,
51 ) -> Retained<NSPredicate>;
52
53 #[cfg(feature = "NSString")]
54 #[unsafe(method(predicateFromMetadataQueryString:))]
55 #[unsafe(method_family = none)]
56 pub fn predicateFromMetadataQueryString(
57 query_string: &NSString,
58 ) -> Option<Retained<NSPredicate>>;
59
60 #[unsafe(method(predicateWithValue:))]
61 #[unsafe(method_family = none)]
62 pub fn predicateWithValue(value: bool) -> Retained<NSPredicate>;
63
64 #[cfg(all(feature = "NSDictionary", feature = "NSString", feature = "block2"))]
65 #[unsafe(method(predicateWithBlock:))]
66 #[unsafe(method_family = none)]
67 pub fn predicateWithBlock(
68 block: &block2::DynBlock<
69 dyn Fn(*mut AnyObject, *mut NSDictionary<NSString, AnyObject>) -> Bool,
70 >,
71 ) -> Retained<NSPredicate>;
72
73 #[cfg(feature = "NSString")]
74 #[unsafe(method(predicateFormat))]
75 #[unsafe(method_family = none)]
76 pub fn predicateFormat(&self) -> Retained<NSString>;
77
78 #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
79 #[unsafe(method(predicateWithSubstitutionVariables:))]
83 #[unsafe(method_family = none)]
84 pub unsafe fn predicateWithSubstitutionVariables(
85 &self,
86 variables: &NSDictionary<NSString, AnyObject>,
87 ) -> Retained<Self>;
88
89 #[unsafe(method(evaluateWithObject:))]
93 #[unsafe(method_family = none)]
94 pub unsafe fn evaluateWithObject(&self, object: Option<&AnyObject>) -> bool;
95
96 #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
97 #[unsafe(method(evaluateWithObject:substitutionVariables:))]
102 #[unsafe(method_family = none)]
103 pub unsafe fn evaluateWithObject_substitutionVariables(
104 &self,
105 object: Option<&AnyObject>,
106 bindings: Option<&NSDictionary<NSString, AnyObject>>,
107 ) -> bool;
108
109 #[unsafe(method(allowEvaluation))]
110 #[unsafe(method_family = none)]
111 pub fn allowEvaluation(&self);
112 );
113}
114
115impl NSPredicate {
117 extern_methods!(
118 #[unsafe(method(init))]
119 #[unsafe(method_family = init)]
120 pub fn init(this: Allocated<Self>) -> Retained<Self>;
121
122 #[unsafe(method(new))]
123 #[unsafe(method_family = new)]
124 pub fn new() -> Retained<Self>;
125 );
126}
127
128impl DefaultRetained for NSPredicate {
129 #[inline]
130 fn default_retained() -> Retained<Self> {
131 Self::new()
132 }
133}
134
135#[cfg(feature = "NSArray")]
137impl<ObjectType: Message> NSArray<ObjectType> {
138 extern_methods!(
139 #[unsafe(method(filteredArrayUsingPredicate:))]
140 #[unsafe(method_family = none)]
141 pub fn filteredArrayUsingPredicate(
142 &self,
143 predicate: &NSPredicate,
144 ) -> Retained<NSArray<ObjectType>>;
145 );
146}
147
148#[cfg(feature = "NSArray")]
150impl<ObjectType: Message> NSMutableArray<ObjectType> {
151 extern_methods!(
152 #[unsafe(method(filterUsingPredicate:))]
153 #[unsafe(method_family = none)]
154 pub fn filterUsingPredicate(&self, predicate: &NSPredicate);
155 );
156}
157
158#[cfg(feature = "NSSet")]
160impl<ObjectType: Message> NSSet<ObjectType> {
161 extern_methods!(
162 #[unsafe(method(filteredSetUsingPredicate:))]
163 #[unsafe(method_family = none)]
164 pub fn filteredSetUsingPredicate(
165 &self,
166 predicate: &NSPredicate,
167 ) -> Retained<NSSet<ObjectType>>;
168 );
169}
170
171#[cfg(feature = "NSSet")]
173impl<ObjectType: Message> NSMutableSet<ObjectType> {
174 extern_methods!(
175 #[unsafe(method(filterUsingPredicate:))]
176 #[unsafe(method_family = none)]
177 pub fn filterUsingPredicate(&self, predicate: &NSPredicate);
178 );
179}
180
181#[cfg(feature = "NSOrderedSet")]
183impl<ObjectType: Message> NSOrderedSet<ObjectType> {
184 extern_methods!(
185 #[unsafe(method(filteredOrderedSetUsingPredicate:))]
186 #[unsafe(method_family = none)]
187 pub fn filteredOrderedSetUsingPredicate(
188 &self,
189 p: &NSPredicate,
190 ) -> Retained<NSOrderedSet<ObjectType>>;
191 );
192}
193
194#[cfg(feature = "NSOrderedSet")]
196impl<ObjectType: Message> NSMutableOrderedSet<ObjectType> {
197 extern_methods!(
198 #[unsafe(method(filterUsingPredicate:))]
199 #[unsafe(method_family = none)]
200 pub fn filterUsingPredicate(&self, p: &NSPredicate);
201 );
202}