core_foundation_sys/
tree.rs1use std::os::raw::c_void;
11
12use crate::base::{CFAllocatorRef, CFComparatorFunction, CFIndex, CFTypeID};
13use crate::string::CFStringRef;
14
15#[repr(C)]
16pub struct __CFTree(c_void);
17pub type CFTreeRef = *mut __CFTree;
18
19pub type CFTreeRetainCallBack = extern "C" fn(info: *const c_void) -> *const c_void;
20pub type CFTreeReleaseCallBack = extern "C" fn(info: *const c_void);
21pub type CFTreeCopyDescriptionCallBack = extern "C" fn(info: *const c_void) -> CFStringRef;
22pub type CFTreeApplierFunction = extern "C" fn(value: *const c_void, context: *mut c_void);
23
24#[repr(C)]
25pub struct CFTreeContext {
26 pub version: CFIndex,
27 pub info: *mut c_void,
28 pub retain: CFTreeRetainCallBack,
29 pub release: CFTreeReleaseCallBack,
30 pub copyDescription: CFTreeCopyDescriptionCallBack,
31}
32
33extern "C" {
34 pub fn CFTreeCreate(allocator: CFAllocatorRef, context: *const CFTreeContext) -> CFTreeRef;
39
40 pub fn CFTreeAppendChild(tree: CFTreeRef, newChild: CFTreeRef);
42 pub fn CFTreeInsertSibling(tree: CFTreeRef, newSibling: CFTreeRef);
43 pub fn CFTreeRemoveAllChildren(tree: CFTreeRef);
44 pub fn CFTreePrependChild(tree: CFTreeRef, newChild: CFTreeRef);
45 pub fn CFTreeRemove(tree: CFTreeRef);
46 pub fn CFTreeSetContext(tree: CFTreeRef, context: *const CFTreeContext);
47
48 pub fn CFTreeSortChildren(
50 tree: CFTreeRef,
51 comparator: CFComparatorFunction,
52 context: *mut c_void,
53 );
54
55 pub fn CFTreeFindRoot(tree: CFTreeRef) -> CFTreeRef;
57 pub fn CFTreeGetChildAtIndex(tree: CFTreeRef, idx: CFIndex) -> CFTreeRef;
58 pub fn CFTreeGetChildCount(tree: CFTreeRef) -> CFIndex;
59 pub fn CFTreeGetChildren(tree: CFTreeRef, children: *mut CFTreeRef);
60 pub fn CFTreeGetContext(tree: CFTreeRef, context: *mut CFTreeContext);
61 pub fn CFTreeGetFirstChild(tree: CFTreeRef) -> CFTreeRef;
62 pub fn CFTreeGetNextSibling(tree: CFTreeRef) -> CFTreeRef;
63 pub fn CFTreeGetParent(tree: CFTreeRef) -> CFTreeRef;
64
65 pub fn CFTreeApplyFunctionToChildren(
67 tree: CFTreeRef,
68 applier: CFTreeApplierFunction,
69 context: *mut c_void,
70 );
71
72 pub fn CFTreeGetTypeID() -> CFTypeID;
74}