objc2-core-services 0.3.2

Bindings to the CoreServices framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::cell::UnsafeCell;
use core::ffi::*;
use core::marker::{PhantomData, PhantomPinned};
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aebuilderrorcode?language=objc)
pub type AEBuildErrorCode = u32;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aebuildsyntaxnoerr?language=objc)
pub const aeBuildSyntaxNoErr: c_uint = 0;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aebuildsyntaxbadtoken?language=objc)
pub const aeBuildSyntaxBadToken: c_uint = 1;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aebuildsyntaxbadeof?language=objc)
pub const aeBuildSyntaxBadEOF: c_uint = 2;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aebuildsyntaxnoeof?language=objc)
pub const aeBuildSyntaxNoEOF: c_uint = 3;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aebuildsyntaxbadnegative?language=objc)
pub const aeBuildSyntaxBadNegative: c_uint = 4;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aebuildsyntaxmissingquote?language=objc)
pub const aeBuildSyntaxMissingQuote: c_uint = 5;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aebuildsyntaxbadhex?language=objc)
pub const aeBuildSyntaxBadHex: c_uint = 6;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aebuildsyntaxoddhex?language=objc)
pub const aeBuildSyntaxOddHex: c_uint = 7;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aebuildsyntaxnoclosehex?language=objc)
pub const aeBuildSyntaxNoCloseHex: c_uint = 8;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aebuildsyntaxuncoercedhex?language=objc)
pub const aeBuildSyntaxUncoercedHex: c_uint = 9;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aebuildsyntaxnoclosestring?language=objc)
pub const aeBuildSyntaxNoCloseString: c_uint = 10;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aebuildsyntaxbaddesc?language=objc)
pub const aeBuildSyntaxBadDesc: c_uint = 11;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aebuildsyntaxbaddata?language=objc)
pub const aeBuildSyntaxBadData: c_uint = 12;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aebuildsyntaxnocloseparen?language=objc)
pub const aeBuildSyntaxNoCloseParen: c_uint = 13;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aebuildsyntaxnoclosebracket?language=objc)
pub const aeBuildSyntaxNoCloseBracket: c_uint = 14;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aebuildsyntaxnoclosebrace?language=objc)
pub const aeBuildSyntaxNoCloseBrace: c_uint = 15;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aebuildsyntaxnokey?language=objc)
pub const aeBuildSyntaxNoKey: c_uint = 16;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aebuildsyntaxnocolon?language=objc)
pub const aeBuildSyntaxNoColon: c_uint = 17;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aebuildsyntaxcoercedlist?language=objc)
pub const aeBuildSyntaxCoercedList: c_uint = 18;
/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aebuildsyntaxuncoerceddoubleat?language=objc)
pub const aeBuildSyntaxUncoercedDoubleAt: c_uint = 19;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aebuilderror?language=objc)
#[repr(C, packed(2))]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct AEBuildError {
    pub fError: AEBuildErrorCode,
    pub fErrorPos: u32,
}

#[cfg(feature = "objc2")]
unsafe impl Encode for AEBuildError {
    const ENCODING: Encoding = Encoding::Struct(
        "AEBuildError",
        &[<AEBuildErrorCode>::ENCODING, <u32>::ENCODING],
    );
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for AEBuildError {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `desc` must be a valid pointer.
    /// - `result` must be a valid pointer.
    #[cfg(feature = "AEDataModel")]
    pub fn AEPrintDescToHandle(desc: *const AEDesc, result: *mut Handle) -> OSStatus;
}

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/opaqueaestreamref?language=objc)
#[repr(C)]
#[derive(Debug)]
pub struct OpaqueAEStreamRef {
    inner: [u8; 0],
    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for OpaqueAEStreamRef {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Encoding::Struct("OpaqueAEStreamRef", &[]));
}

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/aestreamref?language=objc)
pub type AEStreamRef = *mut OpaqueAEStreamRef;

extern "C-unwind" {
    pub fn AEStreamOpen() -> AEStreamRef;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `ref` must be a valid pointer.
    /// - `desc` must be a valid pointer.
    #[cfg(feature = "AEDataModel")]
    pub fn AEStreamClose(r#ref: AEStreamRef, desc: *mut AEDesc) -> OSStatus;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `ref` must be a valid pointer.
    #[cfg(feature = "AEDataModel")]
    pub fn AEStreamOpenDesc(r#ref: AEStreamRef, new_type: DescType) -> OSStatus;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `ref` must be a valid pointer.
    /// - `data` must be a valid pointer.
    pub fn AEStreamWriteData(r#ref: AEStreamRef, data: *const c_void, length: Size) -> OSStatus;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `ref` must be a valid pointer.
    pub fn AEStreamCloseDesc(r#ref: AEStreamRef) -> OSStatus;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `ref` must be a valid pointer.
    /// - `data` must be a valid pointer.
    #[cfg(feature = "AEDataModel")]
    pub fn AEStreamWriteDesc(
        r#ref: AEStreamRef,
        new_type: DescType,
        data: *const c_void,
        length: Size,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `ref` must be a valid pointer.
    /// - `desc` must be a valid pointer.
    #[cfg(feature = "AEDataModel")]
    pub fn AEStreamWriteAEDesc(r#ref: AEStreamRef, desc: *const AEDesc) -> OSStatus;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `ref` must be a valid pointer.
    pub fn AEStreamOpenList(r#ref: AEStreamRef) -> OSStatus;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `ref` must be a valid pointer.
    pub fn AEStreamCloseList(r#ref: AEStreamRef) -> OSStatus;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `ref` must be a valid pointer.
    #[cfg(feature = "AEDataModel")]
    pub fn AEStreamOpenRecord(r#ref: AEStreamRef, new_type: DescType) -> OSStatus;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `ref` must be a valid pointer.
    #[cfg(feature = "AEDataModel")]
    pub fn AEStreamSetRecordType(r#ref: AEStreamRef, new_type: DescType) -> OSStatus;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `ref` must be a valid pointer.
    pub fn AEStreamCloseRecord(r#ref: AEStreamRef) -> OSStatus;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `ref` must be a valid pointer.
    /// - `data` must be a valid pointer.
    #[cfg(feature = "AEDataModel")]
    pub fn AEStreamWriteKeyDesc(
        r#ref: AEStreamRef,
        key: AEKeyword,
        new_type: DescType,
        data: *const c_void,
        length: Size,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `ref` must be a valid pointer.
    #[cfg(feature = "AEDataModel")]
    pub fn AEStreamOpenKeyDesc(r#ref: AEStreamRef, key: AEKeyword, new_type: DescType) -> OSStatus;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `ref` must be a valid pointer.
    #[cfg(feature = "AEDataModel")]
    pub fn AEStreamWriteKey(r#ref: AEStreamRef, key: AEKeyword) -> OSStatus;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `target_data` must be a valid pointer.
    #[cfg(feature = "AEDataModel")]
    pub fn AEStreamCreateEvent(
        clazz: AEEventClass,
        id: AEEventID,
        target_type: DescType,
        target_data: *const c_void,
        target_length: Size,
        return_id: i16,
        transaction_id: i32,
    ) -> AEStreamRef;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `event` must be a valid pointer.
    #[cfg(feature = "AEDataModel")]
    pub fn AEStreamOpenEvent(event: *mut AppleEvent) -> AEStreamRef;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `ref` must be a valid pointer.
    #[cfg(feature = "AEDataModel")]
    pub fn AEStreamOptionalParam(r#ref: AEStreamRef, key: AEKeyword) -> OSStatus;
}