objc2_core_graphics/generated/
CGPDFContentStream.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};
6use core::ptr::NonNull;
7#[cfg(feature = "objc2")]
8use objc2::__framework_prelude::*;
9use objc2_core_foundation::*;
10
11use crate::*;
12
13/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgpdfcontentstream?language=objc)
14#[repr(C)]
15#[derive(Debug)]
16pub struct CGPDFContentStream {
17    inner: [u8; 0],
18    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
19}
20
21#[cfg(feature = "objc2")]
22unsafe impl RefEncode for CGPDFContentStream {
23    const ENCODING_REF: Encoding = Encoding::Pointer(&Encoding::Struct("CGPDFContentStream", &[]));
24}
25
26/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgpdfcontentstreamref?language=objc)
27pub type CGPDFContentStreamRef = *mut CGPDFContentStream;
28
29impl CGPDFContentStream {
30    #[doc(alias = "CGPDFContentStreamCreateWithPage")]
31    #[cfg(feature = "CGPDFPage")]
32    #[inline]
33    pub unsafe fn create_with_page(page: &CGPDFPage) -> CGPDFContentStreamRef {
34        extern "C-unwind" {
35            fn CGPDFContentStreamCreateWithPage(page: &CGPDFPage) -> CGPDFContentStreamRef;
36        }
37        unsafe { CGPDFContentStreamCreateWithPage(page) }
38    }
39
40    #[doc(alias = "CGPDFContentStreamCreateWithStream")]
41    #[cfg(all(feature = "CGPDFDictionary", feature = "CGPDFStream"))]
42    #[inline]
43    pub unsafe fn create_with_stream(
44        stream: CGPDFStreamRef,
45        stream_resources: CGPDFDictionaryRef,
46        parent: CGPDFContentStreamRef,
47    ) -> CGPDFContentStreamRef {
48        extern "C-unwind" {
49            fn CGPDFContentStreamCreateWithStream(
50                stream: CGPDFStreamRef,
51                stream_resources: CGPDFDictionaryRef,
52                parent: CGPDFContentStreamRef,
53            ) -> CGPDFContentStreamRef;
54        }
55        unsafe { CGPDFContentStreamCreateWithStream(stream, stream_resources, parent) }
56    }
57
58    #[doc(alias = "CGPDFContentStreamRetain")]
59    #[inline]
60    pub unsafe fn retain(cs: CGPDFContentStreamRef) -> CGPDFContentStreamRef {
61        extern "C-unwind" {
62            fn CGPDFContentStreamRetain(cs: CGPDFContentStreamRef) -> CGPDFContentStreamRef;
63        }
64        unsafe { CGPDFContentStreamRetain(cs) }
65    }
66
67    #[doc(alias = "CGPDFContentStreamRelease")]
68    #[inline]
69    pub unsafe fn release(cs: CGPDFContentStreamRef) {
70        extern "C-unwind" {
71            fn CGPDFContentStreamRelease(cs: CGPDFContentStreamRef);
72        }
73        unsafe { CGPDFContentStreamRelease(cs) }
74    }
75
76    #[doc(alias = "CGPDFContentStreamGetStreams")]
77    #[inline]
78    pub unsafe fn streams(cs: CGPDFContentStreamRef) -> Option<CFRetained<CFArray>> {
79        extern "C-unwind" {
80            fn CGPDFContentStreamGetStreams(cs: CGPDFContentStreamRef) -> Option<NonNull<CFArray>>;
81        }
82        let ret = unsafe { CGPDFContentStreamGetStreams(cs) };
83        ret.map(|ret| unsafe { CFRetained::retain(ret) })
84    }
85
86    #[doc(alias = "CGPDFContentStreamGetResource")]
87    #[cfg(feature = "CGPDFObject")]
88    #[inline]
89    pub unsafe fn resource(
90        cs: CGPDFContentStreamRef,
91        category: NonNull<c_char>,
92        name: NonNull<c_char>,
93    ) -> CGPDFObjectRef {
94        extern "C-unwind" {
95            fn CGPDFContentStreamGetResource(
96                cs: CGPDFContentStreamRef,
97                category: NonNull<c_char>,
98                name: NonNull<c_char>,
99            ) -> CGPDFObjectRef;
100        }
101        unsafe { CGPDFContentStreamGetResource(cs, category, name) }
102    }
103}
104
105extern "C-unwind" {
106    #[cfg(feature = "CGPDFPage")]
107    #[deprecated = "renamed to `CGPDFContentStream::create_with_page`"]
108    pub fn CGPDFContentStreamCreateWithPage(page: &CGPDFPage) -> CGPDFContentStreamRef;
109}
110
111extern "C-unwind" {
112    #[cfg(all(feature = "CGPDFDictionary", feature = "CGPDFStream"))]
113    #[deprecated = "renamed to `CGPDFContentStream::create_with_stream`"]
114    pub fn CGPDFContentStreamCreateWithStream(
115        stream: CGPDFStreamRef,
116        stream_resources: CGPDFDictionaryRef,
117        parent: CGPDFContentStreamRef,
118    ) -> CGPDFContentStreamRef;
119}
120
121extern "C-unwind" {
122    #[deprecated = "renamed to `CGPDFContentStream::retain`"]
123    pub fn CGPDFContentStreamRetain(cs: CGPDFContentStreamRef) -> CGPDFContentStreamRef;
124}
125
126extern "C-unwind" {
127    #[deprecated = "renamed to `CGPDFContentStream::release`"]
128    pub fn CGPDFContentStreamRelease(cs: CGPDFContentStreamRef);
129}
130
131#[deprecated = "renamed to `CGPDFContentStream::streams`"]
132#[inline]
133pub unsafe extern "C-unwind" fn CGPDFContentStreamGetStreams(
134    cs: CGPDFContentStreamRef,
135) -> Option<CFRetained<CFArray>> {
136    extern "C-unwind" {
137        fn CGPDFContentStreamGetStreams(cs: CGPDFContentStreamRef) -> Option<NonNull<CFArray>>;
138    }
139    let ret = unsafe { CGPDFContentStreamGetStreams(cs) };
140    ret.map(|ret| unsafe { CFRetained::retain(ret) })
141}
142
143extern "C-unwind" {
144    #[cfg(feature = "CGPDFObject")]
145    #[deprecated = "renamed to `CGPDFContentStream::resource`"]
146    pub fn CGPDFContentStreamGetResource(
147        cs: CGPDFContentStreamRef,
148        category: NonNull<c_char>,
149        name: NonNull<c_char>,
150    ) -> CGPDFObjectRef;
151}