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};
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;
48 
49     /* Applying a Function to Set Members */
CFSetApplyFunction(theSet: CFSetRef, applier: CFSetApplierFunction, context: *const c_void)50     pub fn CFSetApplyFunction(theSet: CFSetRef,
51                               applier: CFSetApplierFunction,
52                               context: *const c_void);
53 
CFSetGetCount(theSet: CFSetRef) -> CFIndex54     pub fn CFSetGetCount(theSet: CFSetRef) -> CFIndex;
55 
CFSetGetTypeID() -> CFTypeID56     pub fn CFSetGetTypeID() -> CFTypeID;
57 }
58 
59