CoreFoundation_sys/
dictionary.rs1use libc::c_void;
4
5use base::*;
6
7pub type CFDictionaryRetainCallBack = extern "C" fn(allocator: CFAllocatorRef, value: *const c_void) -> *const c_void;
8pub type CFDictionaryReleaseCallBack = extern "C" fn(allocator: CFAllocatorRef, value: *const c_void);
9pub type CFDictionaryCopyDescriptionCallBack = extern "C" fn(value: *const c_void) -> CFStringRef;
10pub type CFDictionaryEqualCallBack = extern "C" fn(value1: *const c_void, value2: *const c_void) -> Boolean;
11pub type CFDictionaryHashCallBack = extern "C" fn(value: *const c_void) -> CFHashCode;
12
13pub type CFDictionaryApplierFunction = extern "C" fn(key: *const c_void, value: *const c_void, context: *const c_void);
14
15#[allow(non_snake_case)]
16#[repr(C)]
17pub struct CFDictionaryKeyCallBacks {
18 pub version: CFIndex,
19 pub retain: CFDictionaryRetainCallBack,
20 pub copyDescription: CFDictionaryCopyDescriptionCallBack,
21 pub equal: CFDictionaryEqualCallBack,
22 pub hash: CFDictionaryHashCallBack
23}
24
25#[allow(non_snake_case)]
26#[repr(C)]
27pub struct CFDictionaryValueCallBacks {
28 pub version: CFIndex,
29 pub retain: CFDictionaryRetainCallBack,
30 pub copyDescription: CFDictionaryCopyDescriptionCallBack,
31 pub equal: CFDictionaryEqualCallBack
32}
33
34#[doc(hidden)]
35#[repr(C)]
36pub struct __CFDictionary {
37 __private: c_void,
38}
39
40pub type CFMutableDictionaryRef = *mut __CFDictionary;
41pub type CFDictionaryRef = *const __CFDictionary;
42
43extern "C" {
44 pub static kCFTypeDictionaryKeyCallBacks: CFDictionaryKeyCallBacks;
45 pub static kCFCopyStringDictionaryKeyCallBacks: CFDictionaryKeyCallBacks;
46
47 pub static kCFTypeDictionaryValueCallBacks: CFDictionaryValueCallBacks;
48
49 pub fn CFDictionaryGetTypeID() -> CFTypeID;
50
51 pub fn CFDictionaryCreate(allocator: CFAllocatorRef, keys: *const *const c_void, values: *const *const c_void, numValues: CFIndex, keyCallBacks: *const CFDictionaryKeyCallBacks, valueCallBacks: *const CFDictionaryValueCallBacks) -> CFDictionaryRef;
52 pub fn CFDictionaryCreateCopy(allocator: CFAllocatorRef, theDict: CFDictionaryRef) -> CFDictionaryRef;
53 pub fn CFDictionaryCreateMutable(allocator: CFAllocatorRef, capacity: CFIndex, keysCallBacks: *const CFDictionaryKeyCallBacks, valueCallBacks: *const CFDictionaryValueCallBacks) -> CFMutableDictionaryRef;
54 pub fn CFDictionaryCreateMutableCopy(allocator: CFAllocatorRef, capacity: CFIndex, theDict: CFDictionaryRef) -> CFMutableDictionaryRef;
55
56 pub fn CFDictionaryGetCount(theDict: CFDictionaryRef) -> CFIndex;
57 pub fn CFDictionaryGetCountOfKey(theDict: CFDictionaryRef, value: *const c_void) -> CFIndex;
58 pub fn CFDictionaryContainsKey(theDict: CFDictionaryRef, key: *const c_void) -> Boolean;
59 pub fn CFDictionaryContainsValue(theDict: CFDictionaryRef, value: *const c_void) -> Boolean;
60 pub fn CFDictionaryGetValue(theDict: CFDictionaryRef, key: *const c_void) -> *const c_void;
61 pub fn CFDictionaryGetValueIfPresent(theDict: CFDictionaryRef, key: *const c_void, value: *mut *const c_void) -> Boolean;
62 pub fn CFDictionaryGetKeysAndValues(theDict: CFDictionaryRef, keys: *mut *const c_void, values: *mut *const c_void);
63 pub fn CFDictionaryApplyFunction(theDict: CFDictionaryRef, applier: CFDictionaryApplierFunction, context: *const c_void);
64
65 pub fn CFDictionaryAddValue(theDict: CFMutableDictionaryRef, key: *const c_void, value: *const c_void);
66 pub fn CFDictionarySetValue(theDict: CFMutableDictionaryRef, key: *const c_void, value: *const c_void);
67 pub fn CFDictionaryReplaceValue(theDict: CFMutableDictionaryRef, key: *const c_void, value: *const c_void);
68 pub fn CFDictionaryRemoveValue(theDict: CFMutableDictionaryRef, key: *const c_void);
69 pub fn CFDictionaryRemoveAllValues(theDict: CFMutableDictionaryRef);
70}