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
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;

use crate::*;

pub const NSNoScriptError: NSInteger = 0;
pub const NSReceiverEvaluationScriptError: NSInteger = 1;
pub const NSKeySpecifierEvaluationScriptError: NSInteger = 2;
pub const NSArgumentEvaluationScriptError: NSInteger = 3;
pub const NSReceiversCantHandleCommandScriptError: NSInteger = 4;
pub const NSRequiredArgumentsMissingScriptError: NSInteger = 5;
pub const NSArgumentsWrongScriptError: NSInteger = 6;
pub const NSUnknownKeyScriptError: NSInteger = 7;
pub const NSInternalScriptError: NSInteger = 8;
pub const NSOperationNotSupportedForKeyScriptError: NSInteger = 9;
pub const NSCannotCreateScriptCommandError: NSInteger = 10;

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

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

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

unsafe impl NSObjectProtocol for NSScriptCommand {}

extern_methods!(
    unsafe impl NSScriptCommand {
        #[cfg(feature = "NSScriptCommandDescription")]
        #[method_id(@__retain_semantics Init initWithCommandDescription:)]
        pub unsafe fn initWithCommandDescription(
            this: Allocated<Self>,
            command_def: &NSScriptCommandDescription,
        ) -> Retained<Self>;

        #[cfg(feature = "NSCoder")]
        #[method_id(@__retain_semantics Init initWithCoder:)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            in_coder: &NSCoder,
        ) -> Option<Retained<Self>>;

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

        #[method_id(@__retain_semantics Other directParameter)]
        pub unsafe fn directParameter(&self) -> Option<Retained<AnyObject>>;

        #[method(setDirectParameter:)]
        pub unsafe fn setDirectParameter(&self, direct_parameter: Option<&AnyObject>);

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

        #[cfg(feature = "NSScriptObjectSpecifiers")]
        #[method(setReceiversSpecifier:)]
        pub unsafe fn setReceiversSpecifier(
            &self,
            receivers_specifier: Option<&NSScriptObjectSpecifier>,
        );

        #[method_id(@__retain_semantics Other evaluatedReceivers)]
        pub unsafe fn evaluatedReceivers(&self) -> Option<Retained<AnyObject>>;

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

        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
        #[method(setArguments:)]
        pub unsafe fn setArguments(&self, arguments: Option<&NSDictionary<NSString, AnyObject>>);

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

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

        #[method_id(@__retain_semantics Other performDefaultImplementation)]
        pub unsafe fn performDefaultImplementation(&self) -> Option<Retained<AnyObject>>;

        #[method_id(@__retain_semantics Other executeCommand)]
        pub unsafe fn executeCommand(&self) -> Option<Retained<AnyObject>>;

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

        #[method(setScriptErrorNumber:)]
        pub unsafe fn setScriptErrorNumber(&self, script_error_number: NSInteger);

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

        #[cfg(feature = "NSAppleEventDescriptor")]
        #[method(setScriptErrorOffendingObjectDescriptor:)]
        pub unsafe fn setScriptErrorOffendingObjectDescriptor(
            &self,
            script_error_offending_object_descriptor: Option<&NSAppleEventDescriptor>,
        );

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

        #[cfg(feature = "NSAppleEventDescriptor")]
        #[method(setScriptErrorExpectedTypeDescriptor:)]
        pub unsafe fn setScriptErrorExpectedTypeDescriptor(
            &self,
            script_error_expected_type_descriptor: Option<&NSAppleEventDescriptor>,
        );

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

        #[cfg(feature = "NSString")]
        #[method(setScriptErrorString:)]
        pub unsafe fn setScriptErrorString(&self, script_error_string: Option<&NSString>);

        #[method_id(@__retain_semantics Other currentCommand)]
        pub unsafe fn currentCommand() -> Option<Retained<NSScriptCommand>>;

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

        #[method(suspendExecution)]
        pub unsafe fn suspendExecution(&self);

        #[method(resumeExecutionWithResult:)]
        pub unsafe fn resumeExecutionWithResult(&self, result: Option<&AnyObject>);
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl NSScriptCommand {
        #[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>;
    }
);