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::*;

use crate::*;

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corespotlight/cssearchableitemactiontype?language=objc)
    pub static CSSearchableItemActionType: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corespotlight/cssearchableitemactivityidentifier?language=objc)
    pub static CSSearchableItemActivityIdentifier: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corespotlight/csactionidentifier?language=objc)
    pub static CSActionIdentifier: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corespotlight/csquerycontinuationactiontype?language=objc)
    pub static CSQueryContinuationActionType: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corespotlight/cssearchquerystring?language=objc)
    pub static CSSearchQueryString: &'static NSString;
}

/// [Apple's documentation](https://developer.apple.com/documentation/corespotlight/cssearchableitemupdatelisteneroptions?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CSSearchableItemUpdateListenerOptions(pub NSUInteger);
bitflags::bitflags! {
    impl CSSearchableItemUpdateListenerOptions: NSUInteger {
        #[doc(alias = "CSSearchableItemUpdateListenerOptionDefault")]
        const Default = 0;
        #[doc(alias = "CSSearchableItemUpdateListenerOptionSummarization")]
        const Summarization = 1<<1;
        #[doc(alias = "CSSearchableItemUpdateListenerOptionPriority")]
        const Priority = 1<<2;
    }
}

unsafe impl Encode for CSSearchableItemUpdateListenerOptions {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for CSSearchableItemUpdateListenerOptions {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

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

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

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

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

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

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

impl CSSearchableItem {
    extern_methods!(
        #[cfg(feature = "CSSearchableItemAttributeSet")]
        #[unsafe(method(initWithUniqueIdentifier:domainIdentifier:attributeSet:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithUniqueIdentifier_domainIdentifier_attributeSet(
            this: Allocated<Self>,
            unique_identifier: Option<&NSString>,
            domain_identifier: Option<&NSString>,
            attribute_set: &CSSearchableItemAttributeSet,
        ) -> Retained<Self>;

        #[unsafe(method(compareByRank:))]
        #[unsafe(method_family = none)]
        pub unsafe fn compareByRank(&self, other: &CSSearchableItem) -> NSComparisonResult;

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

        /// Setter for [`uniqueIdentifier`][Self::uniqueIdentifier].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setUniqueIdentifier:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setUniqueIdentifier(&self, unique_identifier: &NSString);

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

        /// Setter for [`domainIdentifier`][Self::domainIdentifier].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setDomainIdentifier:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDomainIdentifier(&self, domain_identifier: Option<&NSString>);

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

        /// Setter for [`expirationDate`][Self::expirationDate].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setExpirationDate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setExpirationDate(&self, expiration_date: Option<&NSDate>);

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

        #[cfg(feature = "CSSearchableItemAttributeSet")]
        /// Setter for [`attributeSet`][Self::attributeSet].
        #[unsafe(method(setAttributeSet:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAttributeSet(&self, attribute_set: &CSSearchableItemAttributeSet);

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

        /// Setter for [`isUpdate`][Self::isUpdate].
        #[unsafe(method(setIsUpdate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setIsUpdate(&self, is_update: bool);

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

        /// Setter for [`updateListenerOptions`][Self::updateListenerOptions].
        #[unsafe(method(setUpdateListenerOptions:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setUpdateListenerOptions(
            &self,
            update_listener_options: CSSearchableItemUpdateListenerOptions,
        );
    );
}

/// Methods declared on superclass `NSObject`.
impl CSSearchableItem {
    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>;
    );
}