objc2_foundation/generated/
NSPredicate.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/nspredicate?language=objc)
11    #[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:))]
44        #[unsafe(method_family = none)]
45        pub unsafe fn predicateWithFormat_argumentArray(
46            predicate_format: &NSString,
47            arguments: Option<&NSArray>,
48        ) -> Retained<NSPredicate>;
49
50        #[cfg(feature = "NSString")]
51        #[unsafe(method(predicateFromMetadataQueryString:))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn predicateFromMetadataQueryString(
54            query_string: &NSString,
55        ) -> Option<Retained<NSPredicate>>;
56
57        #[unsafe(method(predicateWithValue:))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn predicateWithValue(value: bool) -> Retained<NSPredicate>;
60
61        #[cfg(all(feature = "NSDictionary", feature = "NSString", feature = "block2"))]
62        #[unsafe(method(predicateWithBlock:))]
63        #[unsafe(method_family = none)]
64        pub unsafe fn predicateWithBlock(
65            block: &block2::DynBlock<
66                dyn Fn(*mut AnyObject, *mut NSDictionary<NSString, AnyObject>) -> Bool,
67            >,
68        ) -> Retained<NSPredicate>;
69
70        #[cfg(feature = "NSString")]
71        #[unsafe(method(predicateFormat))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn predicateFormat(&self) -> Retained<NSString>;
74
75        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
76        #[unsafe(method(predicateWithSubstitutionVariables:))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn predicateWithSubstitutionVariables(
79            &self,
80            variables: &NSDictionary<NSString, AnyObject>,
81        ) -> Retained<Self>;
82
83        #[unsafe(method(evaluateWithObject:))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn evaluateWithObject(&self, object: Option<&AnyObject>) -> bool;
86
87        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
88        #[unsafe(method(evaluateWithObject:substitutionVariables:))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn evaluateWithObject_substitutionVariables(
91            &self,
92            object: Option<&AnyObject>,
93            bindings: Option<&NSDictionary<NSString, AnyObject>>,
94        ) -> bool;
95
96        #[unsafe(method(allowEvaluation))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn allowEvaluation(&self);
99    );
100}
101
102/// Methods declared on superclass `NSObject`.
103impl NSPredicate {
104    extern_methods!(
105        #[unsafe(method(init))]
106        #[unsafe(method_family = init)]
107        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
108
109        #[unsafe(method(new))]
110        #[unsafe(method_family = new)]
111        pub unsafe fn new() -> Retained<Self>;
112    );
113}
114
115/// NSPredicateSupport.
116#[cfg(feature = "NSArray")]
117impl<ObjectType: Message> NSArray<ObjectType> {
118    extern_methods!(
119        #[unsafe(method(filteredArrayUsingPredicate:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn filteredArrayUsingPredicate(
122            &self,
123            predicate: &NSPredicate,
124        ) -> Retained<NSArray<ObjectType>>;
125    );
126}
127
128/// NSPredicateSupport.
129#[cfg(feature = "NSArray")]
130impl<ObjectType: Message> NSMutableArray<ObjectType> {
131    extern_methods!(
132        #[unsafe(method(filterUsingPredicate:))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn filterUsingPredicate(&self, predicate: &NSPredicate);
135    );
136}
137
138/// NSPredicateSupport.
139#[cfg(feature = "NSSet")]
140impl<ObjectType: Message> NSSet<ObjectType> {
141    extern_methods!(
142        #[unsafe(method(filteredSetUsingPredicate:))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn filteredSetUsingPredicate(
145            &self,
146            predicate: &NSPredicate,
147        ) -> Retained<NSSet<ObjectType>>;
148    );
149}
150
151/// NSPredicateSupport.
152#[cfg(feature = "NSSet")]
153impl<ObjectType: Message> NSMutableSet<ObjectType> {
154    extern_methods!(
155        #[unsafe(method(filterUsingPredicate:))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn filterUsingPredicate(&self, predicate: &NSPredicate);
158    );
159}
160
161/// NSPredicateSupport.
162#[cfg(feature = "NSOrderedSet")]
163impl<ObjectType: Message> NSOrderedSet<ObjectType> {
164    extern_methods!(
165        #[unsafe(method(filteredOrderedSetUsingPredicate:))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn filteredOrderedSetUsingPredicate(
168            &self,
169            p: &NSPredicate,
170        ) -> Retained<NSOrderedSet<ObjectType>>;
171    );
172}
173
174/// NSPredicateSupport.
175#[cfg(feature = "NSOrderedSet")]
176impl<ObjectType: Message> NSMutableOrderedSet<ObjectType> {
177    extern_methods!(
178        #[unsafe(method(filterUsingPredicate:))]
179        #[unsafe(method_family = none)]
180        pub unsafe fn filterUsingPredicate(&self, p: &NSPredicate);
181    );
182}