objc2-foundation 0.3.2

Bindings to the Foundation framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsorthography?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSOrthography;
);

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCoding for NSOrthography {}
);

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCopying for NSOrthography {}
);

#[cfg(feature = "NSObject")]
unsafe impl CopyingHelper for NSOrthography {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for NSOrthography {}
);

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSSecureCoding for NSOrthography {}
);

impl NSOrthography {
    extern_methods!(
        #[cfg(feature = "NSString")]
        #[unsafe(method(dominantScript))]
        #[unsafe(method_family = none)]
        pub fn dominantScript(&self) -> Retained<NSString>;

        #[cfg(all(feature = "NSArray", feature = "NSDictionary", feature = "NSString"))]
        #[unsafe(method(languageMap))]
        #[unsafe(method_family = none)]
        pub fn languageMap(&self) -> Retained<NSDictionary<NSString, NSArray<NSString>>>;

        #[cfg(all(feature = "NSArray", feature = "NSDictionary", feature = "NSString"))]
        #[unsafe(method(initWithDominantScript:languageMap:))]
        #[unsafe(method_family = init)]
        pub fn initWithDominantScript_languageMap(
            this: Allocated<Self>,
            script: &NSString,
            map: &NSDictionary<NSString, NSArray<NSString>>,
        ) -> Retained<Self>;

        #[cfg(feature = "NSCoder")]
        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSOrthography {
    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 NSOrthography {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

/// NSOrthographyExtended.
impl NSOrthography {
    extern_methods!(
        #[cfg(all(feature = "NSArray", feature = "NSString"))]
        #[unsafe(method(languagesForScript:))]
        #[unsafe(method_family = none)]
        pub fn languagesForScript(&self, script: &NSString) -> Option<Retained<NSArray<NSString>>>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(dominantLanguageForScript:))]
        #[unsafe(method_family = none)]
        pub fn dominantLanguageForScript(&self, script: &NSString) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(dominantLanguage))]
        #[unsafe(method_family = none)]
        pub fn dominantLanguage(&self) -> Retained<NSString>;

        #[cfg(all(feature = "NSArray", feature = "NSString"))]
        #[unsafe(method(allScripts))]
        #[unsafe(method_family = none)]
        pub fn allScripts(&self) -> Retained<NSArray<NSString>>;

        #[cfg(all(feature = "NSArray", feature = "NSString"))]
        #[unsafe(method(allLanguages))]
        #[unsafe(method_family = none)]
        pub fn allLanguages(&self) -> Retained<NSArray<NSString>>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(defaultOrthographyForLanguage:))]
        #[unsafe(method_family = none)]
        pub fn defaultOrthographyForLanguage(language: &NSString) -> Retained<Self>;
    );
}

/// NSOrthographyCreation.
impl NSOrthography {
    extern_methods!(
        #[cfg(all(feature = "NSArray", feature = "NSDictionary", feature = "NSString"))]
        #[unsafe(method(orthographyWithDominantScript:languageMap:))]
        #[unsafe(method_family = none)]
        pub fn orthographyWithDominantScript_languageMap(
            script: &NSString,
            map: &NSDictionary<NSString, NSArray<NSString>>,
        ) -> Retained<Self>;
    );
}