objc2-foundation 0.2.2

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

use crate::*;

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSAppleEventSendOptions(pub NSUInteger);
bitflags::bitflags! {
    impl NSAppleEventSendOptions: NSUInteger {
        const NSAppleEventSendNoReply = 1;
        const NSAppleEventSendQueueReply = 2;
        const NSAppleEventSendWaitForReply = 3;
        const NSAppleEventSendNeverInteract = 16;
        const NSAppleEventSendCanInteract = 32;
        const NSAppleEventSendAlwaysInteract = 48;
        const NSAppleEventSendCanSwitchLayer = 64;
        const NSAppleEventSendDontRecord = 4096;
        const NSAppleEventSendDontExecute = 8192;
        const NSAppleEventSendDontAnnotate = 65536;
        const NSAppleEventSendDefaultOptions = 35;
    }
}

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

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

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSAppleEventDescriptor;

    unsafe impl ClassType for NSAppleEventDescriptor {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSAppleEventDescriptor {}

#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSAppleEventDescriptor {}

unsafe impl NSObjectProtocol for NSAppleEventDescriptor {}

#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSAppleEventDescriptor {}

extern_methods!(
    unsafe impl NSAppleEventDescriptor {
        #[method_id(@__retain_semantics Other nullDescriptor)]
        pub unsafe fn nullDescriptor() -> Retained<NSAppleEventDescriptor>;

        #[method_id(@__retain_semantics Other descriptorWithBoolean:)]
        pub unsafe fn descriptorWithBoolean(boolean: Boolean) -> Retained<NSAppleEventDescriptor>;

        #[method_id(@__retain_semantics Other descriptorWithEnumCode:)]
        pub unsafe fn descriptorWithEnumCode(
            enumerator: OSType,
        ) -> Retained<NSAppleEventDescriptor>;

        #[method_id(@__retain_semantics Other descriptorWithInt32:)]
        pub unsafe fn descriptorWithInt32(signed_int: i32) -> Retained<NSAppleEventDescriptor>;

        #[method_id(@__retain_semantics Other descriptorWithDouble:)]
        pub unsafe fn descriptorWithDouble(
            double_value: c_double,
        ) -> Retained<NSAppleEventDescriptor>;

        #[method_id(@__retain_semantics Other descriptorWithTypeCode:)]
        pub unsafe fn descriptorWithTypeCode(type_code: OSType)
            -> Retained<NSAppleEventDescriptor>;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other descriptorWithString:)]
        pub unsafe fn descriptorWithString(string: &NSString) -> Retained<NSAppleEventDescriptor>;

        #[cfg(feature = "NSDate")]
        #[method_id(@__retain_semantics Other descriptorWithDate:)]
        pub unsafe fn descriptorWithDate(date: &NSDate) -> Retained<NSAppleEventDescriptor>;

        #[cfg(feature = "NSURL")]
        #[method_id(@__retain_semantics Other descriptorWithFileURL:)]
        pub unsafe fn descriptorWithFileURL(file_url: &NSURL) -> Retained<NSAppleEventDescriptor>;

        #[method_id(@__retain_semantics Other listDescriptor)]
        pub unsafe fn listDescriptor() -> Retained<NSAppleEventDescriptor>;

        #[method_id(@__retain_semantics Other recordDescriptor)]
        pub unsafe fn recordDescriptor() -> Retained<NSAppleEventDescriptor>;

        #[method_id(@__retain_semantics Other currentProcessDescriptor)]
        pub unsafe fn currentProcessDescriptor() -> Retained<NSAppleEventDescriptor>;

        #[cfg(feature = "libc")]
        #[method_id(@__retain_semantics Other descriptorWithProcessIdentifier:)]
        pub unsafe fn descriptorWithProcessIdentifier(
            process_identifier: libc::pid_t,
        ) -> Retained<NSAppleEventDescriptor>;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other descriptorWithBundleIdentifier:)]
        pub unsafe fn descriptorWithBundleIdentifier(
            bundle_identifier: &NSString,
        ) -> Retained<NSAppleEventDescriptor>;

        #[cfg(feature = "NSURL")]
        #[method_id(@__retain_semantics Other descriptorWithApplicationURL:)]
        pub unsafe fn descriptorWithApplicationURL(
            application_url: &NSURL,
        ) -> Retained<NSAppleEventDescriptor>;

        #[method_id(@__retain_semantics Init initListDescriptor)]
        pub unsafe fn initListDescriptor(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics Init initRecordDescriptor)]
        pub unsafe fn initRecordDescriptor(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "NSData")]
        #[method_id(@__retain_semantics Other data)]
        pub unsafe fn data(&self) -> Retained<NSData>;

        #[method(booleanValue)]
        pub unsafe fn booleanValue(&self) -> Boolean;

        #[method(enumCodeValue)]
        pub unsafe fn enumCodeValue(&self) -> OSType;

        #[method(int32Value)]
        pub unsafe fn int32Value(&self) -> i32;

        #[method(doubleValue)]
        pub unsafe fn doubleValue(&self) -> c_double;

        #[method(typeCodeValue)]
        pub unsafe fn typeCodeValue(&self) -> OSType;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other stringValue)]
        pub unsafe fn stringValue(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSDate")]
        #[method_id(@__retain_semantics Other dateValue)]
        pub unsafe fn dateValue(&self) -> Option<Retained<NSDate>>;

        #[cfg(feature = "NSURL")]
        #[method_id(@__retain_semantics Other fileURLValue)]
        pub unsafe fn fileURLValue(&self) -> Option<Retained<NSURL>>;

        #[method(isRecordDescriptor)]
        pub unsafe fn isRecordDescriptor(&self) -> bool;

        #[method(numberOfItems)]
        pub unsafe fn numberOfItems(&self) -> NSInteger;

        #[method(insertDescriptor:atIndex:)]
        pub unsafe fn insertDescriptor_atIndex(
            &self,
            descriptor: &NSAppleEventDescriptor,
            index: NSInteger,
        );

        #[method_id(@__retain_semantics Other descriptorAtIndex:)]
        pub unsafe fn descriptorAtIndex(
            &self,
            index: NSInteger,
        ) -> Option<Retained<NSAppleEventDescriptor>>;

        #[method(removeDescriptorAtIndex:)]
        pub unsafe fn removeDescriptorAtIndex(&self, index: NSInteger);
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl NSAppleEventDescriptor {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);