objc2_foundation/generated/
NSExpression.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
9/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsexpressiontype?language=objc)
10// NS_ENUM
11#[repr(transparent)]
12#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
13pub struct NSExpressionType(pub NSUInteger);
14impl NSExpressionType {
15    #[doc(alias = "NSConstantValueExpressionType")]
16    pub const ConstantValueExpressionType: Self = Self(0);
17    #[doc(alias = "NSEvaluatedObjectExpressionType")]
18    pub const EvaluatedObjectExpressionType: Self = Self(1);
19    #[doc(alias = "NSVariableExpressionType")]
20    pub const VariableExpressionType: Self = Self(2);
21    #[doc(alias = "NSKeyPathExpressionType")]
22    pub const KeyPathExpressionType: Self = Self(3);
23    #[doc(alias = "NSFunctionExpressionType")]
24    pub const FunctionExpressionType: Self = Self(4);
25    #[doc(alias = "NSUnionSetExpressionType")]
26    pub const UnionSetExpressionType: Self = Self(5);
27    #[doc(alias = "NSIntersectSetExpressionType")]
28    pub const IntersectSetExpressionType: Self = Self(6);
29    #[doc(alias = "NSMinusSetExpressionType")]
30    pub const MinusSetExpressionType: Self = Self(7);
31    #[doc(alias = "NSSubqueryExpressionType")]
32    pub const SubqueryExpressionType: Self = Self(13);
33    #[doc(alias = "NSAggregateExpressionType")]
34    pub const AggregateExpressionType: Self = Self(14);
35    #[doc(alias = "NSAnyKeyExpressionType")]
36    pub const AnyKeyExpressionType: Self = Self(15);
37    #[doc(alias = "NSBlockExpressionType")]
38    pub const BlockExpressionType: Self = Self(19);
39    #[doc(alias = "NSConditionalExpressionType")]
40    pub const ConditionalExpressionType: Self = Self(20);
41}
42
43unsafe impl Encode for NSExpressionType {
44    const ENCODING: Encoding = NSUInteger::ENCODING;
45}
46
47unsafe impl RefEncode for NSExpressionType {
48    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
49}
50
51extern_class!(
52    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsexpression?language=objc)
53    #[unsafe(super(NSObject))]
54    #[derive(Debug, PartialEq, Eq, Hash)]
55    pub struct NSExpression;
56);
57
58#[cfg(feature = "NSObject")]
59unsafe impl NSCoding for NSExpression {}
60
61#[cfg(feature = "NSObject")]
62unsafe impl NSCopying for NSExpression {}
63
64#[cfg(feature = "NSObject")]
65unsafe impl CopyingHelper for NSExpression {
66    type Result = Self;
67}
68
69unsafe impl NSObjectProtocol for NSExpression {}
70
71#[cfg(feature = "NSObject")]
72unsafe impl NSSecureCoding for NSExpression {}
73
74impl NSExpression {
75    extern_methods!(
76        #[cfg(all(feature = "NSArray", feature = "NSString"))]
77        #[unsafe(method(expressionWithFormat:argumentArray:))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn expressionWithFormat_argumentArray(
80            expression_format: &NSString,
81            arguments: &NSArray,
82        ) -> Retained<NSExpression>;
83
84        #[unsafe(method(expressionForConstantValue:))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn expressionForConstantValue(obj: Option<&AnyObject>)
87            -> Retained<NSExpression>;
88
89        #[unsafe(method(expressionForEvaluatedObject))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn expressionForEvaluatedObject() -> Retained<NSExpression>;
92
93        #[cfg(feature = "NSString")]
94        #[unsafe(method(expressionForVariable:))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn expressionForVariable(string: &NSString) -> Retained<NSExpression>;
97
98        #[cfg(feature = "NSString")]
99        #[unsafe(method(expressionForKeyPath:))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn expressionForKeyPath(key_path: &NSString) -> Retained<NSExpression>;
102
103        #[cfg(all(feature = "NSArray", feature = "NSString"))]
104        #[unsafe(method(expressionForFunction:arguments:))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn expressionForFunction_arguments(
107            name: &NSString,
108            parameters: &NSArray,
109        ) -> Retained<NSExpression>;
110
111        #[cfg(feature = "NSArray")]
112        #[unsafe(method(expressionForAggregate:))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn expressionForAggregate(
115            subexpressions: &NSArray<NSExpression>,
116        ) -> Retained<NSExpression>;
117
118        #[unsafe(method(expressionForUnionSet:with:))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn expressionForUnionSet_with(
121            left: &NSExpression,
122            right: &NSExpression,
123        ) -> Retained<NSExpression>;
124
125        #[unsafe(method(expressionForIntersectSet:with:))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn expressionForIntersectSet_with(
128            left: &NSExpression,
129            right: &NSExpression,
130        ) -> Retained<NSExpression>;
131
132        #[unsafe(method(expressionForMinusSet:with:))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn expressionForMinusSet_with(
135            left: &NSExpression,
136            right: &NSExpression,
137        ) -> Retained<NSExpression>;
138
139        #[cfg(all(feature = "NSPredicate", feature = "NSString"))]
140        #[unsafe(method(expressionForSubquery:usingIteratorVariable:predicate:))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn expressionForSubquery_usingIteratorVariable_predicate(
143            expression: &NSExpression,
144            variable: &NSString,
145            predicate: &NSPredicate,
146        ) -> Retained<NSExpression>;
147
148        #[cfg(all(feature = "NSArray", feature = "NSString"))]
149        #[unsafe(method(expressionForFunction:selectorName:arguments:))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn expressionForFunction_selectorName_arguments(
152            target: &NSExpression,
153            name: &NSString,
154            parameters: Option<&NSArray>,
155        ) -> Retained<NSExpression>;
156
157        #[unsafe(method(expressionForAnyKey))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn expressionForAnyKey() -> Retained<NSExpression>;
160
161        #[cfg(all(feature = "NSArray", feature = "NSDictionary", feature = "block2"))]
162        #[unsafe(method(expressionForBlock:arguments:))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn expressionForBlock_arguments(
165            block: &block2::Block<
166                dyn Fn(
167                    *mut AnyObject,
168                    NonNull<NSArray<NSExpression>>,
169                    *mut NSMutableDictionary,
170                ) -> NonNull<AnyObject>,
171            >,
172            arguments: Option<&NSArray<NSExpression>>,
173        ) -> Retained<NSExpression>;
174
175        #[cfg(feature = "NSPredicate")]
176        #[unsafe(method(expressionForConditional:trueExpression:falseExpression:))]
177        #[unsafe(method_family = none)]
178        pub unsafe fn expressionForConditional_trueExpression_falseExpression(
179            predicate: &NSPredicate,
180            true_expression: &NSExpression,
181            false_expression: &NSExpression,
182        ) -> Retained<NSExpression>;
183
184        #[unsafe(method(initWithExpressionType:))]
185        #[unsafe(method_family = init)]
186        pub unsafe fn initWithExpressionType(
187            this: Allocated<Self>,
188            r#type: NSExpressionType,
189        ) -> Retained<Self>;
190
191        #[cfg(feature = "NSCoder")]
192        #[unsafe(method(initWithCoder:))]
193        #[unsafe(method_family = init)]
194        pub unsafe fn initWithCoder(
195            this: Allocated<Self>,
196            coder: &NSCoder,
197        ) -> Option<Retained<Self>>;
198
199        #[unsafe(method(expressionType))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn expressionType(&self) -> NSExpressionType;
202
203        #[unsafe(method(constantValue))]
204        #[unsafe(method_family = none)]
205        pub unsafe fn constantValue(&self) -> Option<Retained<AnyObject>>;
206
207        #[cfg(feature = "NSString")]
208        #[unsafe(method(keyPath))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn keyPath(&self) -> Retained<NSString>;
211
212        #[cfg(feature = "NSString")]
213        #[unsafe(method(function))]
214        #[unsafe(method_family = none)]
215        pub unsafe fn function(&self) -> Retained<NSString>;
216
217        #[cfg(feature = "NSString")]
218        #[unsafe(method(variable))]
219        #[unsafe(method_family = none)]
220        pub unsafe fn variable(&self) -> Retained<NSString>;
221
222        #[unsafe(method(operand))]
223        #[unsafe(method_family = none)]
224        pub unsafe fn operand(&self) -> Retained<NSExpression>;
225
226        #[cfg(feature = "NSArray")]
227        #[unsafe(method(arguments))]
228        #[unsafe(method_family = none)]
229        pub unsafe fn arguments(&self) -> Option<Retained<NSArray<NSExpression>>>;
230
231        #[unsafe(method(collection))]
232        #[unsafe(method_family = none)]
233        pub unsafe fn collection(&self) -> Retained<AnyObject>;
234
235        #[cfg(feature = "NSPredicate")]
236        #[unsafe(method(predicate))]
237        #[unsafe(method_family = none)]
238        pub unsafe fn predicate(&self) -> Retained<NSPredicate>;
239
240        #[unsafe(method(leftExpression))]
241        #[unsafe(method_family = none)]
242        pub unsafe fn leftExpression(&self) -> Retained<NSExpression>;
243
244        #[unsafe(method(rightExpression))]
245        #[unsafe(method_family = none)]
246        pub unsafe fn rightExpression(&self) -> Retained<NSExpression>;
247
248        #[unsafe(method(trueExpression))]
249        #[unsafe(method_family = none)]
250        pub unsafe fn trueExpression(&self) -> Retained<NSExpression>;
251
252        #[unsafe(method(falseExpression))]
253        #[unsafe(method_family = none)]
254        pub unsafe fn falseExpression(&self) -> Retained<NSExpression>;
255
256        #[cfg(all(feature = "NSArray", feature = "NSDictionary", feature = "block2"))]
257        #[unsafe(method(expressionBlock))]
258        #[unsafe(method_family = none)]
259        pub unsafe fn expressionBlock(
260            &self,
261        ) -> NonNull<
262            block2::Block<
263                dyn Fn(
264                    *mut AnyObject,
265                    NonNull<NSArray<NSExpression>>,
266                    *mut NSMutableDictionary,
267                ) -> NonNull<AnyObject>,
268            >,
269        >;
270
271        #[cfg(feature = "NSDictionary")]
272        #[unsafe(method(expressionValueWithObject:context:))]
273        #[unsafe(method_family = none)]
274        pub unsafe fn expressionValueWithObject_context(
275            &self,
276            object: Option<&AnyObject>,
277            context: Option<&NSMutableDictionary>,
278        ) -> Option<Retained<AnyObject>>;
279
280        #[unsafe(method(allowEvaluation))]
281        #[unsafe(method_family = none)]
282        pub unsafe fn allowEvaluation(&self);
283    );
284}
285
286/// Methods declared on superclass `NSObject`.
287impl NSExpression {
288    extern_methods!(
289        #[unsafe(method(init))]
290        #[unsafe(method_family = init)]
291        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
292
293        #[unsafe(method(new))]
294        #[unsafe(method_family = new)]
295        pub unsafe fn new() -> Retained<Self>;
296    );
297}