objc2_foundation/generated/
NSScriptCommand.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/nsnoscripterror?language=objc)
10pub const NSNoScriptError: NSInteger = 0;
11/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsreceiverevaluationscripterror?language=objc)
12pub const NSReceiverEvaluationScriptError: NSInteger = 1;
13/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nskeyspecifierevaluationscripterror?language=objc)
14pub const NSKeySpecifierEvaluationScriptError: NSInteger = 2;
15/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsargumentevaluationscripterror?language=objc)
16pub const NSArgumentEvaluationScriptError: NSInteger = 3;
17/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsreceiverscanthandlecommandscripterror?language=objc)
18pub const NSReceiversCantHandleCommandScriptError: NSInteger = 4;
19/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsrequiredargumentsmissingscripterror?language=objc)
20pub const NSRequiredArgumentsMissingScriptError: NSInteger = 5;
21/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsargumentswrongscripterror?language=objc)
22pub const NSArgumentsWrongScriptError: NSInteger = 6;
23/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsunknownkeyscripterror?language=objc)
24pub const NSUnknownKeyScriptError: NSInteger = 7;
25/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsinternalscripterror?language=objc)
26pub const NSInternalScriptError: NSInteger = 8;
27/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsoperationnotsupportedforkeyscripterror?language=objc)
28pub const NSOperationNotSupportedForKeyScriptError: NSInteger = 9;
29/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nscannotcreatescriptcommanderror?language=objc)
30pub const NSCannotCreateScriptCommandError: NSInteger = 10;
31
32extern_class!(
33    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsscriptcommand?language=objc)
34    #[unsafe(super(NSObject))]
35    #[derive(Debug, PartialEq, Eq, Hash)]
36    pub struct NSScriptCommand;
37);
38
39#[cfg(feature = "NSObject")]
40extern_conformance!(
41    unsafe impl NSCoding for NSScriptCommand {}
42);
43
44extern_conformance!(
45    unsafe impl NSObjectProtocol for NSScriptCommand {}
46);
47
48impl NSScriptCommand {
49    extern_methods!(
50        #[cfg(feature = "NSScriptCommandDescription")]
51        #[unsafe(method(initWithCommandDescription:))]
52        #[unsafe(method_family = init)]
53        pub fn initWithCommandDescription(
54            this: Allocated<Self>,
55            command_def: &NSScriptCommandDescription,
56        ) -> Retained<Self>;
57
58        #[cfg(feature = "NSCoder")]
59        /// # Safety
60        ///
61        /// `in_coder` possibly has further requirements.
62        #[unsafe(method(initWithCoder:))]
63        #[unsafe(method_family = init)]
64        pub unsafe fn initWithCoder(
65            this: Allocated<Self>,
66            in_coder: &NSCoder,
67        ) -> Option<Retained<Self>>;
68
69        #[cfg(feature = "NSScriptCommandDescription")]
70        #[unsafe(method(commandDescription))]
71        #[unsafe(method_family = none)]
72        pub fn commandDescription(&self) -> Retained<NSScriptCommandDescription>;
73
74        #[unsafe(method(directParameter))]
75        #[unsafe(method_family = none)]
76        pub fn directParameter(&self) -> Option<Retained<AnyObject>>;
77
78        /// Setter for [`directParameter`][Self::directParameter].
79        ///
80        /// # Safety
81        ///
82        /// `direct_parameter` should be of the correct type.
83        #[unsafe(method(setDirectParameter:))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn setDirectParameter(&self, direct_parameter: Option<&AnyObject>);
86
87        #[cfg(feature = "NSScriptObjectSpecifiers")]
88        #[unsafe(method(receiversSpecifier))]
89        #[unsafe(method_family = none)]
90        pub fn receiversSpecifier(&self) -> Option<Retained<NSScriptObjectSpecifier>>;
91
92        #[cfg(feature = "NSScriptObjectSpecifiers")]
93        /// Setter for [`receiversSpecifier`][Self::receiversSpecifier].
94        #[unsafe(method(setReceiversSpecifier:))]
95        #[unsafe(method_family = none)]
96        pub fn setReceiversSpecifier(&self, receivers_specifier: Option<&NSScriptObjectSpecifier>);
97
98        #[unsafe(method(evaluatedReceivers))]
99        #[unsafe(method_family = none)]
100        pub fn evaluatedReceivers(&self) -> Option<Retained<AnyObject>>;
101
102        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
103        #[unsafe(method(arguments))]
104        #[unsafe(method_family = none)]
105        pub fn arguments(&self) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
106
107        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
108        /// Setter for [`arguments`][Self::arguments].
109        ///
110        /// This is [copied][crate::NSCopying::copy] when set.
111        ///
112        /// # Safety
113        ///
114        /// `arguments` generic should be of the correct type.
115        #[unsafe(method(setArguments:))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn setArguments(&self, arguments: Option<&NSDictionary<NSString, AnyObject>>);
118
119        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
120        #[unsafe(method(evaluatedArguments))]
121        #[unsafe(method_family = none)]
122        pub fn evaluatedArguments(&self) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
123
124        #[unsafe(method(isWellFormed))]
125        #[unsafe(method_family = none)]
126        pub fn isWellFormed(&self) -> bool;
127
128        #[unsafe(method(performDefaultImplementation))]
129        #[unsafe(method_family = none)]
130        pub fn performDefaultImplementation(&self) -> Option<Retained<AnyObject>>;
131
132        #[unsafe(method(executeCommand))]
133        #[unsafe(method_family = none)]
134        pub fn executeCommand(&self) -> Option<Retained<AnyObject>>;
135
136        #[unsafe(method(scriptErrorNumber))]
137        #[unsafe(method_family = none)]
138        pub fn scriptErrorNumber(&self) -> NSInteger;
139
140        /// Setter for [`scriptErrorNumber`][Self::scriptErrorNumber].
141        #[unsafe(method(setScriptErrorNumber:))]
142        #[unsafe(method_family = none)]
143        pub fn setScriptErrorNumber(&self, script_error_number: NSInteger);
144
145        #[cfg(feature = "NSAppleEventDescriptor")]
146        #[unsafe(method(scriptErrorOffendingObjectDescriptor))]
147        #[unsafe(method_family = none)]
148        pub fn scriptErrorOffendingObjectDescriptor(
149            &self,
150        ) -> Option<Retained<NSAppleEventDescriptor>>;
151
152        #[cfg(feature = "NSAppleEventDescriptor")]
153        /// Setter for [`scriptErrorOffendingObjectDescriptor`][Self::scriptErrorOffendingObjectDescriptor].
154        #[unsafe(method(setScriptErrorOffendingObjectDescriptor:))]
155        #[unsafe(method_family = none)]
156        pub fn setScriptErrorOffendingObjectDescriptor(
157            &self,
158            script_error_offending_object_descriptor: Option<&NSAppleEventDescriptor>,
159        );
160
161        #[cfg(feature = "NSAppleEventDescriptor")]
162        #[unsafe(method(scriptErrorExpectedTypeDescriptor))]
163        #[unsafe(method_family = none)]
164        pub fn scriptErrorExpectedTypeDescriptor(&self)
165            -> Option<Retained<NSAppleEventDescriptor>>;
166
167        #[cfg(feature = "NSAppleEventDescriptor")]
168        /// Setter for [`scriptErrorExpectedTypeDescriptor`][Self::scriptErrorExpectedTypeDescriptor].
169        #[unsafe(method(setScriptErrorExpectedTypeDescriptor:))]
170        #[unsafe(method_family = none)]
171        pub fn setScriptErrorExpectedTypeDescriptor(
172            &self,
173            script_error_expected_type_descriptor: Option<&NSAppleEventDescriptor>,
174        );
175
176        #[cfg(feature = "NSString")]
177        #[unsafe(method(scriptErrorString))]
178        #[unsafe(method_family = none)]
179        pub fn scriptErrorString(&self) -> Option<Retained<NSString>>;
180
181        #[cfg(feature = "NSString")]
182        /// Setter for [`scriptErrorString`][Self::scriptErrorString].
183        ///
184        /// This is [copied][crate::NSCopying::copy] when set.
185        #[unsafe(method(setScriptErrorString:))]
186        #[unsafe(method_family = none)]
187        pub fn setScriptErrorString(&self, script_error_string: Option<&NSString>);
188
189        #[unsafe(method(currentCommand))]
190        #[unsafe(method_family = none)]
191        pub fn currentCommand() -> Option<Retained<NSScriptCommand>>;
192
193        #[cfg(feature = "NSAppleEventDescriptor")]
194        #[unsafe(method(appleEvent))]
195        #[unsafe(method_family = none)]
196        pub fn appleEvent(&self) -> Option<Retained<NSAppleEventDescriptor>>;
197
198        #[unsafe(method(suspendExecution))]
199        #[unsafe(method_family = none)]
200        pub fn suspendExecution(&self);
201
202        /// # Safety
203        ///
204        /// `result` should be of the correct type.
205        #[unsafe(method(resumeExecutionWithResult:))]
206        #[unsafe(method_family = none)]
207        pub unsafe fn resumeExecutionWithResult(&self, result: Option<&AnyObject>);
208    );
209}
210
211/// Methods declared on superclass `NSObject`.
212impl NSScriptCommand {
213    extern_methods!(
214        #[unsafe(method(init))]
215        #[unsafe(method_family = init)]
216        pub fn init(this: Allocated<Self>) -> Retained<Self>;
217
218        #[unsafe(method(new))]
219        #[unsafe(method_family = new)]
220        pub fn new() -> Retained<Self>;
221    );
222}
223
224impl DefaultRetained for NSScriptCommand {
225    #[inline]
226    fn default_retained() -> Retained<Self> {
227        Self::new()
228    }
229}