core_foundation_sys/
data.rs1use crate::base::{CFAllocatorRef, CFIndex, CFOptionFlags, CFRange, CFTypeID};
11use std::os::raw::c_void;
12
13#[repr(C)]
14pub struct __CFData(c_void);
15
16pub type CFDataRef = *const __CFData;
17pub type CFMutableDataRef = *mut __CFData;
18pub type CFDataSearchFlags = CFOptionFlags;
19
20pub const kCFDataSearchBackwards: CFDataSearchFlags = 1usize << 0;
22pub const kCFDataSearchAnchored: CFDataSearchFlags = 1usize << 1;
23
24extern "C" {
25 pub fn CFDataCreate(allocator: CFAllocatorRef, bytes: *const u8, length: CFIndex) -> CFDataRef;
32 pub fn CFDataCreateCopy(allocator: CFAllocatorRef, theData: CFDataRef) -> CFDataRef;
33 pub fn CFDataCreateWithBytesNoCopy(
34 allocator: CFAllocatorRef,
35 bytes: *const u8,
36 length: CFIndex,
37 bytesDeallocator: CFAllocatorRef,
38 ) -> CFDataRef;
39
40 pub fn CFDataGetBytePtr(theData: CFDataRef) -> *const u8;
42 pub fn CFDataGetBytes(theData: CFDataRef, range: CFRange, buffer: *mut u8);
43 pub fn CFDataGetLength(theData: CFDataRef) -> CFIndex;
44 pub fn CFDataFind(
45 theData: CFDataRef,
46 dataToFind: CFDataRef,
47 searchRange: CFRange,
48 compareOptions: CFDataSearchFlags,
49 ) -> CFRange;
50
51 pub fn CFDataGetTypeID() -> CFTypeID;
53
54 pub fn CFDataCreateMutable(allocator: CFAllocatorRef, capacity: CFIndex) -> CFMutableDataRef;
57 pub fn CFDataCreateMutableCopy(
58 allocator: CFAllocatorRef,
59 capacity: CFIndex,
60 theData: CFDataRef,
61 ) -> CFMutableDataRef;
62
63 pub fn CFDataGetMutableBytePtr(theData: CFMutableDataRef) -> *mut u8;
65
66 pub fn CFDataAppendBytes(theData: CFMutableDataRef, bytes: *const u8, length: CFIndex);
68 pub fn CFDataDeleteBytes(theData: CFMutableDataRef, range: CFRange);
69 pub fn CFDataReplaceBytes(
70 theData: CFMutableDataRef,
71 range: CFRange,
72 newBytes: *const u8,
73 newLength: CFIndex,
74 );
75 pub fn CFDataIncreaseLength(theData: CFMutableDataRef, extraLength: CFIndex);
76 pub fn CFDataSetLength(theData: CFMutableDataRef, length: CFIndex);
77}