Skip to main content

objc2_core_graphics/generated/
CGPDFDictionary.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::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgpdfdictionary?language=objc)
13#[repr(C)]
14#[derive(Debug)]
15pub struct CGPDFDictionary {
16    inner: [u8; 0],
17    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
18}
19
20#[cfg(feature = "objc2")]
21unsafe impl RefEncode for CGPDFDictionary {
22    const ENCODING_REF: Encoding = Encoding::Pointer(&Encoding::Struct("CGPDFDictionary", &[]));
23}
24
25/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgpdfdictionaryref?language=objc)
26pub type CGPDFDictionaryRef = *mut CGPDFDictionary;
27
28impl CGPDFDictionary {
29    /// # Safety
30    ///
31    /// `dict` must be a valid pointer or null.
32    #[doc(alias = "CGPDFDictionaryGetCount")]
33    #[inline]
34    pub unsafe fn count(dict: CGPDFDictionaryRef) -> usize {
35        extern "C-unwind" {
36            fn CGPDFDictionaryGetCount(dict: CGPDFDictionaryRef) -> usize;
37        }
38        unsafe { CGPDFDictionaryGetCount(dict) }
39    }
40
41    /// # Safety
42    ///
43    /// - `dict` must be a valid pointer or null.
44    /// - `key` must be a valid pointer.
45    /// - `value` must be a valid pointer or null.
46    #[doc(alias = "CGPDFDictionaryGetObject")]
47    #[cfg(feature = "CGPDFObject")]
48    #[inline]
49    pub unsafe fn object(
50        dict: CGPDFDictionaryRef,
51        key: NonNull<c_char>,
52        value: *mut CGPDFObjectRef,
53    ) -> bool {
54        extern "C-unwind" {
55            fn CGPDFDictionaryGetObject(
56                dict: CGPDFDictionaryRef,
57                key: NonNull<c_char>,
58                value: *mut CGPDFObjectRef,
59            ) -> bool;
60        }
61        unsafe { CGPDFDictionaryGetObject(dict, key, value) }
62    }
63
64    /// # Safety
65    ///
66    /// - `dict` must be a valid pointer or null.
67    /// - `key` must be a valid pointer.
68    /// - `value` must be a valid pointer or null.
69    #[doc(alias = "CGPDFDictionaryGetBoolean")]
70    #[cfg(feature = "CGPDFObject")]
71    #[inline]
72    pub unsafe fn boolean(
73        dict: CGPDFDictionaryRef,
74        key: NonNull<c_char>,
75        value: *mut CGPDFBoolean,
76    ) -> bool {
77        extern "C-unwind" {
78            fn CGPDFDictionaryGetBoolean(
79                dict: CGPDFDictionaryRef,
80                key: NonNull<c_char>,
81                value: *mut CGPDFBoolean,
82            ) -> bool;
83        }
84        unsafe { CGPDFDictionaryGetBoolean(dict, key, value) }
85    }
86
87    /// # Safety
88    ///
89    /// - `dict` must be a valid pointer or null.
90    /// - `key` must be a valid pointer.
91    /// - `value` must be a valid pointer or null.
92    #[doc(alias = "CGPDFDictionaryGetInteger")]
93    #[cfg(feature = "CGPDFObject")]
94    #[inline]
95    pub unsafe fn integer(
96        dict: CGPDFDictionaryRef,
97        key: NonNull<c_char>,
98        value: *mut CGPDFInteger,
99    ) -> bool {
100        extern "C-unwind" {
101            fn CGPDFDictionaryGetInteger(
102                dict: CGPDFDictionaryRef,
103                key: NonNull<c_char>,
104                value: *mut CGPDFInteger,
105            ) -> bool;
106        }
107        unsafe { CGPDFDictionaryGetInteger(dict, key, value) }
108    }
109
110    /// # Safety
111    ///
112    /// - `dict` must be a valid pointer or null.
113    /// - `key` must be a valid pointer.
114    /// - `value` must be a valid pointer or null.
115    #[doc(alias = "CGPDFDictionaryGetNumber")]
116    #[cfg(feature = "CGPDFObject")]
117    #[inline]
118    pub unsafe fn number(
119        dict: CGPDFDictionaryRef,
120        key: NonNull<c_char>,
121        value: *mut CGPDFReal,
122    ) -> bool {
123        extern "C-unwind" {
124            fn CGPDFDictionaryGetNumber(
125                dict: CGPDFDictionaryRef,
126                key: NonNull<c_char>,
127                value: *mut CGPDFReal,
128            ) -> bool;
129        }
130        unsafe { CGPDFDictionaryGetNumber(dict, key, value) }
131    }
132
133    /// # Safety
134    ///
135    /// - `dict` must be a valid pointer or null.
136    /// - `key` must be a valid pointer.
137    /// - `value` must be a valid pointer or null.
138    #[doc(alias = "CGPDFDictionaryGetName")]
139    #[inline]
140    pub unsafe fn name(
141        dict: CGPDFDictionaryRef,
142        key: NonNull<c_char>,
143        value: *mut *const c_char,
144    ) -> bool {
145        extern "C-unwind" {
146            fn CGPDFDictionaryGetName(
147                dict: CGPDFDictionaryRef,
148                key: NonNull<c_char>,
149                value: *mut *const c_char,
150            ) -> bool;
151        }
152        unsafe { CGPDFDictionaryGetName(dict, key, value) }
153    }
154
155    /// # Safety
156    ///
157    /// - `dict` must be a valid pointer or null.
158    /// - `key` must be a valid pointer.
159    /// - `value` must be a valid pointer or null.
160    #[doc(alias = "CGPDFDictionaryGetString")]
161    #[cfg(feature = "CGPDFString")]
162    #[inline]
163    pub unsafe fn string(
164        dict: CGPDFDictionaryRef,
165        key: NonNull<c_char>,
166        value: *mut CGPDFStringRef,
167    ) -> bool {
168        extern "C-unwind" {
169            fn CGPDFDictionaryGetString(
170                dict: CGPDFDictionaryRef,
171                key: NonNull<c_char>,
172                value: *mut CGPDFStringRef,
173            ) -> bool;
174        }
175        unsafe { CGPDFDictionaryGetString(dict, key, value) }
176    }
177
178    /// # Safety
179    ///
180    /// - `dict` must be a valid pointer or null.
181    /// - `key` must be a valid pointer.
182    /// - `value` must be a valid pointer or null.
183    #[doc(alias = "CGPDFDictionaryGetArray")]
184    #[cfg(feature = "CGPDFArray")]
185    #[inline]
186    pub unsafe fn array(
187        dict: CGPDFDictionaryRef,
188        key: NonNull<c_char>,
189        value: *mut CGPDFArrayRef,
190    ) -> bool {
191        extern "C-unwind" {
192            fn CGPDFDictionaryGetArray(
193                dict: CGPDFDictionaryRef,
194                key: NonNull<c_char>,
195                value: *mut CGPDFArrayRef,
196            ) -> bool;
197        }
198        unsafe { CGPDFDictionaryGetArray(dict, key, value) }
199    }
200
201    /// # Safety
202    ///
203    /// - `dict` must be a valid pointer or null.
204    /// - `key` must be a valid pointer.
205    /// - `value` must be a valid pointer or null.
206    #[doc(alias = "CGPDFDictionaryGetDictionary")]
207    #[inline]
208    pub unsafe fn dictionary(
209        dict: CGPDFDictionaryRef,
210        key: NonNull<c_char>,
211        value: *mut CGPDFDictionaryRef,
212    ) -> bool {
213        extern "C-unwind" {
214            fn CGPDFDictionaryGetDictionary(
215                dict: CGPDFDictionaryRef,
216                key: NonNull<c_char>,
217                value: *mut CGPDFDictionaryRef,
218            ) -> bool;
219        }
220        unsafe { CGPDFDictionaryGetDictionary(dict, key, value) }
221    }
222
223    /// # Safety
224    ///
225    /// - `dict` must be a valid pointer or null.
226    /// - `key` must be a valid pointer.
227    /// - `value` must be a valid pointer or null.
228    #[doc(alias = "CGPDFDictionaryGetStream")]
229    #[cfg(feature = "CGPDFStream")]
230    #[inline]
231    pub unsafe fn stream(
232        dict: CGPDFDictionaryRef,
233        key: NonNull<c_char>,
234        value: *mut CGPDFStreamRef,
235    ) -> bool {
236        extern "C-unwind" {
237            fn CGPDFDictionaryGetStream(
238                dict: CGPDFDictionaryRef,
239                key: NonNull<c_char>,
240                value: *mut CGPDFStreamRef,
241            ) -> bool;
242        }
243        unsafe { CGPDFDictionaryGetStream(dict, key, value) }
244    }
245}
246
247/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgpdfdictionaryapplierfunction?language=objc)
248#[cfg(feature = "CGPDFObject")]
249pub type CGPDFDictionaryApplierFunction =
250    Option<unsafe extern "C-unwind" fn(NonNull<c_char>, CGPDFObjectRef, *mut c_void)>;
251
252impl CGPDFDictionary {
253    /// # Safety
254    ///
255    /// - `dict` must be a valid pointer or null.
256    /// - `function` must be implemented correctly.
257    /// - `info` must be a valid pointer or null.
258    #[doc(alias = "CGPDFDictionaryApplyFunction")]
259    #[cfg(feature = "CGPDFObject")]
260    #[inline]
261    pub unsafe fn apply_function(
262        dict: CGPDFDictionaryRef,
263        function: CGPDFDictionaryApplierFunction,
264        info: *mut c_void,
265    ) {
266        extern "C-unwind" {
267            fn CGPDFDictionaryApplyFunction(
268                dict: CGPDFDictionaryRef,
269                function: CGPDFDictionaryApplierFunction,
270                info: *mut c_void,
271            );
272        }
273        unsafe { CGPDFDictionaryApplyFunction(dict, function, info) }
274    }
275}
276
277/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgpdfdictionaryapplierblock?language=objc)
278#[cfg(all(feature = "CGPDFObject", feature = "block2"))]
279pub type CGPDFDictionaryApplierBlock =
280    *mut block2::DynBlock<dyn Fn(NonNull<c_char>, CGPDFObjectRef, *mut c_void) -> bool>;
281
282impl CGPDFDictionary {
283    /// # Safety
284    ///
285    /// - `dict` must be a valid pointer or null.
286    /// - `block` must be a valid pointer or null.
287    /// - `info` must be a valid pointer or null.
288    #[doc(alias = "CGPDFDictionaryApplyBlock")]
289    #[cfg(all(feature = "CGPDFObject", feature = "block2"))]
290    #[inline]
291    pub unsafe fn apply_block(
292        dict: CGPDFDictionaryRef,
293        block: CGPDFDictionaryApplierBlock,
294        info: *mut c_void,
295    ) {
296        extern "C-unwind" {
297            fn CGPDFDictionaryApplyBlock(
298                dict: CGPDFDictionaryRef,
299                block: CGPDFDictionaryApplierBlock,
300                info: *mut c_void,
301            );
302        }
303        unsafe { CGPDFDictionaryApplyBlock(dict, block, info) }
304    }
305}
306
307extern "C-unwind" {
308    #[deprecated = "renamed to `CGPDFDictionary::count`"]
309    pub fn CGPDFDictionaryGetCount(dict: CGPDFDictionaryRef) -> usize;
310}
311
312extern "C-unwind" {
313    #[cfg(feature = "CGPDFObject")]
314    #[deprecated = "renamed to `CGPDFDictionary::object`"]
315    pub fn CGPDFDictionaryGetObject(
316        dict: CGPDFDictionaryRef,
317        key: NonNull<c_char>,
318        value: *mut CGPDFObjectRef,
319    ) -> bool;
320}
321
322extern "C-unwind" {
323    #[cfg(feature = "CGPDFObject")]
324    #[deprecated = "renamed to `CGPDFDictionary::boolean`"]
325    pub fn CGPDFDictionaryGetBoolean(
326        dict: CGPDFDictionaryRef,
327        key: NonNull<c_char>,
328        value: *mut CGPDFBoolean,
329    ) -> bool;
330}
331
332extern "C-unwind" {
333    #[cfg(feature = "CGPDFObject")]
334    #[deprecated = "renamed to `CGPDFDictionary::integer`"]
335    pub fn CGPDFDictionaryGetInteger(
336        dict: CGPDFDictionaryRef,
337        key: NonNull<c_char>,
338        value: *mut CGPDFInteger,
339    ) -> bool;
340}
341
342extern "C-unwind" {
343    #[cfg(feature = "CGPDFObject")]
344    #[deprecated = "renamed to `CGPDFDictionary::number`"]
345    pub fn CGPDFDictionaryGetNumber(
346        dict: CGPDFDictionaryRef,
347        key: NonNull<c_char>,
348        value: *mut CGPDFReal,
349    ) -> bool;
350}
351
352extern "C-unwind" {
353    #[deprecated = "renamed to `CGPDFDictionary::name`"]
354    pub fn CGPDFDictionaryGetName(
355        dict: CGPDFDictionaryRef,
356        key: NonNull<c_char>,
357        value: *mut *const c_char,
358    ) -> bool;
359}
360
361extern "C-unwind" {
362    #[cfg(feature = "CGPDFString")]
363    #[deprecated = "renamed to `CGPDFDictionary::string`"]
364    pub fn CGPDFDictionaryGetString(
365        dict: CGPDFDictionaryRef,
366        key: NonNull<c_char>,
367        value: *mut CGPDFStringRef,
368    ) -> bool;
369}
370
371extern "C-unwind" {
372    #[cfg(feature = "CGPDFArray")]
373    #[deprecated = "renamed to `CGPDFDictionary::array`"]
374    pub fn CGPDFDictionaryGetArray(
375        dict: CGPDFDictionaryRef,
376        key: NonNull<c_char>,
377        value: *mut CGPDFArrayRef,
378    ) -> bool;
379}
380
381extern "C-unwind" {
382    #[deprecated = "renamed to `CGPDFDictionary::dictionary`"]
383    pub fn CGPDFDictionaryGetDictionary(
384        dict: CGPDFDictionaryRef,
385        key: NonNull<c_char>,
386        value: *mut CGPDFDictionaryRef,
387    ) -> bool;
388}
389
390extern "C-unwind" {
391    #[cfg(feature = "CGPDFStream")]
392    #[deprecated = "renamed to `CGPDFDictionary::stream`"]
393    pub fn CGPDFDictionaryGetStream(
394        dict: CGPDFDictionaryRef,
395        key: NonNull<c_char>,
396        value: *mut CGPDFStreamRef,
397    ) -> bool;
398}
399
400extern "C-unwind" {
401    #[cfg(feature = "CGPDFObject")]
402    #[deprecated = "renamed to `CGPDFDictionary::apply_function`"]
403    pub fn CGPDFDictionaryApplyFunction(
404        dict: CGPDFDictionaryRef,
405        function: CGPDFDictionaryApplierFunction,
406        info: *mut c_void,
407    );
408}
409
410extern "C-unwind" {
411    #[cfg(all(feature = "CGPDFObject", feature = "block2"))]
412    #[deprecated = "renamed to `CGPDFDictionary::apply_block`"]
413    pub fn CGPDFDictionaryApplyBlock(
414        dict: CGPDFDictionaryRef,
415        block: CGPDFDictionaryApplierBlock,
416        info: *mut c_void,
417    );
418}