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 base::{CFAllocatorRef, CFIndex, CFTypeID, Boolean}; 13 14 pub type CFSetApplierFunction = extern "C" fn (value: *const c_void, 15 context: *const c_void); 16 pub type CFSetRetainCallBack = *const u8; 17 pub type CFSetReleaseCallBack = *const u8; 18 pub type CFSetCopyDescriptionCallBack = *const u8; 19 pub type CFSetEqualCallBack = *const u8; 20 pub type CFSetHashCallBack = *const u8; 21 22 #[repr(C)] 23 #[derive(Clone, Copy)] 24 pub struct CFSetCallBacks { 25 pub version: CFIndex, 26 pub retain: CFSetRetainCallBack, 27 pub release: CFSetReleaseCallBack, 28 pub copyDescription: CFSetCopyDescriptionCallBack, 29 pub equal: CFSetEqualCallBack, 30 pub hash: CFSetHashCallBack, 31 } 32 33 #[repr(C)] 34 pub struct __CFSet(c_void); 35 36 pub type CFSetRef = *const __CFSet; 37 38 extern { 39 /* 40 * CFSet.h 41 */ 42 43 pub static kCFTypeSetCallBacks: CFSetCallBacks; 44 45 /* Creating Sets */ CFSetCreate(allocator: CFAllocatorRef, values: *const *const c_void, numValues: CFIndex, callBacks: *const CFSetCallBacks) -> CFSetRef46 pub fn CFSetCreate(allocator: CFAllocatorRef, values: *const *const c_void, numValues: CFIndex, 47 callBacks: *const CFSetCallBacks) -> CFSetRef; CFSetCreateCopy(allocator: CFAllocatorRef, theSet: CFSetRef) -> CFSetRef48 pub fn CFSetCreateCopy(allocator: CFAllocatorRef, theSet: CFSetRef) -> CFSetRef; 49 50 /* Examining a Set */ CFSetContainsValue(theSet: CFSetRef, value: *const c_void) -> Boolean51 pub fn CFSetContainsValue(theSet: CFSetRef, value: *const c_void) -> Boolean; CFSetGetCount(theSet: CFSetRef) -> CFIndex52 pub fn CFSetGetCount(theSet: CFSetRef) -> CFIndex; CFSetGetCountOfValue(theSet: CFSetRef, value: *const c_void) -> CFIndex53 pub fn CFSetGetCountOfValue(theSet: CFSetRef, value: *const c_void) -> CFIndex; CFSetGetValue(theSet: CFSetRef, value: *const c_void) -> *const c_void54 pub fn CFSetGetValue(theSet: CFSetRef, value: *const c_void) -> *const c_void; CFSetGetValueIfPresent(theSet: CFSetRef, candidate: *const c_void, value: *mut *const c_void) -> Boolean55 pub fn CFSetGetValueIfPresent(theSet: CFSetRef, candidate: *const c_void, value: *mut *const c_void) -> Boolean; CFSetGetValues(theSet: CFSetRef, values: *mut *const c_void)56 pub fn CFSetGetValues(theSet: CFSetRef, values: *mut *const c_void); 57 58 /* Applying a Function to Set Members */ CFSetApplyFunction(theSet: CFSetRef, applier: CFSetApplierFunction, context: *const c_void)59 pub fn CFSetApplyFunction(theSet: CFSetRef, 60 applier: CFSetApplierFunction, 61 context: *const c_void); 62 63 /* Getting the CFSet Type ID */ CFSetGetTypeID() -> CFTypeID64 pub fn CFSetGetTypeID() -> CFTypeID; 65 } 66 67