]> git.proxmox.com Git - rustc.git/blob - vendor/core-foundation-sys/src/set.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / vendor / core-foundation-sys / src / set.rs
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 */
46 pub fn CFSetCreate(allocator: CFAllocatorRef, values: *const *const c_void, numValues: CFIndex,
47 callBacks: *const CFSetCallBacks) -> CFSetRef;
48 pub fn CFSetCreateCopy(allocator: CFAllocatorRef, theSet: CFSetRef) -> CFSetRef;
49
50 /* Examining a Set */
51 pub fn CFSetContainsValue(theSet: CFSetRef, value: *const c_void) -> Boolean;
52 pub fn CFSetGetCount(theSet: CFSetRef) -> CFIndex;
53 pub fn CFSetGetCountOfValue(theSet: CFSetRef, value: *const c_void) -> CFIndex;
54 pub fn CFSetGetValue(theSet: CFSetRef, value: *const c_void) -> *const c_void;
55 pub fn CFSetGetValueIfPresent(theSet: CFSetRef, candidate: *const c_void, value: *mut *const c_void) -> Boolean;
56 pub fn CFSetGetValues(theSet: CFSetRef, values: *mut *const c_void);
57
58 /* Applying a Function to Set Members */
59 pub fn CFSetApplyFunction(theSet: CFSetRef,
60 applier: CFSetApplierFunction,
61 context: *const c_void);
62
63 /* Getting the CFSet Type ID */
64 pub fn CFSetGetTypeID() -> CFTypeID;
65 }
66