//! 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/cgpdfstring?language=objc) #[repr(C)] #[derive(Debug)] pub struct CGPDFString { inner: [u8; 0], _p: UnsafeCell, PhantomPinned)>>, } #[cfg(feature = "objc2")] unsafe impl RefEncode for CGPDFString { const ENCODING_REF: Encoding = Encoding::Pointer(&Encoding::Struct("CGPDFString", &[])); } /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgpdfstringref?language=objc) pub type CGPDFStringRef = *mut CGPDFString; impl CGPDFString { /// # Safety /// /// `string` must be a valid pointer or null. #[doc(alias = "CGPDFStringGetLength")] #[inline] pub unsafe fn length(string: CGPDFStringRef) -> usize { extern "C-unwind" { fn CGPDFStringGetLength(string: CGPDFStringRef) -> usize; } unsafe { CGPDFStringGetLength(string) } } /// # Safety /// /// `string` must be a valid pointer or null. #[doc(alias = "CGPDFStringGetBytePtr")] #[inline] pub unsafe fn byte_ptr(string: CGPDFStringRef) -> *const c_uchar { extern "C-unwind" { fn CGPDFStringGetBytePtr(string: CGPDFStringRef) -> *const c_uchar; } unsafe { CGPDFStringGetBytePtr(string) } } /// # Safety /// /// `string` must be a valid pointer or null. #[doc(alias = "CGPDFStringCopyTextString")] #[inline] pub unsafe fn text_string(string: CGPDFStringRef) -> Option> { extern "C-unwind" { fn CGPDFStringCopyTextString(string: CGPDFStringRef) -> Option>; } let ret = unsafe { CGPDFStringCopyTextString(string) }; ret.map(|ret| unsafe { CFRetained::from_raw(ret) }) } /// # Safety /// /// `string` must be a valid pointer or null. #[doc(alias = "CGPDFStringCopyDate")] #[inline] pub unsafe fn date(string: CGPDFStringRef) -> Option> { extern "C-unwind" { fn CGPDFStringCopyDate(string: CGPDFStringRef) -> Option>; } let ret = unsafe { CGPDFStringCopyDate(string) }; ret.map(|ret| unsafe { CFRetained::from_raw(ret) }) } } extern "C-unwind" { #[deprecated = "renamed to `CGPDFString::length`"] pub fn CGPDFStringGetLength(string: CGPDFStringRef) -> usize; } extern "C-unwind" { #[deprecated = "renamed to `CGPDFString::byte_ptr`"] pub fn CGPDFStringGetBytePtr(string: CGPDFStringRef) -> *const c_uchar; } #[deprecated = "renamed to `CGPDFString::text_string`"] #[inline] pub unsafe extern "C-unwind" fn CGPDFStringCopyTextString( string: CGPDFStringRef, ) -> Option> { extern "C-unwind" { fn CGPDFStringCopyTextString(string: CGPDFStringRef) -> Option>; } let ret = unsafe { CGPDFStringCopyTextString(string) }; ret.map(|ret| unsafe { CFRetained::from_raw(ret) }) } #[deprecated = "renamed to `CGPDFString::date`"] #[inline] pub unsafe extern "C-unwind" fn CGPDFStringCopyDate( string: CGPDFStringRef, ) -> Option> { extern "C-unwind" { fn CGPDFStringCopyDate(string: CGPDFStringRef) -> Option>; } let ret = unsafe { CGPDFStringCopyDate(string) }; ret.map(|ret| unsafe { CFRetained::from_raw(ret) }) }