//! 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 crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_0?language=objc)
pub const kCFCoreFoundationVersionNumber10_0: c_float = 196.40;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_0_3?language=objc)
pub const kCFCoreFoundationVersionNumber10_0_3: c_float = 196.50;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_1?language=objc)
pub const kCFCoreFoundationVersionNumber10_1: c_float = 226.00;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_1_1?language=objc)
pub const kCFCoreFoundationVersionNumber10_1_1: c_float = 226.00;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_1_2?language=objc)
pub const kCFCoreFoundationVersionNumber10_1_2: c_float = 227.20;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_1_3?language=objc)
pub const kCFCoreFoundationVersionNumber10_1_3: c_float = 227.20;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_1_4?language=objc)
pub const kCFCoreFoundationVersionNumber10_1_4: c_float = 227.30;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_2?language=objc)
pub const kCFCoreFoundationVersionNumber10_2: c_float = 263.00;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_2_1?language=objc)
pub const kCFCoreFoundationVersionNumber10_2_1: c_float = 263.10;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_2_2?language=objc)
pub const kCFCoreFoundationVersionNumber10_2_2: c_float = 263.10;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_2_3?language=objc)
pub const kCFCoreFoundationVersionNumber10_2_3: c_float = 263.30;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_2_4?language=objc)
pub const kCFCoreFoundationVersionNumber10_2_4: c_float = 263.30;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_2_5?language=objc)
pub const kCFCoreFoundationVersionNumber10_2_5: c_float = 263.50;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_2_6?language=objc)
pub const kCFCoreFoundationVersionNumber10_2_6: c_float = 263.50;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_2_7?language=objc)
pub const kCFCoreFoundationVersionNumber10_2_7: c_float = 263.50;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_2_8?language=objc)
pub const kCFCoreFoundationVersionNumber10_2_8: c_float = 263.50;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_3?language=objc)
pub const kCFCoreFoundationVersionNumber10_3: c_float = 299.00;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_3_1?language=objc)
pub const kCFCoreFoundationVersionNumber10_3_1: c_float = 299.00;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_3_2?language=objc)
pub const kCFCoreFoundationVersionNumber10_3_2: c_float = 299.00;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_3_3?language=objc)
pub const kCFCoreFoundationVersionNumber10_3_3: c_float = 299.30;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_3_4?language=objc)
pub const kCFCoreFoundationVersionNumber10_3_4: c_float = 299.31;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_3_5?language=objc)
pub const kCFCoreFoundationVersionNumber10_3_5: c_float = 299.31;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_3_6?language=objc)
pub const kCFCoreFoundationVersionNumber10_3_6: c_float = 299.32;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_3_7?language=objc)
pub const kCFCoreFoundationVersionNumber10_3_7: c_float = 299.33;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_3_8?language=objc)
pub const kCFCoreFoundationVersionNumber10_3_8: c_float = 299.33;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_3_9?language=objc)
pub const kCFCoreFoundationVersionNumber10_3_9: c_float = 299.35;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4?language=objc)
pub const kCFCoreFoundationVersionNumber10_4: c_float = 368.00;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_1?language=objc)
pub const kCFCoreFoundationVersionNumber10_4_1: c_float = 368.10;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_2?language=objc)
pub const kCFCoreFoundationVersionNumber10_4_2: c_float = 368.11;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_3?language=objc)
pub const kCFCoreFoundationVersionNumber10_4_3: c_float = 368.18;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_4_intel?language=objc)
pub const kCFCoreFoundationVersionNumber10_4_4_Intel: c_float = 368.26;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_4_powerpc?language=objc)
pub const kCFCoreFoundationVersionNumber10_4_4_PowerPC: c_float = 368.25;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_5_intel?language=objc)
pub const kCFCoreFoundationVersionNumber10_4_5_Intel: c_float = 368.26;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_5_powerpc?language=objc)
pub const kCFCoreFoundationVersionNumber10_4_5_PowerPC: c_float = 368.25;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_6_intel?language=objc)
pub const kCFCoreFoundationVersionNumber10_4_6_Intel: c_float = 368.26;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_6_powerpc?language=objc)
pub const kCFCoreFoundationVersionNumber10_4_6_PowerPC: c_float = 368.25;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_7?language=objc)
pub const kCFCoreFoundationVersionNumber10_4_7: c_float = 368.27;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_8?language=objc)
pub const kCFCoreFoundationVersionNumber10_4_8: c_float = 368.27;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_9?language=objc)
pub const kCFCoreFoundationVersionNumber10_4_9: c_float = 368.28;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_10?language=objc)
pub const kCFCoreFoundationVersionNumber10_4_10: c_float = 368.28;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_11?language=objc)
pub const kCFCoreFoundationVersionNumber10_4_11: c_float = 368.31;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_5?language=objc)
pub const kCFCoreFoundationVersionNumber10_5: c_float = 476.00;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_5_1?language=objc)
pub const kCFCoreFoundationVersionNumber10_5_1: c_float = 476.00;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_5_2?language=objc)
pub const kCFCoreFoundationVersionNumber10_5_2: c_float = 476.10;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_5_3?language=objc)
pub const kCFCoreFoundationVersionNumber10_5_3: c_float = 476.13;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_5_4?language=objc)
pub const kCFCoreFoundationVersionNumber10_5_4: c_float = 476.14;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_5_5?language=objc)
pub const kCFCoreFoundationVersionNumber10_5_5: c_float = 476.15;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_5_6?language=objc)
pub const kCFCoreFoundationVersionNumber10_5_6: c_float = 476.17;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_5_7?language=objc)
pub const kCFCoreFoundationVersionNumber10_5_7: c_float = 476.18;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_5_8?language=objc)
pub const kCFCoreFoundationVersionNumber10_5_8: c_float = 476.19;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_6?language=objc)
pub const kCFCoreFoundationVersionNumber10_6: c_float = 550.00;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_6_1?language=objc)
pub const kCFCoreFoundationVersionNumber10_6_1: c_float = 550.00;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_6_2?language=objc)
pub const kCFCoreFoundationVersionNumber10_6_2: c_float = 550.13;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_6_3?language=objc)
pub const kCFCoreFoundationVersionNumber10_6_3: c_float = 550.19;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_6_4?language=objc)
pub const kCFCoreFoundationVersionNumber10_6_4: c_float = 550.29;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_6_5?language=objc)
pub const kCFCoreFoundationVersionNumber10_6_5: c_float = 550.42;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_6_6?language=objc)
pub const kCFCoreFoundationVersionNumber10_6_6: c_float = 550.42;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_6_7?language=objc)
pub const kCFCoreFoundationVersionNumber10_6_7: c_float = 550.42;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_6_8?language=objc)
pub const kCFCoreFoundationVersionNumber10_6_8: c_float = 550.43;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_7?language=objc)
pub const kCFCoreFoundationVersionNumber10_7: c_float = 635.00;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_7_1?language=objc)
pub const kCFCoreFoundationVersionNumber10_7_1: c_float = 635.00;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_7_2?language=objc)
pub const kCFCoreFoundationVersionNumber10_7_2: c_float = 635.15;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_7_3?language=objc)
pub const kCFCoreFoundationVersionNumber10_7_3: c_float = 635.19;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_7_4?language=objc)
pub const kCFCoreFoundationVersionNumber10_7_4: c_float = 635.21;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_7_5?language=objc)
pub const kCFCoreFoundationVersionNumber10_7_5: c_float = 635.21;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_8?language=objc)
pub const kCFCoreFoundationVersionNumber10_8: c_float = 744.00;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_8_1?language=objc)
pub const kCFCoreFoundationVersionNumber10_8_1: c_float = 744.00;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_8_2?language=objc)
pub const kCFCoreFoundationVersionNumber10_8_2: c_float = 744.12;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_8_3?language=objc)
pub const kCFCoreFoundationVersionNumber10_8_3: c_float = 744.18;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_8_4?language=objc)
pub const kCFCoreFoundationVersionNumber10_8_4: c_float = 744.19;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_9?language=objc)
pub const kCFCoreFoundationVersionNumber10_9: c_float = 855.11;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_9_1?language=objc)
pub const kCFCoreFoundationVersionNumber10_9_1: c_float = 855.11;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_9_2?language=objc)
pub const kCFCoreFoundationVersionNumber10_9_2: c_float = 855.14;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_10?language=objc)
pub const kCFCoreFoundationVersionNumber10_10: c_float = 1151.16;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_10_1?language=objc)
pub const kCFCoreFoundationVersionNumber10_10_1: c_float = 1151.16;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_10_2?language=objc)
pub const kCFCoreFoundationVersionNumber10_10_2: c_uint = 1152;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_10_3?language=objc)
pub const kCFCoreFoundationVersionNumber10_10_3: c_float = 1153.18;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_10_4?language=objc)
pub const kCFCoreFoundationVersionNumber10_10_4: c_float = 1153.18;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_10_5?language=objc)
pub const kCFCoreFoundationVersionNumber10_10_5: c_float = 1153.18;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_10_max?language=objc)
pub const kCFCoreFoundationVersionNumber10_10_Max: c_uint = 1199;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_11?language=objc)
pub const kCFCoreFoundationVersionNumber10_11: c_uint = 1253;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_11_1?language=objc)
pub const kCFCoreFoundationVersionNumber10_11_1: c_float = 1255.1;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_11_2?language=objc)
pub const kCFCoreFoundationVersionNumber10_11_2: c_float = 1256.14;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_11_3?language=objc)
pub const kCFCoreFoundationVersionNumber10_11_3: c_float = 1256.14;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_11_4?language=objc)
pub const kCFCoreFoundationVersionNumber10_11_4: c_float = 1258.1;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_11_max?language=objc)
pub const kCFCoreFoundationVersionNumber10_11_Max: c_uint = 1299;
/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfallocatortypeid?language=objc)
pub type CFAllocatorTypeID = c_ulonglong;

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber?language=objc)
    pub static kCFCoreFoundationVersionNumber: c_double;
}

/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfstring?language=objc)
#[repr(C)]
pub struct CFString {
    inner: [u8; 0],
    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}

cf_type!(
    unsafe impl CFString {}
);
#[cfg(feature = "objc2")]
cf_objc2_type!(
    unsafe impl RefEncode<"__CFString"> for CFString {}
);

/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfmutablestring?language=objc)
#[repr(C)]
pub struct CFMutableString {
    inner: [u8; 0],
    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}

cf_type!(
    unsafe impl CFMutableString: CFString {}
);
#[cfg(feature = "objc2")]
cf_objc2_type!(
    unsafe impl RefEncode<"__CFString"> for CFMutableString {}
);

/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfpropertylist?language=objc)
pub type CFPropertyList = CFType;

/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfcomparisonresult?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CFComparisonResult(pub CFIndex);
impl CFComparisonResult {
    #[doc(alias = "kCFCompareLessThan")]
    pub const CompareLessThan: Self = Self(-1);
    #[doc(alias = "kCFCompareEqualTo")]
    pub const CompareEqualTo: Self = Self(0);
    #[doc(alias = "kCFCompareGreaterThan")]
    pub const CompareGreaterThan: Self = Self(1);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for CFComparisonResult {
    const ENCODING: Encoding = CFIndex::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for CFComparisonResult {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfcomparatorfunction?language=objc)
pub type CFComparatorFunction = Option<
    unsafe extern "C-unwind" fn(*const c_void, *const c_void, *mut c_void) -> CFComparisonResult,
>;

/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfnotfound?language=objc)
pub static kCFNotFound: CFIndex = -1;

/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfrange?language=objc)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CFRange {
    pub location: CFIndex,
    pub length: CFIndex,
}

#[cfg(feature = "objc2")]
unsafe impl Encode for CFRange {
    const ENCODING: Encoding = Encoding::Struct("?", &[<CFIndex>::ENCODING, <CFIndex>::ENCODING]);
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for CFRange {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfnull?language=objc)
#[repr(C)]
pub struct CFNull {
    inner: [u8; 0],
    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}

cf_type!(
    unsafe impl CFNull {}
);
#[cfg(feature = "objc2")]
cf_objc2_type!(
    unsafe impl RefEncode<"__CFNull"> for CFNull {}
);

unsafe impl ConcreteType for CFNull {
    #[doc(alias = "CFNullGetTypeID")]
    #[inline]
    fn type_id() -> CFTypeID {
        extern "C-unwind" {
            fn CFNullGetTypeID() -> CFTypeID;
        }
        unsafe { CFNullGetTypeID() }
    }
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfnull?language=objc)
    pub static kCFNull: Option<&'static CFNull>;
}

/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfallocator?language=objc)
#[repr(C)]
pub struct CFAllocator {
    inner: [u8; 0],
    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}

cf_type!(
    unsafe impl CFAllocator {}
);
#[cfg(feature = "objc2")]
cf_objc2_type!(
    unsafe impl RefEncode<"__CFAllocator"> for CFAllocator {}
);

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfallocatordefault?language=objc)
    pub static kCFAllocatorDefault: Option<&'static CFAllocator>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfallocatorsystemdefault?language=objc)
    pub static kCFAllocatorSystemDefault: Option<&'static CFAllocator>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfallocatormalloc?language=objc)
    pub static kCFAllocatorMalloc: Option<&'static CFAllocator>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfallocatormalloczone?language=objc)
    pub static kCFAllocatorMallocZone: Option<&'static CFAllocator>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfallocatornull?language=objc)
    pub static kCFAllocatorNull: Option<&'static CFAllocator>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfallocatorusecontext?language=objc)
    pub static kCFAllocatorUseContext: Option<&'static CFAllocator>;
}

/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfallocatorretaincallback?language=objc)
pub type CFAllocatorRetainCallBack =
    Option<unsafe extern "C-unwind" fn(*const c_void) -> *const c_void>;

/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfallocatorreleasecallback?language=objc)
pub type CFAllocatorReleaseCallBack = Option<unsafe extern "C-unwind" fn(*const c_void)>;

/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfallocatorcopydescriptioncallback?language=objc)
pub type CFAllocatorCopyDescriptionCallBack =
    Option<unsafe extern "C-unwind" fn(*const c_void) -> *const CFString>;

/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfallocatorallocatecallback?language=objc)
pub type CFAllocatorAllocateCallBack =
    Option<unsafe extern "C-unwind" fn(CFIndex, CFOptionFlags, *mut c_void) -> *mut c_void>;

/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfallocatorreallocatecallback?language=objc)
pub type CFAllocatorReallocateCallBack = Option<
    unsafe extern "C-unwind" fn(*mut c_void, CFIndex, CFOptionFlags, *mut c_void) -> *mut c_void,
>;

/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfallocatordeallocatecallback?language=objc)
pub type CFAllocatorDeallocateCallBack =
    Option<unsafe extern "C-unwind" fn(*mut c_void, *mut c_void)>;

/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfallocatorpreferredsizecallback?language=objc)
pub type CFAllocatorPreferredSizeCallBack =
    Option<unsafe extern "C-unwind" fn(CFIndex, CFOptionFlags, *mut c_void) -> CFIndex>;

/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfallocatorcontext?language=objc)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CFAllocatorContext {
    pub version: CFIndex,
    pub info: *mut c_void,
    pub retain: CFAllocatorRetainCallBack,
    pub release: CFAllocatorReleaseCallBack,
    pub copyDescription: CFAllocatorCopyDescriptionCallBack,
    pub allocate: CFAllocatorAllocateCallBack,
    pub reallocate: CFAllocatorReallocateCallBack,
    pub deallocate: CFAllocatorDeallocateCallBack,
    pub preferredSize: CFAllocatorPreferredSizeCallBack,
}

#[cfg(feature = "objc2")]
unsafe impl Encode for CFAllocatorContext {
    const ENCODING: Encoding = Encoding::Struct(
        "?",
        &[
            <CFIndex>::ENCODING,
            <*mut c_void>::ENCODING,
            <CFAllocatorRetainCallBack>::ENCODING,
            <CFAllocatorReleaseCallBack>::ENCODING,
            <CFAllocatorCopyDescriptionCallBack>::ENCODING,
            <CFAllocatorAllocateCallBack>::ENCODING,
            <CFAllocatorReallocateCallBack>::ENCODING,
            <CFAllocatorDeallocateCallBack>::ENCODING,
            <CFAllocatorPreferredSizeCallBack>::ENCODING,
        ],
    );
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for CFAllocatorContext {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

unsafe impl ConcreteType for CFAllocator {
    #[doc(alias = "CFAllocatorGetTypeID")]
    #[inline]
    fn type_id() -> CFTypeID {
        extern "C-unwind" {
            fn CFAllocatorGetTypeID() -> CFTypeID;
        }
        unsafe { CFAllocatorGetTypeID() }
    }
}

impl CFAllocator {
    #[doc(alias = "CFAllocatorSetDefault")]
    #[inline]
    pub fn set_default(allocator: Option<&CFAllocator>) {
        extern "C-unwind" {
            fn CFAllocatorSetDefault(allocator: Option<&CFAllocator>);
        }
        unsafe { CFAllocatorSetDefault(allocator) }
    }

    #[doc(alias = "CFAllocatorGetDefault")]
    #[inline]
    pub fn default() -> Option<CFRetained<CFAllocator>> {
        extern "C-unwind" {
            fn CFAllocatorGetDefault() -> Option<NonNull<CFAllocator>>;
        }
        let ret = unsafe { CFAllocatorGetDefault() };
        ret.map(|ret| unsafe { CFRetained::retain(ret) })
    }

    #[doc(alias = "CFAllocatorCreate")]
    #[inline]
    pub unsafe fn new(
        allocator: Option<&CFAllocator>,
        context: *mut CFAllocatorContext,
    ) -> Option<CFRetained<CFAllocator>> {
        extern "C-unwind" {
            fn CFAllocatorCreate(
                allocator: Option<&CFAllocator>,
                context: *mut CFAllocatorContext,
            ) -> Option<NonNull<CFAllocator>>;
        }
        let ret = unsafe { CFAllocatorCreate(allocator, context) };
        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
    }

    #[doc(alias = "CFAllocatorAllocateTyped")]
    #[inline]
    pub unsafe fn allocate_typed(
        allocator: Option<&CFAllocator>,
        size: CFIndex,
        descriptor: CFAllocatorTypeID,
        hint: CFOptionFlags,
    ) -> *mut c_void {
        extern "C-unwind" {
            fn CFAllocatorAllocateTyped(
                allocator: Option<&CFAllocator>,
                size: CFIndex,
                descriptor: CFAllocatorTypeID,
                hint: CFOptionFlags,
            ) -> *mut c_void;
        }
        unsafe { CFAllocatorAllocateTyped(allocator, size, descriptor, hint) }
    }

    #[doc(alias = "CFAllocatorReallocateTyped")]
    #[inline]
    pub unsafe fn reallocate_typed(
        allocator: Option<&CFAllocator>,
        ptr: *mut c_void,
        newsize: CFIndex,
        descriptor: CFAllocatorTypeID,
        hint: CFOptionFlags,
    ) -> *mut c_void {
        extern "C-unwind" {
            fn CFAllocatorReallocateTyped(
                allocator: Option<&CFAllocator>,
                ptr: *mut c_void,
                newsize: CFIndex,
                descriptor: CFAllocatorTypeID,
                hint: CFOptionFlags,
            ) -> *mut c_void;
        }
        unsafe { CFAllocatorReallocateTyped(allocator, ptr, newsize, descriptor, hint) }
    }

    #[doc(alias = "CFAllocatorAllocateBytes")]
    #[inline]
    pub fn allocate_bytes(
        allocator: Option<&CFAllocator>,
        size: CFIndex,
        hint: CFOptionFlags,
    ) -> *mut c_void {
        extern "C-unwind" {
            fn CFAllocatorAllocateBytes(
                allocator: Option<&CFAllocator>,
                size: CFIndex,
                hint: CFOptionFlags,
            ) -> *mut c_void;
        }
        unsafe { CFAllocatorAllocateBytes(allocator, size, hint) }
    }

    #[doc(alias = "CFAllocatorReallocateBytes")]
    #[inline]
    pub unsafe fn reallocate_bytes(
        allocator: Option<&CFAllocator>,
        ptr: *mut c_void,
        newsize: CFIndex,
        hint: CFOptionFlags,
    ) -> *mut c_void {
        extern "C-unwind" {
            fn CFAllocatorReallocateBytes(
                allocator: Option<&CFAllocator>,
                ptr: *mut c_void,
                newsize: CFIndex,
                hint: CFOptionFlags,
            ) -> *mut c_void;
        }
        unsafe { CFAllocatorReallocateBytes(allocator, ptr, newsize, hint) }
    }

    #[doc(alias = "CFAllocatorAllocate")]
    #[inline]
    pub fn allocate(
        allocator: Option<&CFAllocator>,
        size: CFIndex,
        hint: CFOptionFlags,
    ) -> *mut c_void {
        extern "C-unwind" {
            fn CFAllocatorAllocate(
                allocator: Option<&CFAllocator>,
                size: CFIndex,
                hint: CFOptionFlags,
            ) -> *mut c_void;
        }
        unsafe { CFAllocatorAllocate(allocator, size, hint) }
    }

    #[doc(alias = "CFAllocatorReallocate")]
    #[inline]
    pub unsafe fn reallocate(
        allocator: Option<&CFAllocator>,
        ptr: *mut c_void,
        newsize: CFIndex,
        hint: CFOptionFlags,
    ) -> *mut c_void {
        extern "C-unwind" {
            fn CFAllocatorReallocate(
                allocator: Option<&CFAllocator>,
                ptr: *mut c_void,
                newsize: CFIndex,
                hint: CFOptionFlags,
            ) -> *mut c_void;
        }
        unsafe { CFAllocatorReallocate(allocator, ptr, newsize, hint) }
    }

    #[doc(alias = "CFAllocatorDeallocate")]
    #[inline]
    pub unsafe fn deallocate(allocator: Option<&CFAllocator>, ptr: *mut c_void) {
        extern "C-unwind" {
            fn CFAllocatorDeallocate(allocator: Option<&CFAllocator>, ptr: *mut c_void);
        }
        unsafe { CFAllocatorDeallocate(allocator, ptr) }
    }

    #[doc(alias = "CFAllocatorGetPreferredSizeForSize")]
    #[inline]
    pub fn preferred_size_for_size(
        allocator: Option<&CFAllocator>,
        size: CFIndex,
        hint: CFOptionFlags,
    ) -> CFIndex {
        extern "C-unwind" {
            fn CFAllocatorGetPreferredSizeForSize(
                allocator: Option<&CFAllocator>,
                size: CFIndex,
                hint: CFOptionFlags,
            ) -> CFIndex;
        }
        unsafe { CFAllocatorGetPreferredSizeForSize(allocator, size, hint) }
    }

    #[doc(alias = "CFAllocatorGetContext")]
    #[inline]
    pub unsafe fn context(allocator: Option<&CFAllocator>, context: *mut CFAllocatorContext) {
        extern "C-unwind" {
            fn CFAllocatorGetContext(
                allocator: Option<&CFAllocator>,
                context: *mut CFAllocatorContext,
            );
        }
        unsafe { CFAllocatorGetContext(allocator, context) }
    }
}

#[inline]
pub extern "C-unwind" fn CFGetTypeID(cf: Option<&CFType>) -> CFTypeID {
    extern "C-unwind" {
        fn CFGetTypeID(cf: Option<&CFType>) -> CFTypeID;
    }
    unsafe { CFGetTypeID(cf) }
}

#[inline]
pub extern "C-unwind" fn CFCopyTypeIDDescription(
    type_id: CFTypeID,
) -> Option<CFRetained<CFString>> {
    extern "C-unwind" {
        fn CFCopyTypeIDDescription(type_id: CFTypeID) -> Option<NonNull<CFString>>;
    }
    let ret = unsafe { CFCopyTypeIDDescription(type_id) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

#[inline]
pub extern "C-unwind" fn CFGetRetainCount(cf: Option<&CFType>) -> CFIndex {
    extern "C-unwind" {
        fn CFGetRetainCount(cf: Option<&CFType>) -> CFIndex;
    }
    unsafe { CFGetRetainCount(cf) }
}

#[inline]
pub extern "C-unwind" fn CFEqual(cf1: Option<&CFType>, cf2: Option<&CFType>) -> bool {
    extern "C-unwind" {
        fn CFEqual(cf1: Option<&CFType>, cf2: Option<&CFType>) -> Boolean;
    }
    let ret = unsafe { CFEqual(cf1, cf2) };
    ret != 0
}

#[inline]
pub extern "C-unwind" fn CFHash(cf: Option<&CFType>) -> CFHashCode {
    extern "C-unwind" {
        fn CFHash(cf: Option<&CFType>) -> CFHashCode;
    }
    unsafe { CFHash(cf) }
}

#[inline]
pub extern "C-unwind" fn CFCopyDescription(cf: Option<&CFType>) -> Option<CFRetained<CFString>> {
    extern "C-unwind" {
        fn CFCopyDescription(cf: Option<&CFType>) -> Option<NonNull<CFString>>;
    }
    let ret = unsafe { CFCopyDescription(cf) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

#[inline]
pub extern "C-unwind" fn CFGetAllocator(cf: Option<&CFType>) -> Option<CFRetained<CFAllocator>> {
    extern "C-unwind" {
        fn CFGetAllocator(cf: Option<&CFType>) -> Option<NonNull<CFAllocator>>;
    }
    let ret = unsafe { CFGetAllocator(cf) };
    ret.map(|ret| unsafe { CFRetained::retain(ret) })
}

#[deprecated = "renamed to `CFAllocator::set_default`"]
#[inline]
pub extern "C-unwind" fn CFAllocatorSetDefault(allocator: Option<&CFAllocator>) {
    extern "C-unwind" {
        fn CFAllocatorSetDefault(allocator: Option<&CFAllocator>);
    }
    unsafe { CFAllocatorSetDefault(allocator) }
}

#[deprecated = "renamed to `CFAllocator::default`"]
#[inline]
pub extern "C-unwind" fn CFAllocatorGetDefault() -> Option<CFRetained<CFAllocator>> {
    extern "C-unwind" {
        fn CFAllocatorGetDefault() -> Option<NonNull<CFAllocator>>;
    }
    let ret = unsafe { CFAllocatorGetDefault() };
    ret.map(|ret| unsafe { CFRetained::retain(ret) })
}

#[deprecated = "renamed to `CFAllocator::new`"]
#[inline]
pub unsafe extern "C-unwind" fn CFAllocatorCreate(
    allocator: Option<&CFAllocator>,
    context: *mut CFAllocatorContext,
) -> Option<CFRetained<CFAllocator>> {
    extern "C-unwind" {
        fn CFAllocatorCreate(
            allocator: Option<&CFAllocator>,
            context: *mut CFAllocatorContext,
        ) -> Option<NonNull<CFAllocator>>;
    }
    let ret = unsafe { CFAllocatorCreate(allocator, context) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

extern "C-unwind" {
    #[deprecated = "renamed to `CFAllocator::allocate_typed`"]
    pub fn CFAllocatorAllocateTyped(
        allocator: Option<&CFAllocator>,
        size: CFIndex,
        descriptor: CFAllocatorTypeID,
        hint: CFOptionFlags,
    ) -> *mut c_void;
}

extern "C-unwind" {
    #[deprecated = "renamed to `CFAllocator::reallocate_typed`"]
    pub fn CFAllocatorReallocateTyped(
        allocator: Option<&CFAllocator>,
        ptr: *mut c_void,
        newsize: CFIndex,
        descriptor: CFAllocatorTypeID,
        hint: CFOptionFlags,
    ) -> *mut c_void;
}

#[deprecated = "renamed to `CFAllocator::allocate_bytes`"]
#[inline]
pub extern "C-unwind" fn CFAllocatorAllocateBytes(
    allocator: Option<&CFAllocator>,
    size: CFIndex,
    hint: CFOptionFlags,
) -> *mut c_void {
    extern "C-unwind" {
        fn CFAllocatorAllocateBytes(
            allocator: Option<&CFAllocator>,
            size: CFIndex,
            hint: CFOptionFlags,
        ) -> *mut c_void;
    }
    unsafe { CFAllocatorAllocateBytes(allocator, size, hint) }
}

extern "C-unwind" {
    #[deprecated = "renamed to `CFAllocator::reallocate_bytes`"]
    pub fn CFAllocatorReallocateBytes(
        allocator: Option<&CFAllocator>,
        ptr: *mut c_void,
        newsize: CFIndex,
        hint: CFOptionFlags,
    ) -> *mut c_void;
}

#[deprecated = "renamed to `CFAllocator::allocate`"]
#[inline]
pub extern "C-unwind" fn CFAllocatorAllocate(
    allocator: Option<&CFAllocator>,
    size: CFIndex,
    hint: CFOptionFlags,
) -> *mut c_void {
    extern "C-unwind" {
        fn CFAllocatorAllocate(
            allocator: Option<&CFAllocator>,
            size: CFIndex,
            hint: CFOptionFlags,
        ) -> *mut c_void;
    }
    unsafe { CFAllocatorAllocate(allocator, size, hint) }
}

extern "C-unwind" {
    #[deprecated = "renamed to `CFAllocator::reallocate`"]
    pub fn CFAllocatorReallocate(
        allocator: Option<&CFAllocator>,
        ptr: *mut c_void,
        newsize: CFIndex,
        hint: CFOptionFlags,
    ) -> *mut c_void;
}

extern "C-unwind" {
    #[deprecated = "renamed to `CFAllocator::deallocate`"]
    pub fn CFAllocatorDeallocate(allocator: Option<&CFAllocator>, ptr: *mut c_void);
}

#[deprecated = "renamed to `CFAllocator::preferred_size_for_size`"]
#[inline]
pub extern "C-unwind" fn CFAllocatorGetPreferredSizeForSize(
    allocator: Option<&CFAllocator>,
    size: CFIndex,
    hint: CFOptionFlags,
) -> CFIndex {
    extern "C-unwind" {
        fn CFAllocatorGetPreferredSizeForSize(
            allocator: Option<&CFAllocator>,
            size: CFIndex,
            hint: CFOptionFlags,
        ) -> CFIndex;
    }
    unsafe { CFAllocatorGetPreferredSizeForSize(allocator, size, hint) }
}

extern "C-unwind" {
    #[deprecated = "renamed to `CFAllocator::context`"]
    pub fn CFAllocatorGetContext(allocator: Option<&CFAllocator>, context: *mut CFAllocatorContext);
}
