| 1 |
// Copyright 2013-2015 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, CFHashCode, CFIndex, CFTypeID}; |
| 13 |
use crate::string::CFStringRef; |
| 14 |
|
| 15 |
pub type CFSetApplierFunction = extern "C" fn(value: *const c_void, context: *const c_void); |
| 16 |
pub type CFSetRetainCallBack = |
| 17 |
extern "C" fn(allocator: CFAllocatorRef, value: *const c_void) -> *const c_void; |
| 18 |
pub type CFSetReleaseCallBack = extern "C" fn(allocator: CFAllocatorRef, value: *const c_void); |
| 19 |
pub type CFSetCopyDescriptionCallBack = extern "C" fn(value: *const c_void) -> CFStringRef; |
| 20 |
pub type CFSetEqualCallBack = |
| 21 |
extern "C" fn(value1: *const c_void, value2: *const c_void) -> Boolean; |
| 22 |
pub type CFSetHashCallBack = extern "C" fn(value: *const c_void) -> CFHashCode; |
| 23 |
|
| 24 |
#[repr(C)] |
| 25 |
#[derive(Clone, Copy)] |
| 26 |
pub 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)] |
| 36 |
pub struct __CFSet(c_void); |
| 37 |
|
| 38 |
pub type CFSetRef = *const __CFSet; |
| 39 |
pub type CFMutableSetRef = *mut __CFSet; |
| 40 |
|
| 41 |
extern "C" { |
| 42 |
/* |
| 43 |
* CFSet.h |
| 44 |
*/ |
| 45 |
|
| 46 |
pub static kCFTypeSetCallBacks: CFSetCallBacks; |
| 47 |
pub static kCFCopyStringSetCallBacks: CFSetCallBacks; |
| 48 |
|
| 49 |
/* CFSet */ |
| 50 |
/* Creating Sets */ |
| 51 |
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 |
/* Examining a Set */ |
| 60 |
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 |
/* Applying a Function to Set Members */ |
| 72 |
pub fn CFSetApplyFunction( |
| 73 |
theSet: CFSetRef, |
| 74 |
applier: CFSetApplierFunction, |
| 75 |
context: *const c_void, |
| 76 |
); |
| 77 |
|
| 78 |
/* Getting the CFSet Type ID */ |
| 79 |
pub fn CFSetGetTypeID() -> CFTypeID; |
| 80 |
|
| 81 |
/* CFMutableSet */ |
| 82 |
/* CFMutableSet Miscellaneous Functions */ |
| 83 |
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 |
} |