objc2_core_foundation/generated/
CFBase.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/corefoundation/kcfcorefoundationversionnumber10_0?language=objc)
13pub const kCFCoreFoundationVersionNumber10_0: c_float = 196.40;
14/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_0_3?language=objc)
15pub const kCFCoreFoundationVersionNumber10_0_3: c_float = 196.50;
16/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_1?language=objc)
17pub const kCFCoreFoundationVersionNumber10_1: c_float = 226.00;
18/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_1_1?language=objc)
19pub const kCFCoreFoundationVersionNumber10_1_1: c_float = 226.00;
20/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_1_2?language=objc)
21pub const kCFCoreFoundationVersionNumber10_1_2: c_float = 227.20;
22/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_1_3?language=objc)
23pub const kCFCoreFoundationVersionNumber10_1_3: c_float = 227.20;
24/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_1_4?language=objc)
25pub const kCFCoreFoundationVersionNumber10_1_4: c_float = 227.30;
26/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_2?language=objc)
27pub const kCFCoreFoundationVersionNumber10_2: c_float = 263.00;
28/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_2_1?language=objc)
29pub const kCFCoreFoundationVersionNumber10_2_1: c_float = 263.10;
30/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_2_2?language=objc)
31pub const kCFCoreFoundationVersionNumber10_2_2: c_float = 263.10;
32/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_2_3?language=objc)
33pub const kCFCoreFoundationVersionNumber10_2_3: c_float = 263.30;
34/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_2_4?language=objc)
35pub const kCFCoreFoundationVersionNumber10_2_4: c_float = 263.30;
36/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_2_5?language=objc)
37pub const kCFCoreFoundationVersionNumber10_2_5: c_float = 263.50;
38/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_2_6?language=objc)
39pub const kCFCoreFoundationVersionNumber10_2_6: c_float = 263.50;
40/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_2_7?language=objc)
41pub const kCFCoreFoundationVersionNumber10_2_7: c_float = 263.50;
42/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_2_8?language=objc)
43pub const kCFCoreFoundationVersionNumber10_2_8: c_float = 263.50;
44/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_3?language=objc)
45pub const kCFCoreFoundationVersionNumber10_3: c_float = 299.00;
46/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_3_1?language=objc)
47pub const kCFCoreFoundationVersionNumber10_3_1: c_float = 299.00;
48/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_3_2?language=objc)
49pub const kCFCoreFoundationVersionNumber10_3_2: c_float = 299.00;
50/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_3_3?language=objc)
51pub const kCFCoreFoundationVersionNumber10_3_3: c_float = 299.30;
52/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_3_4?language=objc)
53pub const kCFCoreFoundationVersionNumber10_3_4: c_float = 299.31;
54/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_3_5?language=objc)
55pub const kCFCoreFoundationVersionNumber10_3_5: c_float = 299.31;
56/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_3_6?language=objc)
57pub const kCFCoreFoundationVersionNumber10_3_6: c_float = 299.32;
58/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_3_7?language=objc)
59pub const kCFCoreFoundationVersionNumber10_3_7: c_float = 299.33;
60/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_3_8?language=objc)
61pub const kCFCoreFoundationVersionNumber10_3_8: c_float = 299.33;
62/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_3_9?language=objc)
63pub const kCFCoreFoundationVersionNumber10_3_9: c_float = 299.35;
64/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4?language=objc)
65pub const kCFCoreFoundationVersionNumber10_4: c_float = 368.00;
66/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_1?language=objc)
67pub const kCFCoreFoundationVersionNumber10_4_1: c_float = 368.10;
68/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_2?language=objc)
69pub const kCFCoreFoundationVersionNumber10_4_2: c_float = 368.11;
70/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_3?language=objc)
71pub const kCFCoreFoundationVersionNumber10_4_3: c_float = 368.18;
72/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_4_intel?language=objc)
73pub const kCFCoreFoundationVersionNumber10_4_4_Intel: c_float = 368.26;
74/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_4_powerpc?language=objc)
75pub const kCFCoreFoundationVersionNumber10_4_4_PowerPC: c_float = 368.25;
76/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_5_intel?language=objc)
77pub const kCFCoreFoundationVersionNumber10_4_5_Intel: c_float = 368.26;
78/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_5_powerpc?language=objc)
79pub const kCFCoreFoundationVersionNumber10_4_5_PowerPC: c_float = 368.25;
80/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_6_intel?language=objc)
81pub const kCFCoreFoundationVersionNumber10_4_6_Intel: c_float = 368.26;
82/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_6_powerpc?language=objc)
83pub const kCFCoreFoundationVersionNumber10_4_6_PowerPC: c_float = 368.25;
84/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_7?language=objc)
85pub const kCFCoreFoundationVersionNumber10_4_7: c_float = 368.27;
86/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_8?language=objc)
87pub const kCFCoreFoundationVersionNumber10_4_8: c_float = 368.27;
88/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_9?language=objc)
89pub const kCFCoreFoundationVersionNumber10_4_9: c_float = 368.28;
90/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_10?language=objc)
91pub const kCFCoreFoundationVersionNumber10_4_10: c_float = 368.28;
92/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_4_11?language=objc)
93pub const kCFCoreFoundationVersionNumber10_4_11: c_float = 368.31;
94/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_5?language=objc)
95pub const kCFCoreFoundationVersionNumber10_5: c_float = 476.00;
96/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_5_1?language=objc)
97pub const kCFCoreFoundationVersionNumber10_5_1: c_float = 476.00;
98/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_5_2?language=objc)
99pub const kCFCoreFoundationVersionNumber10_5_2: c_float = 476.10;
100/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_5_3?language=objc)
101pub const kCFCoreFoundationVersionNumber10_5_3: c_float = 476.13;
102/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_5_4?language=objc)
103pub const kCFCoreFoundationVersionNumber10_5_4: c_float = 476.14;
104/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_5_5?language=objc)
105pub const kCFCoreFoundationVersionNumber10_5_5: c_float = 476.15;
106/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_5_6?language=objc)
107pub const kCFCoreFoundationVersionNumber10_5_6: c_float = 476.17;
108/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_5_7?language=objc)
109pub const kCFCoreFoundationVersionNumber10_5_7: c_float = 476.18;
110/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_5_8?language=objc)
111pub const kCFCoreFoundationVersionNumber10_5_8: c_float = 476.19;
112/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_6?language=objc)
113pub const kCFCoreFoundationVersionNumber10_6: c_float = 550.00;
114/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_6_1?language=objc)
115pub const kCFCoreFoundationVersionNumber10_6_1: c_float = 550.00;
116/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_6_2?language=objc)
117pub const kCFCoreFoundationVersionNumber10_6_2: c_float = 550.13;
118/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_6_3?language=objc)
119pub const kCFCoreFoundationVersionNumber10_6_3: c_float = 550.19;
120/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_6_4?language=objc)
121pub const kCFCoreFoundationVersionNumber10_6_4: c_float = 550.29;
122/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_6_5?language=objc)
123pub const kCFCoreFoundationVersionNumber10_6_5: c_float = 550.42;
124/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_6_6?language=objc)
125pub const kCFCoreFoundationVersionNumber10_6_6: c_float = 550.42;
126/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_6_7?language=objc)
127pub const kCFCoreFoundationVersionNumber10_6_7: c_float = 550.42;
128/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_6_8?language=objc)
129pub const kCFCoreFoundationVersionNumber10_6_8: c_float = 550.43;
130/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_7?language=objc)
131pub const kCFCoreFoundationVersionNumber10_7: c_float = 635.00;
132/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_7_1?language=objc)
133pub const kCFCoreFoundationVersionNumber10_7_1: c_float = 635.00;
134/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_7_2?language=objc)
135pub const kCFCoreFoundationVersionNumber10_7_2: c_float = 635.15;
136/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_7_3?language=objc)
137pub const kCFCoreFoundationVersionNumber10_7_3: c_float = 635.19;
138/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_7_4?language=objc)
139pub const kCFCoreFoundationVersionNumber10_7_4: c_float = 635.21;
140/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_7_5?language=objc)
141pub const kCFCoreFoundationVersionNumber10_7_5: c_float = 635.21;
142/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_8?language=objc)
143pub const kCFCoreFoundationVersionNumber10_8: c_float = 744.00;
144/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_8_1?language=objc)
145pub const kCFCoreFoundationVersionNumber10_8_1: c_float = 744.00;
146/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_8_2?language=objc)
147pub const kCFCoreFoundationVersionNumber10_8_2: c_float = 744.12;
148/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_8_3?language=objc)
149pub const kCFCoreFoundationVersionNumber10_8_3: c_float = 744.18;
150/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_8_4?language=objc)
151pub const kCFCoreFoundationVersionNumber10_8_4: c_float = 744.19;
152/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_9?language=objc)
153pub const kCFCoreFoundationVersionNumber10_9: c_float = 855.11;
154/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_9_1?language=objc)
155pub const kCFCoreFoundationVersionNumber10_9_1: c_float = 855.11;
156/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_9_2?language=objc)
157pub const kCFCoreFoundationVersionNumber10_9_2: c_float = 855.14;
158/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_10?language=objc)
159pub const kCFCoreFoundationVersionNumber10_10: c_float = 1151.16;
160/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_10_1?language=objc)
161pub const kCFCoreFoundationVersionNumber10_10_1: c_float = 1151.16;
162/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_10_2?language=objc)
163pub const kCFCoreFoundationVersionNumber10_10_2: c_uint = 1152;
164/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_10_3?language=objc)
165pub const kCFCoreFoundationVersionNumber10_10_3: c_float = 1153.18;
166/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_10_4?language=objc)
167pub const kCFCoreFoundationVersionNumber10_10_4: c_float = 1153.18;
168/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_10_5?language=objc)
169pub const kCFCoreFoundationVersionNumber10_10_5: c_float = 1153.18;
170/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_10_max?language=objc)
171pub const kCFCoreFoundationVersionNumber10_10_Max: c_uint = 1199;
172/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_11?language=objc)
173pub const kCFCoreFoundationVersionNumber10_11: c_uint = 1253;
174/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_11_1?language=objc)
175pub const kCFCoreFoundationVersionNumber10_11_1: c_float = 1255.1;
176/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_11_2?language=objc)
177pub const kCFCoreFoundationVersionNumber10_11_2: c_float = 1256.14;
178/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_11_3?language=objc)
179pub const kCFCoreFoundationVersionNumber10_11_3: c_float = 1256.14;
180/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_11_4?language=objc)
181pub const kCFCoreFoundationVersionNumber10_11_4: c_float = 1258.1;
182/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber10_11_max?language=objc)
183pub const kCFCoreFoundationVersionNumber10_11_Max: c_uint = 1299;
184/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfallocatortypeid?language=objc)
185pub type CFAllocatorTypeID = c_ulonglong;
186
187extern "C" {
188    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfcorefoundationversionnumber?language=objc)
189    pub static kCFCoreFoundationVersionNumber: c_double;
190}
191
192/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfstring?language=objc)
193#[repr(C)]
194pub struct CFString {
195    inner: [u8; 0],
196    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
197}
198
199cf_type!(
200    unsafe impl CFString {}
201);
202#[cfg(feature = "objc2")]
203cf_objc2_type!(
204    unsafe impl RefEncode<"__CFString"> for CFString {}
205);
206
207/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfmutablestring?language=objc)
208#[repr(C)]
209pub struct CFMutableString {
210    inner: [u8; 0],
211    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
212}
213
214cf_type!(
215    unsafe impl CFMutableString: CFString {}
216);
217#[cfg(feature = "objc2")]
218cf_objc2_type!(
219    unsafe impl RefEncode<"__CFString"> for CFMutableString {}
220);
221
222/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfpropertylist?language=objc)
223pub type CFPropertyList = CFType;
224
225/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfcomparisonresult?language=objc)
226// NS_ENUM
227#[repr(transparent)]
228#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
229pub struct CFComparisonResult(pub CFIndex);
230impl CFComparisonResult {
231    #[doc(alias = "kCFCompareLessThan")]
232    pub const CompareLessThan: Self = Self(-1);
233    #[doc(alias = "kCFCompareEqualTo")]
234    pub const CompareEqualTo: Self = Self(0);
235    #[doc(alias = "kCFCompareGreaterThan")]
236    pub const CompareGreaterThan: Self = Self(1);
237}
238
239#[cfg(feature = "objc2")]
240unsafe impl Encode for CFComparisonResult {
241    const ENCODING: Encoding = CFIndex::ENCODING;
242}
243
244#[cfg(feature = "objc2")]
245unsafe impl RefEncode for CFComparisonResult {
246    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
247}
248
249/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfcomparatorfunction?language=objc)
250pub type CFComparatorFunction = Option<
251    unsafe extern "C-unwind" fn(*const c_void, *const c_void, *mut c_void) -> CFComparisonResult,
252>;
253
254/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfnotfound?language=objc)
255pub static kCFNotFound: CFIndex = -1;
256
257/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfrange?language=objc)
258#[repr(C)]
259#[derive(Clone, Copy, Debug, PartialEq)]
260pub struct CFRange {
261    pub location: CFIndex,
262    pub length: CFIndex,
263}
264
265#[cfg(feature = "objc2")]
266unsafe impl Encode for CFRange {
267    const ENCODING: Encoding = Encoding::Struct("?", &[<CFIndex>::ENCODING, <CFIndex>::ENCODING]);
268}
269
270#[cfg(feature = "objc2")]
271unsafe impl RefEncode for CFRange {
272    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
273}
274
275/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfnull?language=objc)
276#[repr(C)]
277pub struct CFNull {
278    inner: [u8; 0],
279    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
280}
281
282cf_type!(
283    unsafe impl CFNull {}
284);
285#[cfg(feature = "objc2")]
286cf_objc2_type!(
287    unsafe impl RefEncode<"__CFNull"> for CFNull {}
288);
289
290unsafe impl ConcreteType for CFNull {
291    #[doc(alias = "CFNullGetTypeID")]
292    #[inline]
293    fn type_id() -> CFTypeID {
294        extern "C-unwind" {
295            fn CFNullGetTypeID() -> CFTypeID;
296        }
297        unsafe { CFNullGetTypeID() }
298    }
299}
300
301extern "C" {
302    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfnull?language=objc)
303    pub static kCFNull: Option<&'static CFNull>;
304}
305
306/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfallocator?language=objc)
307#[repr(C)]
308pub struct CFAllocator {
309    inner: [u8; 0],
310    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
311}
312
313cf_type!(
314    unsafe impl CFAllocator {}
315);
316#[cfg(feature = "objc2")]
317cf_objc2_type!(
318    unsafe impl RefEncode<"__CFAllocator"> for CFAllocator {}
319);
320
321extern "C" {
322    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfallocatordefault?language=objc)
323    pub static kCFAllocatorDefault: Option<&'static CFAllocator>;
324}
325
326extern "C" {
327    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfallocatorsystemdefault?language=objc)
328    pub static kCFAllocatorSystemDefault: Option<&'static CFAllocator>;
329}
330
331extern "C" {
332    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfallocatormalloc?language=objc)
333    pub static kCFAllocatorMalloc: Option<&'static CFAllocator>;
334}
335
336extern "C" {
337    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfallocatormalloczone?language=objc)
338    pub static kCFAllocatorMallocZone: Option<&'static CFAllocator>;
339}
340
341extern "C" {
342    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfallocatornull?language=objc)
343    pub static kCFAllocatorNull: Option<&'static CFAllocator>;
344}
345
346extern "C" {
347    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfallocatorusecontext?language=objc)
348    pub static kCFAllocatorUseContext: Option<&'static CFAllocator>;
349}
350
351/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfallocatorretaincallback?language=objc)
352pub type CFAllocatorRetainCallBack =
353    Option<unsafe extern "C-unwind" fn(*const c_void) -> *const c_void>;
354
355/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfallocatorreleasecallback?language=objc)
356pub type CFAllocatorReleaseCallBack = Option<unsafe extern "C-unwind" fn(*const c_void)>;
357
358/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfallocatorcopydescriptioncallback?language=objc)
359pub type CFAllocatorCopyDescriptionCallBack =
360    Option<unsafe extern "C-unwind" fn(*const c_void) -> *const CFString>;
361
362/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfallocatorallocatecallback?language=objc)
363pub type CFAllocatorAllocateCallBack =
364    Option<unsafe extern "C-unwind" fn(CFIndex, CFOptionFlags, *mut c_void) -> *mut c_void>;
365
366/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfallocatorreallocatecallback?language=objc)
367pub type CFAllocatorReallocateCallBack = Option<
368    unsafe extern "C-unwind" fn(*mut c_void, CFIndex, CFOptionFlags, *mut c_void) -> *mut c_void,
369>;
370
371/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfallocatordeallocatecallback?language=objc)
372pub type CFAllocatorDeallocateCallBack =
373    Option<unsafe extern "C-unwind" fn(*mut c_void, *mut c_void)>;
374
375/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfallocatorpreferredsizecallback?language=objc)
376pub type CFAllocatorPreferredSizeCallBack =
377    Option<unsafe extern "C-unwind" fn(CFIndex, CFOptionFlags, *mut c_void) -> CFIndex>;
378
379/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfallocatorcontext?language=objc)
380#[repr(C)]
381#[derive(Clone, Copy, Debug, PartialEq)]
382pub struct CFAllocatorContext {
383    pub version: CFIndex,
384    pub info: *mut c_void,
385    pub retain: CFAllocatorRetainCallBack,
386    pub release: CFAllocatorReleaseCallBack,
387    pub copyDescription: CFAllocatorCopyDescriptionCallBack,
388    pub allocate: CFAllocatorAllocateCallBack,
389    pub reallocate: CFAllocatorReallocateCallBack,
390    pub deallocate: CFAllocatorDeallocateCallBack,
391    pub preferredSize: CFAllocatorPreferredSizeCallBack,
392}
393
394#[cfg(feature = "objc2")]
395unsafe impl Encode for CFAllocatorContext {
396    const ENCODING: Encoding = Encoding::Struct(
397        "?",
398        &[
399            <CFIndex>::ENCODING,
400            <*mut c_void>::ENCODING,
401            <CFAllocatorRetainCallBack>::ENCODING,
402            <CFAllocatorReleaseCallBack>::ENCODING,
403            <CFAllocatorCopyDescriptionCallBack>::ENCODING,
404            <CFAllocatorAllocateCallBack>::ENCODING,
405            <CFAllocatorReallocateCallBack>::ENCODING,
406            <CFAllocatorDeallocateCallBack>::ENCODING,
407            <CFAllocatorPreferredSizeCallBack>::ENCODING,
408        ],
409    );
410}
411
412#[cfg(feature = "objc2")]
413unsafe impl RefEncode for CFAllocatorContext {
414    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
415}
416
417unsafe impl ConcreteType for CFAllocator {
418    #[doc(alias = "CFAllocatorGetTypeID")]
419    #[inline]
420    fn type_id() -> CFTypeID {
421        extern "C-unwind" {
422            fn CFAllocatorGetTypeID() -> CFTypeID;
423        }
424        unsafe { CFAllocatorGetTypeID() }
425    }
426}
427
428impl CFAllocator {
429    #[doc(alias = "CFAllocatorSetDefault")]
430    #[inline]
431    pub fn set_default(allocator: Option<&CFAllocator>) {
432        extern "C-unwind" {
433            fn CFAllocatorSetDefault(allocator: Option<&CFAllocator>);
434        }
435        unsafe { CFAllocatorSetDefault(allocator) }
436    }
437
438    #[doc(alias = "CFAllocatorGetDefault")]
439    #[inline]
440    pub fn default() -> Option<CFRetained<CFAllocator>> {
441        extern "C-unwind" {
442            fn CFAllocatorGetDefault() -> Option<NonNull<CFAllocator>>;
443        }
444        let ret = unsafe { CFAllocatorGetDefault() };
445        ret.map(|ret| unsafe { CFRetained::retain(ret) })
446    }
447
448    #[doc(alias = "CFAllocatorCreate")]
449    #[inline]
450    pub unsafe fn new(
451        allocator: Option<&CFAllocator>,
452        context: *mut CFAllocatorContext,
453    ) -> Option<CFRetained<CFAllocator>> {
454        extern "C-unwind" {
455            fn CFAllocatorCreate(
456                allocator: Option<&CFAllocator>,
457                context: *mut CFAllocatorContext,
458            ) -> Option<NonNull<CFAllocator>>;
459        }
460        let ret = unsafe { CFAllocatorCreate(allocator, context) };
461        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
462    }
463
464    #[doc(alias = "CFAllocatorAllocateTyped")]
465    #[inline]
466    pub unsafe fn allocate_typed(
467        allocator: Option<&CFAllocator>,
468        size: CFIndex,
469        descriptor: CFAllocatorTypeID,
470        hint: CFOptionFlags,
471    ) -> *mut c_void {
472        extern "C-unwind" {
473            fn CFAllocatorAllocateTyped(
474                allocator: Option<&CFAllocator>,
475                size: CFIndex,
476                descriptor: CFAllocatorTypeID,
477                hint: CFOptionFlags,
478            ) -> *mut c_void;
479        }
480        unsafe { CFAllocatorAllocateTyped(allocator, size, descriptor, hint) }
481    }
482
483    #[doc(alias = "CFAllocatorReallocateTyped")]
484    #[inline]
485    pub unsafe fn reallocate_typed(
486        allocator: Option<&CFAllocator>,
487        ptr: *mut c_void,
488        newsize: CFIndex,
489        descriptor: CFAllocatorTypeID,
490        hint: CFOptionFlags,
491    ) -> *mut c_void {
492        extern "C-unwind" {
493            fn CFAllocatorReallocateTyped(
494                allocator: Option<&CFAllocator>,
495                ptr: *mut c_void,
496                newsize: CFIndex,
497                descriptor: CFAllocatorTypeID,
498                hint: CFOptionFlags,
499            ) -> *mut c_void;
500        }
501        unsafe { CFAllocatorReallocateTyped(allocator, ptr, newsize, descriptor, hint) }
502    }
503
504    #[doc(alias = "CFAllocatorAllocateBytes")]
505    #[inline]
506    pub fn allocate_bytes(
507        allocator: Option<&CFAllocator>,
508        size: CFIndex,
509        hint: CFOptionFlags,
510    ) -> *mut c_void {
511        extern "C-unwind" {
512            fn CFAllocatorAllocateBytes(
513                allocator: Option<&CFAllocator>,
514                size: CFIndex,
515                hint: CFOptionFlags,
516            ) -> *mut c_void;
517        }
518        unsafe { CFAllocatorAllocateBytes(allocator, size, hint) }
519    }
520
521    #[doc(alias = "CFAllocatorReallocateBytes")]
522    #[inline]
523    pub unsafe fn reallocate_bytes(
524        allocator: Option<&CFAllocator>,
525        ptr: *mut c_void,
526        newsize: CFIndex,
527        hint: CFOptionFlags,
528    ) -> *mut c_void {
529        extern "C-unwind" {
530            fn CFAllocatorReallocateBytes(
531                allocator: Option<&CFAllocator>,
532                ptr: *mut c_void,
533                newsize: CFIndex,
534                hint: CFOptionFlags,
535            ) -> *mut c_void;
536        }
537        unsafe { CFAllocatorReallocateBytes(allocator, ptr, newsize, hint) }
538    }
539
540    #[doc(alias = "CFAllocatorAllocate")]
541    #[inline]
542    pub fn allocate(
543        allocator: Option<&CFAllocator>,
544        size: CFIndex,
545        hint: CFOptionFlags,
546    ) -> *mut c_void {
547        extern "C-unwind" {
548            fn CFAllocatorAllocate(
549                allocator: Option<&CFAllocator>,
550                size: CFIndex,
551                hint: CFOptionFlags,
552            ) -> *mut c_void;
553        }
554        unsafe { CFAllocatorAllocate(allocator, size, hint) }
555    }
556
557    #[doc(alias = "CFAllocatorReallocate")]
558    #[inline]
559    pub unsafe fn reallocate(
560        allocator: Option<&CFAllocator>,
561        ptr: *mut c_void,
562        newsize: CFIndex,
563        hint: CFOptionFlags,
564    ) -> *mut c_void {
565        extern "C-unwind" {
566            fn CFAllocatorReallocate(
567                allocator: Option<&CFAllocator>,
568                ptr: *mut c_void,
569                newsize: CFIndex,
570                hint: CFOptionFlags,
571            ) -> *mut c_void;
572        }
573        unsafe { CFAllocatorReallocate(allocator, ptr, newsize, hint) }
574    }
575
576    #[doc(alias = "CFAllocatorDeallocate")]
577    #[inline]
578    pub unsafe fn deallocate(allocator: Option<&CFAllocator>, ptr: *mut c_void) {
579        extern "C-unwind" {
580            fn CFAllocatorDeallocate(allocator: Option<&CFAllocator>, ptr: *mut c_void);
581        }
582        unsafe { CFAllocatorDeallocate(allocator, ptr) }
583    }
584
585    #[doc(alias = "CFAllocatorGetPreferredSizeForSize")]
586    #[inline]
587    pub fn preferred_size_for_size(
588        allocator: Option<&CFAllocator>,
589        size: CFIndex,
590        hint: CFOptionFlags,
591    ) -> CFIndex {
592        extern "C-unwind" {
593            fn CFAllocatorGetPreferredSizeForSize(
594                allocator: Option<&CFAllocator>,
595                size: CFIndex,
596                hint: CFOptionFlags,
597            ) -> CFIndex;
598        }
599        unsafe { CFAllocatorGetPreferredSizeForSize(allocator, size, hint) }
600    }
601
602    #[doc(alias = "CFAllocatorGetContext")]
603    #[inline]
604    pub unsafe fn context(allocator: Option<&CFAllocator>, context: *mut CFAllocatorContext) {
605        extern "C-unwind" {
606            fn CFAllocatorGetContext(
607                allocator: Option<&CFAllocator>,
608                context: *mut CFAllocatorContext,
609            );
610        }
611        unsafe { CFAllocatorGetContext(allocator, context) }
612    }
613}
614
615#[inline]
616pub extern "C-unwind" fn CFGetTypeID(cf: Option<&CFType>) -> CFTypeID {
617    extern "C-unwind" {
618        fn CFGetTypeID(cf: Option<&CFType>) -> CFTypeID;
619    }
620    unsafe { CFGetTypeID(cf) }
621}
622
623#[inline]
624pub extern "C-unwind" fn CFCopyTypeIDDescription(
625    type_id: CFTypeID,
626) -> Option<CFRetained<CFString>> {
627    extern "C-unwind" {
628        fn CFCopyTypeIDDescription(type_id: CFTypeID) -> Option<NonNull<CFString>>;
629    }
630    let ret = unsafe { CFCopyTypeIDDescription(type_id) };
631    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
632}
633
634#[inline]
635pub extern "C-unwind" fn CFGetRetainCount(cf: Option<&CFType>) -> CFIndex {
636    extern "C-unwind" {
637        fn CFGetRetainCount(cf: Option<&CFType>) -> CFIndex;
638    }
639    unsafe { CFGetRetainCount(cf) }
640}
641
642#[inline]
643pub extern "C-unwind" fn CFEqual(cf1: Option<&CFType>, cf2: Option<&CFType>) -> bool {
644    extern "C-unwind" {
645        fn CFEqual(cf1: Option<&CFType>, cf2: Option<&CFType>) -> Boolean;
646    }
647    let ret = unsafe { CFEqual(cf1, cf2) };
648    ret != 0
649}
650
651#[inline]
652pub extern "C-unwind" fn CFHash(cf: Option<&CFType>) -> CFHashCode {
653    extern "C-unwind" {
654        fn CFHash(cf: Option<&CFType>) -> CFHashCode;
655    }
656    unsafe { CFHash(cf) }
657}
658
659#[inline]
660pub extern "C-unwind" fn CFCopyDescription(cf: Option<&CFType>) -> Option<CFRetained<CFString>> {
661    extern "C-unwind" {
662        fn CFCopyDescription(cf: Option<&CFType>) -> Option<NonNull<CFString>>;
663    }
664    let ret = unsafe { CFCopyDescription(cf) };
665    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
666}
667
668#[inline]
669pub extern "C-unwind" fn CFGetAllocator(cf: Option<&CFType>) -> Option<CFRetained<CFAllocator>> {
670    extern "C-unwind" {
671        fn CFGetAllocator(cf: Option<&CFType>) -> Option<NonNull<CFAllocator>>;
672    }
673    let ret = unsafe { CFGetAllocator(cf) };
674    ret.map(|ret| unsafe { CFRetained::retain(ret) })
675}
676
677#[deprecated = "renamed to `CFAllocator::set_default`"]
678#[inline]
679pub extern "C-unwind" fn CFAllocatorSetDefault(allocator: Option<&CFAllocator>) {
680    extern "C-unwind" {
681        fn CFAllocatorSetDefault(allocator: Option<&CFAllocator>);
682    }
683    unsafe { CFAllocatorSetDefault(allocator) }
684}
685
686#[deprecated = "renamed to `CFAllocator::default`"]
687#[inline]
688pub extern "C-unwind" fn CFAllocatorGetDefault() -> Option<CFRetained<CFAllocator>> {
689    extern "C-unwind" {
690        fn CFAllocatorGetDefault() -> Option<NonNull<CFAllocator>>;
691    }
692    let ret = unsafe { CFAllocatorGetDefault() };
693    ret.map(|ret| unsafe { CFRetained::retain(ret) })
694}
695
696#[deprecated = "renamed to `CFAllocator::new`"]
697#[inline]
698pub unsafe extern "C-unwind" fn CFAllocatorCreate(
699    allocator: Option<&CFAllocator>,
700    context: *mut CFAllocatorContext,
701) -> Option<CFRetained<CFAllocator>> {
702    extern "C-unwind" {
703        fn CFAllocatorCreate(
704            allocator: Option<&CFAllocator>,
705            context: *mut CFAllocatorContext,
706        ) -> Option<NonNull<CFAllocator>>;
707    }
708    let ret = unsafe { CFAllocatorCreate(allocator, context) };
709    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
710}
711
712extern "C-unwind" {
713    #[deprecated = "renamed to `CFAllocator::allocate_typed`"]
714    pub fn CFAllocatorAllocateTyped(
715        allocator: Option<&CFAllocator>,
716        size: CFIndex,
717        descriptor: CFAllocatorTypeID,
718        hint: CFOptionFlags,
719    ) -> *mut c_void;
720}
721
722extern "C-unwind" {
723    #[deprecated = "renamed to `CFAllocator::reallocate_typed`"]
724    pub fn CFAllocatorReallocateTyped(
725        allocator: Option<&CFAllocator>,
726        ptr: *mut c_void,
727        newsize: CFIndex,
728        descriptor: CFAllocatorTypeID,
729        hint: CFOptionFlags,
730    ) -> *mut c_void;
731}
732
733#[deprecated = "renamed to `CFAllocator::allocate_bytes`"]
734#[inline]
735pub extern "C-unwind" fn CFAllocatorAllocateBytes(
736    allocator: Option<&CFAllocator>,
737    size: CFIndex,
738    hint: CFOptionFlags,
739) -> *mut c_void {
740    extern "C-unwind" {
741        fn CFAllocatorAllocateBytes(
742            allocator: Option<&CFAllocator>,
743            size: CFIndex,
744            hint: CFOptionFlags,
745        ) -> *mut c_void;
746    }
747    unsafe { CFAllocatorAllocateBytes(allocator, size, hint) }
748}
749
750extern "C-unwind" {
751    #[deprecated = "renamed to `CFAllocator::reallocate_bytes`"]
752    pub fn CFAllocatorReallocateBytes(
753        allocator: Option<&CFAllocator>,
754        ptr: *mut c_void,
755        newsize: CFIndex,
756        hint: CFOptionFlags,
757    ) -> *mut c_void;
758}
759
760#[deprecated = "renamed to `CFAllocator::allocate`"]
761#[inline]
762pub extern "C-unwind" fn CFAllocatorAllocate(
763    allocator: Option<&CFAllocator>,
764    size: CFIndex,
765    hint: CFOptionFlags,
766) -> *mut c_void {
767    extern "C-unwind" {
768        fn CFAllocatorAllocate(
769            allocator: Option<&CFAllocator>,
770            size: CFIndex,
771            hint: CFOptionFlags,
772        ) -> *mut c_void;
773    }
774    unsafe { CFAllocatorAllocate(allocator, size, hint) }
775}
776
777extern "C-unwind" {
778    #[deprecated = "renamed to `CFAllocator::reallocate`"]
779    pub fn CFAllocatorReallocate(
780        allocator: Option<&CFAllocator>,
781        ptr: *mut c_void,
782        newsize: CFIndex,
783        hint: CFOptionFlags,
784    ) -> *mut c_void;
785}
786
787extern "C-unwind" {
788    #[deprecated = "renamed to `CFAllocator::deallocate`"]
789    pub fn CFAllocatorDeallocate(allocator: Option<&CFAllocator>, ptr: *mut c_void);
790}
791
792#[deprecated = "renamed to `CFAllocator::preferred_size_for_size`"]
793#[inline]
794pub extern "C-unwind" fn CFAllocatorGetPreferredSizeForSize(
795    allocator: Option<&CFAllocator>,
796    size: CFIndex,
797    hint: CFOptionFlags,
798) -> CFIndex {
799    extern "C-unwind" {
800        fn CFAllocatorGetPreferredSizeForSize(
801            allocator: Option<&CFAllocator>,
802            size: CFIndex,
803            hint: CFOptionFlags,
804        ) -> CFIndex;
805    }
806    unsafe { CFAllocatorGetPreferredSizeForSize(allocator, size, hint) }
807}
808
809extern "C-unwind" {
810    #[deprecated = "renamed to `CFAllocator::context`"]
811    pub fn CFAllocatorGetContext(allocator: Option<&CFAllocator>, context: *mut CFAllocatorContext);
812}