objc2_foundation/generated/
NSSpellServer.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
9extern_class!(
10    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsspellserver?language=objc)
11    #[unsafe(super(NSObject))]
12    #[derive(Debug, PartialEq, Eq, Hash)]
13    pub struct NSSpellServer;
14);
15
16extern_conformance!(
17    unsafe impl NSObjectProtocol for NSSpellServer {}
18);
19
20impl NSSpellServer {
21    extern_methods!(
22        /// # Safety
23        ///
24        /// This is not retained internally, you must ensure the object is still alive.
25        #[unsafe(method(delegate))]
26        #[unsafe(method_family = none)]
27        pub unsafe fn delegate(
28            &self,
29        ) -> Option<Retained<ProtocolObject<dyn NSSpellServerDelegate>>>;
30
31        /// Setter for [`delegate`][Self::delegate].
32        ///
33        /// # Safety
34        ///
35        /// This is unretained, you must ensure the object is kept alive while in use.
36        #[unsafe(method(setDelegate:))]
37        #[unsafe(method_family = none)]
38        pub unsafe fn setDelegate(
39            &self,
40            delegate: Option<&ProtocolObject<dyn NSSpellServerDelegate>>,
41        );
42
43        #[cfg(feature = "NSString")]
44        #[unsafe(method(registerLanguage:byVendor:))]
45        #[unsafe(method_family = none)]
46        pub fn registerLanguage_byVendor(
47            &self,
48            language: Option<&NSString>,
49            vendor: Option<&NSString>,
50        ) -> bool;
51
52        #[cfg(feature = "NSString")]
53        #[unsafe(method(isWordInUserDictionaries:caseSensitive:))]
54        #[unsafe(method_family = none)]
55        pub fn isWordInUserDictionaries_caseSensitive(&self, word: &NSString, flag: bool) -> bool;
56
57        #[unsafe(method(run))]
58        #[unsafe(method_family = none)]
59        pub fn run(&self);
60    );
61}
62
63/// Methods declared on superclass `NSObject`.
64impl NSSpellServer {
65    extern_methods!(
66        #[unsafe(method(init))]
67        #[unsafe(method_family = init)]
68        pub fn init(this: Allocated<Self>) -> Retained<Self>;
69
70        #[unsafe(method(new))]
71        #[unsafe(method_family = new)]
72        pub fn new() -> Retained<Self>;
73    );
74}
75
76impl DefaultRetained for NSSpellServer {
77    #[inline]
78    fn default_retained() -> Retained<Self> {
79        Self::new()
80    }
81}
82
83extern "C" {
84    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsgrammarrange?language=objc)
85    #[cfg(feature = "NSString")]
86    pub static NSGrammarRange: &'static NSString;
87}
88
89extern "C" {
90    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsgrammaruserdescription?language=objc)
91    #[cfg(feature = "NSString")]
92    pub static NSGrammarUserDescription: &'static NSString;
93}
94
95extern "C" {
96    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsgrammarcorrections?language=objc)
97    #[cfg(feature = "NSString")]
98    pub static NSGrammarCorrections: &'static NSString;
99}
100
101extern_protocol!(
102    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsspellserverdelegate?language=objc)
103    pub unsafe trait NSSpellServerDelegate: NSObjectProtocol {
104        #[cfg(all(feature = "NSRange", feature = "NSString"))]
105        /// # Safety
106        ///
107        /// `word_count` must be a valid pointer.
108        #[optional]
109        #[unsafe(method(spellServer:findMisspelledWordInString:language:wordCount:countOnly:))]
110        #[unsafe(method_family = none)]
111        unsafe fn spellServer_findMisspelledWordInString_language_wordCount_countOnly(
112            &self,
113            sender: &NSSpellServer,
114            string_to_check: &NSString,
115            language: &NSString,
116            word_count: NonNull<NSInteger>,
117            count_only: bool,
118        ) -> NSRange;
119
120        #[cfg(all(feature = "NSArray", feature = "NSString"))]
121        #[optional]
122        #[unsafe(method(spellServer:suggestGuessesForWord:inLanguage:))]
123        #[unsafe(method_family = none)]
124        fn spellServer_suggestGuessesForWord_inLanguage(
125            &self,
126            sender: &NSSpellServer,
127            word: &NSString,
128            language: &NSString,
129        ) -> Option<Retained<NSArray<NSString>>>;
130
131        #[cfg(feature = "NSString")]
132        #[optional]
133        #[unsafe(method(spellServer:didLearnWord:inLanguage:))]
134        #[unsafe(method_family = none)]
135        fn spellServer_didLearnWord_inLanguage(
136            &self,
137            sender: &NSSpellServer,
138            word: &NSString,
139            language: &NSString,
140        );
141
142        #[cfg(feature = "NSString")]
143        #[optional]
144        #[unsafe(method(spellServer:didForgetWord:inLanguage:))]
145        #[unsafe(method_family = none)]
146        fn spellServer_didForgetWord_inLanguage(
147            &self,
148            sender: &NSSpellServer,
149            word: &NSString,
150            language: &NSString,
151        );
152
153        #[cfg(all(feature = "NSArray", feature = "NSRange", feature = "NSString"))]
154        #[optional]
155        #[unsafe(method(spellServer:suggestCompletionsForPartialWordRange:inString:language:))]
156        #[unsafe(method_family = none)]
157        fn spellServer_suggestCompletionsForPartialWordRange_inString_language(
158            &self,
159            sender: &NSSpellServer,
160            range: NSRange,
161            string: &NSString,
162            language: &NSString,
163        ) -> Option<Retained<NSArray<NSString>>>;
164
165        #[cfg(all(
166            feature = "NSArray",
167            feature = "NSDictionary",
168            feature = "NSRange",
169            feature = "NSString"
170        ))]
171        /// # Safety
172        ///
173        /// `details` generic generic should be of the correct type.
174        #[optional]
175        #[unsafe(method(spellServer:checkGrammarInString:language:details:))]
176        #[unsafe(method_family = none)]
177        unsafe fn spellServer_checkGrammarInString_language_details(
178            &self,
179            sender: &NSSpellServer,
180            string_to_check: &NSString,
181            language: Option<&NSString>,
182            details: Option<&mut Option<Retained<NSArray<NSDictionary<NSString, AnyObject>>>>>,
183        ) -> NSRange;
184
185        #[cfg(all(
186            feature = "NSArray",
187            feature = "NSDictionary",
188            feature = "NSOrthography",
189            feature = "NSString",
190            feature = "NSTextCheckingResult"
191        ))]
192        /// # Safety
193        ///
194        /// - `options` generic should be of the correct type.
195        /// - `word_count` must be a valid pointer.
196        #[optional]
197        #[unsafe(method(spellServer:checkString:offset:types:options:orthography:wordCount:))]
198        #[unsafe(method_family = none)]
199        unsafe fn spellServer_checkString_offset_types_options_orthography_wordCount(
200            &self,
201            sender: &NSSpellServer,
202            string_to_check: &NSString,
203            offset: NSUInteger,
204            checking_types: NSTextCheckingTypes,
205            options: Option<&NSDictionary<NSString, AnyObject>>,
206            orthography: Option<&NSOrthography>,
207            word_count: NonNull<NSInteger>,
208        ) -> Option<Retained<NSArray<NSTextCheckingResult>>>;
209
210        #[cfg(feature = "NSString")]
211        #[optional]
212        #[unsafe(method(spellServer:recordResponse:toCorrection:forWord:language:))]
213        #[unsafe(method_family = none)]
214        fn spellServer_recordResponse_toCorrection_forWord_language(
215            &self,
216            sender: &NSSpellServer,
217            response: NSUInteger,
218            correction: &NSString,
219            word: &NSString,
220            language: &NSString,
221        );
222    }
223);