fruity__bbqsrc/core_foundation/
sys.rs

1//! Raw unsafe C functions exposed by `CoreFoundation.framework`.
2
3use super::{
4    Boolean, CFAllocator, CFAllocatorContext, CFBoolean, CFComparisonResult, CFHashCode, CFIndex,
5    CFNumber, CFNumberType, CFOptionFlags, CFType, CFTypeID,
6};
7use std::ffi::c_void;
8
9#[allow(missing_docs)]
10#[link(name = "CoreFoundation", kind = "framework")]
11extern "C" {
12    pub fn CFRetain(cf: *const CFType) -> *const CFType;
13    pub fn CFRelease(cf: *const CFType);
14    pub fn CFGetRetainCount(cf: *const CFType) -> CFIndex;
15
16    pub fn CFEqual(cf1: *const CFType, cf2: *const CFType) -> Boolean;
17
18    pub fn CFHash(cf: *const CFType) -> CFHashCode;
19    pub fn CFGetTypeID(cf: *const CFType) -> CFTypeID;
20
21    pub fn CFAllocatorGetTypeID() -> CFTypeID;
22
23    pub fn CFAllocatorCreate(
24        allocator: *const CFAllocator,
25        context: *mut CFAllocatorContext,
26    ) -> *mut CFAllocator;
27
28    pub fn CFAllocatorAllocate(
29        allocator: *const CFAllocator,
30        size: CFIndex,
31        hint: CFOptionFlags,
32    ) -> *mut c_void;
33
34    pub fn CFAllocatorReallocate(
35        allocator: *const CFAllocator,
36        ptr: *mut c_void,
37        new_size: CFIndex,
38        hint: CFOptionFlags,
39    ) -> *mut c_void;
40
41    pub fn CFAllocatorDeallocate(allocator: *const CFAllocator, ptr: *mut c_void);
42
43    pub fn CFAllocatorGetPreferredSizeForSize(
44        allocator: *const CFAllocator,
45        size: CFIndex,
46        hint: CFOptionFlags,
47    ) -> CFIndex;
48
49    pub fn CFAllocatorGetDefault() -> *const CFAllocator;
50    pub fn CFAllocatorSetDefault(allocator: *const CFAllocator);
51
52    pub fn CFAllocatorGetContext(allocator: *const CFAllocator, context: *mut CFAllocatorContext);
53
54    pub fn CFNumberGetTypeID() -> CFTypeID;
55
56    pub fn CFNumberCreate(
57        allocator: *const CFAllocator,
58        number_type: CFNumberType,
59        value_ptr: *const c_void,
60    ) -> *const CFNumber;
61
62    pub fn CFNumberCompare(
63        a: *const CFNumber,
64        b: *const CFNumber,
65        context: *mut c_void,
66    ) -> CFComparisonResult;
67
68    pub fn CFNumberGetByteSize(number: *const CFNumber) -> CFIndex;
69
70    pub fn CFNumberGetType(number: *const CFNumber) -> CFNumberType;
71
72    pub fn CFNumberIsFloatType(number: *const CFNumber) -> Boolean;
73
74    pub fn CFNumberGetValue(
75        number: *const CFNumber,
76        number_type: CFNumberType,
77        value_ptr: *mut c_void,
78    ) -> Boolean;
79
80    pub fn CFBooleanGetTypeID() -> CFTypeID;
81
82    pub fn CFBooleanGetValue(boolean: *const CFBoolean) -> Boolean;
83}