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

/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nstestcomparisonoperation?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSTestComparisonOperation(pub NSUInteger);
impl NSTestComparisonOperation {
    #[doc(alias = "NSEqualToComparison")]
    pub const EqualToComparison: Self = Self(0);
    #[doc(alias = "NSLessThanOrEqualToComparison")]
    pub const LessThanOrEqualToComparison: Self = Self(1);
    #[doc(alias = "NSLessThanComparison")]
    pub const LessThanComparison: Self = Self(2);
    #[doc(alias = "NSGreaterThanOrEqualToComparison")]
    pub const GreaterThanOrEqualToComparison: Self = Self(3);
    #[doc(alias = "NSGreaterThanComparison")]
    pub const GreaterThanComparison: Self = Self(4);
    #[doc(alias = "NSBeginsWithComparison")]
    pub const BeginsWithComparison: Self = Self(5);
    #[doc(alias = "NSEndsWithComparison")]
    pub const EndsWithComparison: Self = Self(6);
    #[doc(alias = "NSContainsComparison")]
    pub const ContainsComparison: Self = Self(7);
}

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

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

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

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

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

impl NSScriptWhoseTest {
    extern_methods!(
        #[unsafe(method(isTrue))]
        #[unsafe(method_family = none)]
        pub fn isTrue(&self) -> bool;

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

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

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

impl DefaultRetained for NSScriptWhoseTest {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

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

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

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

impl NSLogicalTest {
    extern_methods!(
        #[cfg(feature = "NSArray")]
        #[unsafe(method(initAndTestWithTests:))]
        #[unsafe(method_family = init)]
        pub fn initAndTestWithTests(
            this: Allocated<Self>,
            sub_tests: &NSArray<NSSpecifierTest>,
        ) -> Retained<Self>;

        #[cfg(feature = "NSArray")]
        #[unsafe(method(initOrTestWithTests:))]
        #[unsafe(method_family = init)]
        pub fn initOrTestWithTests(
            this: Allocated<Self>,
            sub_tests: &NSArray<NSSpecifierTest>,
        ) -> Retained<Self>;

        #[unsafe(method(initNotTestWithTest:))]
        #[unsafe(method_family = init)]
        pub fn initNotTestWithTest(
            this: Allocated<Self>,
            sub_test: &NSScriptWhoseTest,
        ) -> Retained<Self>;
    );
}

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

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

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

impl DefaultRetained for NSLogicalTest {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

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

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

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

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

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

        #[cfg(feature = "NSScriptObjectSpecifiers")]
        /// # Safety
        ///
        /// `obj2` should be of the correct type.
        #[unsafe(method(initWithObjectSpecifier:comparisonOperator:testObject:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithObjectSpecifier_comparisonOperator_testObject(
            this: Allocated<Self>,
            obj1: Option<&NSScriptObjectSpecifier>,
            comp_op: NSTestComparisonOperation,
            obj2: Option<&AnyObject>,
        ) -> Retained<Self>;
    );
}

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

mod private_NSObjectNSComparisonMethods {
    pub trait Sealed {}
}

/// Category "NSComparisonMethods" on [`NSObject`].
#[doc(alias = "NSComparisonMethods")]
pub unsafe trait NSObjectNSComparisonMethods:
    ClassType + Sized + private_NSObjectNSComparisonMethods::Sealed
{
    extern_methods!(
        /// # Safety
        ///
        /// `object` should be of the correct type.
        #[unsafe(method(isEqualTo:))]
        #[unsafe(method_family = none)]
        unsafe fn isEqualTo(&self, object: Option<&AnyObject>) -> bool;

        /// # Safety
        ///
        /// `object` should be of the correct type.
        #[unsafe(method(isLessThanOrEqualTo:))]
        #[unsafe(method_family = none)]
        unsafe fn isLessThanOrEqualTo(&self, object: Option<&AnyObject>) -> bool;

        /// # Safety
        ///
        /// `object` should be of the correct type.
        #[unsafe(method(isLessThan:))]
        #[unsafe(method_family = none)]
        unsafe fn isLessThan(&self, object: Option<&AnyObject>) -> bool;

        /// # Safety
        ///
        /// `object` should be of the correct type.
        #[unsafe(method(isGreaterThanOrEqualTo:))]
        #[unsafe(method_family = none)]
        unsafe fn isGreaterThanOrEqualTo(&self, object: Option<&AnyObject>) -> bool;

        /// # Safety
        ///
        /// `object` should be of the correct type.
        #[unsafe(method(isGreaterThan:))]
        #[unsafe(method_family = none)]
        unsafe fn isGreaterThan(&self, object: Option<&AnyObject>) -> bool;

        /// # Safety
        ///
        /// `object` should be of the correct type.
        #[unsafe(method(isNotEqualTo:))]
        #[unsafe(method_family = none)]
        unsafe fn isNotEqualTo(&self, object: Option<&AnyObject>) -> bool;

        /// # Safety
        ///
        /// `object` should be of the correct type.
        #[unsafe(method(doesContain:))]
        #[unsafe(method_family = none)]
        unsafe fn doesContain(&self, object: &AnyObject) -> bool;

        #[cfg(feature = "NSString")]
        #[unsafe(method(isLike:))]
        #[unsafe(method_family = none)]
        fn isLike(&self, object: &NSString) -> bool;

        #[cfg(feature = "NSString")]
        #[unsafe(method(isCaseInsensitiveLike:))]
        #[unsafe(method_family = none)]
        fn isCaseInsensitiveLike(&self, object: &NSString) -> bool;
    );
}

impl private_NSObjectNSComparisonMethods::Sealed for NSObject {}
unsafe impl NSObjectNSComparisonMethods for NSObject {}

mod private_NSObjectNSScriptingComparisonMethods {
    pub trait Sealed {}
}

/// Category "NSScriptingComparisonMethods" on [`NSObject`].
#[doc(alias = "NSScriptingComparisonMethods")]
pub unsafe trait NSObjectNSScriptingComparisonMethods:
    ClassType + Sized + private_NSObjectNSScriptingComparisonMethods::Sealed
{
    extern_methods!(
        /// # Safety
        ///
        /// `object` should be of the correct type.
        #[unsafe(method(scriptingIsEqualTo:))]
        #[unsafe(method_family = none)]
        unsafe fn scriptingIsEqualTo(&self, object: &AnyObject) -> bool;

        /// # Safety
        ///
        /// `object` should be of the correct type.
        #[unsafe(method(scriptingIsLessThanOrEqualTo:))]
        #[unsafe(method_family = none)]
        unsafe fn scriptingIsLessThanOrEqualTo(&self, object: &AnyObject) -> bool;

        /// # Safety
        ///
        /// `object` should be of the correct type.
        #[unsafe(method(scriptingIsLessThan:))]
        #[unsafe(method_family = none)]
        unsafe fn scriptingIsLessThan(&self, object: &AnyObject) -> bool;

        /// # Safety
        ///
        /// `object` should be of the correct type.
        #[unsafe(method(scriptingIsGreaterThanOrEqualTo:))]
        #[unsafe(method_family = none)]
        unsafe fn scriptingIsGreaterThanOrEqualTo(&self, object: &AnyObject) -> bool;

        /// # Safety
        ///
        /// `object` should be of the correct type.
        #[unsafe(method(scriptingIsGreaterThan:))]
        #[unsafe(method_family = none)]
        unsafe fn scriptingIsGreaterThan(&self, object: &AnyObject) -> bool;

        /// # Safety
        ///
        /// `object` should be of the correct type.
        #[unsafe(method(scriptingBeginsWith:))]
        #[unsafe(method_family = none)]
        unsafe fn scriptingBeginsWith(&self, object: &AnyObject) -> bool;

        /// # Safety
        ///
        /// `object` should be of the correct type.
        #[unsafe(method(scriptingEndsWith:))]
        #[unsafe(method_family = none)]
        unsafe fn scriptingEndsWith(&self, object: &AnyObject) -> bool;

        /// # Safety
        ///
        /// `object` should be of the correct type.
        #[unsafe(method(scriptingContains:))]
        #[unsafe(method_family = none)]
        unsafe fn scriptingContains(&self, object: &AnyObject) -> bool;
    );
}

impl private_NSObjectNSScriptingComparisonMethods::Sealed for NSObject {}
unsafe impl NSObjectNSScriptingComparisonMethods for NSObject {}