1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;

use crate::*;

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSAppleEventSendOptions(pub NSUInteger);
bitflags::bitflags! {
    impl NSAppleEventSendOptions: NSUInteger {
        const NSAppleEventSendNoReply = 1;
        const NSAppleEventSendQueueReply = 2;
        const NSAppleEventSendWaitForReply = 3;
        const NSAppleEventSendNeverInteract = 16;
        const NSAppleEventSendCanInteract = 32;
        const NSAppleEventSendAlwaysInteract = 48;
        const NSAppleEventSendCanSwitchLayer = 64;
        const NSAppleEventSendDontRecord = 4096;
        const NSAppleEventSendDontExecute = 8192;
        const NSAppleEventSendDontAnnotate = 65536;
        const NSAppleEventSendDefaultOptions = 35;
    }
}

unsafe impl Encode for NSAppleEventSendOptions {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSAppleEventSendOptions {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSAppleEventDescriptor;

    unsafe impl ClassType for NSAppleEventDescriptor {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSAppleEventDescriptor {}

#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSAppleEventDescriptor {}

unsafe impl NSObjectProtocol for NSAppleEventDescriptor {}

#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSAppleEventDescriptor {}

extern_methods!(
    unsafe impl NSAppleEventDescriptor {
        #[method_id(@__retain_semantics Other nullDescriptor)]
        pub unsafe fn nullDescriptor() -> Retained<NSAppleEventDescriptor>;

        #[method_id(@__retain_semantics Other descriptorWithBoolean:)]
        pub unsafe fn descriptorWithBoolean(boolean: Boolean) -> Retained<NSAppleEventDescriptor>;

        #[method_id(@__retain_semantics Other descriptorWithEnumCode:)]
        pub unsafe fn descriptorWithEnumCode(
            enumerator: OSType,
        ) -> Retained<NSAppleEventDescriptor>;

        #[method_id(@__retain_semantics Other descriptorWithInt32:)]
        pub unsafe fn descriptorWithInt32(signed_int: i32) -> Retained<NSAppleEventDescriptor>;

        #[method_id(@__retain_semantics Other descriptorWithDouble:)]
        pub unsafe fn descriptorWithDouble(
            double_value: c_double,
        ) -> Retained<NSAppleEventDescriptor>;

        #[method_id(@__retain_semantics Other descriptorWithTypeCode:)]
        pub unsafe fn descriptorWithTypeCode(type_code: OSType)
            -> Retained<NSAppleEventDescriptor>;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other descriptorWithString:)]
        pub unsafe fn descriptorWithString(string: &NSString) -> Retained<NSAppleEventDescriptor>;

        #[cfg(feature = "NSDate")]
        #[method_id(@__retain_semantics Other descriptorWithDate:)]
        pub unsafe fn descriptorWithDate(date: &NSDate) -> Retained<NSAppleEventDescriptor>;

        #[cfg(feature = "NSURL")]
        #[method_id(@__retain_semantics Other descriptorWithFileURL:)]
        pub unsafe fn descriptorWithFileURL(file_url: &NSURL) -> Retained<NSAppleEventDescriptor>;

        #[method_id(@__retain_semantics Other listDescriptor)]
        pub unsafe fn listDescriptor() -> Retained<NSAppleEventDescriptor>;

        #[method_id(@__retain_semantics Other recordDescriptor)]
        pub unsafe fn recordDescriptor() -> Retained<NSAppleEventDescriptor>;

        #[method_id(@__retain_semantics Other currentProcessDescriptor)]
        pub unsafe fn currentProcessDescriptor() -> Retained<NSAppleEventDescriptor>;

        #[cfg(feature = "libc")]
        #[method_id(@__retain_semantics Other descriptorWithProcessIdentifier:)]
        pub unsafe fn descriptorWithProcessIdentifier(
            process_identifier: libc::pid_t,
        ) -> Retained<NSAppleEventDescriptor>;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other descriptorWithBundleIdentifier:)]
        pub unsafe fn descriptorWithBundleIdentifier(
            bundle_identifier: &NSString,
        ) -> Retained<NSAppleEventDescriptor>;

        #[cfg(feature = "NSURL")]
        #[method_id(@__retain_semantics Other descriptorWithApplicationURL:)]
        pub unsafe fn descriptorWithApplicationURL(
            application_url: &NSURL,
        ) -> Retained<NSAppleEventDescriptor>;

        #[method_id(@__retain_semantics Init initListDescriptor)]
        pub unsafe fn initListDescriptor(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics Init initRecordDescriptor)]
        pub unsafe fn initRecordDescriptor(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "NSData")]
        #[method_id(@__retain_semantics Other data)]
        pub unsafe fn data(&self) -> Retained<NSData>;

        #[method(booleanValue)]
        pub unsafe fn booleanValue(&self) -> Boolean;

        #[method(enumCodeValue)]
        pub unsafe fn enumCodeValue(&self) -> OSType;

        #[method(int32Value)]
        pub unsafe fn int32Value(&self) -> i32;

        #[method(doubleValue)]
        pub unsafe fn doubleValue(&self) -> c_double;

        #[method(typeCodeValue)]
        pub unsafe fn typeCodeValue(&self) -> OSType;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other stringValue)]
        pub unsafe fn stringValue(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSDate")]
        #[method_id(@__retain_semantics Other dateValue)]
        pub unsafe fn dateValue(&self) -> Option<Retained<NSDate>>;

        #[cfg(feature = "NSURL")]
        #[method_id(@__retain_semantics Other fileURLValue)]
        pub unsafe fn fileURLValue(&self) -> Option<Retained<NSURL>>;

        #[method(isRecordDescriptor)]
        pub unsafe fn isRecordDescriptor(&self) -> bool;

        #[method(numberOfItems)]
        pub unsafe fn numberOfItems(&self) -> NSInteger;

        #[method(insertDescriptor:atIndex:)]
        pub unsafe fn insertDescriptor_atIndex(
            &self,
            descriptor: &NSAppleEventDescriptor,
            index: NSInteger,
        );

        #[method_id(@__retain_semantics Other descriptorAtIndex:)]
        pub unsafe fn descriptorAtIndex(
            &self,
            index: NSInteger,
        ) -> Option<Retained<NSAppleEventDescriptor>>;

        #[method(removeDescriptorAtIndex:)]
        pub unsafe fn removeDescriptorAtIndex(&self, index: NSInteger);
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl NSAppleEventDescriptor {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);