objc2-core-graphics 0.3.2

Bindings to the CoreGraphics 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/coregraphics/cgpdfoperatortable?language=objc)
#[repr(C)]
#[derive(Debug)]
pub struct CGPDFOperatorTable {
    inner: [u8; 0],
    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}

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

/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgpdfoperatortableref?language=objc)
pub type CGPDFOperatorTableRef = *mut CGPDFOperatorTable;

/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgpdfoperatorcallback?language=objc)
#[cfg(feature = "CGPDFScanner")]
pub type CGPDFOperatorCallback = Option<unsafe extern "C-unwind" fn(CGPDFScannerRef, *mut c_void)>;

impl CGPDFOperatorTable {
    #[doc(alias = "CGPDFOperatorTableCreate")]
    #[inline]
    pub fn create() -> CGPDFOperatorTableRef {
        extern "C-unwind" {
            fn CGPDFOperatorTableCreate() -> CGPDFOperatorTableRef;
        }
        unsafe { CGPDFOperatorTableCreate() }
    }

    /// # Safety
    ///
    /// `table` must be a valid pointer or null.
    #[doc(alias = "CGPDFOperatorTableRetain")]
    #[inline]
    pub unsafe fn retain(table: CGPDFOperatorTableRef) -> CGPDFOperatorTableRef {
        extern "C-unwind" {
            fn CGPDFOperatorTableRetain(table: CGPDFOperatorTableRef) -> CGPDFOperatorTableRef;
        }
        unsafe { CGPDFOperatorTableRetain(table) }
    }

    /// # Safety
    ///
    /// `table` must be a valid pointer or null.
    #[doc(alias = "CGPDFOperatorTableRelease")]
    #[inline]
    pub unsafe fn release(table: CGPDFOperatorTableRef) {
        extern "C-unwind" {
            fn CGPDFOperatorTableRelease(table: CGPDFOperatorTableRef);
        }
        unsafe { CGPDFOperatorTableRelease(table) }
    }

    /// # Safety
    ///
    /// - `table` must be a valid pointer or null.
    /// - `name` must be a valid pointer or null.
    /// - `callback` must be implemented correctly.
    #[doc(alias = "CGPDFOperatorTableSetCallback")]
    #[cfg(feature = "CGPDFScanner")]
    #[inline]
    pub unsafe fn set_callback(
        table: CGPDFOperatorTableRef,
        name: *const c_char,
        callback: CGPDFOperatorCallback,
    ) {
        extern "C-unwind" {
            fn CGPDFOperatorTableSetCallback(
                table: CGPDFOperatorTableRef,
                name: *const c_char,
                callback: CGPDFOperatorCallback,
            );
        }
        unsafe { CGPDFOperatorTableSetCallback(table, name, callback) }
    }
}

#[deprecated = "renamed to `CGPDFOperatorTable::create`"]
#[inline]
pub extern "C-unwind" fn CGPDFOperatorTableCreate() -> CGPDFOperatorTableRef {
    extern "C-unwind" {
        fn CGPDFOperatorTableCreate() -> CGPDFOperatorTableRef;
    }
    unsafe { CGPDFOperatorTableCreate() }
}

extern "C-unwind" {
    #[deprecated = "renamed to `CGPDFOperatorTable::retain`"]
    pub fn CGPDFOperatorTableRetain(table: CGPDFOperatorTableRef) -> CGPDFOperatorTableRef;
}

extern "C-unwind" {
    #[deprecated = "renamed to `CGPDFOperatorTable::release`"]
    pub fn CGPDFOperatorTableRelease(table: CGPDFOperatorTableRef);
}

extern "C-unwind" {
    #[cfg(feature = "CGPDFScanner")]
    #[deprecated = "renamed to `CGPDFOperatorTable::set_callback`"]
    pub fn CGPDFOperatorTableSetCallback(
        table: CGPDFOperatorTableRef,
        name: *const c_char,
        callback: CGPDFOperatorCallback,
    );
}