objc2_foundation/generated/
NSAppleEventDescriptor.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-services")]
7#[cfg(target_vendor = "apple")]
8use objc2_core_services::*;
9
10use crate::*;
11
12#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct NSAppleEventSendOptions(pub NSUInteger);
17bitflags::bitflags! {
18 impl NSAppleEventSendOptions: NSUInteger {
19 #[doc(alias = "NSAppleEventSendNoReply")]
20 const NoReply = 1;
21 #[doc(alias = "NSAppleEventSendQueueReply")]
22 const QueueReply = 2;
23 #[doc(alias = "NSAppleEventSendWaitForReply")]
24 const WaitForReply = 3;
25 #[doc(alias = "NSAppleEventSendNeverInteract")]
26 const NeverInteract = 16;
27 #[doc(alias = "NSAppleEventSendCanInteract")]
28 const CanInteract = 32;
29 #[doc(alias = "NSAppleEventSendAlwaysInteract")]
30 const AlwaysInteract = 48;
31 #[doc(alias = "NSAppleEventSendCanSwitchLayer")]
32 const CanSwitchLayer = 64;
33 #[doc(alias = "NSAppleEventSendDontRecord")]
34 const DontRecord = 4096;
35 #[doc(alias = "NSAppleEventSendDontExecute")]
36 const DontExecute = 8192;
37 #[doc(alias = "NSAppleEventSendDontAnnotate")]
38 const DontAnnotate = 65536;
39 #[doc(alias = "NSAppleEventSendDefaultOptions")]
40 const DefaultOptions = 35;
41 }
42}
43
44unsafe impl Encode for NSAppleEventSendOptions {
45 const ENCODING: Encoding = NSUInteger::ENCODING;
46}
47
48unsafe impl RefEncode for NSAppleEventSendOptions {
49 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
50}
51
52extern_class!(
53 #[unsafe(super(NSObject))]
55 #[derive(Debug, PartialEq, Eq, Hash)]
56 pub struct NSAppleEventDescriptor;
57);
58
59#[cfg(feature = "NSObject")]
60extern_conformance!(
61 unsafe impl NSCoding for NSAppleEventDescriptor {}
62);
63
64#[cfg(feature = "NSObject")]
65extern_conformance!(
66 unsafe impl NSCopying for NSAppleEventDescriptor {}
67);
68
69#[cfg(feature = "NSObject")]
70unsafe impl CopyingHelper for NSAppleEventDescriptor {
71 type Result = Self;
72}
73
74extern_conformance!(
75 unsafe impl NSObjectProtocol for NSAppleEventDescriptor {}
76);
77
78#[cfg(feature = "NSObject")]
79extern_conformance!(
80 unsafe impl NSSecureCoding for NSAppleEventDescriptor {}
81);
82
83impl NSAppleEventDescriptor {
84 extern_methods!(
85 #[unsafe(method(nullDescriptor))]
86 #[unsafe(method_family = none)]
87 pub unsafe fn nullDescriptor() -> Retained<NSAppleEventDescriptor>;
88
89 #[cfg(feature = "objc2-core-services")]
90 #[cfg(target_vendor = "apple")]
91 #[unsafe(method(descriptorWithDescriptorType:bytes:length:))]
92 #[unsafe(method_family = none)]
93 pub unsafe fn descriptorWithDescriptorType_bytes_length(
94 descriptor_type: DescType,
95 bytes: *const c_void,
96 byte_count: NSUInteger,
97 ) -> Option<Retained<NSAppleEventDescriptor>>;
98
99 #[cfg(all(feature = "NSData", feature = "objc2-core-services"))]
100 #[cfg(target_vendor = "apple")]
101 #[unsafe(method(descriptorWithDescriptorType:data:))]
102 #[unsafe(method_family = none)]
103 pub unsafe fn descriptorWithDescriptorType_data(
104 descriptor_type: DescType,
105 data: Option<&NSData>,
106 ) -> Option<Retained<NSAppleEventDescriptor>>;
107
108 #[unsafe(method(descriptorWithBoolean:))]
109 #[unsafe(method_family = none)]
110 pub unsafe fn descriptorWithBoolean(boolean: Boolean) -> Retained<NSAppleEventDescriptor>;
111
112 #[unsafe(method(descriptorWithEnumCode:))]
113 #[unsafe(method_family = none)]
114 pub unsafe fn descriptorWithEnumCode(
115 enumerator: OSType,
116 ) -> Retained<NSAppleEventDescriptor>;
117
118 #[unsafe(method(descriptorWithInt32:))]
119 #[unsafe(method_family = none)]
120 pub unsafe fn descriptorWithInt32(signed_int: i32) -> Retained<NSAppleEventDescriptor>;
121
122 #[unsafe(method(descriptorWithDouble:))]
123 #[unsafe(method_family = none)]
124 pub unsafe fn descriptorWithDouble(
125 double_value: c_double,
126 ) -> Retained<NSAppleEventDescriptor>;
127
128 #[unsafe(method(descriptorWithTypeCode:))]
129 #[unsafe(method_family = none)]
130 pub unsafe fn descriptorWithTypeCode(type_code: OSType)
131 -> Retained<NSAppleEventDescriptor>;
132
133 #[cfg(feature = "NSString")]
134 #[unsafe(method(descriptorWithString:))]
135 #[unsafe(method_family = none)]
136 pub unsafe fn descriptorWithString(string: &NSString) -> Retained<NSAppleEventDescriptor>;
137
138 #[cfg(feature = "NSDate")]
139 #[unsafe(method(descriptorWithDate:))]
140 #[unsafe(method_family = none)]
141 pub unsafe fn descriptorWithDate(date: &NSDate) -> Retained<NSAppleEventDescriptor>;
142
143 #[cfg(feature = "NSURL")]
144 #[unsafe(method(descriptorWithFileURL:))]
145 #[unsafe(method_family = none)]
146 pub unsafe fn descriptorWithFileURL(file_url: &NSURL) -> Retained<NSAppleEventDescriptor>;
147
148 #[cfg(feature = "objc2-core-services")]
149 #[cfg(target_vendor = "apple")]
150 #[unsafe(method(appleEventWithEventClass:eventID:targetDescriptor:returnID:transactionID:))]
151 #[unsafe(method_family = none)]
152 pub unsafe fn appleEventWithEventClass_eventID_targetDescriptor_returnID_transactionID(
153 event_class: AEEventClass,
154 event_id: AEEventID,
155 target_descriptor: Option<&NSAppleEventDescriptor>,
156 return_id: AEReturnID,
157 transaction_id: AETransactionID,
158 ) -> Retained<NSAppleEventDescriptor>;
159
160 #[unsafe(method(listDescriptor))]
161 #[unsafe(method_family = none)]
162 pub unsafe fn listDescriptor() -> Retained<NSAppleEventDescriptor>;
163
164 #[unsafe(method(recordDescriptor))]
165 #[unsafe(method_family = none)]
166 pub unsafe fn recordDescriptor() -> Retained<NSAppleEventDescriptor>;
167
168 #[unsafe(method(currentProcessDescriptor))]
169 #[unsafe(method_family = none)]
170 pub unsafe fn currentProcessDescriptor() -> Retained<NSAppleEventDescriptor>;
171
172 #[cfg(feature = "libc")]
173 #[unsafe(method(descriptorWithProcessIdentifier:))]
174 #[unsafe(method_family = none)]
175 pub unsafe fn descriptorWithProcessIdentifier(
176 process_identifier: libc::pid_t,
177 ) -> Retained<NSAppleEventDescriptor>;
178
179 #[cfg(feature = "NSString")]
180 #[unsafe(method(descriptorWithBundleIdentifier:))]
181 #[unsafe(method_family = none)]
182 pub unsafe fn descriptorWithBundleIdentifier(
183 bundle_identifier: &NSString,
184 ) -> Retained<NSAppleEventDescriptor>;
185
186 #[cfg(feature = "NSURL")]
187 #[unsafe(method(descriptorWithApplicationURL:))]
188 #[unsafe(method_family = none)]
189 pub unsafe fn descriptorWithApplicationURL(
190 application_url: &NSURL,
191 ) -> Retained<NSAppleEventDescriptor>;
192
193 #[cfg(feature = "objc2-core-services")]
194 #[cfg(target_vendor = "apple")]
195 #[unsafe(method(initWithAEDescNoCopy:))]
196 #[unsafe(method_family = init)]
197 pub unsafe fn initWithAEDescNoCopy(
198 this: Allocated<Self>,
199 ae_desc: NonNull<AEDesc>,
200 ) -> Retained<Self>;
201
202 #[cfg(feature = "objc2-core-services")]
203 #[cfg(target_vendor = "apple")]
204 #[unsafe(method(initWithDescriptorType:bytes:length:))]
205 #[unsafe(method_family = init)]
206 pub unsafe fn initWithDescriptorType_bytes_length(
207 this: Allocated<Self>,
208 descriptor_type: DescType,
209 bytes: *const c_void,
210 byte_count: NSUInteger,
211 ) -> Option<Retained<Self>>;
212
213 #[cfg(all(feature = "NSData", feature = "objc2-core-services"))]
214 #[cfg(target_vendor = "apple")]
215 #[unsafe(method(initWithDescriptorType:data:))]
216 #[unsafe(method_family = init)]
217 pub unsafe fn initWithDescriptorType_data(
218 this: Allocated<Self>,
219 descriptor_type: DescType,
220 data: Option<&NSData>,
221 ) -> Option<Retained<Self>>;
222
223 #[cfg(feature = "objc2-core-services")]
224 #[cfg(target_vendor = "apple")]
225 #[unsafe(method(initWithEventClass:eventID:targetDescriptor:returnID:transactionID:))]
226 #[unsafe(method_family = init)]
227 pub unsafe fn initWithEventClass_eventID_targetDescriptor_returnID_transactionID(
228 this: Allocated<Self>,
229 event_class: AEEventClass,
230 event_id: AEEventID,
231 target_descriptor: Option<&NSAppleEventDescriptor>,
232 return_id: AEReturnID,
233 transaction_id: AETransactionID,
234 ) -> Retained<Self>;
235
236 #[unsafe(method(initListDescriptor))]
237 #[unsafe(method_family = init)]
238 pub unsafe fn initListDescriptor(this: Allocated<Self>) -> Retained<Self>;
239
240 #[unsafe(method(initRecordDescriptor))]
241 #[unsafe(method_family = init)]
242 pub unsafe fn initRecordDescriptor(this: Allocated<Self>) -> Retained<Self>;
243
244 #[cfg(feature = "objc2-core-services")]
245 #[cfg(target_vendor = "apple")]
246 #[unsafe(method(aeDesc))]
247 #[unsafe(method_family = none)]
248 pub unsafe fn aeDesc(&self) -> *const AEDesc;
249
250 #[cfg(feature = "objc2-core-services")]
251 #[cfg(target_vendor = "apple")]
252 #[unsafe(method(descriptorType))]
253 #[unsafe(method_family = none)]
254 pub unsafe fn descriptorType(&self) -> DescType;
255
256 #[cfg(feature = "NSData")]
257 #[unsafe(method(data))]
258 #[unsafe(method_family = none)]
259 pub unsafe fn data(&self) -> Retained<NSData>;
260
261 #[unsafe(method(booleanValue))]
262 #[unsafe(method_family = none)]
263 pub unsafe fn booleanValue(&self) -> Boolean;
264
265 #[unsafe(method(enumCodeValue))]
266 #[unsafe(method_family = none)]
267 pub unsafe fn enumCodeValue(&self) -> OSType;
268
269 #[unsafe(method(int32Value))]
270 #[unsafe(method_family = none)]
271 pub unsafe fn int32Value(&self) -> i32;
272
273 #[unsafe(method(doubleValue))]
274 #[unsafe(method_family = none)]
275 pub unsafe fn doubleValue(&self) -> c_double;
276
277 #[unsafe(method(typeCodeValue))]
278 #[unsafe(method_family = none)]
279 pub unsafe fn typeCodeValue(&self) -> OSType;
280
281 #[cfg(feature = "NSString")]
282 #[unsafe(method(stringValue))]
283 #[unsafe(method_family = none)]
284 pub unsafe fn stringValue(&self) -> Option<Retained<NSString>>;
285
286 #[cfg(feature = "NSDate")]
287 #[unsafe(method(dateValue))]
288 #[unsafe(method_family = none)]
289 pub unsafe fn dateValue(&self) -> Option<Retained<NSDate>>;
290
291 #[cfg(feature = "NSURL")]
292 #[unsafe(method(fileURLValue))]
293 #[unsafe(method_family = none)]
294 pub unsafe fn fileURLValue(&self) -> Option<Retained<NSURL>>;
295
296 #[cfg(feature = "objc2-core-services")]
297 #[cfg(target_vendor = "apple")]
298 #[unsafe(method(eventClass))]
299 #[unsafe(method_family = none)]
300 pub unsafe fn eventClass(&self) -> AEEventClass;
301
302 #[cfg(feature = "objc2-core-services")]
303 #[cfg(target_vendor = "apple")]
304 #[unsafe(method(eventID))]
305 #[unsafe(method_family = none)]
306 pub unsafe fn eventID(&self) -> AEEventID;
307
308 #[cfg(feature = "objc2-core-services")]
309 #[cfg(target_vendor = "apple")]
310 #[unsafe(method(returnID))]
311 #[unsafe(method_family = none)]
312 pub unsafe fn returnID(&self) -> AEReturnID;
313
314 #[cfg(feature = "objc2-core-services")]
315 #[cfg(target_vendor = "apple")]
316 #[unsafe(method(transactionID))]
317 #[unsafe(method_family = none)]
318 pub unsafe fn transactionID(&self) -> AETransactionID;
319
320 #[cfg(feature = "objc2-core-services")]
321 #[cfg(target_vendor = "apple")]
322 #[unsafe(method(setParamDescriptor:forKeyword:))]
323 #[unsafe(method_family = none)]
324 pub unsafe fn setParamDescriptor_forKeyword(
325 &self,
326 descriptor: &NSAppleEventDescriptor,
327 keyword: AEKeyword,
328 );
329
330 #[cfg(feature = "objc2-core-services")]
331 #[cfg(target_vendor = "apple")]
332 #[unsafe(method(paramDescriptorForKeyword:))]
333 #[unsafe(method_family = none)]
334 pub unsafe fn paramDescriptorForKeyword(
335 &self,
336 keyword: AEKeyword,
337 ) -> Option<Retained<NSAppleEventDescriptor>>;
338
339 #[cfg(feature = "objc2-core-services")]
340 #[cfg(target_vendor = "apple")]
341 #[unsafe(method(removeParamDescriptorWithKeyword:))]
342 #[unsafe(method_family = none)]
343 pub unsafe fn removeParamDescriptorWithKeyword(&self, keyword: AEKeyword);
344
345 #[cfg(feature = "objc2-core-services")]
346 #[cfg(target_vendor = "apple")]
347 #[unsafe(method(setAttributeDescriptor:forKeyword:))]
348 #[unsafe(method_family = none)]
349 pub unsafe fn setAttributeDescriptor_forKeyword(
350 &self,
351 descriptor: &NSAppleEventDescriptor,
352 keyword: AEKeyword,
353 );
354
355 #[cfg(feature = "objc2-core-services")]
356 #[cfg(target_vendor = "apple")]
357 #[unsafe(method(attributeDescriptorForKeyword:))]
358 #[unsafe(method_family = none)]
359 pub unsafe fn attributeDescriptorForKeyword(
360 &self,
361 keyword: AEKeyword,
362 ) -> Option<Retained<NSAppleEventDescriptor>>;
363
364 #[cfg(all(feature = "NSDate", feature = "NSError"))]
365 #[unsafe(method(sendEventWithOptions:timeout:error:_))]
366 #[unsafe(method_family = none)]
367 pub unsafe fn sendEventWithOptions_timeout_error(
368 &self,
369 send_options: NSAppleEventSendOptions,
370 timeout_in_seconds: NSTimeInterval,
371 ) -> Result<Retained<NSAppleEventDescriptor>, Retained<NSError>>;
372
373 #[unsafe(method(isRecordDescriptor))]
374 #[unsafe(method_family = none)]
375 pub unsafe fn isRecordDescriptor(&self) -> bool;
376
377 #[unsafe(method(numberOfItems))]
378 #[unsafe(method_family = none)]
379 pub unsafe fn numberOfItems(&self) -> NSInteger;
380
381 #[unsafe(method(insertDescriptor:atIndex:))]
382 #[unsafe(method_family = none)]
383 pub unsafe fn insertDescriptor_atIndex(
384 &self,
385 descriptor: &NSAppleEventDescriptor,
386 index: NSInteger,
387 );
388
389 #[unsafe(method(descriptorAtIndex:))]
390 #[unsafe(method_family = none)]
391 pub unsafe fn descriptorAtIndex(
392 &self,
393 index: NSInteger,
394 ) -> Option<Retained<NSAppleEventDescriptor>>;
395
396 #[unsafe(method(removeDescriptorAtIndex:))]
397 #[unsafe(method_family = none)]
398 pub unsafe fn removeDescriptorAtIndex(&self, index: NSInteger);
399
400 #[cfg(feature = "objc2-core-services")]
401 #[cfg(target_vendor = "apple")]
402 #[unsafe(method(setDescriptor:forKeyword:))]
403 #[unsafe(method_family = none)]
404 pub unsafe fn setDescriptor_forKeyword(
405 &self,
406 descriptor: &NSAppleEventDescriptor,
407 keyword: AEKeyword,
408 );
409
410 #[cfg(feature = "objc2-core-services")]
411 #[cfg(target_vendor = "apple")]
412 #[unsafe(method(descriptorForKeyword:))]
413 #[unsafe(method_family = none)]
414 pub unsafe fn descriptorForKeyword(
415 &self,
416 keyword: AEKeyword,
417 ) -> Option<Retained<NSAppleEventDescriptor>>;
418
419 #[cfg(feature = "objc2-core-services")]
420 #[cfg(target_vendor = "apple")]
421 #[unsafe(method(removeDescriptorWithKeyword:))]
422 #[unsafe(method_family = none)]
423 pub unsafe fn removeDescriptorWithKeyword(&self, keyword: AEKeyword);
424
425 #[cfg(feature = "objc2-core-services")]
426 #[cfg(target_vendor = "apple")]
427 #[unsafe(method(keywordForDescriptorAtIndex:))]
428 #[unsafe(method_family = none)]
429 pub unsafe fn keywordForDescriptorAtIndex(&self, index: NSInteger) -> AEKeyword;
430
431 #[cfg(feature = "objc2-core-services")]
432 #[cfg(target_vendor = "apple")]
433 #[unsafe(method(coerceToDescriptorType:))]
434 #[unsafe(method_family = none)]
435 pub unsafe fn coerceToDescriptorType(
436 &self,
437 descriptor_type: DescType,
438 ) -> Option<Retained<NSAppleEventDescriptor>>;
439 );
440}
441
442impl NSAppleEventDescriptor {
444 extern_methods!(
445 #[unsafe(method(init))]
446 #[unsafe(method_family = init)]
447 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
448
449 #[unsafe(method(new))]
450 #[unsafe(method_family = new)]
451 pub unsafe fn new() -> Retained<Self>;
452 );
453}