//! 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}; use core::ptr::NonNull; #[cfg(feature = "objc2")] use objc2::__framework_prelude::*; use objc2_core_foundation::*; use crate::*; /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgpsconverter?language=objc) #[doc(alias = "CGPSConverterRef")] #[repr(C)] pub struct CGPSConverter { inner: [u8; 0], _p: UnsafeCell, PhantomPinned)>>, } cf_type!( unsafe impl CGPSConverter {} ); #[cfg(feature = "objc2")] cf_objc2_type!( unsafe impl RefEncode<"CGPSConverter"> for CGPSConverter {} ); /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgpsconverterbegindocumentcallback?language=objc) pub type CGPSConverterBeginDocumentCallback = Option; /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgpsconverterenddocumentcallback?language=objc) pub type CGPSConverterEndDocumentCallback = Option; /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgpsconverterbeginpagecallback?language=objc) pub type CGPSConverterBeginPageCallback = Option)>; /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgpsconverterendpagecallback?language=objc) pub type CGPSConverterEndPageCallback = Option)>; /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgpsconverterprogresscallback?language=objc) pub type CGPSConverterProgressCallback = Option; /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgpsconvertermessagecallback?language=objc) pub type CGPSConverterMessageCallback = Option)>; /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgpsconverterreleaseinfocallback?language=objc) pub type CGPSConverterReleaseInfoCallback = Option; /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgpsconvertercallbacks?language=objc) #[repr(C)] #[allow(unpredictable_function_pointer_comparisons)] #[derive(Clone, Copy, Debug, PartialEq)] pub struct CGPSConverterCallbacks { pub version: c_uint, pub beginDocument: CGPSConverterBeginDocumentCallback, pub endDocument: CGPSConverterEndDocumentCallback, pub beginPage: CGPSConverterBeginPageCallback, pub endPage: CGPSConverterEndPageCallback, pub noteProgress: CGPSConverterProgressCallback, pub noteMessage: CGPSConverterMessageCallback, pub releaseInfo: CGPSConverterReleaseInfoCallback, } #[cfg(feature = "objc2")] unsafe impl Encode for CGPSConverterCallbacks { const ENCODING: Encoding = Encoding::Struct( "CGPSConverterCallbacks", &[ ::ENCODING, ::ENCODING, Encoding::Pointer(&Encoding::Unknown), ::ENCODING, ::ENCODING, ::ENCODING, ::ENCODING, ::ENCODING, ], ); } #[cfg(feature = "objc2")] unsafe impl RefEncode for CGPSConverterCallbacks { const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING); } impl CGPSConverter { /// # Safety /// /// - `info` must be a valid pointer or null. /// - `callbacks` must be a valid pointer. /// - `options` generics must be of the correct type. #[doc(alias = "CGPSConverterCreate")] #[inline] pub unsafe fn new( info: *mut c_void, callbacks: NonNull, options: Option<&CFDictionary>, ) -> Option> { extern "C-unwind" { fn CGPSConverterCreate( info: *mut c_void, callbacks: NonNull, options: Option<&CFDictionary>, ) -> Option>; } let ret = unsafe { CGPSConverterCreate(info, callbacks, options) }; ret.map(|ret| unsafe { CFRetained::from_raw(ret) }) } /// # Safety /// /// `options` generics must be of the correct type. #[doc(alias = "CGPSConverterConvert")] #[cfg(all(feature = "CGDataConsumer", feature = "CGDataProvider"))] #[inline] pub unsafe fn convert( &self, provider: &CGDataProvider, consumer: &CGDataConsumer, options: Option<&CFDictionary>, ) -> bool { extern "C-unwind" { fn CGPSConverterConvert( converter: &CGPSConverter, provider: &CGDataProvider, consumer: &CGDataConsumer, options: Option<&CFDictionary>, ) -> bool; } unsafe { CGPSConverterConvert(self, provider, consumer, options) } } #[doc(alias = "CGPSConverterAbort")] #[inline] pub fn abort(&self) -> bool { extern "C-unwind" { fn CGPSConverterAbort(converter: &CGPSConverter) -> bool; } unsafe { CGPSConverterAbort(self) } } #[doc(alias = "CGPSConverterIsConverting")] #[inline] pub fn is_converting(&self) -> bool { extern "C-unwind" { fn CGPSConverterIsConverting(converter: &CGPSConverter) -> bool; } unsafe { CGPSConverterIsConverting(self) } } } unsafe impl ConcreteType for CGPSConverter { #[doc(alias = "CGPSConverterGetTypeID")] #[inline] fn type_id() -> CFTypeID { extern "C-unwind" { fn CGPSConverterGetTypeID() -> CFTypeID; } unsafe { CGPSConverterGetTypeID() } } } #[deprecated = "renamed to `CGPSConverter::new`"] #[inline] pub unsafe extern "C-unwind" fn CGPSConverterCreate( info: *mut c_void, callbacks: NonNull, options: Option<&CFDictionary>, ) -> Option> { extern "C-unwind" { fn CGPSConverterCreate( info: *mut c_void, callbacks: NonNull, options: Option<&CFDictionary>, ) -> Option>; } let ret = unsafe { CGPSConverterCreate(info, callbacks, options) }; ret.map(|ret| unsafe { CFRetained::from_raw(ret) }) } extern "C-unwind" { #[cfg(all(feature = "CGDataConsumer", feature = "CGDataProvider"))] #[deprecated = "renamed to `CGPSConverter::convert`"] pub fn CGPSConverterConvert( converter: &CGPSConverter, provider: &CGDataProvider, consumer: &CGDataConsumer, options: Option<&CFDictionary>, ) -> bool; } #[deprecated = "renamed to `CGPSConverter::abort`"] #[inline] pub extern "C-unwind" fn CGPSConverterAbort(converter: &CGPSConverter) -> bool { extern "C-unwind" { fn CGPSConverterAbort(converter: &CGPSConverter) -> bool; } unsafe { CGPSConverterAbort(converter) } } #[deprecated = "renamed to `CGPSConverter::is_converting`"] #[inline] pub extern "C-unwind" fn CGPSConverterIsConverting(converter: &CGPSConverter) -> bool { extern "C-unwind" { fn CGPSConverterIsConverting(converter: &CGPSConverter) -> bool; } unsafe { CGPSConverterIsConverting(converter) } }