1use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7#[cfg(feature = "objc2")]
8use objc2::__framework_prelude::*;
9
10use crate::*;
11
12#[doc(alias = "CFBundleRef")]
14#[repr(C)]
15pub struct CFBundle {
16 inner: [u8; 0],
17 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
18}
19
20cf_type!(
21 unsafe impl CFBundle {}
22);
23#[cfg(feature = "objc2")]
24cf_objc2_type!(
25 unsafe impl RefEncode<"__CFBundle"> for CFBundle {}
26);
27
28#[doc(alias = "CFPlugInRef")]
30#[repr(C)]
31pub struct CFPlugIn {
32 inner: [u8; 0],
33 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
34}
35
36cf_type!(
37 unsafe impl CFPlugIn {}
38);
39#[cfg(feature = "objc2")]
40cf_objc2_type!(
41 unsafe impl RefEncode<"__CFBundle"> for CFPlugIn {}
42);
43
44extern "C" {
45 pub static kCFBundleInfoDictionaryVersionKey: Option<&'static CFString>;
47}
48
49extern "C" {
50 pub static kCFBundleExecutableKey: Option<&'static CFString>;
52}
53
54extern "C" {
55 pub static kCFBundleIdentifierKey: Option<&'static CFString>;
57}
58
59extern "C" {
60 pub static kCFBundleVersionKey: Option<&'static CFString>;
62}
63
64extern "C" {
65 pub static kCFBundleDevelopmentRegionKey: Option<&'static CFString>;
67}
68
69extern "C" {
70 pub static kCFBundleNameKey: Option<&'static CFString>;
72}
73
74extern "C" {
75 pub static kCFBundleLocalizationsKey: Option<&'static CFString>;
77}
78
79impl CFBundle {
80 #[doc(alias = "CFBundleGetMainBundle")]
81 #[inline]
82 pub fn main_bundle() -> Option<CFRetained<CFBundle>> {
83 extern "C-unwind" {
84 fn CFBundleGetMainBundle() -> Option<NonNull<CFBundle>>;
85 }
86 let ret = unsafe { CFBundleGetMainBundle() };
87 ret.map(|ret| unsafe { CFRetained::retain(ret) })
88 }
89
90 #[doc(alias = "CFBundleGetBundleWithIdentifier")]
91 #[inline]
92 pub fn bundle_with_identifier(bundle_id: Option<&CFString>) -> Option<CFRetained<CFBundle>> {
93 extern "C-unwind" {
94 fn CFBundleGetBundleWithIdentifier(
95 bundle_id: Option<&CFString>,
96 ) -> Option<NonNull<CFBundle>>;
97 }
98 let ret = unsafe { CFBundleGetBundleWithIdentifier(bundle_id) };
99 ret.map(|ret| unsafe { CFRetained::retain(ret) })
100 }
101
102 #[doc(alias = "CFBundleGetAllBundles")]
103 #[cfg(feature = "CFArray")]
104 #[inline]
105 pub unsafe fn all_bundles() -> Option<CFRetained<CFArray>> {
106 extern "C-unwind" {
107 fn CFBundleGetAllBundles() -> Option<NonNull<CFArray>>;
108 }
109 let ret = unsafe { CFBundleGetAllBundles() };
110 ret.map(|ret| unsafe { CFRetained::retain(ret) })
111 }
112}
113
114unsafe impl ConcreteType for CFBundle {
115 #[doc(alias = "CFBundleGetTypeID")]
116 #[inline]
117 fn type_id() -> CFTypeID {
118 extern "C-unwind" {
119 fn CFBundleGetTypeID() -> CFTypeID;
120 }
121 unsafe { CFBundleGetTypeID() }
122 }
123}
124
125impl CFBundle {
126 #[doc(alias = "CFBundleCreate")]
127 #[cfg(feature = "CFURL")]
128 #[inline]
129 pub fn new(
130 allocator: Option<&CFAllocator>,
131 bundle_url: Option<&CFURL>,
132 ) -> Option<CFRetained<CFBundle>> {
133 extern "C-unwind" {
134 fn CFBundleCreate(
135 allocator: Option<&CFAllocator>,
136 bundle_url: Option<&CFURL>,
137 ) -> Option<NonNull<CFBundle>>;
138 }
139 let ret = unsafe { CFBundleCreate(allocator, bundle_url) };
140 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
141 }
142
143 #[doc(alias = "CFBundleCreateBundlesFromDirectory")]
144 #[cfg(all(feature = "CFArray", feature = "CFURL"))]
145 #[inline]
146 pub fn new_bundles_from_directory(
147 allocator: Option<&CFAllocator>,
148 directory_url: Option<&CFURL>,
149 bundle_type: Option<&CFString>,
150 ) -> Option<CFRetained<CFArray>> {
151 extern "C-unwind" {
152 fn CFBundleCreateBundlesFromDirectory(
153 allocator: Option<&CFAllocator>,
154 directory_url: Option<&CFURL>,
155 bundle_type: Option<&CFString>,
156 ) -> Option<NonNull<CFArray>>;
157 }
158 let ret =
159 unsafe { CFBundleCreateBundlesFromDirectory(allocator, directory_url, bundle_type) };
160 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
161 }
162
163 #[doc(alias = "CFBundleCopyBundleURL")]
164 #[cfg(feature = "CFURL")]
165 #[inline]
166 pub fn bundle_url(&self) -> Option<CFRetained<CFURL>> {
167 extern "C-unwind" {
168 fn CFBundleCopyBundleURL(bundle: &CFBundle) -> Option<NonNull<CFURL>>;
169 }
170 let ret = unsafe { CFBundleCopyBundleURL(self) };
171 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
172 }
173
174 #[doc(alias = "CFBundleGetValueForInfoDictionaryKey")]
175 #[inline]
176 pub fn value_for_info_dictionary_key(
177 &self,
178 key: Option<&CFString>,
179 ) -> Option<CFRetained<CFType>> {
180 extern "C-unwind" {
181 fn CFBundleGetValueForInfoDictionaryKey(
182 bundle: &CFBundle,
183 key: Option<&CFString>,
184 ) -> Option<NonNull<CFType>>;
185 }
186 let ret = unsafe { CFBundleGetValueForInfoDictionaryKey(self, key) };
187 ret.map(|ret| unsafe { CFRetained::retain(ret) })
188 }
189
190 #[doc(alias = "CFBundleGetInfoDictionary")]
191 #[cfg(feature = "CFDictionary")]
192 #[inline]
193 pub fn info_dictionary(&self) -> Option<CFRetained<CFDictionary>> {
194 extern "C-unwind" {
195 fn CFBundleGetInfoDictionary(bundle: &CFBundle) -> Option<NonNull<CFDictionary>>;
196 }
197 let ret = unsafe { CFBundleGetInfoDictionary(self) };
198 ret.map(|ret| unsafe { CFRetained::retain(ret) })
199 }
200
201 #[doc(alias = "CFBundleGetLocalInfoDictionary")]
202 #[cfg(feature = "CFDictionary")]
203 #[inline]
204 pub fn local_info_dictionary(&self) -> Option<CFRetained<CFDictionary>> {
205 extern "C-unwind" {
206 fn CFBundleGetLocalInfoDictionary(bundle: &CFBundle) -> Option<NonNull<CFDictionary>>;
207 }
208 let ret = unsafe { CFBundleGetLocalInfoDictionary(self) };
209 ret.map(|ret| unsafe { CFRetained::retain(ret) })
210 }
211
212 #[doc(alias = "CFBundleGetPackageInfo")]
217 #[inline]
218 pub unsafe fn package_info(&self, package_type: *mut u32, package_creator: *mut u32) {
219 extern "C-unwind" {
220 fn CFBundleGetPackageInfo(
221 bundle: &CFBundle,
222 package_type: *mut u32,
223 package_creator: *mut u32,
224 );
225 }
226 unsafe { CFBundleGetPackageInfo(self, package_type, package_creator) }
227 }
228
229 #[doc(alias = "CFBundleGetIdentifier")]
230 #[inline]
231 pub fn identifier(&self) -> Option<CFRetained<CFString>> {
232 extern "C-unwind" {
233 fn CFBundleGetIdentifier(bundle: &CFBundle) -> Option<NonNull<CFString>>;
234 }
235 let ret = unsafe { CFBundleGetIdentifier(self) };
236 ret.map(|ret| unsafe { CFRetained::retain(ret) })
237 }
238
239 #[doc(alias = "CFBundleGetVersionNumber")]
240 #[inline]
241 pub fn version_number(&self) -> u32 {
242 extern "C-unwind" {
243 fn CFBundleGetVersionNumber(bundle: &CFBundle) -> u32;
244 }
245 unsafe { CFBundleGetVersionNumber(self) }
246 }
247
248 #[doc(alias = "CFBundleGetDevelopmentRegion")]
249 #[inline]
250 pub fn development_region(&self) -> Option<CFRetained<CFString>> {
251 extern "C-unwind" {
252 fn CFBundleGetDevelopmentRegion(bundle: &CFBundle) -> Option<NonNull<CFString>>;
253 }
254 let ret = unsafe { CFBundleGetDevelopmentRegion(self) };
255 ret.map(|ret| unsafe { CFRetained::retain(ret) })
256 }
257
258 #[doc(alias = "CFBundleCopySupportFilesDirectoryURL")]
259 #[cfg(feature = "CFURL")]
260 #[inline]
261 pub fn support_files_directory_url(&self) -> Option<CFRetained<CFURL>> {
262 extern "C-unwind" {
263 fn CFBundleCopySupportFilesDirectoryURL(bundle: &CFBundle) -> Option<NonNull<CFURL>>;
264 }
265 let ret = unsafe { CFBundleCopySupportFilesDirectoryURL(self) };
266 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
267 }
268
269 #[doc(alias = "CFBundleCopyResourcesDirectoryURL")]
270 #[cfg(feature = "CFURL")]
271 #[inline]
272 pub fn resources_directory_url(&self) -> Option<CFRetained<CFURL>> {
273 extern "C-unwind" {
274 fn CFBundleCopyResourcesDirectoryURL(bundle: &CFBundle) -> Option<NonNull<CFURL>>;
275 }
276 let ret = unsafe { CFBundleCopyResourcesDirectoryURL(self) };
277 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
278 }
279
280 #[doc(alias = "CFBundleCopyPrivateFrameworksURL")]
281 #[cfg(feature = "CFURL")]
282 #[inline]
283 pub fn private_frameworks_url(&self) -> Option<CFRetained<CFURL>> {
284 extern "C-unwind" {
285 fn CFBundleCopyPrivateFrameworksURL(bundle: &CFBundle) -> Option<NonNull<CFURL>>;
286 }
287 let ret = unsafe { CFBundleCopyPrivateFrameworksURL(self) };
288 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
289 }
290
291 #[doc(alias = "CFBundleCopySharedFrameworksURL")]
292 #[cfg(feature = "CFURL")]
293 #[inline]
294 pub fn shared_frameworks_url(&self) -> Option<CFRetained<CFURL>> {
295 extern "C-unwind" {
296 fn CFBundleCopySharedFrameworksURL(bundle: &CFBundle) -> Option<NonNull<CFURL>>;
297 }
298 let ret = unsafe { CFBundleCopySharedFrameworksURL(self) };
299 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
300 }
301
302 #[doc(alias = "CFBundleCopySharedSupportURL")]
303 #[cfg(feature = "CFURL")]
304 #[inline]
305 pub fn shared_support_url(&self) -> Option<CFRetained<CFURL>> {
306 extern "C-unwind" {
307 fn CFBundleCopySharedSupportURL(bundle: &CFBundle) -> Option<NonNull<CFURL>>;
308 }
309 let ret = unsafe { CFBundleCopySharedSupportURL(self) };
310 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
311 }
312
313 #[doc(alias = "CFBundleCopyBuiltInPlugInsURL")]
314 #[cfg(feature = "CFURL")]
315 #[inline]
316 pub fn built_in_plug_ins_url(&self) -> Option<CFRetained<CFURL>> {
317 extern "C-unwind" {
318 fn CFBundleCopyBuiltInPlugInsURL(bundle: &CFBundle) -> Option<NonNull<CFURL>>;
319 }
320 let ret = unsafe { CFBundleCopyBuiltInPlugInsURL(self) };
321 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
322 }
323
324 #[doc(alias = "CFBundleCopyInfoDictionaryInDirectory")]
325 #[cfg(all(feature = "CFDictionary", feature = "CFURL"))]
326 #[inline]
327 pub fn info_dictionary_in_directory(
328 bundle_url: Option<&CFURL>,
329 ) -> Option<CFRetained<CFDictionary>> {
330 extern "C-unwind" {
331 fn CFBundleCopyInfoDictionaryInDirectory(
332 bundle_url: Option<&CFURL>,
333 ) -> Option<NonNull<CFDictionary>>;
334 }
335 let ret = unsafe { CFBundleCopyInfoDictionaryInDirectory(bundle_url) };
336 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
337 }
338
339 #[doc(alias = "CFBundleGetPackageInfoInDirectory")]
345 #[cfg(feature = "CFURL")]
346 #[inline]
347 pub unsafe fn package_info_in_directory(
348 url: Option<&CFURL>,
349 package_type: *mut u32,
350 package_creator: *mut u32,
351 ) -> bool {
352 extern "C-unwind" {
353 fn CFBundleGetPackageInfoInDirectory(
354 url: Option<&CFURL>,
355 package_type: *mut u32,
356 package_creator: *mut u32,
357 ) -> Boolean;
358 }
359 let ret = unsafe { CFBundleGetPackageInfoInDirectory(url, package_type, package_creator) };
360 ret != 0
361 }
362
363 #[doc(alias = "CFBundleCopyResourceURL")]
364 #[cfg(feature = "CFURL")]
365 #[inline]
366 pub fn resource_url(
367 &self,
368 resource_name: Option<&CFString>,
369 resource_type: Option<&CFString>,
370 sub_dir_name: Option<&CFString>,
371 ) -> Option<CFRetained<CFURL>> {
372 extern "C-unwind" {
373 fn CFBundleCopyResourceURL(
374 bundle: &CFBundle,
375 resource_name: Option<&CFString>,
376 resource_type: Option<&CFString>,
377 sub_dir_name: Option<&CFString>,
378 ) -> Option<NonNull<CFURL>>;
379 }
380 let ret =
381 unsafe { CFBundleCopyResourceURL(self, resource_name, resource_type, sub_dir_name) };
382 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
383 }
384
385 #[doc(alias = "CFBundleCopyResourceURLsOfType")]
386 #[cfg(feature = "CFArray")]
387 #[inline]
388 pub fn resource_urls_of_type(
389 &self,
390 resource_type: Option<&CFString>,
391 sub_dir_name: Option<&CFString>,
392 ) -> Option<CFRetained<CFArray>> {
393 extern "C-unwind" {
394 fn CFBundleCopyResourceURLsOfType(
395 bundle: &CFBundle,
396 resource_type: Option<&CFString>,
397 sub_dir_name: Option<&CFString>,
398 ) -> Option<NonNull<CFArray>>;
399 }
400 let ret = unsafe { CFBundleCopyResourceURLsOfType(self, resource_type, sub_dir_name) };
401 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
402 }
403
404 #[doc(alias = "CFBundleCopyLocalizedString")]
405 #[inline]
406 pub fn localized_string(
407 &self,
408 key: Option<&CFString>,
409 value: Option<&CFString>,
410 table_name: Option<&CFString>,
411 ) -> Option<CFRetained<CFString>> {
412 extern "C-unwind" {
413 fn CFBundleCopyLocalizedString(
414 bundle: &CFBundle,
415 key: Option<&CFString>,
416 value: Option<&CFString>,
417 table_name: Option<&CFString>,
418 ) -> Option<NonNull<CFString>>;
419 }
420 let ret = unsafe { CFBundleCopyLocalizedString(self, key, value, table_name) };
421 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
422 }
423
424 #[doc(alias = "CFBundleCopyLocalizedStringForLocalizations")]
441 #[cfg(feature = "CFArray")]
442 #[inline]
443 pub unsafe fn localized_string_for_localizations(
444 &self,
445 key: Option<&CFString>,
446 value: Option<&CFString>,
447 table_name: Option<&CFString>,
448 localizations: Option<&CFArray>,
449 ) -> Option<CFRetained<CFString>> {
450 extern "C-unwind" {
451 fn CFBundleCopyLocalizedStringForLocalizations(
452 bundle: &CFBundle,
453 key: Option<&CFString>,
454 value: Option<&CFString>,
455 table_name: Option<&CFString>,
456 localizations: Option<&CFArray>,
457 ) -> Option<NonNull<CFString>>;
458 }
459 let ret = unsafe {
460 CFBundleCopyLocalizedStringForLocalizations(self, key, value, table_name, localizations)
461 };
462 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
463 }
464
465 #[doc(alias = "CFBundleCopyResourceURLInDirectory")]
466 #[cfg(feature = "CFURL")]
467 #[inline]
468 pub fn resource_url_in_directory(
469 bundle_url: Option<&CFURL>,
470 resource_name: Option<&CFString>,
471 resource_type: Option<&CFString>,
472 sub_dir_name: Option<&CFString>,
473 ) -> Option<CFRetained<CFURL>> {
474 extern "C-unwind" {
475 fn CFBundleCopyResourceURLInDirectory(
476 bundle_url: Option<&CFURL>,
477 resource_name: Option<&CFString>,
478 resource_type: Option<&CFString>,
479 sub_dir_name: Option<&CFString>,
480 ) -> Option<NonNull<CFURL>>;
481 }
482 let ret = unsafe {
483 CFBundleCopyResourceURLInDirectory(
484 bundle_url,
485 resource_name,
486 resource_type,
487 sub_dir_name,
488 )
489 };
490 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
491 }
492
493 #[doc(alias = "CFBundleCopyResourceURLsOfTypeInDirectory")]
494 #[cfg(all(feature = "CFArray", feature = "CFURL"))]
495 #[inline]
496 pub fn resource_urls_of_type_in_directory(
497 bundle_url: Option<&CFURL>,
498 resource_type: Option<&CFString>,
499 sub_dir_name: Option<&CFString>,
500 ) -> Option<CFRetained<CFArray>> {
501 extern "C-unwind" {
502 fn CFBundleCopyResourceURLsOfTypeInDirectory(
503 bundle_url: Option<&CFURL>,
504 resource_type: Option<&CFString>,
505 sub_dir_name: Option<&CFString>,
506 ) -> Option<NonNull<CFArray>>;
507 }
508 let ret = unsafe {
509 CFBundleCopyResourceURLsOfTypeInDirectory(bundle_url, resource_type, sub_dir_name)
510 };
511 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
512 }
513
514 #[doc(alias = "CFBundleCopyBundleLocalizations")]
515 #[cfg(feature = "CFArray")]
516 #[inline]
517 pub fn bundle_localizations(&self) -> Option<CFRetained<CFArray>> {
518 extern "C-unwind" {
519 fn CFBundleCopyBundleLocalizations(bundle: &CFBundle) -> Option<NonNull<CFArray>>;
520 }
521 let ret = unsafe { CFBundleCopyBundleLocalizations(self) };
522 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
523 }
524
525 #[doc(alias = "CFBundleCopyPreferredLocalizationsFromArray")]
530 #[cfg(feature = "CFArray")]
531 #[inline]
532 pub unsafe fn preferred_localizations_from_array(
533 loc_array: Option<&CFArray>,
534 ) -> Option<CFRetained<CFArray>> {
535 extern "C-unwind" {
536 fn CFBundleCopyPreferredLocalizationsFromArray(
537 loc_array: Option<&CFArray>,
538 ) -> Option<NonNull<CFArray>>;
539 }
540 let ret = unsafe { CFBundleCopyPreferredLocalizationsFromArray(loc_array) };
541 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
542 }
543
544 #[doc(alias = "CFBundleCopyLocalizationsForPreferences")]
551 #[cfg(feature = "CFArray")]
552 #[inline]
553 pub unsafe fn localizations_for_preferences(
554 loc_array: Option<&CFArray>,
555 pref_array: Option<&CFArray>,
556 ) -> Option<CFRetained<CFArray>> {
557 extern "C-unwind" {
558 fn CFBundleCopyLocalizationsForPreferences(
559 loc_array: Option<&CFArray>,
560 pref_array: Option<&CFArray>,
561 ) -> Option<NonNull<CFArray>>;
562 }
563 let ret = unsafe { CFBundleCopyLocalizationsForPreferences(loc_array, pref_array) };
564 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
565 }
566
567 #[doc(alias = "CFBundleCopyResourceURLForLocalization")]
568 #[cfg(feature = "CFURL")]
569 #[inline]
570 pub fn resource_url_for_localization(
571 &self,
572 resource_name: Option<&CFString>,
573 resource_type: Option<&CFString>,
574 sub_dir_name: Option<&CFString>,
575 localization_name: Option<&CFString>,
576 ) -> Option<CFRetained<CFURL>> {
577 extern "C-unwind" {
578 fn CFBundleCopyResourceURLForLocalization(
579 bundle: &CFBundle,
580 resource_name: Option<&CFString>,
581 resource_type: Option<&CFString>,
582 sub_dir_name: Option<&CFString>,
583 localization_name: Option<&CFString>,
584 ) -> Option<NonNull<CFURL>>;
585 }
586 let ret = unsafe {
587 CFBundleCopyResourceURLForLocalization(
588 self,
589 resource_name,
590 resource_type,
591 sub_dir_name,
592 localization_name,
593 )
594 };
595 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
596 }
597
598 #[doc(alias = "CFBundleCopyResourceURLsOfTypeForLocalization")]
599 #[cfg(feature = "CFArray")]
600 #[inline]
601 pub fn resource_urls_of_type_for_localization(
602 &self,
603 resource_type: Option<&CFString>,
604 sub_dir_name: Option<&CFString>,
605 localization_name: Option<&CFString>,
606 ) -> Option<CFRetained<CFArray>> {
607 extern "C-unwind" {
608 fn CFBundleCopyResourceURLsOfTypeForLocalization(
609 bundle: &CFBundle,
610 resource_type: Option<&CFString>,
611 sub_dir_name: Option<&CFString>,
612 localization_name: Option<&CFString>,
613 ) -> Option<NonNull<CFArray>>;
614 }
615 let ret = unsafe {
616 CFBundleCopyResourceURLsOfTypeForLocalization(
617 self,
618 resource_type,
619 sub_dir_name,
620 localization_name,
621 )
622 };
623 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
624 }
625
626 #[doc(alias = "CFBundleCopyInfoDictionaryForURL")]
627 #[cfg(all(feature = "CFDictionary", feature = "CFURL"))]
628 #[inline]
629 pub fn info_dictionary_for_url(url: Option<&CFURL>) -> Option<CFRetained<CFDictionary>> {
630 extern "C-unwind" {
631 fn CFBundleCopyInfoDictionaryForURL(
632 url: Option<&CFURL>,
633 ) -> Option<NonNull<CFDictionary>>;
634 }
635 let ret = unsafe { CFBundleCopyInfoDictionaryForURL(url) };
636 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
637 }
638
639 #[doc(alias = "CFBundleCopyLocalizationsForURL")]
640 #[cfg(all(feature = "CFArray", feature = "CFURL"))]
641 #[inline]
642 pub fn localizations_for_url(url: Option<&CFURL>) -> Option<CFRetained<CFArray>> {
643 extern "C-unwind" {
644 fn CFBundleCopyLocalizationsForURL(url: Option<&CFURL>) -> Option<NonNull<CFArray>>;
645 }
646 let ret = unsafe { CFBundleCopyLocalizationsForURL(url) };
647 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
648 }
649
650 #[doc(alias = "CFBundleCopyExecutableArchitecturesForURL")]
651 #[cfg(all(feature = "CFArray", feature = "CFURL"))]
652 #[inline]
653 pub fn executable_architectures_for_url(url: Option<&CFURL>) -> Option<CFRetained<CFArray>> {
654 extern "C-unwind" {
655 fn CFBundleCopyExecutableArchitecturesForURL(
656 url: Option<&CFURL>,
657 ) -> Option<NonNull<CFArray>>;
658 }
659 let ret = unsafe { CFBundleCopyExecutableArchitecturesForURL(url) };
660 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
661 }
662
663 #[doc(alias = "CFBundleCopyExecutableURL")]
664 #[cfg(feature = "CFURL")]
665 #[inline]
666 pub fn executable_url(&self) -> Option<CFRetained<CFURL>> {
667 extern "C-unwind" {
668 fn CFBundleCopyExecutableURL(bundle: &CFBundle) -> Option<NonNull<CFURL>>;
669 }
670 let ret = unsafe { CFBundleCopyExecutableURL(self) };
671 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
672 }
673}
674
675pub const kCFBundleExecutableArchitectureI386: c_uint = 0x00000007;
677pub const kCFBundleExecutableArchitecturePPC: c_uint = 0x00000012;
679pub const kCFBundleExecutableArchitectureX86_64: c_uint = 0x01000007;
681pub const kCFBundleExecutableArchitecturePPC64: c_uint = 0x01000012;
683pub const kCFBundleExecutableArchitectureARM64: c_uint = 0x0100000c;
685
686impl CFBundle {
687 #[doc(alias = "CFBundleCopyExecutableArchitectures")]
688 #[cfg(feature = "CFArray")]
689 #[inline]
690 pub fn executable_architectures(&self) -> Option<CFRetained<CFArray>> {
691 extern "C-unwind" {
692 fn CFBundleCopyExecutableArchitectures(bundle: &CFBundle) -> Option<NonNull<CFArray>>;
693 }
694 let ret = unsafe { CFBundleCopyExecutableArchitectures(self) };
695 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
696 }
697
698 #[doc(alias = "CFBundlePreflightExecutable")]
702 #[cfg(feature = "CFError")]
703 #[inline]
704 pub unsafe fn preflight_executable(&self, error: *mut *mut CFError) -> bool {
705 extern "C-unwind" {
706 fn CFBundlePreflightExecutable(bundle: &CFBundle, error: *mut *mut CFError) -> Boolean;
707 }
708 let ret = unsafe { CFBundlePreflightExecutable(self, error) };
709 ret != 0
710 }
711
712 #[doc(alias = "CFBundleLoadExecutableAndReturnError")]
716 #[cfg(feature = "CFError")]
717 #[inline]
718 pub unsafe fn load_executable_and_return_error(&self, error: *mut *mut CFError) -> bool {
719 extern "C-unwind" {
720 fn CFBundleLoadExecutableAndReturnError(
721 bundle: &CFBundle,
722 error: *mut *mut CFError,
723 ) -> Boolean;
724 }
725 let ret = unsafe { CFBundleLoadExecutableAndReturnError(self, error) };
726 ret != 0
727 }
728
729 #[doc(alias = "CFBundleLoadExecutable")]
730 #[inline]
731 pub unsafe fn load_executable(&self) -> bool {
732 extern "C-unwind" {
733 fn CFBundleLoadExecutable(bundle: &CFBundle) -> Boolean;
734 }
735 let ret = unsafe { CFBundleLoadExecutable(self) };
736 ret != 0
737 }
738
739 #[doc(alias = "CFBundleIsExecutableLoaded")]
740 #[inline]
741 pub fn is_executable_loaded(&self) -> bool {
742 extern "C-unwind" {
743 fn CFBundleIsExecutableLoaded(bundle: &CFBundle) -> Boolean;
744 }
745 let ret = unsafe { CFBundleIsExecutableLoaded(self) };
746 ret != 0
747 }
748
749 #[doc(alias = "CFBundleUnloadExecutable")]
750 #[inline]
751 pub unsafe fn unload_executable(&self) {
752 extern "C-unwind" {
753 fn CFBundleUnloadExecutable(bundle: &CFBundle);
754 }
755 unsafe { CFBundleUnloadExecutable(self) }
756 }
757
758 #[doc(alias = "CFBundleGetFunctionPointerForName")]
759 #[inline]
760 pub fn function_pointer_for_name(&self, function_name: Option<&CFString>) -> *mut c_void {
761 extern "C-unwind" {
762 fn CFBundleGetFunctionPointerForName(
763 bundle: &CFBundle,
764 function_name: Option<&CFString>,
765 ) -> *mut c_void;
766 }
767 unsafe { CFBundleGetFunctionPointerForName(self, function_name) }
768 }
769
770 #[doc(alias = "CFBundleGetFunctionPointersForNames")]
776 #[cfg(feature = "CFArray")]
777 #[inline]
778 pub unsafe fn function_pointers_for_names(
779 &self,
780 function_names: Option<&CFArray>,
781 ftbl: *mut *mut c_void,
782 ) {
783 extern "C-unwind" {
784 fn CFBundleGetFunctionPointersForNames(
785 bundle: &CFBundle,
786 function_names: Option<&CFArray>,
787 ftbl: *mut *mut c_void,
788 );
789 }
790 unsafe { CFBundleGetFunctionPointersForNames(self, function_names, ftbl) }
791 }
792
793 #[doc(alias = "CFBundleGetDataPointerForName")]
794 #[inline]
795 pub fn data_pointer_for_name(&self, symbol_name: Option<&CFString>) -> *mut c_void {
796 extern "C-unwind" {
797 fn CFBundleGetDataPointerForName(
798 bundle: &CFBundle,
799 symbol_name: Option<&CFString>,
800 ) -> *mut c_void;
801 }
802 unsafe { CFBundleGetDataPointerForName(self, symbol_name) }
803 }
804
805 #[doc(alias = "CFBundleGetDataPointersForNames")]
811 #[cfg(feature = "CFArray")]
812 #[inline]
813 pub unsafe fn data_pointers_for_names(
814 &self,
815 symbol_names: Option<&CFArray>,
816 stbl: *mut *mut c_void,
817 ) {
818 extern "C-unwind" {
819 fn CFBundleGetDataPointersForNames(
820 bundle: &CFBundle,
821 symbol_names: Option<&CFArray>,
822 stbl: *mut *mut c_void,
823 );
824 }
825 unsafe { CFBundleGetDataPointersForNames(self, symbol_names, stbl) }
826 }
827
828 #[doc(alias = "CFBundleCopyAuxiliaryExecutableURL")]
829 #[cfg(feature = "CFURL")]
830 #[inline]
831 pub fn auxiliary_executable_url(
832 &self,
833 executable_name: Option<&CFString>,
834 ) -> Option<CFRetained<CFURL>> {
835 extern "C-unwind" {
836 fn CFBundleCopyAuxiliaryExecutableURL(
837 bundle: &CFBundle,
838 executable_name: Option<&CFString>,
839 ) -> Option<NonNull<CFURL>>;
840 }
841 let ret = unsafe { CFBundleCopyAuxiliaryExecutableURL(self, executable_name) };
842 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
843 }
844
845 #[doc(alias = "CFBundleIsExecutableLoadable")]
846 #[inline]
847 pub fn is_executable_loadable(&self) -> bool {
848 extern "C-unwind" {
849 fn CFBundleIsExecutableLoadable(bundle: &CFBundle) -> Boolean;
850 }
851 let ret = unsafe { CFBundleIsExecutableLoadable(self) };
852 ret != 0
853 }
854
855 #[doc(alias = "CFBundleIsExecutableLoadableForURL")]
856 #[cfg(feature = "CFURL")]
857 #[inline]
858 pub fn is_executable_loadable_for_url(url: Option<&CFURL>) -> bool {
859 extern "C-unwind" {
860 fn CFBundleIsExecutableLoadableForURL(url: Option<&CFURL>) -> Boolean;
861 }
862 let ret = unsafe { CFBundleIsExecutableLoadableForURL(url) };
863 ret != 0
864 }
865
866 #[doc(alias = "CFBundleIsArchitectureLoadable")]
867 #[cfg(feature = "libc")]
868 #[inline]
869 pub fn is_architecture_loadable(arch: libc::cpu_type_t) -> bool {
870 extern "C-unwind" {
871 fn CFBundleIsArchitectureLoadable(arch: libc::cpu_type_t) -> Boolean;
872 }
873 let ret = unsafe { CFBundleIsArchitectureLoadable(arch) };
874 ret != 0
875 }
876
877 #[doc(alias = "CFBundleGetPlugIn")]
878 #[inline]
879 pub fn plug_in(&self) -> Option<CFRetained<CFPlugIn>> {
880 extern "C-unwind" {
881 fn CFBundleGetPlugIn(bundle: &CFBundle) -> Option<NonNull<CFPlugIn>>;
882 }
883 let ret = unsafe { CFBundleGetPlugIn(self) };
884 ret.map(|ret| unsafe { CFRetained::retain(ret) })
885 }
886
887 #[doc(alias = "CFBundleOpenBundleResourceMap")]
888 #[deprecated = "The Carbon Resource Manager is deprecated. This should only be used to access Resource Manager-style resources in old bundles."]
889 #[inline]
890 pub fn open_bundle_resource_map(&self) -> CFBundleRefNum {
891 extern "C-unwind" {
892 fn CFBundleOpenBundleResourceMap(bundle: &CFBundle) -> CFBundleRefNum;
893 }
894 unsafe { CFBundleOpenBundleResourceMap(self) }
895 }
896
897 #[doc(alias = "CFBundleOpenBundleResourceFiles")]
902 #[deprecated = "The Carbon Resource Manager is deprecated. This should only be used to access Resource Manager-style resources in old bundles."]
903 #[inline]
904 pub unsafe fn open_bundle_resource_files(
905 &self,
906 ref_num: *mut CFBundleRefNum,
907 localized_ref_num: *mut CFBundleRefNum,
908 ) -> i32 {
909 extern "C-unwind" {
910 fn CFBundleOpenBundleResourceFiles(
911 bundle: &CFBundle,
912 ref_num: *mut CFBundleRefNum,
913 localized_ref_num: *mut CFBundleRefNum,
914 ) -> i32;
915 }
916 unsafe { CFBundleOpenBundleResourceFiles(self, ref_num, localized_ref_num) }
917 }
918
919 #[doc(alias = "CFBundleCloseBundleResourceMap")]
920 #[deprecated = "The Carbon Resource Manager is deprecated. This should only be used to access Resource Manager-style resources in old bundles."]
921 #[inline]
922 pub fn close_bundle_resource_map(&self, ref_num: CFBundleRefNum) {
923 extern "C-unwind" {
924 fn CFBundleCloseBundleResourceMap(bundle: &CFBundle, ref_num: CFBundleRefNum);
925 }
926 unsafe { CFBundleCloseBundleResourceMap(self, ref_num) }
927 }
928}
929
930#[deprecated = "renamed to `CFBundle::main_bundle`"]
931#[inline]
932pub extern "C-unwind" fn CFBundleGetMainBundle() -> Option<CFRetained<CFBundle>> {
933 extern "C-unwind" {
934 fn CFBundleGetMainBundle() -> Option<NonNull<CFBundle>>;
935 }
936 let ret = unsafe { CFBundleGetMainBundle() };
937 ret.map(|ret| unsafe { CFRetained::retain(ret) })
938}
939
940#[deprecated = "renamed to `CFBundle::bundle_with_identifier`"]
941#[inline]
942pub extern "C-unwind" fn CFBundleGetBundleWithIdentifier(
943 bundle_id: Option<&CFString>,
944) -> Option<CFRetained<CFBundle>> {
945 extern "C-unwind" {
946 fn CFBundleGetBundleWithIdentifier(
947 bundle_id: Option<&CFString>,
948 ) -> Option<NonNull<CFBundle>>;
949 }
950 let ret = unsafe { CFBundleGetBundleWithIdentifier(bundle_id) };
951 ret.map(|ret| unsafe { CFRetained::retain(ret) })
952}
953
954#[cfg(feature = "CFArray")]
955#[deprecated = "renamed to `CFBundle::all_bundles`"]
956#[inline]
957pub unsafe extern "C-unwind" fn CFBundleGetAllBundles() -> Option<CFRetained<CFArray>> {
958 extern "C-unwind" {
959 fn CFBundleGetAllBundles() -> Option<NonNull<CFArray>>;
960 }
961 let ret = unsafe { CFBundleGetAllBundles() };
962 ret.map(|ret| unsafe { CFRetained::retain(ret) })
963}
964
965#[cfg(feature = "CFURL")]
966#[deprecated = "renamed to `CFBundle::new`"]
967#[inline]
968pub extern "C-unwind" fn CFBundleCreate(
969 allocator: Option<&CFAllocator>,
970 bundle_url: Option<&CFURL>,
971) -> Option<CFRetained<CFBundle>> {
972 extern "C-unwind" {
973 fn CFBundleCreate(
974 allocator: Option<&CFAllocator>,
975 bundle_url: Option<&CFURL>,
976 ) -> Option<NonNull<CFBundle>>;
977 }
978 let ret = unsafe { CFBundleCreate(allocator, bundle_url) };
979 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
980}
981
982#[cfg(all(feature = "CFArray", feature = "CFURL"))]
983#[deprecated = "renamed to `CFBundle::new_bundles_from_directory`"]
984#[inline]
985pub extern "C-unwind" fn CFBundleCreateBundlesFromDirectory(
986 allocator: Option<&CFAllocator>,
987 directory_url: Option<&CFURL>,
988 bundle_type: Option<&CFString>,
989) -> Option<CFRetained<CFArray>> {
990 extern "C-unwind" {
991 fn CFBundleCreateBundlesFromDirectory(
992 allocator: Option<&CFAllocator>,
993 directory_url: Option<&CFURL>,
994 bundle_type: Option<&CFString>,
995 ) -> Option<NonNull<CFArray>>;
996 }
997 let ret = unsafe { CFBundleCreateBundlesFromDirectory(allocator, directory_url, bundle_type) };
998 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
999}
1000
1001#[cfg(feature = "CFURL")]
1002#[deprecated = "renamed to `CFBundle::bundle_url`"]
1003#[inline]
1004pub extern "C-unwind" fn CFBundleCopyBundleURL(bundle: &CFBundle) -> Option<CFRetained<CFURL>> {
1005 extern "C-unwind" {
1006 fn CFBundleCopyBundleURL(bundle: &CFBundle) -> Option<NonNull<CFURL>>;
1007 }
1008 let ret = unsafe { CFBundleCopyBundleURL(bundle) };
1009 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1010}
1011
1012#[deprecated = "renamed to `CFBundle::value_for_info_dictionary_key`"]
1013#[inline]
1014pub extern "C-unwind" fn CFBundleGetValueForInfoDictionaryKey(
1015 bundle: &CFBundle,
1016 key: Option<&CFString>,
1017) -> Option<CFRetained<CFType>> {
1018 extern "C-unwind" {
1019 fn CFBundleGetValueForInfoDictionaryKey(
1020 bundle: &CFBundle,
1021 key: Option<&CFString>,
1022 ) -> Option<NonNull<CFType>>;
1023 }
1024 let ret = unsafe { CFBundleGetValueForInfoDictionaryKey(bundle, key) };
1025 ret.map(|ret| unsafe { CFRetained::retain(ret) })
1026}
1027
1028#[cfg(feature = "CFDictionary")]
1029#[deprecated = "renamed to `CFBundle::info_dictionary`"]
1030#[inline]
1031pub extern "C-unwind" fn CFBundleGetInfoDictionary(
1032 bundle: &CFBundle,
1033) -> Option<CFRetained<CFDictionary>> {
1034 extern "C-unwind" {
1035 fn CFBundleGetInfoDictionary(bundle: &CFBundle) -> Option<NonNull<CFDictionary>>;
1036 }
1037 let ret = unsafe { CFBundleGetInfoDictionary(bundle) };
1038 ret.map(|ret| unsafe { CFRetained::retain(ret) })
1039}
1040
1041#[cfg(feature = "CFDictionary")]
1042#[deprecated = "renamed to `CFBundle::local_info_dictionary`"]
1043#[inline]
1044pub extern "C-unwind" fn CFBundleGetLocalInfoDictionary(
1045 bundle: &CFBundle,
1046) -> Option<CFRetained<CFDictionary>> {
1047 extern "C-unwind" {
1048 fn CFBundleGetLocalInfoDictionary(bundle: &CFBundle) -> Option<NonNull<CFDictionary>>;
1049 }
1050 let ret = unsafe { CFBundleGetLocalInfoDictionary(bundle) };
1051 ret.map(|ret| unsafe { CFRetained::retain(ret) })
1052}
1053
1054extern "C-unwind" {
1055 #[deprecated = "renamed to `CFBundle::package_info`"]
1056 pub fn CFBundleGetPackageInfo(
1057 bundle: &CFBundle,
1058 package_type: *mut u32,
1059 package_creator: *mut u32,
1060 );
1061}
1062
1063#[deprecated = "renamed to `CFBundle::identifier`"]
1064#[inline]
1065pub extern "C-unwind" fn CFBundleGetIdentifier(bundle: &CFBundle) -> Option<CFRetained<CFString>> {
1066 extern "C-unwind" {
1067 fn CFBundleGetIdentifier(bundle: &CFBundle) -> Option<NonNull<CFString>>;
1068 }
1069 let ret = unsafe { CFBundleGetIdentifier(bundle) };
1070 ret.map(|ret| unsafe { CFRetained::retain(ret) })
1071}
1072
1073#[deprecated = "renamed to `CFBundle::version_number`"]
1074#[inline]
1075pub extern "C-unwind" fn CFBundleGetVersionNumber(bundle: &CFBundle) -> u32 {
1076 extern "C-unwind" {
1077 fn CFBundleGetVersionNumber(bundle: &CFBundle) -> u32;
1078 }
1079 unsafe { CFBundleGetVersionNumber(bundle) }
1080}
1081
1082#[deprecated = "renamed to `CFBundle::development_region`"]
1083#[inline]
1084pub extern "C-unwind" fn CFBundleGetDevelopmentRegion(
1085 bundle: &CFBundle,
1086) -> Option<CFRetained<CFString>> {
1087 extern "C-unwind" {
1088 fn CFBundleGetDevelopmentRegion(bundle: &CFBundle) -> Option<NonNull<CFString>>;
1089 }
1090 let ret = unsafe { CFBundleGetDevelopmentRegion(bundle) };
1091 ret.map(|ret| unsafe { CFRetained::retain(ret) })
1092}
1093
1094#[cfg(feature = "CFURL")]
1095#[deprecated = "renamed to `CFBundle::support_files_directory_url`"]
1096#[inline]
1097pub extern "C-unwind" fn CFBundleCopySupportFilesDirectoryURL(
1098 bundle: &CFBundle,
1099) -> Option<CFRetained<CFURL>> {
1100 extern "C-unwind" {
1101 fn CFBundleCopySupportFilesDirectoryURL(bundle: &CFBundle) -> Option<NonNull<CFURL>>;
1102 }
1103 let ret = unsafe { CFBundleCopySupportFilesDirectoryURL(bundle) };
1104 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1105}
1106
1107#[cfg(feature = "CFURL")]
1108#[deprecated = "renamed to `CFBundle::resources_directory_url`"]
1109#[inline]
1110pub extern "C-unwind" fn CFBundleCopyResourcesDirectoryURL(
1111 bundle: &CFBundle,
1112) -> Option<CFRetained<CFURL>> {
1113 extern "C-unwind" {
1114 fn CFBundleCopyResourcesDirectoryURL(bundle: &CFBundle) -> Option<NonNull<CFURL>>;
1115 }
1116 let ret = unsafe { CFBundleCopyResourcesDirectoryURL(bundle) };
1117 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1118}
1119
1120#[cfg(feature = "CFURL")]
1121#[deprecated = "renamed to `CFBundle::private_frameworks_url`"]
1122#[inline]
1123pub extern "C-unwind" fn CFBundleCopyPrivateFrameworksURL(
1124 bundle: &CFBundle,
1125) -> Option<CFRetained<CFURL>> {
1126 extern "C-unwind" {
1127 fn CFBundleCopyPrivateFrameworksURL(bundle: &CFBundle) -> Option<NonNull<CFURL>>;
1128 }
1129 let ret = unsafe { CFBundleCopyPrivateFrameworksURL(bundle) };
1130 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1131}
1132
1133#[cfg(feature = "CFURL")]
1134#[deprecated = "renamed to `CFBundle::shared_frameworks_url`"]
1135#[inline]
1136pub extern "C-unwind" fn CFBundleCopySharedFrameworksURL(
1137 bundle: &CFBundle,
1138) -> Option<CFRetained<CFURL>> {
1139 extern "C-unwind" {
1140 fn CFBundleCopySharedFrameworksURL(bundle: &CFBundle) -> Option<NonNull<CFURL>>;
1141 }
1142 let ret = unsafe { CFBundleCopySharedFrameworksURL(bundle) };
1143 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1144}
1145
1146#[cfg(feature = "CFURL")]
1147#[deprecated = "renamed to `CFBundle::shared_support_url`"]
1148#[inline]
1149pub extern "C-unwind" fn CFBundleCopySharedSupportURL(
1150 bundle: &CFBundle,
1151) -> Option<CFRetained<CFURL>> {
1152 extern "C-unwind" {
1153 fn CFBundleCopySharedSupportURL(bundle: &CFBundle) -> Option<NonNull<CFURL>>;
1154 }
1155 let ret = unsafe { CFBundleCopySharedSupportURL(bundle) };
1156 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1157}
1158
1159#[cfg(feature = "CFURL")]
1160#[deprecated = "renamed to `CFBundle::built_in_plug_ins_url`"]
1161#[inline]
1162pub extern "C-unwind" fn CFBundleCopyBuiltInPlugInsURL(
1163 bundle: &CFBundle,
1164) -> Option<CFRetained<CFURL>> {
1165 extern "C-unwind" {
1166 fn CFBundleCopyBuiltInPlugInsURL(bundle: &CFBundle) -> Option<NonNull<CFURL>>;
1167 }
1168 let ret = unsafe { CFBundleCopyBuiltInPlugInsURL(bundle) };
1169 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1170}
1171
1172#[cfg(all(feature = "CFDictionary", feature = "CFURL"))]
1173#[deprecated = "renamed to `CFBundle::info_dictionary_in_directory`"]
1174#[inline]
1175pub extern "C-unwind" fn CFBundleCopyInfoDictionaryInDirectory(
1176 bundle_url: Option<&CFURL>,
1177) -> Option<CFRetained<CFDictionary>> {
1178 extern "C-unwind" {
1179 fn CFBundleCopyInfoDictionaryInDirectory(
1180 bundle_url: Option<&CFURL>,
1181 ) -> Option<NonNull<CFDictionary>>;
1182 }
1183 let ret = unsafe { CFBundleCopyInfoDictionaryInDirectory(bundle_url) };
1184 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1185}
1186
1187#[cfg(feature = "CFURL")]
1188#[deprecated = "renamed to `CFBundle::package_info_in_directory`"]
1189#[inline]
1190pub unsafe extern "C-unwind" fn CFBundleGetPackageInfoInDirectory(
1191 url: Option<&CFURL>,
1192 package_type: *mut u32,
1193 package_creator: *mut u32,
1194) -> bool {
1195 extern "C-unwind" {
1196 fn CFBundleGetPackageInfoInDirectory(
1197 url: Option<&CFURL>,
1198 package_type: *mut u32,
1199 package_creator: *mut u32,
1200 ) -> Boolean;
1201 }
1202 let ret = unsafe { CFBundleGetPackageInfoInDirectory(url, package_type, package_creator) };
1203 ret != 0
1204}
1205
1206#[cfg(feature = "CFURL")]
1207#[deprecated = "renamed to `CFBundle::resource_url`"]
1208#[inline]
1209pub extern "C-unwind" fn CFBundleCopyResourceURL(
1210 bundle: &CFBundle,
1211 resource_name: Option<&CFString>,
1212 resource_type: Option<&CFString>,
1213 sub_dir_name: Option<&CFString>,
1214) -> Option<CFRetained<CFURL>> {
1215 extern "C-unwind" {
1216 fn CFBundleCopyResourceURL(
1217 bundle: &CFBundle,
1218 resource_name: Option<&CFString>,
1219 resource_type: Option<&CFString>,
1220 sub_dir_name: Option<&CFString>,
1221 ) -> Option<NonNull<CFURL>>;
1222 }
1223 let ret =
1224 unsafe { CFBundleCopyResourceURL(bundle, resource_name, resource_type, sub_dir_name) };
1225 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1226}
1227
1228#[cfg(feature = "CFArray")]
1229#[deprecated = "renamed to `CFBundle::resource_urls_of_type`"]
1230#[inline]
1231pub extern "C-unwind" fn CFBundleCopyResourceURLsOfType(
1232 bundle: &CFBundle,
1233 resource_type: Option<&CFString>,
1234 sub_dir_name: Option<&CFString>,
1235) -> Option<CFRetained<CFArray>> {
1236 extern "C-unwind" {
1237 fn CFBundleCopyResourceURLsOfType(
1238 bundle: &CFBundle,
1239 resource_type: Option<&CFString>,
1240 sub_dir_name: Option<&CFString>,
1241 ) -> Option<NonNull<CFArray>>;
1242 }
1243 let ret = unsafe { CFBundleCopyResourceURLsOfType(bundle, resource_type, sub_dir_name) };
1244 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1245}
1246
1247#[deprecated = "renamed to `CFBundle::localized_string`"]
1248#[inline]
1249pub extern "C-unwind" fn CFBundleCopyLocalizedString(
1250 bundle: &CFBundle,
1251 key: Option<&CFString>,
1252 value: Option<&CFString>,
1253 table_name: Option<&CFString>,
1254) -> Option<CFRetained<CFString>> {
1255 extern "C-unwind" {
1256 fn CFBundleCopyLocalizedString(
1257 bundle: &CFBundle,
1258 key: Option<&CFString>,
1259 value: Option<&CFString>,
1260 table_name: Option<&CFString>,
1261 ) -> Option<NonNull<CFString>>;
1262 }
1263 let ret = unsafe { CFBundleCopyLocalizedString(bundle, key, value, table_name) };
1264 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1265}
1266
1267#[cfg(feature = "CFArray")]
1268#[deprecated = "renamed to `CFBundle::localized_string_for_localizations`"]
1269#[inline]
1270pub unsafe extern "C-unwind" fn CFBundleCopyLocalizedStringForLocalizations(
1271 bundle: &CFBundle,
1272 key: Option<&CFString>,
1273 value: Option<&CFString>,
1274 table_name: Option<&CFString>,
1275 localizations: Option<&CFArray>,
1276) -> Option<CFRetained<CFString>> {
1277 extern "C-unwind" {
1278 fn CFBundleCopyLocalizedStringForLocalizations(
1279 bundle: &CFBundle,
1280 key: Option<&CFString>,
1281 value: Option<&CFString>,
1282 table_name: Option<&CFString>,
1283 localizations: Option<&CFArray>,
1284 ) -> Option<NonNull<CFString>>;
1285 }
1286 let ret = unsafe {
1287 CFBundleCopyLocalizedStringForLocalizations(bundle, key, value, table_name, localizations)
1288 };
1289 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1290}
1291
1292#[cfg(feature = "CFURL")]
1293#[deprecated = "renamed to `CFBundle::resource_url_in_directory`"]
1294#[inline]
1295pub extern "C-unwind" fn CFBundleCopyResourceURLInDirectory(
1296 bundle_url: Option<&CFURL>,
1297 resource_name: Option<&CFString>,
1298 resource_type: Option<&CFString>,
1299 sub_dir_name: Option<&CFString>,
1300) -> Option<CFRetained<CFURL>> {
1301 extern "C-unwind" {
1302 fn CFBundleCopyResourceURLInDirectory(
1303 bundle_url: Option<&CFURL>,
1304 resource_name: Option<&CFString>,
1305 resource_type: Option<&CFString>,
1306 sub_dir_name: Option<&CFString>,
1307 ) -> Option<NonNull<CFURL>>;
1308 }
1309 let ret = unsafe {
1310 CFBundleCopyResourceURLInDirectory(bundle_url, resource_name, resource_type, sub_dir_name)
1311 };
1312 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1313}
1314
1315#[cfg(all(feature = "CFArray", feature = "CFURL"))]
1316#[deprecated = "renamed to `CFBundle::resource_urls_of_type_in_directory`"]
1317#[inline]
1318pub extern "C-unwind" fn CFBundleCopyResourceURLsOfTypeInDirectory(
1319 bundle_url: Option<&CFURL>,
1320 resource_type: Option<&CFString>,
1321 sub_dir_name: Option<&CFString>,
1322) -> Option<CFRetained<CFArray>> {
1323 extern "C-unwind" {
1324 fn CFBundleCopyResourceURLsOfTypeInDirectory(
1325 bundle_url: Option<&CFURL>,
1326 resource_type: Option<&CFString>,
1327 sub_dir_name: Option<&CFString>,
1328 ) -> Option<NonNull<CFArray>>;
1329 }
1330 let ret = unsafe {
1331 CFBundleCopyResourceURLsOfTypeInDirectory(bundle_url, resource_type, sub_dir_name)
1332 };
1333 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1334}
1335
1336#[cfg(feature = "CFArray")]
1337#[deprecated = "renamed to `CFBundle::bundle_localizations`"]
1338#[inline]
1339pub extern "C-unwind" fn CFBundleCopyBundleLocalizations(
1340 bundle: &CFBundle,
1341) -> Option<CFRetained<CFArray>> {
1342 extern "C-unwind" {
1343 fn CFBundleCopyBundleLocalizations(bundle: &CFBundle) -> Option<NonNull<CFArray>>;
1344 }
1345 let ret = unsafe { CFBundleCopyBundleLocalizations(bundle) };
1346 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1347}
1348
1349#[cfg(feature = "CFArray")]
1350#[deprecated = "renamed to `CFBundle::preferred_localizations_from_array`"]
1351#[inline]
1352pub unsafe extern "C-unwind" fn CFBundleCopyPreferredLocalizationsFromArray(
1353 loc_array: Option<&CFArray>,
1354) -> Option<CFRetained<CFArray>> {
1355 extern "C-unwind" {
1356 fn CFBundleCopyPreferredLocalizationsFromArray(
1357 loc_array: Option<&CFArray>,
1358 ) -> Option<NonNull<CFArray>>;
1359 }
1360 let ret = unsafe { CFBundleCopyPreferredLocalizationsFromArray(loc_array) };
1361 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1362}
1363
1364#[cfg(feature = "CFArray")]
1365#[deprecated = "renamed to `CFBundle::localizations_for_preferences`"]
1366#[inline]
1367pub unsafe extern "C-unwind" fn CFBundleCopyLocalizationsForPreferences(
1368 loc_array: Option<&CFArray>,
1369 pref_array: Option<&CFArray>,
1370) -> Option<CFRetained<CFArray>> {
1371 extern "C-unwind" {
1372 fn CFBundleCopyLocalizationsForPreferences(
1373 loc_array: Option<&CFArray>,
1374 pref_array: Option<&CFArray>,
1375 ) -> Option<NonNull<CFArray>>;
1376 }
1377 let ret = unsafe { CFBundleCopyLocalizationsForPreferences(loc_array, pref_array) };
1378 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1379}
1380
1381#[cfg(feature = "CFURL")]
1382#[deprecated = "renamed to `CFBundle::resource_url_for_localization`"]
1383#[inline]
1384pub extern "C-unwind" fn CFBundleCopyResourceURLForLocalization(
1385 bundle: &CFBundle,
1386 resource_name: Option<&CFString>,
1387 resource_type: Option<&CFString>,
1388 sub_dir_name: Option<&CFString>,
1389 localization_name: Option<&CFString>,
1390) -> Option<CFRetained<CFURL>> {
1391 extern "C-unwind" {
1392 fn CFBundleCopyResourceURLForLocalization(
1393 bundle: &CFBundle,
1394 resource_name: Option<&CFString>,
1395 resource_type: Option<&CFString>,
1396 sub_dir_name: Option<&CFString>,
1397 localization_name: Option<&CFString>,
1398 ) -> Option<NonNull<CFURL>>;
1399 }
1400 let ret = unsafe {
1401 CFBundleCopyResourceURLForLocalization(
1402 bundle,
1403 resource_name,
1404 resource_type,
1405 sub_dir_name,
1406 localization_name,
1407 )
1408 };
1409 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1410}
1411
1412#[cfg(feature = "CFArray")]
1413#[deprecated = "renamed to `CFBundle::resource_urls_of_type_for_localization`"]
1414#[inline]
1415pub extern "C-unwind" fn CFBundleCopyResourceURLsOfTypeForLocalization(
1416 bundle: &CFBundle,
1417 resource_type: Option<&CFString>,
1418 sub_dir_name: Option<&CFString>,
1419 localization_name: Option<&CFString>,
1420) -> Option<CFRetained<CFArray>> {
1421 extern "C-unwind" {
1422 fn CFBundleCopyResourceURLsOfTypeForLocalization(
1423 bundle: &CFBundle,
1424 resource_type: Option<&CFString>,
1425 sub_dir_name: Option<&CFString>,
1426 localization_name: Option<&CFString>,
1427 ) -> Option<NonNull<CFArray>>;
1428 }
1429 let ret = unsafe {
1430 CFBundleCopyResourceURLsOfTypeForLocalization(
1431 bundle,
1432 resource_type,
1433 sub_dir_name,
1434 localization_name,
1435 )
1436 };
1437 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1438}
1439
1440#[cfg(all(feature = "CFDictionary", feature = "CFURL"))]
1441#[deprecated = "renamed to `CFBundle::info_dictionary_for_url`"]
1442#[inline]
1443pub extern "C-unwind" fn CFBundleCopyInfoDictionaryForURL(
1444 url: Option<&CFURL>,
1445) -> Option<CFRetained<CFDictionary>> {
1446 extern "C-unwind" {
1447 fn CFBundleCopyInfoDictionaryForURL(url: Option<&CFURL>) -> Option<NonNull<CFDictionary>>;
1448 }
1449 let ret = unsafe { CFBundleCopyInfoDictionaryForURL(url) };
1450 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1451}
1452
1453#[cfg(all(feature = "CFArray", feature = "CFURL"))]
1454#[deprecated = "renamed to `CFBundle::localizations_for_url`"]
1455#[inline]
1456pub extern "C-unwind" fn CFBundleCopyLocalizationsForURL(
1457 url: Option<&CFURL>,
1458) -> Option<CFRetained<CFArray>> {
1459 extern "C-unwind" {
1460 fn CFBundleCopyLocalizationsForURL(url: Option<&CFURL>) -> Option<NonNull<CFArray>>;
1461 }
1462 let ret = unsafe { CFBundleCopyLocalizationsForURL(url) };
1463 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1464}
1465
1466#[cfg(all(feature = "CFArray", feature = "CFURL"))]
1467#[deprecated = "renamed to `CFBundle::executable_architectures_for_url`"]
1468#[inline]
1469pub extern "C-unwind" fn CFBundleCopyExecutableArchitecturesForURL(
1470 url: Option<&CFURL>,
1471) -> Option<CFRetained<CFArray>> {
1472 extern "C-unwind" {
1473 fn CFBundleCopyExecutableArchitecturesForURL(
1474 url: Option<&CFURL>,
1475 ) -> Option<NonNull<CFArray>>;
1476 }
1477 let ret = unsafe { CFBundleCopyExecutableArchitecturesForURL(url) };
1478 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1479}
1480
1481#[cfg(feature = "CFURL")]
1482#[deprecated = "renamed to `CFBundle::executable_url`"]
1483#[inline]
1484pub extern "C-unwind" fn CFBundleCopyExecutableURL(bundle: &CFBundle) -> Option<CFRetained<CFURL>> {
1485 extern "C-unwind" {
1486 fn CFBundleCopyExecutableURL(bundle: &CFBundle) -> Option<NonNull<CFURL>>;
1487 }
1488 let ret = unsafe { CFBundleCopyExecutableURL(bundle) };
1489 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1490}
1491
1492#[cfg(feature = "CFArray")]
1493#[deprecated = "renamed to `CFBundle::executable_architectures`"]
1494#[inline]
1495pub extern "C-unwind" fn CFBundleCopyExecutableArchitectures(
1496 bundle: &CFBundle,
1497) -> Option<CFRetained<CFArray>> {
1498 extern "C-unwind" {
1499 fn CFBundleCopyExecutableArchitectures(bundle: &CFBundle) -> Option<NonNull<CFArray>>;
1500 }
1501 let ret = unsafe { CFBundleCopyExecutableArchitectures(bundle) };
1502 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1503}
1504
1505#[cfg(feature = "CFError")]
1506#[deprecated = "renamed to `CFBundle::preflight_executable`"]
1507#[inline]
1508pub unsafe extern "C-unwind" fn CFBundlePreflightExecutable(
1509 bundle: &CFBundle,
1510 error: *mut *mut CFError,
1511) -> bool {
1512 extern "C-unwind" {
1513 fn CFBundlePreflightExecutable(bundle: &CFBundle, error: *mut *mut CFError) -> Boolean;
1514 }
1515 let ret = unsafe { CFBundlePreflightExecutable(bundle, error) };
1516 ret != 0
1517}
1518
1519#[cfg(feature = "CFError")]
1520#[deprecated = "renamed to `CFBundle::load_executable_and_return_error`"]
1521#[inline]
1522pub unsafe extern "C-unwind" fn CFBundleLoadExecutableAndReturnError(
1523 bundle: &CFBundle,
1524 error: *mut *mut CFError,
1525) -> bool {
1526 extern "C-unwind" {
1527 fn CFBundleLoadExecutableAndReturnError(
1528 bundle: &CFBundle,
1529 error: *mut *mut CFError,
1530 ) -> Boolean;
1531 }
1532 let ret = unsafe { CFBundleLoadExecutableAndReturnError(bundle, error) };
1533 ret != 0
1534}
1535
1536#[deprecated = "renamed to `CFBundle::load_executable`"]
1537#[inline]
1538pub unsafe extern "C-unwind" fn CFBundleLoadExecutable(bundle: &CFBundle) -> bool {
1539 extern "C-unwind" {
1540 fn CFBundleLoadExecutable(bundle: &CFBundle) -> Boolean;
1541 }
1542 let ret = unsafe { CFBundleLoadExecutable(bundle) };
1543 ret != 0
1544}
1545
1546#[deprecated = "renamed to `CFBundle::is_executable_loaded`"]
1547#[inline]
1548pub extern "C-unwind" fn CFBundleIsExecutableLoaded(bundle: &CFBundle) -> bool {
1549 extern "C-unwind" {
1550 fn CFBundleIsExecutableLoaded(bundle: &CFBundle) -> Boolean;
1551 }
1552 let ret = unsafe { CFBundleIsExecutableLoaded(bundle) };
1553 ret != 0
1554}
1555
1556extern "C-unwind" {
1557 #[deprecated = "renamed to `CFBundle::unload_executable`"]
1558 pub fn CFBundleUnloadExecutable(bundle: &CFBundle);
1559}
1560
1561#[deprecated = "renamed to `CFBundle::function_pointer_for_name`"]
1562#[inline]
1563pub extern "C-unwind" fn CFBundleGetFunctionPointerForName(
1564 bundle: &CFBundle,
1565 function_name: Option<&CFString>,
1566) -> *mut c_void {
1567 extern "C-unwind" {
1568 fn CFBundleGetFunctionPointerForName(
1569 bundle: &CFBundle,
1570 function_name: Option<&CFString>,
1571 ) -> *mut c_void;
1572 }
1573 unsafe { CFBundleGetFunctionPointerForName(bundle, function_name) }
1574}
1575
1576extern "C-unwind" {
1577 #[cfg(feature = "CFArray")]
1578 #[deprecated = "renamed to `CFBundle::function_pointers_for_names`"]
1579 pub fn CFBundleGetFunctionPointersForNames(
1580 bundle: &CFBundle,
1581 function_names: Option<&CFArray>,
1582 ftbl: *mut *mut c_void,
1583 );
1584}
1585
1586#[deprecated = "renamed to `CFBundle::data_pointer_for_name`"]
1587#[inline]
1588pub extern "C-unwind" fn CFBundleGetDataPointerForName(
1589 bundle: &CFBundle,
1590 symbol_name: Option<&CFString>,
1591) -> *mut c_void {
1592 extern "C-unwind" {
1593 fn CFBundleGetDataPointerForName(
1594 bundle: &CFBundle,
1595 symbol_name: Option<&CFString>,
1596 ) -> *mut c_void;
1597 }
1598 unsafe { CFBundleGetDataPointerForName(bundle, symbol_name) }
1599}
1600
1601extern "C-unwind" {
1602 #[cfg(feature = "CFArray")]
1603 #[deprecated = "renamed to `CFBundle::data_pointers_for_names`"]
1604 pub fn CFBundleGetDataPointersForNames(
1605 bundle: &CFBundle,
1606 symbol_names: Option<&CFArray>,
1607 stbl: *mut *mut c_void,
1608 );
1609}
1610
1611#[cfg(feature = "CFURL")]
1612#[deprecated = "renamed to `CFBundle::auxiliary_executable_url`"]
1613#[inline]
1614pub extern "C-unwind" fn CFBundleCopyAuxiliaryExecutableURL(
1615 bundle: &CFBundle,
1616 executable_name: Option<&CFString>,
1617) -> Option<CFRetained<CFURL>> {
1618 extern "C-unwind" {
1619 fn CFBundleCopyAuxiliaryExecutableURL(
1620 bundle: &CFBundle,
1621 executable_name: Option<&CFString>,
1622 ) -> Option<NonNull<CFURL>>;
1623 }
1624 let ret = unsafe { CFBundleCopyAuxiliaryExecutableURL(bundle, executable_name) };
1625 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1626}
1627
1628#[deprecated = "renamed to `CFBundle::is_executable_loadable`"]
1629#[inline]
1630pub extern "C-unwind" fn CFBundleIsExecutableLoadable(bundle: &CFBundle) -> bool {
1631 extern "C-unwind" {
1632 fn CFBundleIsExecutableLoadable(bundle: &CFBundle) -> Boolean;
1633 }
1634 let ret = unsafe { CFBundleIsExecutableLoadable(bundle) };
1635 ret != 0
1636}
1637
1638#[cfg(feature = "CFURL")]
1639#[deprecated = "renamed to `CFBundle::is_executable_loadable_for_url`"]
1640#[inline]
1641pub extern "C-unwind" fn CFBundleIsExecutableLoadableForURL(url: Option<&CFURL>) -> bool {
1642 extern "C-unwind" {
1643 fn CFBundleIsExecutableLoadableForURL(url: Option<&CFURL>) -> Boolean;
1644 }
1645 let ret = unsafe { CFBundleIsExecutableLoadableForURL(url) };
1646 ret != 0
1647}
1648
1649#[cfg(feature = "libc")]
1650#[deprecated = "renamed to `CFBundle::is_architecture_loadable`"]
1651#[inline]
1652pub extern "C-unwind" fn CFBundleIsArchitectureLoadable(arch: libc::cpu_type_t) -> bool {
1653 extern "C-unwind" {
1654 fn CFBundleIsArchitectureLoadable(arch: libc::cpu_type_t) -> Boolean;
1655 }
1656 let ret = unsafe { CFBundleIsArchitectureLoadable(arch) };
1657 ret != 0
1658}
1659
1660#[deprecated = "renamed to `CFBundle::plug_in`"]
1661#[inline]
1662pub extern "C-unwind" fn CFBundleGetPlugIn(bundle: &CFBundle) -> Option<CFRetained<CFPlugIn>> {
1663 extern "C-unwind" {
1664 fn CFBundleGetPlugIn(bundle: &CFBundle) -> Option<NonNull<CFPlugIn>>;
1665 }
1666 let ret = unsafe { CFBundleGetPlugIn(bundle) };
1667 ret.map(|ret| unsafe { CFRetained::retain(ret) })
1668}
1669
1670#[deprecated = "renamed to `CFBundle::open_bundle_resource_map`"]
1671#[inline]
1672pub extern "C-unwind" fn CFBundleOpenBundleResourceMap(bundle: &CFBundle) -> CFBundleRefNum {
1673 extern "C-unwind" {
1674 fn CFBundleOpenBundleResourceMap(bundle: &CFBundle) -> CFBundleRefNum;
1675 }
1676 unsafe { CFBundleOpenBundleResourceMap(bundle) }
1677}
1678
1679extern "C-unwind" {
1680 #[deprecated = "renamed to `CFBundle::open_bundle_resource_files`"]
1681 pub fn CFBundleOpenBundleResourceFiles(
1682 bundle: &CFBundle,
1683 ref_num: *mut CFBundleRefNum,
1684 localized_ref_num: *mut CFBundleRefNum,
1685 ) -> i32;
1686}
1687
1688#[deprecated = "renamed to `CFBundle::close_bundle_resource_map`"]
1689#[inline]
1690pub extern "C-unwind" fn CFBundleCloseBundleResourceMap(
1691 bundle: &CFBundle,
1692 ref_num: CFBundleRefNum,
1693) {
1694 extern "C-unwind" {
1695 fn CFBundleCloseBundleResourceMap(bundle: &CFBundle, ref_num: CFBundleRefNum);
1696 }
1697 unsafe { CFBundleCloseBundleResourceMap(bundle, ref_num) }
1698}