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