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::ptr::NonNull;
use objc2_core_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/skdocument?language=objc)
#[doc(alias = "SKDocumentRef")]
pub type SKDocument = CFType;

#[inline]
pub extern "C-unwind" fn SKDocumentGetTypeID() -> CFTypeID {
    extern "C-unwind" {
        fn SKDocumentGetTypeID() -> CFTypeID;
    }
    unsafe { SKDocumentGetTypeID() }
}

/// # Safety
///
/// `in_url` might not allow `None`.
#[inline]
pub unsafe extern "C-unwind" fn SKDocumentCreateWithURL(
    in_url: Option<&CFURL>,
) -> Option<CFRetained<SKDocument>> {
    extern "C-unwind" {
        fn SKDocumentCreateWithURL(in_url: Option<&CFURL>) -> Option<NonNull<SKDocument>>;
    }
    let ret = unsafe { SKDocumentCreateWithURL(in_url) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

/// # Safety
///
/// `in_document` should be of the correct type.
#[inline]
pub unsafe extern "C-unwind" fn SKDocumentCopyURL(
    in_document: &SKDocument,
) -> Option<CFRetained<CFURL>> {
    extern "C-unwind" {
        fn SKDocumentCopyURL(in_document: &SKDocument) -> Option<NonNull<CFURL>>;
    }
    let ret = unsafe { SKDocumentCopyURL(in_document) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

/// # Safety
///
/// - `in_scheme` might not allow `None`.
/// - `in_parent` should be of the correct type.
/// - `in_parent` might not allow `None`.
/// - `in_name` might not allow `None`.
#[inline]
pub unsafe extern "C-unwind" fn SKDocumentCreate(
    in_scheme: Option<&CFString>,
    in_parent: Option<&SKDocument>,
    in_name: Option<&CFString>,
) -> Option<CFRetained<SKDocument>> {
    extern "C-unwind" {
        fn SKDocumentCreate(
            in_scheme: Option<&CFString>,
            in_parent: Option<&SKDocument>,
            in_name: Option<&CFString>,
        ) -> Option<NonNull<SKDocument>>;
    }
    let ret = unsafe { SKDocumentCreate(in_scheme, in_parent, in_name) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

/// # Safety
///
/// `in_document` should be of the correct type.
#[inline]
pub unsafe extern "C-unwind" fn SKDocumentGetSchemeName(
    in_document: &SKDocument,
) -> Option<CFRetained<CFString>> {
    extern "C-unwind" {
        fn SKDocumentGetSchemeName(in_document: &SKDocument) -> Option<NonNull<CFString>>;
    }
    let ret = unsafe { SKDocumentGetSchemeName(in_document) };
    ret.map(|ret| unsafe { CFRetained::retain(ret) })
}

/// # Safety
///
/// `in_document` should be of the correct type.
#[inline]
pub unsafe extern "C-unwind" fn SKDocumentGetName(
    in_document: &SKDocument,
) -> Option<CFRetained<CFString>> {
    extern "C-unwind" {
        fn SKDocumentGetName(in_document: &SKDocument) -> Option<NonNull<CFString>>;
    }
    let ret = unsafe { SKDocumentGetName(in_document) };
    ret.map(|ret| unsafe { CFRetained::retain(ret) })
}

/// # Safety
///
/// `in_document` should be of the correct type.
#[inline]
pub unsafe extern "C-unwind" fn SKDocumentGetParent(
    in_document: &SKDocument,
) -> Option<CFRetained<SKDocument>> {
    extern "C-unwind" {
        fn SKDocumentGetParent(in_document: &SKDocument) -> Option<NonNull<SKDocument>>;
    }
    let ret = unsafe { SKDocumentGetParent(in_document) };
    ret.map(|ret| unsafe { CFRetained::retain(ret) })
}