CoreFoundation_sys/
data.rs

1// Exports from <CoreFoundation/CFData.h>
2
3use libc::c_void;
4
5use base::*;
6
7#[doc(hidden)]
8#[repr(C)]
9pub struct __CFData {
10    __private: c_void,
11}
12
13pub type CFDataRef = *const __CFData;
14pub type CFMutableDataRef = *mut __CFData;
15
16pub type CFDataSearchFlags = CFOptionFlags;
17pub const kCFDataSearchBackwards: CFDataSearchFlags = 1 << 0;
18pub const kCFDataSearchAnchored: CFDataSearchFlags = 1 << 1;
19
20extern "C" {
21    pub fn CFDataGetTypeID() -> CFTypeID;
22
23    pub fn CFDataCreate(allocator: CFAllocatorRef, bytes: *const UInt8, length: CFIndex) -> CFDataRef;
24    pub fn CFDataCreateWithBytesNoCopy(allocator: CFAllocatorRef, bytes: *const UInt8, length: CFIndex, bytesDeallocator: CFAllocatorRef) -> CFDataRef;
25    pub fn CFDataCreateCopy(allocator: CFAllocatorRef, theData: CFDataRef) -> CFDataRef;
26    pub fn CFDataCreateMutable(allocator: CFAllocatorRef, capacity: CFIndex) -> CFMutableDataRef;
27    pub fn CFDataCreateMutableCopy(allocator: CFAllocatorRef, capacity: CFIndex, theData: CFDataRef) -> CFMutableDataRef;
28
29    pub fn CFDataGetLength(theData: CFDataRef) -> CFIndex;
30    pub fn CFDataGetBytePtr(theData: CFDataRef) -> *const UInt8;
31    pub fn CFDataGetMutableBytePtr(theData: CFMutableDataRef) -> *mut UInt8;
32    pub fn CFDataGetBytes(theData: CFDataRef, range: CFRange, buffer: *mut UInt8);
33
34    pub fn CFDataSetLength(theData: CFMutableDataRef, length: CFIndex);
35    pub fn CFDataIncreaseLength(theData: CFMutableDataRef, extraLength: CFIndex);
36    pub fn CFDataAppendBytes(theData: CFMutableDataRef, bytes: *const UInt8, length: CFIndex);
37    pub fn CFDataReplaceBytes(theData: CFMutableDataRef, range: CFRange, newBytes: *const UInt8, newLength: CFIndex);
38    pub fn CFDataDeleteBytes(theData: CFMutableDataRef, range: CFRange);
39
40    pub fn CFDataFind(theData: CFDataRef, dataToFind: CFDataRef, searchRange: CFRange, compareOptions: CFDataSearchFlags) -> CFRange;
41}