core_foundation_sys/
set.rs1use std::os::raw::c_void;
11
12use crate::base::{Boolean, CFAllocatorRef, CFHashCode, CFIndex, CFTypeID};
13use crate::string::CFStringRef;
14
15pub type CFSetApplierFunction = extern "C" fn(value: *const c_void, context: *const c_void);
16pub type CFSetRetainCallBack =
17 extern "C" fn(allocator: CFAllocatorRef, value: *const c_void) -> *const c_void;
18pub type CFSetReleaseCallBack = extern "C" fn(allocator: CFAllocatorRef, value: *const c_void);
19pub type CFSetCopyDescriptionCallBack = extern "C" fn(value: *const c_void) -> CFStringRef;
20pub type CFSetEqualCallBack =
21 extern "C" fn(value1: *const c_void, value2: *const c_void) -> Boolean;
22pub type CFSetHashCallBack = extern "C" fn(value: *const c_void) -> CFHashCode;
23
24#[repr(C)]
25#[derive(Clone, Copy)]
26pub struct CFSetCallBacks {
27 pub version: CFIndex,
28 pub retain: CFSetRetainCallBack,
29 pub release: CFSetReleaseCallBack,
30 pub copyDescription: CFSetCopyDescriptionCallBack,
31 pub equal: CFSetEqualCallBack,
32 pub hash: CFSetHashCallBack,
33}
34
35#[repr(C)]
36pub struct __CFSet(c_void);
37
38pub type CFSetRef = *const __CFSet;
39pub type CFMutableSetRef = *mut __CFSet;
40
41extern "C" {
42 pub static kCFTypeSetCallBacks: CFSetCallBacks;
47 pub static kCFCopyStringSetCallBacks: CFSetCallBacks;
48
49 pub fn CFSetCreate(
52 allocator: CFAllocatorRef,
53 values: *const *const c_void,
54 numValues: CFIndex,
55 callBacks: *const CFSetCallBacks,
56 ) -> CFSetRef;
57 pub fn CFSetCreateCopy(allocator: CFAllocatorRef, theSet: CFSetRef) -> CFSetRef;
58
59 pub fn CFSetContainsValue(theSet: CFSetRef, value: *const c_void) -> Boolean;
61 pub fn CFSetGetCount(theSet: CFSetRef) -> CFIndex;
62 pub fn CFSetGetCountOfValue(theSet: CFSetRef, value: *const c_void) -> CFIndex;
63 pub fn CFSetGetValue(theSet: CFSetRef, value: *const c_void) -> *const c_void;
64 pub fn CFSetGetValueIfPresent(
65 theSet: CFSetRef,
66 candidate: *const c_void,
67 value: *mut *const c_void,
68 ) -> Boolean;
69 pub fn CFSetGetValues(theSet: CFSetRef, values: *mut *const c_void);
70
71 pub fn CFSetApplyFunction(
73 theSet: CFSetRef,
74 applier: CFSetApplierFunction,
75 context: *const c_void,
76 );
77
78 pub fn CFSetGetTypeID() -> CFTypeID;
80
81 pub fn CFSetAddValue(theSet: CFMutableSetRef, value: *const c_void);
84 pub fn CFSetCreateMutable(
85 allocator: CFAllocatorRef,
86 capacity: CFIndex,
87 callBacks: *const CFSetCallBacks,
88 ) -> CFMutableSetRef;
89 pub fn CFSetCreateMutableCopy(
90 allocator: CFAllocatorRef,
91 capacity: CFIndex,
92 theSet: CFSetRef,
93 ) -> CFMutableSetRef;
94 pub fn CFSetRemoveAllValues(theSet: CFMutableSetRef);
95 pub fn CFSetRemoveValue(theSet: CFMutableSetRef, value: *const c_void);
96 pub fn CFSetReplaceValue(theSet: CFMutableSetRef, value: *const c_void);
97 pub fn CFSetSetValue(theSet: CFMutableSetRef, value: *const c_void);
98}