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")]
59extern_conformance!(
60    unsafe impl NSCoding for NSExpression {}
61);
62
63#[cfg(feature = "NSObject")]
64extern_conformance!(
65    unsafe impl NSCopying for NSExpression {}
66);
67
68#[cfg(feature = "NSObject")]
69unsafe impl CopyingHelper for NSExpression {
70    type Result = Self;
71}
72
73extern_conformance!(
74    unsafe impl NSObjectProtocol for NSExpression {}
75);
76
77#[cfg(feature = "NSObject")]
78extern_conformance!(
79    unsafe impl NSSecureCoding for NSExpression {}
80);
81
82impl NSExpression {
83    extern_methods!(
84        #[cfg(all(feature = "NSArray", feature = "NSString"))]
85        #[unsafe(method(expressionWithFormat:argumentArray:))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn expressionWithFormat_argumentArray(
88            expression_format: &NSString,
89            arguments: &NSArray,
90        ) -> Retained<NSExpression>;
91
92        #[unsafe(method(expressionForConstantValue:))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn expressionForConstantValue(obj: Option<&AnyObject>)
95            -> Retained<NSExpression>;
96
97        #[unsafe(method(expressionForEvaluatedObject))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn expressionForEvaluatedObject() -> Retained<NSExpression>;
100
101        #[cfg(feature = "NSString")]
102        #[unsafe(method(expressionForVariable:))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn expressionForVariable(string: &NSString) -> Retained<NSExpression>;
105
106        #[cfg(feature = "NSString")]
107        #[unsafe(method(expressionForKeyPath:))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn expressionForKeyPath(key_path: &NSString) -> Retained<NSExpression>;
110
111        #[cfg(all(feature = "NSArray", feature = "NSString"))]
112        #[unsafe(method(expressionForFunction:arguments:))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn expressionForFunction_arguments(
115            name: &NSString,
116            parameters: &NSArray,
117        ) -> Retained<NSExpression>;
118
119        #[cfg(feature = "NSArray")]
120        #[unsafe(method(expressionForAggregate:))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn expressionForAggregate(
123            subexpressions: &NSArray<NSExpression>,
124        ) -> Retained<NSExpression>;
125
126        #[unsafe(method(expressionForUnionSet:with:))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn expressionForUnionSet_with(
129            left: &NSExpression,
130            right: &NSExpression,
131        ) -> Retained<NSExpression>;
132
133        #[unsafe(method(expressionForIntersectSet:with:))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn expressionForIntersectSet_with(
136            left: &NSExpression,
137            right: &NSExpression,
138        ) -> Retained<NSExpression>;
139
140        #[unsafe(method(expressionForMinusSet:with:))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn expressionForMinusSet_with(
143            left: &NSExpression,
144            right: &NSExpression,
145        ) -> Retained<NSExpression>;
146
147        #[cfg(all(feature = "NSPredicate", feature = "NSString"))]
148        #[unsafe(method(expressionForSubquery:usingIteratorVariable:predicate:))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn expressionForSubquery_usingIteratorVariable_predicate(
151            expression: &NSExpression,
152            variable: &NSString,
153            predicate: &NSPredicate,
154        ) -> Retained<NSExpression>;
155
156        #[cfg(all(feature = "NSArray", feature = "NSString"))]
157        #[unsafe(method(expressionForFunction:selectorName:arguments:))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn expressionForFunction_selectorName_arguments(
160            target: &NSExpression,
161            name: &NSString,
162            parameters: Option<&NSArray>,
163        ) -> Retained<NSExpression>;
164
165        #[unsafe(method(expressionForAnyKey))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn expressionForAnyKey() -> Retained<NSExpression>;
168
169        #[cfg(all(feature = "NSArray", feature = "NSDictionary", feature = "block2"))]
170        #[unsafe(method(expressionForBlock:arguments:))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn expressionForBlock_arguments(
173            block: &block2::DynBlock<
174                dyn Fn(
175                    *mut AnyObject,
176                    NonNull<NSArray<NSExpression>>,
177                    *mut NSMutableDictionary,
178                ) -> NonNull<AnyObject>,
179            >,
180            arguments: Option<&NSArray<NSExpression>>,
181        ) -> Retained<NSExpression>;
182
183        #[cfg(feature = "NSPredicate")]
184        #[unsafe(method(expressionForConditional:trueExpression:falseExpression:))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn expressionForConditional_trueExpression_falseExpression(
187            predicate: &NSPredicate,
188            true_expression: &NSExpression,
189            false_expression: &NSExpression,
190        ) -> Retained<NSExpression>;
191
192        #[unsafe(method(initWithExpressionType:))]
193        #[unsafe(method_family = init)]
194        pub unsafe fn initWithExpressionType(
195            this: Allocated<Self>,
196            r#type: NSExpressionType,
197        ) -> Retained<Self>;
198
199        #[cfg(feature = "NSCoder")]
200        #[unsafe(method(initWithCoder:))]
201        #[unsafe(method_family = init)]
202        pub unsafe fn initWithCoder(
203            this: Allocated<Self>,
204            coder: &NSCoder,
205        ) -> Option<Retained<Self>>;
206
207        #[unsafe(method(expressionType))]
208        #[unsafe(method_family = none)]
209        pub unsafe fn expressionType(&self) -> NSExpressionType;
210
211        #[unsafe(method(constantValue))]
212        #[unsafe(method_family = none)]
213        pub unsafe fn constantValue(&self) -> Option<Retained<AnyObject>>;
214
215        #[cfg(feature = "NSString")]
216        #[unsafe(method(keyPath))]
217        #[unsafe(method_family = none)]
218        pub unsafe fn keyPath(&self) -> Retained<NSString>;
219
220        #[cfg(feature = "NSString")]
221        #[unsafe(method(function))]
222        #[unsafe(method_family = none)]
223        pub unsafe fn function(&self) -> Retained<NSString>;
224
225        #[cfg(feature = "NSString")]
226        #[unsafe(method(variable))]
227        #[unsafe(method_family = none)]
228        pub unsafe fn variable(&self) -> Retained<NSString>;
229
230        #[unsafe(method(operand))]
231        #[unsafe(method_family = none)]
232        pub unsafe fn operand(&self) -> Retained<NSExpression>;
233
234        #[cfg(feature = "NSArray")]
235        #[unsafe(method(arguments))]
236        #[unsafe(method_family = none)]
237        pub unsafe fn arguments(&self) -> Option<Retained<NSArray<NSExpression>>>;
238
239        #[unsafe(method(collection))]
240        #[unsafe(method_family = none)]
241        pub unsafe fn collection(&self) -> Retained<AnyObject>;
242
243        #[cfg(feature = "NSPredicate")]
244        #[unsafe(method(predicate))]
245        #[unsafe(method_family = none)]
246        pub unsafe fn predicate(&self) -> Retained<NSPredicate>;
247
248        #[unsafe(method(leftExpression))]
249        #[unsafe(method_family = none)]
250        pub unsafe fn leftExpression(&self) -> Retained<NSExpression>;
251
252        #[unsafe(method(rightExpression))]
253        #[unsafe(method_family = none)]
254        pub unsafe fn rightExpression(&self) -> Retained<NSExpression>;
255
256        #[unsafe(method(trueExpression))]
257        #[unsafe(method_family = none)]
258        pub unsafe fn trueExpression(&self) -> Retained<NSExpression>;
259
260        #[unsafe(method(falseExpression))]
261        #[unsafe(method_family = none)]
262        pub unsafe fn falseExpression(&self) -> Retained<NSExpression>;
263
264        #[cfg(all(feature = "NSArray", feature = "NSDictionary", feature = "block2"))]
265        #[unsafe(method(expressionBlock))]
266        #[unsafe(method_family = none)]
267        pub unsafe fn expressionBlock(
268            &self,
269        ) -> NonNull<
270            block2::DynBlock<
271                dyn Fn(
272                    *mut AnyObject,
273                    NonNull<NSArray<NSExpression>>,
274                    *mut NSMutableDictionary,
275                ) -> NonNull<AnyObject>,
276            >,
277        >;
278
279        #[cfg(feature = "NSDictionary")]
280        #[unsafe(method(expressionValueWithObject:context:))]
281        #[unsafe(method_family = none)]
282        pub unsafe fn expressionValueWithObject_context(
283            &self,
284            object: Option<&AnyObject>,
285            context: Option<&NSMutableDictionary>,
286        ) -> Option<Retained<AnyObject>>;
287
288        #[unsafe(method(allowEvaluation))]
289        #[unsafe(method_family = none)]
290        pub unsafe fn allowEvaluation(&self);
291    );
292}
293
294/// Methods declared on superclass `NSObject`.
295impl NSExpression {
296    extern_methods!(
297        #[unsafe(method(init))]
298        #[unsafe(method_family = init)]
299        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
300
301        #[unsafe(method(new))]
302        #[unsafe(method_family = new)]
303        pub unsafe fn new() -> Retained<Self>;
304    );
305}