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 fn nullDescriptor() -> Retained<NSAppleEventDescriptor>;
88
89 #[cfg(feature = "objc2-core-services")]
90 #[cfg(target_vendor = "apple")]
91 #[unsafe(method(descriptorWithDescriptorType:bytes:length:))]
95 #[unsafe(method_family = none)]
96 pub unsafe fn descriptorWithDescriptorType_bytes_length(
97 descriptor_type: DescType,
98 bytes: *const c_void,
99 byte_count: NSUInteger,
100 ) -> Option<Retained<NSAppleEventDescriptor>>;
101
102 #[cfg(all(feature = "NSData", feature = "objc2-core-services"))]
103 #[cfg(target_vendor = "apple")]
104 #[unsafe(method(descriptorWithDescriptorType:data:))]
105 #[unsafe(method_family = none)]
106 pub fn descriptorWithDescriptorType_data(
107 descriptor_type: DescType,
108 data: Option<&NSData>,
109 ) -> Option<Retained<NSAppleEventDescriptor>>;
110
111 #[unsafe(method(descriptorWithBoolean:))]
112 #[unsafe(method_family = none)]
113 pub fn descriptorWithBoolean(boolean: Boolean) -> Retained<NSAppleEventDescriptor>;
114
115 #[unsafe(method(descriptorWithEnumCode:))]
116 #[unsafe(method_family = none)]
117 pub fn descriptorWithEnumCode(enumerator: OSType) -> Retained<NSAppleEventDescriptor>;
118
119 #[unsafe(method(descriptorWithInt32:))]
120 #[unsafe(method_family = none)]
121 pub fn descriptorWithInt32(signed_int: i32) -> Retained<NSAppleEventDescriptor>;
122
123 #[unsafe(method(descriptorWithDouble:))]
124 #[unsafe(method_family = none)]
125 pub fn descriptorWithDouble(double_value: c_double) -> Retained<NSAppleEventDescriptor>;
126
127 #[unsafe(method(descriptorWithTypeCode:))]
128 #[unsafe(method_family = none)]
129 pub fn descriptorWithTypeCode(type_code: OSType) -> Retained<NSAppleEventDescriptor>;
130
131 #[cfg(feature = "NSString")]
132 #[unsafe(method(descriptorWithString:))]
133 #[unsafe(method_family = none)]
134 pub fn descriptorWithString(string: &NSString) -> Retained<NSAppleEventDescriptor>;
135
136 #[cfg(feature = "NSDate")]
137 #[unsafe(method(descriptorWithDate:))]
138 #[unsafe(method_family = none)]
139 pub fn descriptorWithDate(date: &NSDate) -> Retained<NSAppleEventDescriptor>;
140
141 #[cfg(feature = "NSURL")]
142 #[unsafe(method(descriptorWithFileURL:))]
143 #[unsafe(method_family = none)]
144 pub fn descriptorWithFileURL(file_url: &NSURL) -> Retained<NSAppleEventDescriptor>;
145
146 #[cfg(feature = "objc2-core-services")]
147 #[cfg(target_vendor = "apple")]
148 #[unsafe(method(appleEventWithEventClass:eventID:targetDescriptor:returnID:transactionID:))]
149 #[unsafe(method_family = none)]
150 pub fn appleEventWithEventClass_eventID_targetDescriptor_returnID_transactionID(
151 event_class: AEEventClass,
152 event_id: AEEventID,
153 target_descriptor: Option<&NSAppleEventDescriptor>,
154 return_id: AEReturnID,
155 transaction_id: AETransactionID,
156 ) -> Retained<NSAppleEventDescriptor>;
157
158 #[unsafe(method(listDescriptor))]
159 #[unsafe(method_family = none)]
160 pub fn listDescriptor() -> Retained<NSAppleEventDescriptor>;
161
162 #[unsafe(method(recordDescriptor))]
163 #[unsafe(method_family = none)]
164 pub fn recordDescriptor() -> Retained<NSAppleEventDescriptor>;
165
166 #[unsafe(method(currentProcessDescriptor))]
167 #[unsafe(method_family = none)]
168 pub fn currentProcessDescriptor() -> Retained<NSAppleEventDescriptor>;
169
170 #[cfg(feature = "libc")]
171 #[unsafe(method(descriptorWithProcessIdentifier:))]
172 #[unsafe(method_family = none)]
173 pub fn descriptorWithProcessIdentifier(
174 process_identifier: libc::pid_t,
175 ) -> Retained<NSAppleEventDescriptor>;
176
177 #[cfg(feature = "NSString")]
178 #[unsafe(method(descriptorWithBundleIdentifier:))]
179 #[unsafe(method_family = none)]
180 pub fn descriptorWithBundleIdentifier(
181 bundle_identifier: &NSString,
182 ) -> Retained<NSAppleEventDescriptor>;
183
184 #[cfg(feature = "NSURL")]
185 #[unsafe(method(descriptorWithApplicationURL:))]
186 #[unsafe(method_family = none)]
187 pub fn descriptorWithApplicationURL(
188 application_url: &NSURL,
189 ) -> Retained<NSAppleEventDescriptor>;
190
191 #[cfg(feature = "objc2-core-services")]
192 #[cfg(target_vendor = "apple")]
193 #[unsafe(method(initWithAEDescNoCopy:))]
197 #[unsafe(method_family = init)]
198 pub unsafe fn initWithAEDescNoCopy(
199 this: Allocated<Self>,
200 ae_desc: NonNull<AEDesc>,
201 ) -> Retained<Self>;
202
203 #[cfg(feature = "objc2-core-services")]
204 #[cfg(target_vendor = "apple")]
205 #[unsafe(method(initWithDescriptorType:bytes:length:))]
209 #[unsafe(method_family = init)]
210 pub unsafe fn initWithDescriptorType_bytes_length(
211 this: Allocated<Self>,
212 descriptor_type: DescType,
213 bytes: *const c_void,
214 byte_count: NSUInteger,
215 ) -> Option<Retained<Self>>;
216
217 #[cfg(all(feature = "NSData", feature = "objc2-core-services"))]
218 #[cfg(target_vendor = "apple")]
219 #[unsafe(method(initWithDescriptorType:data:))]
220 #[unsafe(method_family = init)]
221 pub fn initWithDescriptorType_data(
222 this: Allocated<Self>,
223 descriptor_type: DescType,
224 data: Option<&NSData>,
225 ) -> Option<Retained<Self>>;
226
227 #[cfg(feature = "objc2-core-services")]
228 #[cfg(target_vendor = "apple")]
229 #[unsafe(method(initWithEventClass:eventID:targetDescriptor:returnID:transactionID:))]
230 #[unsafe(method_family = init)]
231 pub fn initWithEventClass_eventID_targetDescriptor_returnID_transactionID(
232 this: Allocated<Self>,
233 event_class: AEEventClass,
234 event_id: AEEventID,
235 target_descriptor: Option<&NSAppleEventDescriptor>,
236 return_id: AEReturnID,
237 transaction_id: AETransactionID,
238 ) -> Retained<Self>;
239
240 #[unsafe(method(initListDescriptor))]
241 #[unsafe(method_family = init)]
242 pub fn initListDescriptor(this: Allocated<Self>) -> Retained<Self>;
243
244 #[unsafe(method(initRecordDescriptor))]
245 #[unsafe(method_family = init)]
246 pub fn initRecordDescriptor(this: Allocated<Self>) -> Retained<Self>;
247
248 #[cfg(feature = "objc2-core-services")]
249 #[cfg(target_vendor = "apple")]
250 #[unsafe(method(aeDesc))]
251 #[unsafe(method_family = none)]
252 pub fn aeDesc(&self) -> *const AEDesc;
253
254 #[cfg(feature = "objc2-core-services")]
255 #[cfg(target_vendor = "apple")]
256 #[unsafe(method(descriptorType))]
257 #[unsafe(method_family = none)]
258 pub fn descriptorType(&self) -> DescType;
259
260 #[cfg(feature = "NSData")]
261 #[unsafe(method(data))]
262 #[unsafe(method_family = none)]
263 pub fn data(&self) -> Retained<NSData>;
264
265 #[unsafe(method(booleanValue))]
266 #[unsafe(method_family = none)]
267 pub fn booleanValue(&self) -> Boolean;
268
269 #[unsafe(method(enumCodeValue))]
270 #[unsafe(method_family = none)]
271 pub fn enumCodeValue(&self) -> OSType;
272
273 #[unsafe(method(int32Value))]
274 #[unsafe(method_family = none)]
275 pub fn int32Value(&self) -> i32;
276
277 #[unsafe(method(doubleValue))]
278 #[unsafe(method_family = none)]
279 pub fn doubleValue(&self) -> c_double;
280
281 #[unsafe(method(typeCodeValue))]
282 #[unsafe(method_family = none)]
283 pub fn typeCodeValue(&self) -> OSType;
284
285 #[cfg(feature = "NSString")]
286 #[unsafe(method(stringValue))]
287 #[unsafe(method_family = none)]
288 pub fn stringValue(&self) -> Option<Retained<NSString>>;
289
290 #[cfg(feature = "NSDate")]
291 #[unsafe(method(dateValue))]
292 #[unsafe(method_family = none)]
293 pub fn dateValue(&self) -> Option<Retained<NSDate>>;
294
295 #[cfg(feature = "NSURL")]
296 #[unsafe(method(fileURLValue))]
297 #[unsafe(method_family = none)]
298 pub fn fileURLValue(&self) -> Option<Retained<NSURL>>;
299
300 #[cfg(feature = "objc2-core-services")]
301 #[cfg(target_vendor = "apple")]
302 #[unsafe(method(eventClass))]
303 #[unsafe(method_family = none)]
304 pub fn eventClass(&self) -> AEEventClass;
305
306 #[cfg(feature = "objc2-core-services")]
307 #[cfg(target_vendor = "apple")]
308 #[unsafe(method(eventID))]
309 #[unsafe(method_family = none)]
310 pub fn eventID(&self) -> AEEventID;
311
312 #[cfg(feature = "objc2-core-services")]
313 #[cfg(target_vendor = "apple")]
314 #[unsafe(method(returnID))]
315 #[unsafe(method_family = none)]
316 pub fn returnID(&self) -> AEReturnID;
317
318 #[cfg(feature = "objc2-core-services")]
319 #[cfg(target_vendor = "apple")]
320 #[unsafe(method(transactionID))]
321 #[unsafe(method_family = none)]
322 pub fn transactionID(&self) -> AETransactionID;
323
324 #[cfg(feature = "objc2-core-services")]
325 #[cfg(target_vendor = "apple")]
326 #[unsafe(method(setParamDescriptor:forKeyword:))]
327 #[unsafe(method_family = none)]
328 pub fn setParamDescriptor_forKeyword(
329 &self,
330 descriptor: &NSAppleEventDescriptor,
331 keyword: AEKeyword,
332 );
333
334 #[cfg(feature = "objc2-core-services")]
335 #[cfg(target_vendor = "apple")]
336 #[unsafe(method(paramDescriptorForKeyword:))]
337 #[unsafe(method_family = none)]
338 pub fn paramDescriptorForKeyword(
339 &self,
340 keyword: AEKeyword,
341 ) -> Option<Retained<NSAppleEventDescriptor>>;
342
343 #[cfg(feature = "objc2-core-services")]
344 #[cfg(target_vendor = "apple")]
345 #[unsafe(method(removeParamDescriptorWithKeyword:))]
346 #[unsafe(method_family = none)]
347 pub fn removeParamDescriptorWithKeyword(&self, keyword: AEKeyword);
348
349 #[cfg(feature = "objc2-core-services")]
350 #[cfg(target_vendor = "apple")]
351 #[unsafe(method(setAttributeDescriptor:forKeyword:))]
352 #[unsafe(method_family = none)]
353 pub fn setAttributeDescriptor_forKeyword(
354 &self,
355 descriptor: &NSAppleEventDescriptor,
356 keyword: AEKeyword,
357 );
358
359 #[cfg(feature = "objc2-core-services")]
360 #[cfg(target_vendor = "apple")]
361 #[unsafe(method(attributeDescriptorForKeyword:))]
362 #[unsafe(method_family = none)]
363 pub fn attributeDescriptorForKeyword(
364 &self,
365 keyword: AEKeyword,
366 ) -> Option<Retained<NSAppleEventDescriptor>>;
367
368 #[cfg(all(feature = "NSDate", feature = "NSError"))]
369 #[unsafe(method(sendEventWithOptions:timeout:error:_))]
370 #[unsafe(method_family = none)]
371 pub fn sendEventWithOptions_timeout_error(
372 &self,
373 send_options: NSAppleEventSendOptions,
374 timeout_in_seconds: NSTimeInterval,
375 ) -> Result<Retained<NSAppleEventDescriptor>, Retained<NSError>>;
376
377 #[unsafe(method(isRecordDescriptor))]
378 #[unsafe(method_family = none)]
379 pub fn isRecordDescriptor(&self) -> bool;
380
381 #[unsafe(method(numberOfItems))]
382 #[unsafe(method_family = none)]
383 pub fn numberOfItems(&self) -> NSInteger;
384
385 #[unsafe(method(insertDescriptor:atIndex:))]
386 #[unsafe(method_family = none)]
387 pub fn insertDescriptor_atIndex(
388 &self,
389 descriptor: &NSAppleEventDescriptor,
390 index: NSInteger,
391 );
392
393 #[unsafe(method(descriptorAtIndex:))]
394 #[unsafe(method_family = none)]
395 pub fn descriptorAtIndex(
396 &self,
397 index: NSInteger,
398 ) -> Option<Retained<NSAppleEventDescriptor>>;
399
400 #[unsafe(method(removeDescriptorAtIndex:))]
401 #[unsafe(method_family = none)]
402 pub fn removeDescriptorAtIndex(&self, index: NSInteger);
403
404 #[cfg(feature = "objc2-core-services")]
405 #[cfg(target_vendor = "apple")]
406 #[unsafe(method(setDescriptor:forKeyword:))]
407 #[unsafe(method_family = none)]
408 pub fn setDescriptor_forKeyword(
409 &self,
410 descriptor: &NSAppleEventDescriptor,
411 keyword: AEKeyword,
412 );
413
414 #[cfg(feature = "objc2-core-services")]
415 #[cfg(target_vendor = "apple")]
416 #[unsafe(method(descriptorForKeyword:))]
417 #[unsafe(method_family = none)]
418 pub fn descriptorForKeyword(
419 &self,
420 keyword: AEKeyword,
421 ) -> Option<Retained<NSAppleEventDescriptor>>;
422
423 #[cfg(feature = "objc2-core-services")]
424 #[cfg(target_vendor = "apple")]
425 #[unsafe(method(removeDescriptorWithKeyword:))]
426 #[unsafe(method_family = none)]
427 pub fn removeDescriptorWithKeyword(&self, keyword: AEKeyword);
428
429 #[cfg(feature = "objc2-core-services")]
430 #[cfg(target_vendor = "apple")]
431 #[unsafe(method(keywordForDescriptorAtIndex:))]
432 #[unsafe(method_family = none)]
433 pub fn keywordForDescriptorAtIndex(&self, index: NSInteger) -> AEKeyword;
434
435 #[cfg(feature = "objc2-core-services")]
436 #[cfg(target_vendor = "apple")]
437 #[unsafe(method(coerceToDescriptorType:))]
438 #[unsafe(method_family = none)]
439 pub fn coerceToDescriptorType(
440 &self,
441 descriptor_type: DescType,
442 ) -> Option<Retained<NSAppleEventDescriptor>>;
443 );
444}
445
446impl NSAppleEventDescriptor {
448 extern_methods!(
449 #[unsafe(method(init))]
450 #[unsafe(method_family = init)]
451 pub fn init(this: Allocated<Self>) -> Retained<Self>;
452
453 #[unsafe(method(new))]
454 #[unsafe(method_family = new)]
455 pub fn new() -> Retained<Self>;
456 );
457}
458
459impl DefaultRetained for NSAppleEventDescriptor {
460 #[inline]
461 fn default_retained() -> Retained<Self> {
462 Self::new()
463 }
464}