objc2-core-spotlight 0.3.2

Bindings to the CoreSpotlight framework
Documentation
//! 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 objc2_foundation::*;
#[cfg(feature = "objc2-uniform-type-identifiers")]
use objc2_uniform_type_identifiers::*;

use crate::*;

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

extern_conformance!(
    unsafe impl NSCoding for CSSearchableItemAttributeSet {}
);

extern_conformance!(
    unsafe impl NSCopying for CSSearchableItemAttributeSet {}
);

unsafe impl CopyingHelper for CSSearchableItemAttributeSet {
    type Result = Self;
}

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

extern_conformance!(
    unsafe impl NSSecureCoding for CSSearchableItemAttributeSet {}
);

impl CSSearchableItemAttributeSet {
    extern_methods!(
        #[deprecated = "Use initWithContentType instead"]
        #[unsafe(method(initWithItemContentType:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithItemContentType(
            this: Allocated<Self>,
            item_content_type: &NSString,
        ) -> Retained<Self>;

        #[cfg(feature = "objc2-uniform-type-identifiers")]
        #[unsafe(method(initWithContentType:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithContentType(
            this: Allocated<Self>,
            content_type: &UTType,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl CSSearchableItemAttributeSet {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

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

extern_conformance!(
    unsafe impl NSCoding for CSLocalizedString {}
);

extern_conformance!(
    unsafe impl NSCopying for CSLocalizedString {}
);

unsafe impl CopyingHelper for CSLocalizedString {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSMutableCopying for CSLocalizedString {}
);

unsafe impl MutableCopyingHelper for CSLocalizedString {
    type Result = NSMutableString;
}

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

extern_conformance!(
    unsafe impl NSSecureCoding for CSLocalizedString {}
);

impl CSLocalizedString {
    extern_methods!(
        /// # Safety
        ///
        /// `localized_strings` generic should be of the correct type.
        #[unsafe(method(initWithLocalizedStrings:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithLocalizedStrings(
            this: Allocated<Self>,
            localized_strings: &NSDictionary,
        ) -> Retained<Self>;

        #[unsafe(method(localizedString))]
        #[unsafe(method_family = none)]
        pub unsafe fn localizedString(&self) -> Retained<NSString>;
    );
}

/// Methods declared on superclass `NSString`.
impl CSLocalizedString {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        /// # 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 CSLocalizedString {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

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

extern_conformance!(
    unsafe impl NSCoding for CSCustomAttributeKey {}
);

extern_conformance!(
    unsafe impl NSCopying for CSCustomAttributeKey {}
);

unsafe impl CopyingHelper for CSCustomAttributeKey {
    type Result = Self;
}

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

extern_conformance!(
    unsafe impl NSSecureCoding for CSCustomAttributeKey {}
);

impl CSCustomAttributeKey {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(initWithKeyName:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithKeyName(
            this: Allocated<Self>,
            key_name: &NSString,
        ) -> Option<Retained<Self>>;

        #[unsafe(method(initWithKeyName:searchable:searchableByDefault:unique:multiValued:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithKeyName_searchable_searchableByDefault_unique_multiValued(
            this: Allocated<Self>,
            key_name: &NSString,
            searchable: bool,
            searchable_by_default: bool,
            unique: bool,
            multi_valued: bool,
        ) -> Option<Retained<Self>>;

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

        #[unsafe(method(isSearchable))]
        #[unsafe(method_family = none)]
        pub unsafe fn isSearchable(&self) -> bool;

        #[unsafe(method(isSearchableByDefault))]
        #[unsafe(method_family = none)]
        pub unsafe fn isSearchableByDefault(&self) -> bool;

        #[unsafe(method(isUnique))]
        #[unsafe(method_family = none)]
        pub unsafe fn isUnique(&self) -> bool;

        #[unsafe(method(isMultiValued))]
        #[unsafe(method_family = none)]
        pub unsafe fn isMultiValued(&self) -> bool;
    );
}

/// Methods declared on superclass `NSObject`.
impl CSCustomAttributeKey {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

/// CSCustomAttributes.
impl CSSearchableItemAttributeSet {
    extern_methods!(
        /// # Safety
        ///
        /// `value` should be of the correct type.
        #[unsafe(method(setValue:forCustomKey:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setValue_forCustomKey(
            &self,
            value: Option<&ProtocolObject<dyn NSSecureCoding>>,
            key: &CSCustomAttributeKey,
        );

        #[unsafe(method(valueForCustomKey:))]
        #[unsafe(method_family = none)]
        pub unsafe fn valueForCustomKey(
            &self,
            key: &CSCustomAttributeKey,
        ) -> Option<Retained<ProtocolObject<dyn NSSecureCoding>>>;
    );
}

mod private_NSUserActivityCSSearchableItemAttributeSet {
    pub trait Sealed {}
}

/// Category "CSSearchableItemAttributeSet" on [`NSUserActivity`].
#[doc(alias = "CSSearchableItemAttributeSet")]
pub unsafe trait NSUserActivityCSSearchableItemAttributeSet:
    ClassType + Sized + private_NSUserActivityCSSearchableItemAttributeSet::Sealed
{
    extern_methods!(
        #[unsafe(method(contentAttributeSet))]
        #[unsafe(method_family = none)]
        unsafe fn contentAttributeSet(&self) -> Option<Retained<CSSearchableItemAttributeSet>>;

        /// Setter for [`contentAttributeSet`][Self::contentAttributeSet].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setContentAttributeSet:))]
        #[unsafe(method_family = none)]
        unsafe fn setContentAttributeSet(
            &self,
            content_attribute_set: Option<&CSSearchableItemAttributeSet>,
        );
    );
}

impl private_NSUserActivityCSSearchableItemAttributeSet::Sealed for NSUserActivity {}
unsafe impl NSUserActivityCSSearchableItemAttributeSet for NSUserActivity {}