objc2_core_foundation/generated/
CFBitVector.rs1use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7
8use crate::*;
9
10pub type CFBit = u32;
12
13#[repr(C)]
15pub struct CFBitVector {
16 inner: [u8; 0],
17 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
18}
19
20cf_type!(
21 #[encoding_name = "__CFBitVector"]
22 unsafe impl CFBitVector {}
23);
24
25#[repr(C)]
27pub struct CFMutableBitVector {
28 inner: [u8; 0],
29 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
30}
31
32cf_type!(
33 #[encoding_name = "__CFBitVector"]
34 unsafe impl CFMutableBitVector: CFBitVector {}
35);
36
37#[cfg(feature = "CFBase")]
38unsafe impl ConcreteType for CFBitVector {
39 #[doc(alias = "CFBitVectorGetTypeID")]
40 #[inline]
41 fn type_id() -> CFTypeID {
42 extern "C-unwind" {
43 fn CFBitVectorGetTypeID() -> CFTypeID;
44 }
45 unsafe { CFBitVectorGetTypeID() }
46 }
47}
48
49#[cfg(feature = "CFBase")]
50#[inline]
51pub unsafe extern "C-unwind" fn CFBitVectorCreate(
52 allocator: Option<&CFAllocator>,
53 bytes: *const u8,
54 num_bits: CFIndex,
55) -> Option<CFRetained<CFBitVector>> {
56 extern "C-unwind" {
57 fn CFBitVectorCreate(
58 allocator: Option<&CFAllocator>,
59 bytes: *const u8,
60 num_bits: CFIndex,
61 ) -> Option<NonNull<CFBitVector>>;
62 }
63 let ret = unsafe { CFBitVectorCreate(allocator, bytes, num_bits) };
64 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
65}
66
67#[cfg(feature = "CFBase")]
68#[inline]
69pub unsafe extern "C-unwind" fn CFBitVectorCreateCopy(
70 allocator: Option<&CFAllocator>,
71 bv: Option<&CFBitVector>,
72) -> Option<CFRetained<CFBitVector>> {
73 extern "C-unwind" {
74 fn CFBitVectorCreateCopy(
75 allocator: Option<&CFAllocator>,
76 bv: Option<&CFBitVector>,
77 ) -> Option<NonNull<CFBitVector>>;
78 }
79 let ret = unsafe { CFBitVectorCreateCopy(allocator, bv) };
80 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
81}
82
83#[cfg(feature = "CFBase")]
84#[inline]
85pub unsafe extern "C-unwind" fn CFBitVectorCreateMutable(
86 allocator: Option<&CFAllocator>,
87 capacity: CFIndex,
88) -> Option<CFRetained<CFMutableBitVector>> {
89 extern "C-unwind" {
90 fn CFBitVectorCreateMutable(
91 allocator: Option<&CFAllocator>,
92 capacity: CFIndex,
93 ) -> Option<NonNull<CFMutableBitVector>>;
94 }
95 let ret = unsafe { CFBitVectorCreateMutable(allocator, capacity) };
96 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
97}
98
99#[cfg(feature = "CFBase")]
100#[inline]
101pub unsafe extern "C-unwind" fn CFBitVectorCreateMutableCopy(
102 allocator: Option<&CFAllocator>,
103 capacity: CFIndex,
104 bv: Option<&CFBitVector>,
105) -> Option<CFRetained<CFMutableBitVector>> {
106 extern "C-unwind" {
107 fn CFBitVectorCreateMutableCopy(
108 allocator: Option<&CFAllocator>,
109 capacity: CFIndex,
110 bv: Option<&CFBitVector>,
111 ) -> Option<NonNull<CFMutableBitVector>>;
112 }
113 let ret = unsafe { CFBitVectorCreateMutableCopy(allocator, capacity, bv) };
114 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
115}
116
117extern "C-unwind" {
118 #[cfg(feature = "CFBase")]
119 pub fn CFBitVectorGetCount(bv: &CFBitVector) -> CFIndex;
120}
121
122extern "C-unwind" {
123 #[cfg(feature = "CFBase")]
124 pub fn CFBitVectorGetCountOfBit(bv: &CFBitVector, range: CFRange, value: CFBit) -> CFIndex;
125}
126
127#[cfg(feature = "CFBase")]
128#[inline]
129pub unsafe extern "C-unwind" fn CFBitVectorContainsBit(
130 bv: &CFBitVector,
131 range: CFRange,
132 value: CFBit,
133) -> bool {
134 extern "C-unwind" {
135 fn CFBitVectorContainsBit(bv: &CFBitVector, range: CFRange, value: CFBit) -> Boolean;
136 }
137 let ret = unsafe { CFBitVectorContainsBit(bv, range, value) };
138 ret != 0
139}
140
141extern "C-unwind" {
142 #[cfg(feature = "CFBase")]
143 pub fn CFBitVectorGetBitAtIndex(bv: &CFBitVector, idx: CFIndex) -> CFBit;
144}
145
146extern "C-unwind" {
147 #[cfg(feature = "CFBase")]
148 pub fn CFBitVectorGetBits(bv: &CFBitVector, range: CFRange, bytes: *mut u8);
149}
150
151extern "C-unwind" {
152 #[cfg(feature = "CFBase")]
153 pub fn CFBitVectorGetFirstIndexOfBit(bv: &CFBitVector, range: CFRange, value: CFBit)
154 -> CFIndex;
155}
156
157extern "C-unwind" {
158 #[cfg(feature = "CFBase")]
159 pub fn CFBitVectorGetLastIndexOfBit(bv: &CFBitVector, range: CFRange, value: CFBit) -> CFIndex;
160}
161
162extern "C-unwind" {
163 #[cfg(feature = "CFBase")]
164 pub fn CFBitVectorSetCount(bv: Option<&CFMutableBitVector>, count: CFIndex);
165}
166
167extern "C-unwind" {
168 #[cfg(feature = "CFBase")]
169 pub fn CFBitVectorFlipBitAtIndex(bv: Option<&CFMutableBitVector>, idx: CFIndex);
170}
171
172extern "C-unwind" {
173 #[cfg(feature = "CFBase")]
174 pub fn CFBitVectorFlipBits(bv: Option<&CFMutableBitVector>, range: CFRange);
175}
176
177extern "C-unwind" {
178 #[cfg(feature = "CFBase")]
179 pub fn CFBitVectorSetBitAtIndex(bv: Option<&CFMutableBitVector>, idx: CFIndex, value: CFBit);
180}
181
182extern "C-unwind" {
183 #[cfg(feature = "CFBase")]
184 pub fn CFBitVectorSetBits(bv: Option<&CFMutableBitVector>, range: CFRange, value: CFBit);
185}
186
187extern "C-unwind" {
188 pub fn CFBitVectorSetAllBits(bv: Option<&CFMutableBitVector>, value: CFBit);
189}