core_foundation_sys/
bag.rs1use std::os::raw::c_void;
11
12use crate::base::{Boolean, CFAllocatorRef, CFHashCode, CFIndex, CFTypeID};
13use crate::string::CFStringRef;
14
15#[repr(C)]
16pub struct __CFBag(c_void);
17
18pub type CFBagRef = *const __CFBag;
19pub type CFMutableBagRef = *mut __CFBag;
20
21pub type CFBagRetainCallBack =
22 extern "C" fn(allocator: CFAllocatorRef, value: *const c_void) -> *const c_void;
23pub type CFBagReleaseCallBack = extern "C" fn(allocator: CFAllocatorRef, value: *const c_void);
24pub type CFBagCopyDescriptionCallBack = extern "C" fn(value: *const c_void) -> CFStringRef;
25pub type CFBagEqualCallBack =
26 extern "C" fn(value1: *const c_void, value2: *const c_void) -> Boolean;
27pub type CFBagHashCallBack = extern "C" fn(value: *const c_void) -> CFHashCode;
28
29#[repr(C)]
30#[derive(Debug, Clone, Copy)]
31pub struct CFBagCallBacks {
32 pub version: CFIndex,
33 pub retain: CFBagRetainCallBack,
34 pub release: CFBagReleaseCallBack,
35 pub copyDescription: CFBagCopyDescriptionCallBack,
36 pub equal: CFBagEqualCallBack,
37 pub hash: CFBagHashCallBack,
38}
39
40pub type CFBagApplierFunction = extern "C" fn(value: *const c_void, context: *mut c_void);
41
42extern "C" {
43 pub static kCFTypeBagCallBacks: CFBagCallBacks;
48 pub static kCFCopyStringBagCallBacks: CFBagCallBacks;
49
50 pub fn CFBagCreate(
53 allocator: CFAllocatorRef,
54 values: *const *const c_void,
55 numValues: CFIndex,
56 callBacks: *const CFBagCallBacks,
57 ) -> CFBagRef;
58 pub fn CFBagCreateCopy(allocator: CFAllocatorRef, theBag: CFBagRef) -> CFBagRef;
59
60 pub fn CFBagContainsValue(theBag: CFBagRef, value: *const c_void) -> Boolean;
62 pub fn CFBagGetCount(theBag: CFBagRef) -> CFIndex;
63 pub fn CFBagGetCountOfValue(theBag: CFBagRef, value: *const c_void) -> CFIndex;
64 pub fn CFBagGetValue(theBag: CFBagRef, value: *const c_void) -> *const c_void;
65 pub fn CFBagGetValueIfPresent(
66 theBag: CFBagRef,
67 candidate: *const c_void,
68 value: *const *const c_void,
69 ) -> Boolean;
70 pub fn CFBagGetValues(theBag: CFBagRef, values: *const *const c_void);
71
72 pub fn CFBagApplyFunction(
74 theBag: CFBagRef,
75 applier: CFBagApplierFunction,
76 context: *mut c_void,
77 );
78
79 pub fn CFBagGetTypeID() -> CFTypeID;
81
82 pub fn CFBagCreateMutable(
85 allocator: CFAllocatorRef,
86 capacity: CFIndex,
87 callBacks: *const CFBagCallBacks,
88 ) -> CFMutableBagRef;
89 pub fn CFBagCreateMutableCopy(
90 allocator: CFAllocatorRef,
91 capacity: CFIndex,
92 theBag: CFBagRef,
93 ) -> CFMutableBagRef;
94
95 pub fn CFBagAddValue(theBag: CFMutableBagRef, value: *const c_void);
97 pub fn CFBagRemoveAllValues(theBag: CFMutableBagRef);
98 pub fn CFBagRemoveValue(theBag: CFMutableBagRef, value: *const c_void);
99 pub fn CFBagReplaceValue(theBag: CFMutableBagRef, value: *const c_void);
100 pub fn CFBagSetValue(theBag: CFMutableBagRef, value: *const c_void);
101}