| 1 |
// Copyright 2023 The Servo Project Developers. See the COPYRIGHT |
| 2 |
// file at the top-level directory of this distribution. |
| 3 |
// |
| 4 |
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
| 5 |
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 6 |
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your |
| 7 |
// option. This file may not be copied, modified, or distributed |
| 8 |
// except according to those terms. |
| 9 |
|
| 10 |
use std::os::raw::c_void; |
| 11 |
|
| 12 |
use crate::base::{Boolean, CFAllocatorRef, CFComparisonResult, CFIndex, CFTypeID}; |
| 13 |
use crate::string::CFStringRef; |
| 14 |
|
| 15 |
#[repr(C)] |
| 16 |
pub struct __CFBinaryHeap(c_void); |
| 17 |
|
| 18 |
pub type CFBinaryHeapRef = *mut __CFBinaryHeap; |
| 19 |
|
| 20 |
#[repr(C)] |
| 21 |
#[derive(Debug, Clone, Copy)] |
| 22 |
pub struct CFBinaryHeapCompareContext { |
| 23 |
pub version: CFIndex, |
| 24 |
pub info: *mut c_void, |
| 25 |
pub retain: extern "C" fn(info: *const c_void) -> *const c_void, |
| 26 |
pub release: extern "C" fn(info: *const c_void), |
| 27 |
pub copyDescription: extern "C" fn(info: *const c_void) -> CFStringRef, |
| 28 |
} |
| 29 |
|
| 30 |
#[repr(C)] |
| 31 |
#[derive(Debug, Clone, Copy)] |
| 32 |
pub struct CFBinaryHeapCallBacks { |
| 33 |
pub version: CFIndex, |
| 34 |
pub retain: extern "C" fn(allocator: CFAllocatorRef, ptr: *const c_void) -> *const c_void, |
| 35 |
pub release: extern "C" fn(allocator: CFAllocatorRef, ptr: *const c_void), |
| 36 |
pub copyDescription: extern "C" fn(ptr: *const c_void) -> CFStringRef, |
| 37 |
pub compare: extern "C" fn( |
| 38 |
ptr1: *const c_void, |
| 39 |
ptr2: *const c_void, |
| 40 |
context: *mut c_void, |
| 41 |
) -> CFComparisonResult, |
| 42 |
} |
| 43 |
|
| 44 |
pub type CFBinaryHeapApplierFunction = extern "C" fn(val: *const c_void, context: *const c_void); |
| 45 |
|
| 46 |
extern "C" { |
| 47 |
/* |
| 48 |
* CFBinaryHeap.h |
| 49 |
*/ |
| 50 |
/* Predefined Callback Structures */ |
| 51 |
pub static kCFStringBinaryHeapCallBacks: CFBinaryHeapCallBacks; |
| 52 |
|
| 53 |
/* CFBinaryHeap Miscellaneous Functions */ |
| 54 |
pub fn CFBinaryHeapAddValue(heap: CFBinaryHeapRef, value: *const c_void); |
| 55 |
pub fn CFBinaryHeapApplyFunction( |
| 56 |
heap: CFBinaryHeapRef, |
| 57 |
applier: CFBinaryHeapApplierFunction, |
| 58 |
context: *mut c_void, |
| 59 |
); |
| 60 |
pub fn CFBinaryHeapContainsValue(heap: CFBinaryHeapRef, value: *const c_void) -> Boolean; |
| 61 |
pub fn CFBinaryHeapCreate( |
| 62 |
allocator: CFAllocatorRef, |
| 63 |
capacity: CFIndex, |
| 64 |
callBacks: *const CFBinaryHeapCallBacks, |
| 65 |
compareContext: *const CFBinaryHeapCompareContext, |
| 66 |
) -> CFBinaryHeapRef; |
| 67 |
pub fn CFBinaryHeapCreateCopy( |
| 68 |
allocator: CFAllocatorRef, |
| 69 |
capacity: CFIndex, |
| 70 |
heap: CFBinaryHeapRef, |
| 71 |
) -> CFBinaryHeapRef; |
| 72 |
pub fn CFBinaryHeapGetCount(heap: CFBinaryHeapRef) -> CFIndex; |
| 73 |
pub fn CFBinaryHeapGetCountOfValue(heap: CFBinaryHeapRef, value: *const c_void) -> CFIndex; |
| 74 |
pub fn CFBinaryHeapGetMinimum(heap: CFBinaryHeapRef) -> *const c_void; |
| 75 |
pub fn CFBinaryHeapGetMinimumIfPresent( |
| 76 |
heap: CFBinaryHeapRef, |
| 77 |
value: *const *const c_void, |
| 78 |
) -> Boolean; |
| 79 |
pub fn CFBinaryHeapGetTypeID() -> CFTypeID; |
| 80 |
pub fn CFBinaryHeapGetValues(heap: CFBinaryHeapRef, values: *const *const c_void); |
| 81 |
pub fn CFBinaryHeapRemoveAllValues(heap: CFBinaryHeapRef); |
| 82 |
pub fn CFBinaryHeapRemoveMinimumValue(heap: CFBinaryHeapRef); |
| 83 |
} |