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 libc::c_void;
11 
12 use base::{CFRange, CFIndex, CFAllocatorRef, CFTypeID, Boolean};
13 use string::CFStringRef;
14 
15 pub type CFArrayRetainCallBack = extern "C" fn(allocator: CFAllocatorRef, value: *const c_void) -> *const c_void;
16 pub type CFArrayReleaseCallBack = extern "C" fn(allocator: CFAllocatorRef, value: *const c_void);
17 pub type CFArrayCopyDescriptionCallBack = extern "C" fn(value: *const c_void) -> CFStringRef;
18 pub type CFArrayEqualCallBack = extern "C" fn(value1: *const c_void, value2: *const c_void) -> Boolean;
19 
20 #[repr(C)]
21 #[derive(Clone, Copy)]
22 pub struct CFArrayCallBacks {
23     pub version: CFIndex,
24     pub retain: CFArrayRetainCallBack,
25     pub release: CFArrayReleaseCallBack,
26     pub copyDescription: CFArrayCopyDescriptionCallBack,
27     pub equal: CFArrayEqualCallBack,
28 }
29 
30 #[repr(C)]
31 pub struct __CFArray(c_void);
32 
33 pub type CFArrayRef = *const __CFArray;
34 
35 extern {
36     /*
37      * CFArray.h
38      */
39     pub static kCFTypeArrayCallBacks: CFArrayCallBacks;
40 
CFArrayCreate(allocator: CFAllocatorRef, values: *const *const c_void, numValues: CFIndex, callBacks: *const CFArrayCallBacks) -> CFArrayRef41     pub fn CFArrayCreate(allocator: CFAllocatorRef, values: *const *const c_void,
42                      numValues: CFIndex, callBacks: *const CFArrayCallBacks) -> CFArrayRef;
CFArrayCreateCopy(allocator: CFAllocatorRef , theArray: CFArrayRef) -> CFArrayRef43     pub fn CFArrayCreateCopy(allocator: CFAllocatorRef , theArray: CFArrayRef) -> CFArrayRef;
44 
45     // CFArrayBSearchValues
46     // CFArrayContainsValue
CFArrayGetCount(theArray: CFArrayRef) -> CFIndex47     pub fn CFArrayGetCount(theArray: CFArrayRef) -> CFIndex;
48     // CFArrayGetCountOfValue
49     // CFArrayGetFirstIndexOfValue
50     // CFArrayGetLastIndexOfValue
CFArrayGetValues(theArray: CFArrayRef, range: CFRange, values: *mut *const c_void)51     pub fn CFArrayGetValues(theArray: CFArrayRef, range: CFRange, values: *mut *const c_void);
CFArrayGetValueAtIndex(theArray: CFArrayRef, idx: CFIndex) -> *const c_void52     pub fn CFArrayGetValueAtIndex(theArray: CFArrayRef, idx: CFIndex) -> *const c_void;
53     // CFArrayApplyFunction
CFArrayGetTypeID() -> CFTypeID54     pub fn CFArrayGetTypeID() -> CFTypeID;
55 }
56