objc2_core_graphics/generated/
CGPDFOperatorTable.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6#[cfg(feature = "objc2")]
7use objc2::__framework_prelude::*;
8
9use crate::*;
10
11/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgpdfoperatortable?language=objc)
12#[repr(C)]
13#[derive(Debug)]
14pub struct CGPDFOperatorTable {
15    inner: [u8; 0],
16    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
17}
18
19#[cfg(feature = "objc2")]
20unsafe impl RefEncode for CGPDFOperatorTable {
21    const ENCODING_REF: Encoding = Encoding::Pointer(&Encoding::Struct("CGPDFOperatorTable", &[]));
22}
23
24/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgpdfoperatortableref?language=objc)
25pub type CGPDFOperatorTableRef = *mut CGPDFOperatorTable;
26
27/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgpdfoperatorcallback?language=objc)
28#[cfg(feature = "CGPDFScanner")]
29pub type CGPDFOperatorCallback = Option<unsafe extern "C-unwind" fn(CGPDFScannerRef, *mut c_void)>;
30
31impl CGPDFOperatorTable {
32    #[doc(alias = "CGPDFOperatorTableCreate")]
33    #[inline]
34    pub fn create() -> CGPDFOperatorTableRef {
35        extern "C-unwind" {
36            fn CGPDFOperatorTableCreate() -> CGPDFOperatorTableRef;
37        }
38        unsafe { CGPDFOperatorTableCreate() }
39    }
40
41    /// # Safety
42    ///
43    /// `table` must be a valid pointer or null.
44    #[doc(alias = "CGPDFOperatorTableRetain")]
45    #[inline]
46    pub unsafe fn retain(table: CGPDFOperatorTableRef) -> CGPDFOperatorTableRef {
47        extern "C-unwind" {
48            fn CGPDFOperatorTableRetain(table: CGPDFOperatorTableRef) -> CGPDFOperatorTableRef;
49        }
50        unsafe { CGPDFOperatorTableRetain(table) }
51    }
52
53    /// # Safety
54    ///
55    /// `table` must be a valid pointer or null.
56    #[doc(alias = "CGPDFOperatorTableRelease")]
57    #[inline]
58    pub unsafe fn release(table: CGPDFOperatorTableRef) {
59        extern "C-unwind" {
60            fn CGPDFOperatorTableRelease(table: CGPDFOperatorTableRef);
61        }
62        unsafe { CGPDFOperatorTableRelease(table) }
63    }
64
65    /// # Safety
66    ///
67    /// - `table` must be a valid pointer or null.
68    /// - `name` must be a valid pointer or null.
69    /// - `callback` must be implemented correctly.
70    #[doc(alias = "CGPDFOperatorTableSetCallback")]
71    #[cfg(feature = "CGPDFScanner")]
72    #[inline]
73    pub unsafe fn set_callback(
74        table: CGPDFOperatorTableRef,
75        name: *const c_char,
76        callback: CGPDFOperatorCallback,
77    ) {
78        extern "C-unwind" {
79            fn CGPDFOperatorTableSetCallback(
80                table: CGPDFOperatorTableRef,
81                name: *const c_char,
82                callback: CGPDFOperatorCallback,
83            );
84        }
85        unsafe { CGPDFOperatorTableSetCallback(table, name, callback) }
86    }
87}
88
89#[deprecated = "renamed to `CGPDFOperatorTable::create`"]
90#[inline]
91pub extern "C-unwind" fn CGPDFOperatorTableCreate() -> CGPDFOperatorTableRef {
92    extern "C-unwind" {
93        fn CGPDFOperatorTableCreate() -> CGPDFOperatorTableRef;
94    }
95    unsafe { CGPDFOperatorTableCreate() }
96}
97
98extern "C-unwind" {
99    #[deprecated = "renamed to `CGPDFOperatorTable::retain`"]
100    pub fn CGPDFOperatorTableRetain(table: CGPDFOperatorTableRef) -> CGPDFOperatorTableRef;
101}
102
103extern "C-unwind" {
104    #[deprecated = "renamed to `CGPDFOperatorTable::release`"]
105    pub fn CGPDFOperatorTableRelease(table: CGPDFOperatorTableRef);
106}
107
108extern "C-unwind" {
109    #[cfg(feature = "CGPDFScanner")]
110    #[deprecated = "renamed to `CGPDFOperatorTable::set_callback`"]
111    pub fn CGPDFOperatorTableSetCallback(
112        table: CGPDFOperatorTableRef,
113        name: *const c_char,
114        callback: CGPDFOperatorCallback,
115    );
116}