Source code

Revision control

Copy as Markdown

Other Tools

//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use crate::*;
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSSpellServer;
);
extern_conformance!(
unsafe impl NSObjectProtocol for NSSpellServer {}
);
impl NSSpellServer {
extern_methods!(
/// # Safety
///
/// This is not retained internally, you must ensure the object is still alive.
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub unsafe fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn NSSpellServerDelegate>>>;
/// Setter for [`delegate`][Self::delegate].
///
/// # Safety
///
/// This is unretained, you must ensure the object is kept alive while in use.
#[unsafe(method(setDelegate:))]
#[unsafe(method_family = none)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn NSSpellServerDelegate>>,
);
#[cfg(feature = "NSString")]
#[unsafe(method(registerLanguage:byVendor:))]
#[unsafe(method_family = none)]
pub fn registerLanguage_byVendor(
&self,
language: Option<&NSString>,
vendor: Option<&NSString>,
) -> bool;
#[cfg(feature = "NSString")]
#[unsafe(method(isWordInUserDictionaries:caseSensitive:))]
#[unsafe(method_family = none)]
pub fn isWordInUserDictionaries_caseSensitive(&self, word: &NSString, flag: bool) -> bool;
#[unsafe(method(run))]
#[unsafe(method_family = none)]
pub fn run(&self);
);
}
/// Methods declared on superclass `NSObject`.
impl NSSpellServer {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for NSSpellServer {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSGrammarRange: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSGrammarUserDescription: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSGrammarCorrections: &'static NSString;
}
extern_protocol!(
pub unsafe trait NSSpellServerDelegate: NSObjectProtocol {
#[cfg(all(feature = "NSRange", feature = "NSString"))]
/// # Safety
///
/// `word_count` must be a valid pointer.
#[optional]
#[unsafe(method(spellServer:findMisspelledWordInString:language:wordCount:countOnly:))]
#[unsafe(method_family = none)]
unsafe fn spellServer_findMisspelledWordInString_language_wordCount_countOnly(
&self,
sender: &NSSpellServer,
string_to_check: &NSString,
language: &NSString,
word_count: NonNull<NSInteger>,
count_only: bool,
) -> NSRange;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[optional]
#[unsafe(method(spellServer:suggestGuessesForWord:inLanguage:))]
#[unsafe(method_family = none)]
fn spellServer_suggestGuessesForWord_inLanguage(
&self,
sender: &NSSpellServer,
word: &NSString,
language: &NSString,
) -> Option<Retained<NSArray<NSString>>>;
#[cfg(feature = "NSString")]
#[optional]
#[unsafe(method(spellServer:didLearnWord:inLanguage:))]
#[unsafe(method_family = none)]
fn spellServer_didLearnWord_inLanguage(
&self,
sender: &NSSpellServer,
word: &NSString,
language: &NSString,
);
#[cfg(feature = "NSString")]
#[optional]
#[unsafe(method(spellServer:didForgetWord:inLanguage:))]
#[unsafe(method_family = none)]
fn spellServer_didForgetWord_inLanguage(
&self,
sender: &NSSpellServer,
word: &NSString,
language: &NSString,
);
#[cfg(all(feature = "NSArray", feature = "NSRange", feature = "NSString"))]
#[optional]
#[unsafe(method(spellServer:suggestCompletionsForPartialWordRange:inString:language:))]
#[unsafe(method_family = none)]
fn spellServer_suggestCompletionsForPartialWordRange_inString_language(
&self,
sender: &NSSpellServer,
range: NSRange,
string: &NSString,
language: &NSString,
) -> Option<Retained<NSArray<NSString>>>;
#[cfg(all(
feature = "NSArray",
feature = "NSDictionary",
feature = "NSRange",
feature = "NSString"
))]
/// # Safety
///
/// `details` generic generic should be of the correct type.
#[optional]
#[unsafe(method(spellServer:checkGrammarInString:language:details:))]
#[unsafe(method_family = none)]
unsafe fn spellServer_checkGrammarInString_language_details(
&self,
sender: &NSSpellServer,
string_to_check: &NSString,
language: Option<&NSString>,
details: Option<&mut Option<Retained<NSArray<NSDictionary<NSString, AnyObject>>>>>,
) -> NSRange;
#[cfg(all(
feature = "NSArray",
feature = "NSDictionary",
feature = "NSOrthography",
feature = "NSString",
feature = "NSTextCheckingResult"
))]
/// # Safety
///
/// - `options` generic should be of the correct type.
/// - `word_count` must be a valid pointer.
#[optional]
#[unsafe(method(spellServer:checkString:offset:types:options:orthography:wordCount:))]
#[unsafe(method_family = none)]
unsafe fn spellServer_checkString_offset_types_options_orthography_wordCount(
&self,
sender: &NSSpellServer,
string_to_check: &NSString,
offset: NSUInteger,
checking_types: NSTextCheckingTypes,
options: Option<&NSDictionary<NSString, AnyObject>>,
orthography: Option<&NSOrthography>,
word_count: NonNull<NSInteger>,
) -> Option<Retained<NSArray<NSTextCheckingResult>>>;
#[cfg(feature = "NSString")]
#[optional]
#[unsafe(method(spellServer:recordResponse:toCorrection:forWord:language:))]
#[unsafe(method_family = none)]
fn spellServer_recordResponse_toCorrection_forWord_language(
&self,
sender: &NSSpellServer,
response: NSUInteger,
correction: &NSString,
word: &NSString,
language: &NSString,
);
}
);