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#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct CFURLPathStyle(pub CFIndex);
17impl CFURLPathStyle {
18 #[doc(alias = "kCFURLPOSIXPathStyle")]
19 pub const CFURLPOSIXPathStyle: Self = Self(0);
20 #[doc(alias = "kCFURLHFSPathStyle")]
21 #[deprecated = "Carbon File Manager is deprecated, use kCFURLPOSIXPathStyle where possible"]
22 pub const CFURLHFSPathStyle: Self = Self(1);
23 #[doc(alias = "kCFURLWindowsPathStyle")]
24 pub const CFURLWindowsPathStyle: Self = Self(2);
25}
26
27#[cfg(feature = "objc2")]
28unsafe impl Encode for CFURLPathStyle {
29 const ENCODING: Encoding = CFIndex::ENCODING;
30}
31
32#[cfg(feature = "objc2")]
33unsafe impl RefEncode for CFURLPathStyle {
34 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
35}
36
37#[doc(alias = "CFURLRef")]
41#[repr(C)]
42pub struct CFURL {
43 inner: [u8; 0],
44 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
45}
46
47cf_type!(
48 unsafe impl CFURL {}
49);
50#[cfg(feature = "objc2")]
51cf_objc2_type!(
52 unsafe impl RefEncode<"__CFURL"> for CFURL {}
53);
54
55unsafe impl ConcreteType for CFURL {
56 #[doc(alias = "CFURLGetTypeID")]
57 #[inline]
58 fn type_id() -> CFTypeID {
59 extern "C-unwind" {
60 fn CFURLGetTypeID() -> CFTypeID;
61 }
62 unsafe { CFURLGetTypeID() }
63 }
64}
65
66impl CFURL {
67 #[doc(alias = "CFURLCreateWithBytes")]
73 #[cfg(feature = "CFString")]
74 #[inline]
75 pub unsafe fn with_bytes(
76 allocator: Option<&CFAllocator>,
77 url_bytes: *const u8,
78 length: CFIndex,
79 encoding: CFStringEncoding,
80 base_url: Option<&CFURL>,
81 ) -> Option<CFRetained<CFURL>> {
82 extern "C-unwind" {
83 fn CFURLCreateWithBytes(
84 allocator: Option<&CFAllocator>,
85 url_bytes: *const u8,
86 length: CFIndex,
87 encoding: CFStringEncoding,
88 base_url: Option<&CFURL>,
89 ) -> Option<NonNull<CFURL>>;
90 }
91 let ret = unsafe { CFURLCreateWithBytes(allocator, url_bytes, length, encoding, base_url) };
92 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
93 }
94
95 #[doc(alias = "CFURLCreateData")]
96 #[cfg(all(feature = "CFData", feature = "CFString"))]
97 #[inline]
98 pub fn new_data(
99 allocator: Option<&CFAllocator>,
100 url: Option<&CFURL>,
101 encoding: CFStringEncoding,
102 escape_whitespace: bool,
103 ) -> Option<CFRetained<CFData>> {
104 extern "C-unwind" {
105 fn CFURLCreateData(
106 allocator: Option<&CFAllocator>,
107 url: Option<&CFURL>,
108 encoding: CFStringEncoding,
109 escape_whitespace: Boolean,
110 ) -> Option<NonNull<CFData>>;
111 }
112 let ret = unsafe { CFURLCreateData(allocator, url, encoding, escape_whitespace as _) };
113 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
114 }
115
116 #[doc(alias = "CFURLCreateWithString")]
117 #[inline]
118 pub(crate) fn __from_string(
119 allocator: Option<&CFAllocator>,
120 url_string: Option<&CFString>,
121 base_url: Option<&CFURL>,
122 ) -> Option<CFRetained<CFURL>> {
123 extern "C-unwind" {
124 fn CFURLCreateWithString(
125 allocator: Option<&CFAllocator>,
126 url_string: Option<&CFString>,
127 base_url: Option<&CFURL>,
128 ) -> Option<NonNull<CFURL>>;
129 }
130 let ret = unsafe { CFURLCreateWithString(allocator, url_string, base_url) };
131 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
132 }
133
134 #[doc(alias = "CFURLCreateAbsoluteURLWithBytes")]
140 #[cfg(feature = "CFString")]
141 #[inline]
142 pub unsafe fn new_absolute_url_with_bytes(
143 alloc: Option<&CFAllocator>,
144 relative_url_bytes: *const u8,
145 length: CFIndex,
146 encoding: CFStringEncoding,
147 base_url: Option<&CFURL>,
148 use_compatibility_mode: bool,
149 ) -> Option<CFRetained<CFURL>> {
150 extern "C-unwind" {
151 fn CFURLCreateAbsoluteURLWithBytes(
152 alloc: Option<&CFAllocator>,
153 relative_url_bytes: *const u8,
154 length: CFIndex,
155 encoding: CFStringEncoding,
156 base_url: Option<&CFURL>,
157 use_compatibility_mode: Boolean,
158 ) -> Option<NonNull<CFURL>>;
159 }
160 let ret = unsafe {
161 CFURLCreateAbsoluteURLWithBytes(
162 alloc,
163 relative_url_bytes,
164 length,
165 encoding,
166 base_url,
167 use_compatibility_mode as _,
168 )
169 };
170 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
171 }
172
173 #[doc(alias = "CFURLCreateWithFileSystemPath")]
174 #[inline]
175 pub fn with_file_system_path(
176 allocator: Option<&CFAllocator>,
177 file_path: Option<&CFString>,
178 path_style: CFURLPathStyle,
179 is_directory: bool,
180 ) -> Option<CFRetained<CFURL>> {
181 extern "C-unwind" {
182 fn CFURLCreateWithFileSystemPath(
183 allocator: Option<&CFAllocator>,
184 file_path: Option<&CFString>,
185 path_style: CFURLPathStyle,
186 is_directory: Boolean,
187 ) -> Option<NonNull<CFURL>>;
188 }
189 let ret = unsafe {
190 CFURLCreateWithFileSystemPath(allocator, file_path, path_style, is_directory as _)
191 };
192 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
193 }
194
195 #[doc(alias = "CFURLCreateFromFileSystemRepresentation")]
200 #[inline]
201 pub unsafe fn from_file_system_representation(
202 allocator: Option<&CFAllocator>,
203 buffer: *const u8,
204 buf_len: CFIndex,
205 is_directory: bool,
206 ) -> Option<CFRetained<CFURL>> {
207 extern "C-unwind" {
208 fn CFURLCreateFromFileSystemRepresentation(
209 allocator: Option<&CFAllocator>,
210 buffer: *const u8,
211 buf_len: CFIndex,
212 is_directory: Boolean,
213 ) -> Option<NonNull<CFURL>>;
214 }
215 let ret = unsafe {
216 CFURLCreateFromFileSystemRepresentation(allocator, buffer, buf_len, is_directory as _)
217 };
218 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
219 }
220
221 #[doc(alias = "CFURLCreateWithFileSystemPathRelativeToBase")]
222 #[inline]
223 pub fn with_file_system_path_relative_to_base(
224 allocator: Option<&CFAllocator>,
225 file_path: Option<&CFString>,
226 path_style: CFURLPathStyle,
227 is_directory: bool,
228 base_url: Option<&CFURL>,
229 ) -> Option<CFRetained<CFURL>> {
230 extern "C-unwind" {
231 fn CFURLCreateWithFileSystemPathRelativeToBase(
232 allocator: Option<&CFAllocator>,
233 file_path: Option<&CFString>,
234 path_style: CFURLPathStyle,
235 is_directory: Boolean,
236 base_url: Option<&CFURL>,
237 ) -> Option<NonNull<CFURL>>;
238 }
239 let ret = unsafe {
240 CFURLCreateWithFileSystemPathRelativeToBase(
241 allocator,
242 file_path,
243 path_style,
244 is_directory as _,
245 base_url,
246 )
247 };
248 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
249 }
250
251 #[doc(alias = "CFURLCreateFromFileSystemRepresentationRelativeToBase")]
257 #[inline]
258 pub unsafe fn from_file_system_representation_relative_to_base(
259 allocator: Option<&CFAllocator>,
260 buffer: *const u8,
261 buf_len: CFIndex,
262 is_directory: bool,
263 base_url: Option<&CFURL>,
264 ) -> Option<CFRetained<CFURL>> {
265 extern "C-unwind" {
266 fn CFURLCreateFromFileSystemRepresentationRelativeToBase(
267 allocator: Option<&CFAllocator>,
268 buffer: *const u8,
269 buf_len: CFIndex,
270 is_directory: Boolean,
271 base_url: Option<&CFURL>,
272 ) -> Option<NonNull<CFURL>>;
273 }
274 let ret = unsafe {
275 CFURLCreateFromFileSystemRepresentationRelativeToBase(
276 allocator,
277 buffer,
278 buf_len,
279 is_directory as _,
280 base_url,
281 )
282 };
283 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
284 }
285
286 #[doc(alias = "CFURLGetFileSystemRepresentation")]
290 #[inline]
291 pub unsafe fn file_system_representation(
292 &self,
293 resolve_against_base: bool,
294 buffer: *mut u8,
295 max_buf_len: CFIndex,
296 ) -> bool {
297 extern "C-unwind" {
298 fn CFURLGetFileSystemRepresentation(
299 url: &CFURL,
300 resolve_against_base: Boolean,
301 buffer: *mut u8,
302 max_buf_len: CFIndex,
303 ) -> Boolean;
304 }
305 let ret = unsafe {
306 CFURLGetFileSystemRepresentation(self, resolve_against_base as _, buffer, max_buf_len)
307 };
308 ret != 0
309 }
310
311 #[doc(alias = "CFURLCopyAbsoluteURL")]
312 #[inline]
313 pub fn absolute_url(&self) -> Option<CFRetained<CFURL>> {
314 extern "C-unwind" {
315 fn CFURLCopyAbsoluteURL(relative_url: &CFURL) -> Option<NonNull<CFURL>>;
316 }
317 let ret = unsafe { CFURLCopyAbsoluteURL(self) };
318 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
319 }
320
321 #[doc(alias = "CFURLGetString")]
322 #[inline]
323 pub(crate) fn __string(&self) -> Option<CFRetained<CFString>> {
324 extern "C-unwind" {
325 fn CFURLGetString(an_url: &CFURL) -> Option<NonNull<CFString>>;
326 }
327 let ret = unsafe { CFURLGetString(self) };
328 ret.map(|ret| unsafe { CFRetained::retain(ret) })
329 }
330
331 #[doc(alias = "CFURLGetBaseURL")]
332 #[inline]
333 pub fn base_url(&self) -> Option<CFRetained<CFURL>> {
334 extern "C-unwind" {
335 fn CFURLGetBaseURL(an_url: &CFURL) -> Option<NonNull<CFURL>>;
336 }
337 let ret = unsafe { CFURLGetBaseURL(self) };
338 ret.map(|ret| unsafe { CFRetained::retain(ret) })
339 }
340
341 #[doc(alias = "CFURLCanBeDecomposed")]
342 #[inline]
343 pub fn can_be_decomposed(&self) -> bool {
344 extern "C-unwind" {
345 fn CFURLCanBeDecomposed(an_url: &CFURL) -> Boolean;
346 }
347 let ret = unsafe { CFURLCanBeDecomposed(self) };
348 ret != 0
349 }
350
351 #[doc(alias = "CFURLCopyScheme")]
352 #[inline]
353 pub fn scheme(&self) -> Option<CFRetained<CFString>> {
354 extern "C-unwind" {
355 fn CFURLCopyScheme(an_url: &CFURL) -> Option<NonNull<CFString>>;
356 }
357 let ret = unsafe { CFURLCopyScheme(self) };
358 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
359 }
360
361 #[doc(alias = "CFURLCopyNetLocation")]
362 #[inline]
363 pub fn net_location(&self) -> Option<CFRetained<CFString>> {
364 extern "C-unwind" {
365 fn CFURLCopyNetLocation(an_url: &CFURL) -> Option<NonNull<CFString>>;
366 }
367 let ret = unsafe { CFURLCopyNetLocation(self) };
368 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
369 }
370
371 #[doc(alias = "CFURLCopyPath")]
372 #[inline]
373 pub fn path(&self) -> Option<CFRetained<CFString>> {
374 extern "C-unwind" {
375 fn CFURLCopyPath(an_url: &CFURL) -> Option<NonNull<CFString>>;
376 }
377 let ret = unsafe { CFURLCopyPath(self) };
378 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
379 }
380
381 #[doc(alias = "CFURLCopyStrictPath")]
385 #[inline]
386 pub unsafe fn strict_path(&self, is_absolute: *mut Boolean) -> Option<CFRetained<CFString>> {
387 extern "C-unwind" {
388 fn CFURLCopyStrictPath(
389 an_url: &CFURL,
390 is_absolute: *mut Boolean,
391 ) -> Option<NonNull<CFString>>;
392 }
393 let ret = unsafe { CFURLCopyStrictPath(self, is_absolute) };
394 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
395 }
396
397 #[doc(alias = "CFURLCopyFileSystemPath")]
398 #[inline]
399 pub fn file_system_path(&self, path_style: CFURLPathStyle) -> Option<CFRetained<CFString>> {
400 extern "C-unwind" {
401 fn CFURLCopyFileSystemPath(
402 an_url: &CFURL,
403 path_style: CFURLPathStyle,
404 ) -> Option<NonNull<CFString>>;
405 }
406 let ret = unsafe { CFURLCopyFileSystemPath(self, path_style) };
407 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
408 }
409
410 #[doc(alias = "CFURLHasDirectoryPath")]
411 #[inline]
412 pub fn has_directory_path(&self) -> bool {
413 extern "C-unwind" {
414 fn CFURLHasDirectoryPath(an_url: &CFURL) -> Boolean;
415 }
416 let ret = unsafe { CFURLHasDirectoryPath(self) };
417 ret != 0
418 }
419
420 #[doc(alias = "CFURLCopyResourceSpecifier")]
421 #[inline]
422 pub fn resource_specifier(&self) -> Option<CFRetained<CFString>> {
423 extern "C-unwind" {
424 fn CFURLCopyResourceSpecifier(an_url: &CFURL) -> Option<NonNull<CFString>>;
425 }
426 let ret = unsafe { CFURLCopyResourceSpecifier(self) };
427 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
428 }
429
430 #[doc(alias = "CFURLCopyHostName")]
431 #[inline]
432 pub fn host_name(&self) -> Option<CFRetained<CFString>> {
433 extern "C-unwind" {
434 fn CFURLCopyHostName(an_url: &CFURL) -> Option<NonNull<CFString>>;
435 }
436 let ret = unsafe { CFURLCopyHostName(self) };
437 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
438 }
439
440 #[doc(alias = "CFURLGetPortNumber")]
441 #[inline]
442 pub fn port_number(&self) -> i32 {
443 extern "C-unwind" {
444 fn CFURLGetPortNumber(an_url: &CFURL) -> i32;
445 }
446 unsafe { CFURLGetPortNumber(self) }
447 }
448
449 #[doc(alias = "CFURLCopyUserName")]
450 #[inline]
451 pub fn user_name(&self) -> Option<CFRetained<CFString>> {
452 extern "C-unwind" {
453 fn CFURLCopyUserName(an_url: &CFURL) -> Option<NonNull<CFString>>;
454 }
455 let ret = unsafe { CFURLCopyUserName(self) };
456 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
457 }
458
459 #[doc(alias = "CFURLCopyPassword")]
460 #[inline]
461 pub fn password(&self) -> Option<CFRetained<CFString>> {
462 extern "C-unwind" {
463 fn CFURLCopyPassword(an_url: &CFURL) -> Option<NonNull<CFString>>;
464 }
465 let ret = unsafe { CFURLCopyPassword(self) };
466 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
467 }
468
469 #[doc(alias = "CFURLCopyParameterString")]
470 #[deprecated = "The CFURLCopyParameterString function is deprecated. Post deprecation for applications linked with or after the macOS 10.15, and for all iOS, watchOS, and tvOS applications, CFURLCopyParameterString will always return NULL, and the CFURLCopyPath(), CFURLCopyStrictPath(), and CFURLCopyFileSystemPath() functions will return the complete path including the semicolon separator and params component if the URL string contains them."]
471 #[inline]
472 pub fn parameter_string(
473 &self,
474 characters_to_leave_escaped: Option<&CFString>,
475 ) -> Option<CFRetained<CFString>> {
476 extern "C-unwind" {
477 fn CFURLCopyParameterString(
478 an_url: &CFURL,
479 characters_to_leave_escaped: Option<&CFString>,
480 ) -> Option<NonNull<CFString>>;
481 }
482 let ret = unsafe { CFURLCopyParameterString(self, characters_to_leave_escaped) };
483 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
484 }
485
486 #[doc(alias = "CFURLCopyQueryString")]
487 #[inline]
488 pub fn query_string(
489 &self,
490 characters_to_leave_escaped: Option<&CFString>,
491 ) -> Option<CFRetained<CFString>> {
492 extern "C-unwind" {
493 fn CFURLCopyQueryString(
494 an_url: &CFURL,
495 characters_to_leave_escaped: Option<&CFString>,
496 ) -> Option<NonNull<CFString>>;
497 }
498 let ret = unsafe { CFURLCopyQueryString(self, characters_to_leave_escaped) };
499 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
500 }
501
502 #[doc(alias = "CFURLCopyFragment")]
503 #[inline]
504 pub fn fragment(
505 &self,
506 characters_to_leave_escaped: Option<&CFString>,
507 ) -> Option<CFRetained<CFString>> {
508 extern "C-unwind" {
509 fn CFURLCopyFragment(
510 an_url: &CFURL,
511 characters_to_leave_escaped: Option<&CFString>,
512 ) -> Option<NonNull<CFString>>;
513 }
514 let ret = unsafe { CFURLCopyFragment(self, characters_to_leave_escaped) };
515 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
516 }
517
518 #[doc(alias = "CFURLCopyLastPathComponent")]
519 #[inline]
520 pub fn last_path_component(&self) -> Option<CFRetained<CFString>> {
521 extern "C-unwind" {
522 fn CFURLCopyLastPathComponent(url: &CFURL) -> Option<NonNull<CFString>>;
523 }
524 let ret = unsafe { CFURLCopyLastPathComponent(self) };
525 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
526 }
527
528 #[doc(alias = "CFURLCopyPathExtension")]
529 #[inline]
530 pub fn path_extension(&self) -> Option<CFRetained<CFString>> {
531 extern "C-unwind" {
532 fn CFURLCopyPathExtension(url: &CFURL) -> Option<NonNull<CFString>>;
533 }
534 let ret = unsafe { CFURLCopyPathExtension(self) };
535 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
536 }
537
538 #[doc(alias = "CFURLCreateCopyAppendingPathComponent")]
539 #[inline]
540 pub fn new_copy_appending_path_component(
541 allocator: Option<&CFAllocator>,
542 url: Option<&CFURL>,
543 path_component: Option<&CFString>,
544 is_directory: bool,
545 ) -> Option<CFRetained<CFURL>> {
546 extern "C-unwind" {
547 fn CFURLCreateCopyAppendingPathComponent(
548 allocator: Option<&CFAllocator>,
549 url: Option<&CFURL>,
550 path_component: Option<&CFString>,
551 is_directory: Boolean,
552 ) -> Option<NonNull<CFURL>>;
553 }
554 let ret = unsafe {
555 CFURLCreateCopyAppendingPathComponent(allocator, url, path_component, is_directory as _)
556 };
557 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
558 }
559
560 #[doc(alias = "CFURLCreateCopyDeletingLastPathComponent")]
561 #[inline]
562 pub fn new_copy_deleting_last_path_component(
563 allocator: Option<&CFAllocator>,
564 url: Option<&CFURL>,
565 ) -> Option<CFRetained<CFURL>> {
566 extern "C-unwind" {
567 fn CFURLCreateCopyDeletingLastPathComponent(
568 allocator: Option<&CFAllocator>,
569 url: Option<&CFURL>,
570 ) -> Option<NonNull<CFURL>>;
571 }
572 let ret = unsafe { CFURLCreateCopyDeletingLastPathComponent(allocator, url) };
573 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
574 }
575
576 #[doc(alias = "CFURLCreateCopyAppendingPathExtension")]
577 #[inline]
578 pub fn new_copy_appending_path_extension(
579 allocator: Option<&CFAllocator>,
580 url: Option<&CFURL>,
581 extension: Option<&CFString>,
582 ) -> Option<CFRetained<CFURL>> {
583 extern "C-unwind" {
584 fn CFURLCreateCopyAppendingPathExtension(
585 allocator: Option<&CFAllocator>,
586 url: Option<&CFURL>,
587 extension: Option<&CFString>,
588 ) -> Option<NonNull<CFURL>>;
589 }
590 let ret = unsafe { CFURLCreateCopyAppendingPathExtension(allocator, url, extension) };
591 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
592 }
593
594 #[doc(alias = "CFURLCreateCopyDeletingPathExtension")]
595 #[inline]
596 pub fn new_copy_deleting_path_extension(
597 allocator: Option<&CFAllocator>,
598 url: Option<&CFURL>,
599 ) -> Option<CFRetained<CFURL>> {
600 extern "C-unwind" {
601 fn CFURLCreateCopyDeletingPathExtension(
602 allocator: Option<&CFAllocator>,
603 url: Option<&CFURL>,
604 ) -> Option<NonNull<CFURL>>;
605 }
606 let ret = unsafe { CFURLCreateCopyDeletingPathExtension(allocator, url) };
607 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
608 }
609
610 #[doc(alias = "CFURLGetBytes")]
614 #[inline]
615 pub unsafe fn bytes(&self, buffer: *mut u8, buffer_length: CFIndex) -> CFIndex {
616 extern "C-unwind" {
617 fn CFURLGetBytes(url: &CFURL, buffer: *mut u8, buffer_length: CFIndex) -> CFIndex;
618 }
619 unsafe { CFURLGetBytes(self, buffer, buffer_length) }
620 }
621}
622
623#[repr(transparent)]
626#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
627pub struct CFURLComponentType(pub CFIndex);
628impl CFURLComponentType {
629 #[doc(alias = "kCFURLComponentScheme")]
630 pub const Scheme: Self = Self(1);
631 #[doc(alias = "kCFURLComponentNetLocation")]
632 pub const NetLocation: Self = Self(2);
633 #[doc(alias = "kCFURLComponentPath")]
634 pub const Path: Self = Self(3);
635 #[doc(alias = "kCFURLComponentResourceSpecifier")]
636 pub const ResourceSpecifier: Self = Self(4);
637 #[doc(alias = "kCFURLComponentUser")]
638 pub const User: Self = Self(5);
639 #[doc(alias = "kCFURLComponentPassword")]
640 pub const Password: Self = Self(6);
641 #[doc(alias = "kCFURLComponentUserInfo")]
642 pub const UserInfo: Self = Self(7);
643 #[doc(alias = "kCFURLComponentHost")]
644 pub const Host: Self = Self(8);
645 #[doc(alias = "kCFURLComponentPort")]
646 pub const Port: Self = Self(9);
647 #[doc(alias = "kCFURLComponentParameterString")]
648 pub const ParameterString: Self = Self(10);
649 #[doc(alias = "kCFURLComponentQuery")]
650 pub const Query: Self = Self(11);
651 #[doc(alias = "kCFURLComponentFragment")]
652 pub const Fragment: Self = Self(12);
653}
654
655#[cfg(feature = "objc2")]
656unsafe impl Encode for CFURLComponentType {
657 const ENCODING: Encoding = CFIndex::ENCODING;
658}
659
660#[cfg(feature = "objc2")]
661unsafe impl RefEncode for CFURLComponentType {
662 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
663}
664
665impl CFURL {
666 #[doc(alias = "CFURLGetByteRangeForComponent")]
670 #[inline]
671 pub unsafe fn byte_range_for_component(
672 &self,
673 component: CFURLComponentType,
674 range_including_separators: *mut CFRange,
675 ) -> CFRange {
676 extern "C-unwind" {
677 fn CFURLGetByteRangeForComponent(
678 url: &CFURL,
679 component: CFURLComponentType,
680 range_including_separators: *mut CFRange,
681 ) -> CFRange;
682 }
683 unsafe { CFURLGetByteRangeForComponent(self, component, range_including_separators) }
684 }
685
686 #[doc(alias = "CFURLCreateStringByReplacingPercentEscapes")]
687 #[inline]
688 pub fn new_string_by_replacing_percent_escapes(
689 allocator: Option<&CFAllocator>,
690 original_string: Option<&CFString>,
691 characters_to_leave_escaped: Option<&CFString>,
692 ) -> Option<CFRetained<CFString>> {
693 extern "C-unwind" {
694 fn CFURLCreateStringByReplacingPercentEscapes(
695 allocator: Option<&CFAllocator>,
696 original_string: Option<&CFString>,
697 characters_to_leave_escaped: Option<&CFString>,
698 ) -> Option<NonNull<CFString>>;
699 }
700 let ret = unsafe {
701 CFURLCreateStringByReplacingPercentEscapes(
702 allocator,
703 original_string,
704 characters_to_leave_escaped,
705 )
706 };
707 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
708 }
709
710 #[doc(alias = "CFURLCreateStringByReplacingPercentEscapesUsingEncoding")]
716 #[cfg(feature = "CFString")]
717 #[deprecated = "Use [NSString stringByRemovingPercentEncoding] or CFURLCreateStringByReplacingPercentEscapes() instead, which always uses the recommended UTF-8 encoding."]
718 #[inline]
719 pub unsafe fn new_string_by_replacing_percent_escapes_using_encoding(
720 allocator: Option<&CFAllocator>,
721 orig_string: Option<&CFString>,
722 chars_to_leave_escaped: Option<&CFString>,
723 encoding: CFStringEncoding,
724 ) -> Option<CFRetained<CFString>> {
725 extern "C-unwind" {
726 fn CFURLCreateStringByReplacingPercentEscapesUsingEncoding(
727 allocator: Option<&CFAllocator>,
728 orig_string: Option<&CFString>,
729 chars_to_leave_escaped: Option<&CFString>,
730 encoding: CFStringEncoding,
731 ) -> Option<NonNull<CFString>>;
732 }
733 let ret = unsafe {
734 CFURLCreateStringByReplacingPercentEscapesUsingEncoding(
735 allocator,
736 orig_string,
737 chars_to_leave_escaped,
738 encoding,
739 )
740 };
741 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
742 }
743
744 #[doc(alias = "CFURLCreateStringByAddingPercentEscapes")]
751 #[cfg(feature = "CFString")]
752 #[deprecated = "Use [NSString stringByAddingPercentEncodingWithAllowedCharacters:] instead, which always uses the recommended UTF-8 encoding, and which encodes for a specific URL component or subcomponent (since each URL component or subcomponent has different rules for what characters are valid)."]
753 #[inline]
754 pub unsafe fn new_string_by_adding_percent_escapes(
755 allocator: Option<&CFAllocator>,
756 original_string: Option<&CFString>,
757 characters_to_leave_unescaped: Option<&CFString>,
758 legal_url_characters_to_be_escaped: Option<&CFString>,
759 encoding: CFStringEncoding,
760 ) -> Option<CFRetained<CFString>> {
761 extern "C-unwind" {
762 fn CFURLCreateStringByAddingPercentEscapes(
763 allocator: Option<&CFAllocator>,
764 original_string: Option<&CFString>,
765 characters_to_leave_unescaped: Option<&CFString>,
766 legal_url_characters_to_be_escaped: Option<&CFString>,
767 encoding: CFStringEncoding,
768 ) -> Option<NonNull<CFString>>;
769 }
770 let ret = unsafe {
771 CFURLCreateStringByAddingPercentEscapes(
772 allocator,
773 original_string,
774 characters_to_leave_unescaped,
775 legal_url_characters_to_be_escaped,
776 encoding,
777 )
778 };
779 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
780 }
781
782 #[doc(alias = "CFURLIsFileReferenceURL")]
783 #[inline]
784 pub fn is_file_reference_url(&self) -> bool {
785 extern "C-unwind" {
786 fn CFURLIsFileReferenceURL(url: &CFURL) -> Boolean;
787 }
788 let ret = unsafe { CFURLIsFileReferenceURL(self) };
789 ret != 0
790 }
791
792 #[doc(alias = "CFURLCreateFileReferenceURL")]
798 #[cfg(feature = "CFError")]
799 #[inline]
800 pub unsafe fn new_file_reference_url(
801 allocator: Option<&CFAllocator>,
802 url: Option<&CFURL>,
803 error: *mut *mut CFError,
804 ) -> Option<CFRetained<CFURL>> {
805 extern "C-unwind" {
806 fn CFURLCreateFileReferenceURL(
807 allocator: Option<&CFAllocator>,
808 url: Option<&CFURL>,
809 error: *mut *mut CFError,
810 ) -> Option<NonNull<CFURL>>;
811 }
812 let ret = unsafe { CFURLCreateFileReferenceURL(allocator, url, error) };
813 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
814 }
815
816 #[doc(alias = "CFURLCreateFilePathURL")]
822 #[cfg(feature = "CFError")]
823 #[inline]
824 pub unsafe fn new_file_path_url(
825 allocator: Option<&CFAllocator>,
826 url: Option<&CFURL>,
827 error: *mut *mut CFError,
828 ) -> Option<CFRetained<CFURL>> {
829 extern "C-unwind" {
830 fn CFURLCreateFilePathURL(
831 allocator: Option<&CFAllocator>,
832 url: Option<&CFURL>,
833 error: *mut *mut CFError,
834 ) -> Option<NonNull<CFURL>>;
835 }
836 let ret = unsafe { CFURLCreateFilePathURL(allocator, url, error) };
837 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
838 }
839
840 #[doc(alias = "CFURLCopyResourcePropertyForKey")]
846 #[cfg(feature = "CFError")]
847 #[inline]
848 pub unsafe fn resource_property_for_key(
849 &self,
850 key: Option<&CFString>,
851 property_value_type_ref_ptr: *mut c_void,
852 error: *mut *mut CFError,
853 ) -> bool {
854 extern "C-unwind" {
855 fn CFURLCopyResourcePropertyForKey(
856 url: &CFURL,
857 key: Option<&CFString>,
858 property_value_type_ref_ptr: *mut c_void,
859 error: *mut *mut CFError,
860 ) -> Boolean;
861 }
862 let ret = unsafe {
863 CFURLCopyResourcePropertyForKey(self, key, property_value_type_ref_ptr, error)
864 };
865 ret != 0
866 }
867
868 #[doc(alias = "CFURLCopyResourcePropertiesForKeys")]
874 #[cfg(all(feature = "CFArray", feature = "CFDictionary", feature = "CFError"))]
875 #[inline]
876 pub unsafe fn resource_properties_for_keys(
877 &self,
878 keys: Option<&CFArray>,
879 error: *mut *mut CFError,
880 ) -> Option<CFRetained<CFDictionary>> {
881 extern "C-unwind" {
882 fn CFURLCopyResourcePropertiesForKeys(
883 url: &CFURL,
884 keys: Option<&CFArray>,
885 error: *mut *mut CFError,
886 ) -> Option<NonNull<CFDictionary>>;
887 }
888 let ret = unsafe { CFURLCopyResourcePropertiesForKeys(self, keys, error) };
889 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
890 }
891
892 #[doc(alias = "CFURLSetResourcePropertyForKey")]
899 #[cfg(feature = "CFError")]
900 #[inline]
901 pub unsafe fn set_resource_property_for_key(
902 &self,
903 key: Option<&CFString>,
904 property_value: Option<&CFType>,
905 error: *mut *mut CFError,
906 ) -> bool {
907 extern "C-unwind" {
908 fn CFURLSetResourcePropertyForKey(
909 url: &CFURL,
910 key: Option<&CFString>,
911 property_value: Option<&CFType>,
912 error: *mut *mut CFError,
913 ) -> Boolean;
914 }
915 let ret = unsafe { CFURLSetResourcePropertyForKey(self, key, property_value, error) };
916 ret != 0
917 }
918
919 #[doc(alias = "CFURLSetResourcePropertiesForKeys")]
925 #[cfg(all(feature = "CFDictionary", feature = "CFError"))]
926 #[inline]
927 pub unsafe fn set_resource_properties_for_keys(
928 &self,
929 keyed_property_values: Option<&CFDictionary>,
930 error: *mut *mut CFError,
931 ) -> bool {
932 extern "C-unwind" {
933 fn CFURLSetResourcePropertiesForKeys(
934 url: &CFURL,
935 keyed_property_values: Option<&CFDictionary>,
936 error: *mut *mut CFError,
937 ) -> Boolean;
938 }
939 let ret = unsafe { CFURLSetResourcePropertiesForKeys(self, keyed_property_values, error) };
940 ret != 0
941 }
942}
943
944extern "C" {
945 pub static kCFURLKeysOfUnsetValuesKey: Option<&'static CFString>;
947}
948
949impl CFURL {
950 #[doc(alias = "CFURLClearResourcePropertyCacheForKey")]
951 #[inline]
952 pub fn clear_resource_property_cache_for_key(&self, key: Option<&CFString>) {
953 extern "C-unwind" {
954 fn CFURLClearResourcePropertyCacheForKey(url: &CFURL, key: Option<&CFString>);
955 }
956 unsafe { CFURLClearResourcePropertyCacheForKey(self, key) }
957 }
958
959 #[doc(alias = "CFURLClearResourcePropertyCache")]
960 #[inline]
961 pub fn clear_resource_property_cache(&self) {
962 extern "C-unwind" {
963 fn CFURLClearResourcePropertyCache(url: &CFURL);
964 }
965 unsafe { CFURLClearResourcePropertyCache(self) }
966 }
967
968 #[doc(alias = "CFURLSetTemporaryResourcePropertyForKey")]
969 #[inline]
970 pub fn set_temporary_resource_property_for_key(
971 &self,
972 key: Option<&CFString>,
973 property_value: Option<&CFType>,
974 ) {
975 extern "C-unwind" {
976 fn CFURLSetTemporaryResourcePropertyForKey(
977 url: &CFURL,
978 key: Option<&CFString>,
979 property_value: Option<&CFType>,
980 );
981 }
982 unsafe { CFURLSetTemporaryResourcePropertyForKey(self, key, property_value) }
983 }
984
985 #[doc(alias = "CFURLResourceIsReachable")]
989 #[cfg(feature = "CFError")]
990 #[inline]
991 pub unsafe fn resource_is_reachable(&self, error: *mut *mut CFError) -> bool {
992 extern "C-unwind" {
993 fn CFURLResourceIsReachable(url: &CFURL, error: *mut *mut CFError) -> Boolean;
994 }
995 let ret = unsafe { CFURLResourceIsReachable(self, error) };
996 ret != 0
997 }
998}
999
1000extern "C" {
1001 pub static kCFURLNameKey: Option<&'static CFString>;
1003}
1004
1005extern "C" {
1006 pub static kCFURLLocalizedNameKey: Option<&'static CFString>;
1008}
1009
1010extern "C" {
1011 pub static kCFURLIsRegularFileKey: Option<&'static CFString>;
1013}
1014
1015extern "C" {
1016 pub static kCFURLIsDirectoryKey: Option<&'static CFString>;
1018}
1019
1020extern "C" {
1021 pub static kCFURLIsSymbolicLinkKey: Option<&'static CFString>;
1023}
1024
1025extern "C" {
1026 pub static kCFURLIsVolumeKey: Option<&'static CFString>;
1028}
1029
1030extern "C" {
1031 pub static kCFURLIsPackageKey: Option<&'static CFString>;
1033}
1034
1035extern "C" {
1036 pub static kCFURLIsApplicationKey: Option<&'static CFString>;
1038}
1039
1040extern "C" {
1041 pub static kCFURLApplicationIsScriptableKey: Option<&'static CFString>;
1043}
1044
1045extern "C" {
1046 pub static kCFURLIsSystemImmutableKey: Option<&'static CFString>;
1048}
1049
1050extern "C" {
1051 pub static kCFURLIsUserImmutableKey: Option<&'static CFString>;
1053}
1054
1055extern "C" {
1056 pub static kCFURLIsHiddenKey: Option<&'static CFString>;
1058}
1059
1060extern "C" {
1061 pub static kCFURLHasHiddenExtensionKey: Option<&'static CFString>;
1063}
1064
1065extern "C" {
1066 pub static kCFURLCreationDateKey: Option<&'static CFString>;
1068}
1069
1070extern "C" {
1071 pub static kCFURLContentAccessDateKey: Option<&'static CFString>;
1073}
1074
1075extern "C" {
1076 pub static kCFURLContentModificationDateKey: Option<&'static CFString>;
1078}
1079
1080extern "C" {
1081 pub static kCFURLAttributeModificationDateKey: Option<&'static CFString>;
1083}
1084
1085extern "C" {
1086 pub static kCFURLFileIdentifierKey: Option<&'static CFString>;
1088}
1089
1090extern "C" {
1091 pub static kCFURLFileContentIdentifierKey: Option<&'static CFString>;
1093}
1094
1095extern "C" {
1096 pub static kCFURLMayShareFileContentKey: Option<&'static CFString>;
1098}
1099
1100extern "C" {
1101 pub static kCFURLMayHaveExtendedAttributesKey: Option<&'static CFString>;
1103}
1104
1105extern "C" {
1106 pub static kCFURLIsPurgeableKey: Option<&'static CFString>;
1108}
1109
1110extern "C" {
1111 pub static kCFURLIsSparseKey: Option<&'static CFString>;
1113}
1114
1115extern "C" {
1116 pub static kCFURLLinkCountKey: Option<&'static CFString>;
1118}
1119
1120extern "C" {
1121 pub static kCFURLParentDirectoryURLKey: Option<&'static CFString>;
1123}
1124
1125extern "C" {
1126 pub static kCFURLVolumeURLKey: Option<&'static CFString>;
1128}
1129
1130extern "C" {
1131 #[deprecated = "Use NSURLContentTypeKey instead"]
1133 pub static kCFURLTypeIdentifierKey: Option<&'static CFString>;
1134}
1135
1136extern "C" {
1137 pub static kCFURLLocalizedTypeDescriptionKey: Option<&'static CFString>;
1139}
1140
1141extern "C" {
1142 pub static kCFURLLabelNumberKey: Option<&'static CFString>;
1144}
1145
1146extern "C" {
1147 #[deprecated = "Use NSURLLabelColorKey"]
1149 pub static kCFURLLabelColorKey: Option<&'static CFString>;
1150}
1151
1152extern "C" {
1153 pub static kCFURLLocalizedLabelKey: Option<&'static CFString>;
1155}
1156
1157extern "C" {
1158 #[deprecated = "Use NSURLEffectiveIconKey"]
1160 pub static kCFURLEffectiveIconKey: Option<&'static CFString>;
1161}
1162
1163extern "C" {
1164 #[deprecated = "Use NSURLCustomIconKey"]
1166 pub static kCFURLCustomIconKey: Option<&'static CFString>;
1167}
1168
1169extern "C" {
1170 pub static kCFURLFileResourceIdentifierKey: Option<&'static CFString>;
1172}
1173
1174extern "C" {
1175 pub static kCFURLVolumeIdentifierKey: Option<&'static CFString>;
1177}
1178
1179extern "C" {
1180 pub static kCFURLPreferredIOBlockSizeKey: Option<&'static CFString>;
1182}
1183
1184extern "C" {
1185 pub static kCFURLIsReadableKey: Option<&'static CFString>;
1187}
1188
1189extern "C" {
1190 pub static kCFURLIsWritableKey: Option<&'static CFString>;
1192}
1193
1194extern "C" {
1195 pub static kCFURLIsExecutableKey: Option<&'static CFString>;
1197}
1198
1199extern "C" {
1200 pub static kCFURLFileSecurityKey: Option<&'static CFString>;
1202}
1203
1204extern "C" {
1205 pub static kCFURLIsExcludedFromBackupKey: Option<&'static CFString>;
1207}
1208
1209extern "C" {
1210 pub static kCFURLTagNamesKey: Option<&'static CFString>;
1212}
1213
1214extern "C" {
1215 pub static kCFURLPathKey: Option<&'static CFString>;
1217}
1218
1219extern "C" {
1220 pub static kCFURLCanonicalPathKey: Option<&'static CFString>;
1222}
1223
1224extern "C" {
1225 pub static kCFURLIsMountTriggerKey: Option<&'static CFString>;
1227}
1228
1229extern "C" {
1230 pub static kCFURLGenerationIdentifierKey: Option<&'static CFString>;
1232}
1233
1234extern "C" {
1235 pub static kCFURLDocumentIdentifierKey: Option<&'static CFString>;
1237}
1238
1239extern "C" {
1240 pub static kCFURLAddedToDirectoryDateKey: Option<&'static CFString>;
1242}
1243
1244extern "C" {
1245 pub static kCFURLQuarantinePropertiesKey: Option<&'static CFString>;
1247}
1248
1249extern "C" {
1250 pub static kCFURLFileResourceTypeKey: Option<&'static CFString>;
1252}
1253
1254extern "C" {
1255 pub static kCFURLFileResourceTypeNamedPipe: Option<&'static CFString>;
1257}
1258
1259extern "C" {
1260 pub static kCFURLFileResourceTypeCharacterSpecial: Option<&'static CFString>;
1262}
1263
1264extern "C" {
1265 pub static kCFURLFileResourceTypeDirectory: Option<&'static CFString>;
1267}
1268
1269extern "C" {
1270 pub static kCFURLFileResourceTypeBlockSpecial: Option<&'static CFString>;
1272}
1273
1274extern "C" {
1275 pub static kCFURLFileResourceTypeRegular: Option<&'static CFString>;
1277}
1278
1279extern "C" {
1280 pub static kCFURLFileResourceTypeSymbolicLink: Option<&'static CFString>;
1282}
1283
1284extern "C" {
1285 pub static kCFURLFileResourceTypeSocket: Option<&'static CFString>;
1287}
1288
1289extern "C" {
1290 pub static kCFURLFileResourceTypeUnknown: Option<&'static CFString>;
1292}
1293
1294extern "C" {
1295 pub static kCFURLFileSizeKey: Option<&'static CFString>;
1297}
1298
1299extern "C" {
1300 pub static kCFURLFileAllocatedSizeKey: Option<&'static CFString>;
1302}
1303
1304extern "C" {
1305 pub static kCFURLTotalFileSizeKey: Option<&'static CFString>;
1307}
1308
1309extern "C" {
1310 pub static kCFURLTotalFileAllocatedSizeKey: Option<&'static CFString>;
1312}
1313
1314extern "C" {
1315 pub static kCFURLIsAliasFileKey: Option<&'static CFString>;
1317}
1318
1319extern "C" {
1320 pub static kCFURLFileProtectionKey: Option<&'static CFString>;
1322}
1323
1324extern "C" {
1325 pub static kCFURLFileProtectionNone: Option<&'static CFString>;
1327}
1328
1329extern "C" {
1330 pub static kCFURLFileProtectionComplete: Option<&'static CFString>;
1332}
1333
1334extern "C" {
1335 pub static kCFURLFileProtectionCompleteUnlessOpen: Option<&'static CFString>;
1337}
1338
1339extern "C" {
1340 pub static kCFURLFileProtectionCompleteUntilFirstUserAuthentication: Option<&'static CFString>;
1342}
1343
1344extern "C" {
1345 pub static kCFURLFileProtectionCompleteWhenUserInactive: Option<&'static CFString>;
1347}
1348
1349extern "C" {
1350 pub static kCFURLDirectoryEntryCountKey: Option<&'static CFString>;
1352}
1353
1354extern "C" {
1355 pub static kCFURLVolumeLocalizedFormatDescriptionKey: Option<&'static CFString>;
1357}
1358
1359extern "C" {
1360 pub static kCFURLVolumeTotalCapacityKey: Option<&'static CFString>;
1362}
1363
1364extern "C" {
1365 pub static kCFURLVolumeAvailableCapacityKey: Option<&'static CFString>;
1367}
1368
1369extern "C" {
1370 pub static kCFURLVolumeAvailableCapacityForImportantUsageKey: Option<&'static CFString>;
1372}
1373
1374extern "C" {
1375 pub static kCFURLVolumeAvailableCapacityForOpportunisticUsageKey: Option<&'static CFString>;
1377}
1378
1379extern "C" {
1380 pub static kCFURLVolumeResourceCountKey: Option<&'static CFString>;
1382}
1383
1384extern "C" {
1385 pub static kCFURLVolumeSupportsPersistentIDsKey: Option<&'static CFString>;
1387}
1388
1389extern "C" {
1390 pub static kCFURLVolumeSupportsSymbolicLinksKey: Option<&'static CFString>;
1392}
1393
1394extern "C" {
1395 pub static kCFURLVolumeSupportsHardLinksKey: Option<&'static CFString>;
1397}
1398
1399extern "C" {
1400 pub static kCFURLVolumeSupportsJournalingKey: Option<&'static CFString>;
1402}
1403
1404extern "C" {
1405 pub static kCFURLVolumeIsJournalingKey: Option<&'static CFString>;
1407}
1408
1409extern "C" {
1410 pub static kCFURLVolumeSupportsSparseFilesKey: Option<&'static CFString>;
1412}
1413
1414extern "C" {
1415 pub static kCFURLVolumeSupportsZeroRunsKey: Option<&'static CFString>;
1417}
1418
1419extern "C" {
1420 pub static kCFURLVolumeSupportsCaseSensitiveNamesKey: Option<&'static CFString>;
1422}
1423
1424extern "C" {
1425 pub static kCFURLVolumeSupportsCasePreservedNamesKey: Option<&'static CFString>;
1427}
1428
1429extern "C" {
1430 pub static kCFURLVolumeSupportsRootDirectoryDatesKey: Option<&'static CFString>;
1432}
1433
1434extern "C" {
1435 pub static kCFURLVolumeSupportsVolumeSizesKey: Option<&'static CFString>;
1437}
1438
1439extern "C" {
1440 pub static kCFURLVolumeSupportsRenamingKey: Option<&'static CFString>;
1442}
1443
1444extern "C" {
1445 pub static kCFURLVolumeSupportsAdvisoryFileLockingKey: Option<&'static CFString>;
1447}
1448
1449extern "C" {
1450 pub static kCFURLVolumeSupportsExtendedSecurityKey: Option<&'static CFString>;
1452}
1453
1454extern "C" {
1455 pub static kCFURLVolumeIsBrowsableKey: Option<&'static CFString>;
1457}
1458
1459extern "C" {
1460 pub static kCFURLVolumeMaximumFileSizeKey: Option<&'static CFString>;
1462}
1463
1464extern "C" {
1465 pub static kCFURLVolumeIsEjectableKey: Option<&'static CFString>;
1467}
1468
1469extern "C" {
1470 pub static kCFURLVolumeIsRemovableKey: Option<&'static CFString>;
1472}
1473
1474extern "C" {
1475 pub static kCFURLVolumeIsInternalKey: Option<&'static CFString>;
1477}
1478
1479extern "C" {
1480 pub static kCFURLVolumeIsAutomountedKey: Option<&'static CFString>;
1482}
1483
1484extern "C" {
1485 pub static kCFURLVolumeIsLocalKey: Option<&'static CFString>;
1487}
1488
1489extern "C" {
1490 pub static kCFURLVolumeIsReadOnlyKey: Option<&'static CFString>;
1492}
1493
1494extern "C" {
1495 pub static kCFURLVolumeCreationDateKey: Option<&'static CFString>;
1497}
1498
1499extern "C" {
1500 pub static kCFURLVolumeURLForRemountingKey: Option<&'static CFString>;
1502}
1503
1504extern "C" {
1505 pub static kCFURLVolumeUUIDStringKey: Option<&'static CFString>;
1507}
1508
1509extern "C" {
1510 pub static kCFURLVolumeNameKey: Option<&'static CFString>;
1512}
1513
1514extern "C" {
1515 pub static kCFURLVolumeLocalizedNameKey: Option<&'static CFString>;
1517}
1518
1519extern "C" {
1520 pub static kCFURLVolumeIsEncryptedKey: Option<&'static CFString>;
1522}
1523
1524extern "C" {
1525 pub static kCFURLVolumeIsRootFileSystemKey: Option<&'static CFString>;
1527}
1528
1529extern "C" {
1530 pub static kCFURLVolumeSupportsCompressionKey: Option<&'static CFString>;
1532}
1533
1534extern "C" {
1535 pub static kCFURLVolumeSupportsFileCloningKey: Option<&'static CFString>;
1537}
1538
1539extern "C" {
1540 pub static kCFURLVolumeSupportsSwapRenamingKey: Option<&'static CFString>;
1542}
1543
1544extern "C" {
1545 pub static kCFURLVolumeSupportsExclusiveRenamingKey: Option<&'static CFString>;
1547}
1548
1549extern "C" {
1550 pub static kCFURLVolumeSupportsImmutableFilesKey: Option<&'static CFString>;
1552}
1553
1554extern "C" {
1555 pub static kCFURLVolumeSupportsAccessPermissionsKey: Option<&'static CFString>;
1557}
1558
1559extern "C" {
1560 pub static kCFURLVolumeSupportsFileProtectionKey: Option<&'static CFString>;
1562}
1563
1564extern "C" {
1565 pub static kCFURLVolumeTypeNameKey: Option<&'static CFString>;
1567}
1568
1569extern "C" {
1570 pub static kCFURLVolumeSubtypeKey: Option<&'static CFString>;
1572}
1573
1574extern "C" {
1575 pub static kCFURLVolumeMountFromLocationKey: Option<&'static CFString>;
1577}
1578
1579extern "C" {
1580 pub static kCFURLIsUbiquitousItemKey: Option<&'static CFString>;
1582}
1583
1584extern "C" {
1585 pub static kCFURLUbiquitousItemHasUnresolvedConflictsKey: Option<&'static CFString>;
1587}
1588
1589extern "C" {
1590 #[deprecated = "Use kCFURLUbiquitousItemDownloadingStatusKey instead"]
1592 pub static kCFURLUbiquitousItemIsDownloadedKey: Option<&'static CFString>;
1593}
1594
1595extern "C" {
1596 pub static kCFURLUbiquitousItemIsDownloadingKey: Option<&'static CFString>;
1598}
1599
1600extern "C" {
1601 pub static kCFURLUbiquitousItemIsUploadedKey: Option<&'static CFString>;
1603}
1604
1605extern "C" {
1606 pub static kCFURLUbiquitousItemIsUploadingKey: Option<&'static CFString>;
1608}
1609
1610extern "C" {
1611 #[deprecated = "Use NSMetadataQuery and NSMetadataUbiquitousItemPercentDownloadedKey on NSMetadataItem instead"]
1613 pub static kCFURLUbiquitousItemPercentDownloadedKey: Option<&'static CFString>;
1614}
1615
1616extern "C" {
1617 #[deprecated = "Use NSMetadataQuery and NSMetadataUbiquitousItemPercentUploadedKey on NSMetadataItem instead"]
1619 pub static kCFURLUbiquitousItemPercentUploadedKey: Option<&'static CFString>;
1620}
1621
1622extern "C" {
1623 pub static kCFURLUbiquitousItemDownloadingStatusKey: Option<&'static CFString>;
1625}
1626
1627extern "C" {
1628 pub static kCFURLUbiquitousItemDownloadingErrorKey: Option<&'static CFString>;
1630}
1631
1632extern "C" {
1633 pub static kCFURLUbiquitousItemUploadingErrorKey: Option<&'static CFString>;
1635}
1636
1637extern "C" {
1638 pub static kCFURLUbiquitousItemIsExcludedFromSyncKey: Option<&'static CFString>;
1640}
1641
1642extern "C" {
1643 pub static kCFURLUbiquitousItemDownloadingStatusNotDownloaded: Option<&'static CFString>;
1645}
1646
1647extern "C" {
1648 pub static kCFURLUbiquitousItemDownloadingStatusDownloaded: Option<&'static CFString>;
1650}
1651
1652extern "C" {
1653 pub static kCFURLUbiquitousItemDownloadingStatusCurrent: Option<&'static CFString>;
1655}
1656
1657extern "C" {
1658 pub static kCFURLUbiquitousItemSupportedSyncControlsKey: Option<&'static CFString>;
1660}
1661
1662extern "C" {
1663 pub static kCFURLUbiquitousItemIsSyncPausedKey: Option<&'static CFString>;
1665}
1666
1667#[repr(transparent)]
1670#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1671pub struct CFURLBookmarkCreationOptions(pub CFOptionFlags);
1672bitflags::bitflags! {
1673 impl CFURLBookmarkCreationOptions: CFOptionFlags {
1674 #[doc(alias = "kCFURLBookmarkCreationMinimalBookmarkMask")]
1675 const MinimalBookmarkMask = 1<<9;
1676 #[doc(alias = "kCFURLBookmarkCreationSuitableForBookmarkFile")]
1677 const SuitableForBookmarkFile = 1<<10;
1678 #[doc(alias = "kCFURLBookmarkCreationWithSecurityScope")]
1679 const WithSecurityScope = 1<<11;
1680 #[doc(alias = "kCFURLBookmarkCreationSecurityScopeAllowOnlyReadAccess")]
1681 const SecurityScopeAllowOnlyReadAccess = 1<<12;
1682 #[doc(alias = "kCFURLBookmarkCreationWithoutImplicitSecurityScope")]
1683 const WithoutImplicitSecurityScope = 1<<29;
1684 #[doc(alias = "kCFURLBookmarkCreationPreferFileIDResolutionMask")]
1685#[deprecated = "kCFURLBookmarkCreationPreferFileIDResolutionMask does nothing and has no effect on bookmark resolution"]
1686 const PreferFileIDResolutionMask = 1<<8;
1687 }
1688}
1689
1690#[cfg(feature = "objc2")]
1691unsafe impl Encode for CFURLBookmarkCreationOptions {
1692 const ENCODING: Encoding = CFOptionFlags::ENCODING;
1693}
1694
1695#[cfg(feature = "objc2")]
1696unsafe impl RefEncode for CFURLBookmarkCreationOptions {
1697 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1698}
1699
1700#[repr(transparent)]
1703#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1704pub struct CFURLBookmarkResolutionOptions(pub CFOptionFlags);
1705bitflags::bitflags! {
1706 impl CFURLBookmarkResolutionOptions: CFOptionFlags {
1707 #[doc(alias = "kCFURLBookmarkResolutionWithoutUIMask")]
1708 const CFURLBookmarkResolutionWithoutUIMask = 1<<8;
1709 #[doc(alias = "kCFURLBookmarkResolutionWithoutMountingMask")]
1710 const CFURLBookmarkResolutionWithoutMountingMask = 1<<9;
1711 #[doc(alias = "kCFURLBookmarkResolutionWithSecurityScope")]
1712 const CFURLBookmarkResolutionWithSecurityScope = 1<<10;
1713 #[doc(alias = "kCFURLBookmarkResolutionWithoutImplicitStartAccessing")]
1714 const CFURLBookmarkResolutionWithoutImplicitStartAccessing = 1<<15;
1715 #[doc(alias = "kCFBookmarkResolutionWithoutUIMask")]
1716 const CFBookmarkResolutionWithoutUIMask = CFURLBookmarkResolutionOptions::CFURLBookmarkResolutionWithoutUIMask.0;
1717 #[doc(alias = "kCFBookmarkResolutionWithoutMountingMask")]
1718 const CFBookmarkResolutionWithoutMountingMask = CFURLBookmarkResolutionOptions::CFURLBookmarkResolutionWithoutMountingMask.0;
1719 }
1720}
1721
1722#[cfg(feature = "objc2")]
1723unsafe impl Encode for CFURLBookmarkResolutionOptions {
1724 const ENCODING: Encoding = CFOptionFlags::ENCODING;
1725}
1726
1727#[cfg(feature = "objc2")]
1728unsafe impl RefEncode for CFURLBookmarkResolutionOptions {
1729 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1730}
1731
1732pub type CFURLBookmarkFileCreationOptions = CFOptionFlags;
1734
1735impl CFURL {
1736 #[doc(alias = "CFURLCreateBookmarkData")]
1745 #[cfg(all(feature = "CFArray", feature = "CFData", feature = "CFError"))]
1746 #[inline]
1747 pub unsafe fn new_bookmark_data(
1748 allocator: Option<&CFAllocator>,
1749 url: Option<&CFURL>,
1750 options: CFURLBookmarkCreationOptions,
1751 resource_properties_to_include: Option<&CFArray>,
1752 relative_to_url: Option<&CFURL>,
1753 error: *mut *mut CFError,
1754 ) -> Option<CFRetained<CFData>> {
1755 extern "C-unwind" {
1756 fn CFURLCreateBookmarkData(
1757 allocator: Option<&CFAllocator>,
1758 url: Option<&CFURL>,
1759 options: CFURLBookmarkCreationOptions,
1760 resource_properties_to_include: Option<&CFArray>,
1761 relative_to_url: Option<&CFURL>,
1762 error: *mut *mut CFError,
1763 ) -> Option<NonNull<CFData>>;
1764 }
1765 let ret = unsafe {
1766 CFURLCreateBookmarkData(
1767 allocator,
1768 url,
1769 options,
1770 resource_properties_to_include,
1771 relative_to_url,
1772 error,
1773 )
1774 };
1775 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1776 }
1777
1778 #[doc(alias = "CFURLCreateByResolvingBookmarkData")]
1788 #[cfg(all(feature = "CFArray", feature = "CFData", feature = "CFError"))]
1789 #[inline]
1790 pub unsafe fn new_by_resolving_bookmark_data(
1791 allocator: Option<&CFAllocator>,
1792 bookmark: Option<&CFData>,
1793 options: CFURLBookmarkResolutionOptions,
1794 relative_to_url: Option<&CFURL>,
1795 resource_properties_to_include: Option<&CFArray>,
1796 is_stale: *mut Boolean,
1797 error: *mut *mut CFError,
1798 ) -> Option<CFRetained<CFURL>> {
1799 extern "C-unwind" {
1800 fn CFURLCreateByResolvingBookmarkData(
1801 allocator: Option<&CFAllocator>,
1802 bookmark: Option<&CFData>,
1803 options: CFURLBookmarkResolutionOptions,
1804 relative_to_url: Option<&CFURL>,
1805 resource_properties_to_include: Option<&CFArray>,
1806 is_stale: *mut Boolean,
1807 error: *mut *mut CFError,
1808 ) -> Option<NonNull<CFURL>>;
1809 }
1810 let ret = unsafe {
1811 CFURLCreateByResolvingBookmarkData(
1812 allocator,
1813 bookmark,
1814 options,
1815 relative_to_url,
1816 resource_properties_to_include,
1817 is_stale,
1818 error,
1819 )
1820 };
1821 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1822 }
1823
1824 #[doc(alias = "CFURLCreateResourcePropertiesForKeysFromBookmarkData")]
1831 #[cfg(all(feature = "CFArray", feature = "CFData", feature = "CFDictionary"))]
1832 #[inline]
1833 pub unsafe fn new_resource_properties_for_keys_from_bookmark_data(
1834 allocator: Option<&CFAllocator>,
1835 resource_properties_to_return: Option<&CFArray>,
1836 bookmark: Option<&CFData>,
1837 ) -> Option<CFRetained<CFDictionary>> {
1838 extern "C-unwind" {
1839 fn CFURLCreateResourcePropertiesForKeysFromBookmarkData(
1840 allocator: Option<&CFAllocator>,
1841 resource_properties_to_return: Option<&CFArray>,
1842 bookmark: Option<&CFData>,
1843 ) -> Option<NonNull<CFDictionary>>;
1844 }
1845 let ret = unsafe {
1846 CFURLCreateResourcePropertiesForKeysFromBookmarkData(
1847 allocator,
1848 resource_properties_to_return,
1849 bookmark,
1850 )
1851 };
1852 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1853 }
1854
1855 #[doc(alias = "CFURLCreateResourcePropertyForKeyFromBookmarkData")]
1861 #[cfg(feature = "CFData")]
1862 #[inline]
1863 pub unsafe fn new_resource_property_for_key_from_bookmark_data(
1864 allocator: Option<&CFAllocator>,
1865 resource_property_key: Option<&CFString>,
1866 bookmark: Option<&CFData>,
1867 ) -> Option<CFRetained<CFType>> {
1868 extern "C-unwind" {
1869 fn CFURLCreateResourcePropertyForKeyFromBookmarkData(
1870 allocator: Option<&CFAllocator>,
1871 resource_property_key: Option<&CFString>,
1872 bookmark: Option<&CFData>,
1873 ) -> Option<NonNull<CFType>>;
1874 }
1875 let ret = unsafe {
1876 CFURLCreateResourcePropertyForKeyFromBookmarkData(
1877 allocator,
1878 resource_property_key,
1879 bookmark,
1880 )
1881 };
1882 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1883 }
1884
1885 #[doc(alias = "CFURLCreateBookmarkDataFromFile")]
1891 #[cfg(all(feature = "CFData", feature = "CFError"))]
1892 #[inline]
1893 pub unsafe fn new_bookmark_data_from_file(
1894 allocator: Option<&CFAllocator>,
1895 file_url: Option<&CFURL>,
1896 error_ref: *mut *mut CFError,
1897 ) -> Option<CFRetained<CFData>> {
1898 extern "C-unwind" {
1899 fn CFURLCreateBookmarkDataFromFile(
1900 allocator: Option<&CFAllocator>,
1901 file_url: Option<&CFURL>,
1902 error_ref: *mut *mut CFError,
1903 ) -> Option<NonNull<CFData>>;
1904 }
1905 let ret = unsafe { CFURLCreateBookmarkDataFromFile(allocator, file_url, error_ref) };
1906 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1907 }
1908
1909 #[doc(alias = "CFURLWriteBookmarkDataToFile")]
1915 #[cfg(all(feature = "CFData", feature = "CFError"))]
1916 #[inline]
1917 pub unsafe fn write_bookmark_data_to_file(
1918 bookmark_ref: Option<&CFData>,
1919 file_url: Option<&CFURL>,
1920 options: CFURLBookmarkFileCreationOptions,
1921 error_ref: *mut *mut CFError,
1922 ) -> bool {
1923 extern "C-unwind" {
1924 fn CFURLWriteBookmarkDataToFile(
1925 bookmark_ref: Option<&CFData>,
1926 file_url: Option<&CFURL>,
1927 options: CFURLBookmarkFileCreationOptions,
1928 error_ref: *mut *mut CFError,
1929 ) -> Boolean;
1930 }
1931 let ret =
1932 unsafe { CFURLWriteBookmarkDataToFile(bookmark_ref, file_url, options, error_ref) };
1933 ret != 0
1934 }
1935
1936 #[doc(alias = "CFURLCreateBookmarkDataFromAliasRecord")]
1941 #[cfg(feature = "CFData")]
1942 #[deprecated = "The Carbon Alias Manager is deprecated. This function should only be used to convert Carbon AliasRecords to bookmark data."]
1943 #[inline]
1944 pub unsafe fn new_bookmark_data_from_alias_record(
1945 allocator_ref: Option<&CFAllocator>,
1946 alias_record_data_ref: Option<&CFData>,
1947 ) -> Option<CFRetained<CFData>> {
1948 extern "C-unwind" {
1949 fn CFURLCreateBookmarkDataFromAliasRecord(
1950 allocator_ref: Option<&CFAllocator>,
1951 alias_record_data_ref: Option<&CFData>,
1952 ) -> Option<NonNull<CFData>>;
1953 }
1954 let ret =
1955 unsafe { CFURLCreateBookmarkDataFromAliasRecord(allocator_ref, alias_record_data_ref) };
1956 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1957 }
1958
1959 #[doc(alias = "CFURLStartAccessingSecurityScopedResource")]
1960 #[inline]
1961 pub unsafe fn start_accessing_security_scoped_resource(&self) -> bool {
1962 extern "C-unwind" {
1963 fn CFURLStartAccessingSecurityScopedResource(url: &CFURL) -> Boolean;
1964 }
1965 let ret = unsafe { CFURLStartAccessingSecurityScopedResource(self) };
1966 ret != 0
1967 }
1968
1969 #[doc(alias = "CFURLStopAccessingSecurityScopedResource")]
1970 #[inline]
1971 pub unsafe fn stop_accessing_security_scoped_resource(&self) {
1972 extern "C-unwind" {
1973 fn CFURLStopAccessingSecurityScopedResource(url: &CFURL);
1974 }
1975 unsafe { CFURLStopAccessingSecurityScopedResource(self) }
1976 }
1977}
1978
1979#[cfg(feature = "CFString")]
1980#[deprecated = "renamed to `CFURL::with_bytes`"]
1981#[inline]
1982pub unsafe extern "C-unwind" fn CFURLCreateWithBytes(
1983 allocator: Option<&CFAllocator>,
1984 url_bytes: *const u8,
1985 length: CFIndex,
1986 encoding: CFStringEncoding,
1987 base_url: Option<&CFURL>,
1988) -> Option<CFRetained<CFURL>> {
1989 extern "C-unwind" {
1990 fn CFURLCreateWithBytes(
1991 allocator: Option<&CFAllocator>,
1992 url_bytes: *const u8,
1993 length: CFIndex,
1994 encoding: CFStringEncoding,
1995 base_url: Option<&CFURL>,
1996 ) -> Option<NonNull<CFURL>>;
1997 }
1998 let ret = unsafe { CFURLCreateWithBytes(allocator, url_bytes, length, encoding, base_url) };
1999 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2000}
2001
2002#[cfg(all(feature = "CFData", feature = "CFString"))]
2003#[deprecated = "renamed to `CFURL::new_data`"]
2004#[inline]
2005pub extern "C-unwind" fn CFURLCreateData(
2006 allocator: Option<&CFAllocator>,
2007 url: Option<&CFURL>,
2008 encoding: CFStringEncoding,
2009 escape_whitespace: bool,
2010) -> Option<CFRetained<CFData>> {
2011 extern "C-unwind" {
2012 fn CFURLCreateData(
2013 allocator: Option<&CFAllocator>,
2014 url: Option<&CFURL>,
2015 encoding: CFStringEncoding,
2016 escape_whitespace: Boolean,
2017 ) -> Option<NonNull<CFData>>;
2018 }
2019 let ret = unsafe { CFURLCreateData(allocator, url, encoding, escape_whitespace as _) };
2020 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2021}
2022
2023#[deprecated = "renamed to `CFURL::__from_string`"]
2024#[inline]
2025pub extern "C-unwind" fn CFURLCreateWithString(
2026 allocator: Option<&CFAllocator>,
2027 url_string: Option<&CFString>,
2028 base_url: Option<&CFURL>,
2029) -> Option<CFRetained<CFURL>> {
2030 extern "C-unwind" {
2031 fn CFURLCreateWithString(
2032 allocator: Option<&CFAllocator>,
2033 url_string: Option<&CFString>,
2034 base_url: Option<&CFURL>,
2035 ) -> Option<NonNull<CFURL>>;
2036 }
2037 let ret = unsafe { CFURLCreateWithString(allocator, url_string, base_url) };
2038 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2039}
2040
2041#[cfg(feature = "CFString")]
2042#[deprecated = "renamed to `CFURL::new_absolute_url_with_bytes`"]
2043#[inline]
2044pub unsafe extern "C-unwind" fn CFURLCreateAbsoluteURLWithBytes(
2045 alloc: Option<&CFAllocator>,
2046 relative_url_bytes: *const u8,
2047 length: CFIndex,
2048 encoding: CFStringEncoding,
2049 base_url: Option<&CFURL>,
2050 use_compatibility_mode: bool,
2051) -> Option<CFRetained<CFURL>> {
2052 extern "C-unwind" {
2053 fn CFURLCreateAbsoluteURLWithBytes(
2054 alloc: Option<&CFAllocator>,
2055 relative_url_bytes: *const u8,
2056 length: CFIndex,
2057 encoding: CFStringEncoding,
2058 base_url: Option<&CFURL>,
2059 use_compatibility_mode: Boolean,
2060 ) -> Option<NonNull<CFURL>>;
2061 }
2062 let ret = unsafe {
2063 CFURLCreateAbsoluteURLWithBytes(
2064 alloc,
2065 relative_url_bytes,
2066 length,
2067 encoding,
2068 base_url,
2069 use_compatibility_mode as _,
2070 )
2071 };
2072 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2073}
2074
2075#[deprecated = "renamed to `CFURL::with_file_system_path`"]
2076#[inline]
2077pub extern "C-unwind" fn CFURLCreateWithFileSystemPath(
2078 allocator: Option<&CFAllocator>,
2079 file_path: Option<&CFString>,
2080 path_style: CFURLPathStyle,
2081 is_directory: bool,
2082) -> Option<CFRetained<CFURL>> {
2083 extern "C-unwind" {
2084 fn CFURLCreateWithFileSystemPath(
2085 allocator: Option<&CFAllocator>,
2086 file_path: Option<&CFString>,
2087 path_style: CFURLPathStyle,
2088 is_directory: Boolean,
2089 ) -> Option<NonNull<CFURL>>;
2090 }
2091 let ret = unsafe {
2092 CFURLCreateWithFileSystemPath(allocator, file_path, path_style, is_directory as _)
2093 };
2094 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2095}
2096
2097#[deprecated = "renamed to `CFURL::from_file_system_representation`"]
2098#[inline]
2099pub unsafe extern "C-unwind" fn CFURLCreateFromFileSystemRepresentation(
2100 allocator: Option<&CFAllocator>,
2101 buffer: *const u8,
2102 buf_len: CFIndex,
2103 is_directory: bool,
2104) -> Option<CFRetained<CFURL>> {
2105 extern "C-unwind" {
2106 fn CFURLCreateFromFileSystemRepresentation(
2107 allocator: Option<&CFAllocator>,
2108 buffer: *const u8,
2109 buf_len: CFIndex,
2110 is_directory: Boolean,
2111 ) -> Option<NonNull<CFURL>>;
2112 }
2113 let ret = unsafe {
2114 CFURLCreateFromFileSystemRepresentation(allocator, buffer, buf_len, is_directory as _)
2115 };
2116 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2117}
2118
2119#[deprecated = "renamed to `CFURL::with_file_system_path_relative_to_base`"]
2120#[inline]
2121pub extern "C-unwind" fn CFURLCreateWithFileSystemPathRelativeToBase(
2122 allocator: Option<&CFAllocator>,
2123 file_path: Option<&CFString>,
2124 path_style: CFURLPathStyle,
2125 is_directory: bool,
2126 base_url: Option<&CFURL>,
2127) -> Option<CFRetained<CFURL>> {
2128 extern "C-unwind" {
2129 fn CFURLCreateWithFileSystemPathRelativeToBase(
2130 allocator: Option<&CFAllocator>,
2131 file_path: Option<&CFString>,
2132 path_style: CFURLPathStyle,
2133 is_directory: Boolean,
2134 base_url: Option<&CFURL>,
2135 ) -> Option<NonNull<CFURL>>;
2136 }
2137 let ret = unsafe {
2138 CFURLCreateWithFileSystemPathRelativeToBase(
2139 allocator,
2140 file_path,
2141 path_style,
2142 is_directory as _,
2143 base_url,
2144 )
2145 };
2146 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2147}
2148
2149#[deprecated = "renamed to `CFURL::from_file_system_representation_relative_to_base`"]
2150#[inline]
2151pub unsafe extern "C-unwind" fn CFURLCreateFromFileSystemRepresentationRelativeToBase(
2152 allocator: Option<&CFAllocator>,
2153 buffer: *const u8,
2154 buf_len: CFIndex,
2155 is_directory: bool,
2156 base_url: Option<&CFURL>,
2157) -> Option<CFRetained<CFURL>> {
2158 extern "C-unwind" {
2159 fn CFURLCreateFromFileSystemRepresentationRelativeToBase(
2160 allocator: Option<&CFAllocator>,
2161 buffer: *const u8,
2162 buf_len: CFIndex,
2163 is_directory: Boolean,
2164 base_url: Option<&CFURL>,
2165 ) -> Option<NonNull<CFURL>>;
2166 }
2167 let ret = unsafe {
2168 CFURLCreateFromFileSystemRepresentationRelativeToBase(
2169 allocator,
2170 buffer,
2171 buf_len,
2172 is_directory as _,
2173 base_url,
2174 )
2175 };
2176 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2177}
2178
2179#[deprecated = "renamed to `CFURL::file_system_representation`"]
2180#[inline]
2181pub unsafe extern "C-unwind" fn CFURLGetFileSystemRepresentation(
2182 url: &CFURL,
2183 resolve_against_base: bool,
2184 buffer: *mut u8,
2185 max_buf_len: CFIndex,
2186) -> bool {
2187 extern "C-unwind" {
2188 fn CFURLGetFileSystemRepresentation(
2189 url: &CFURL,
2190 resolve_against_base: Boolean,
2191 buffer: *mut u8,
2192 max_buf_len: CFIndex,
2193 ) -> Boolean;
2194 }
2195 let ret = unsafe {
2196 CFURLGetFileSystemRepresentation(url, resolve_against_base as _, buffer, max_buf_len)
2197 };
2198 ret != 0
2199}
2200
2201#[deprecated = "renamed to `CFURL::absolute_url`"]
2202#[inline]
2203pub extern "C-unwind" fn CFURLCopyAbsoluteURL(relative_url: &CFURL) -> Option<CFRetained<CFURL>> {
2204 extern "C-unwind" {
2205 fn CFURLCopyAbsoluteURL(relative_url: &CFURL) -> Option<NonNull<CFURL>>;
2206 }
2207 let ret = unsafe { CFURLCopyAbsoluteURL(relative_url) };
2208 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2209}
2210
2211#[deprecated = "renamed to `CFURL::__string`"]
2212#[inline]
2213pub extern "C-unwind" fn CFURLGetString(an_url: &CFURL) -> Option<CFRetained<CFString>> {
2214 extern "C-unwind" {
2215 fn CFURLGetString(an_url: &CFURL) -> Option<NonNull<CFString>>;
2216 }
2217 let ret = unsafe { CFURLGetString(an_url) };
2218 ret.map(|ret| unsafe { CFRetained::retain(ret) })
2219}
2220
2221#[deprecated = "renamed to `CFURL::base_url`"]
2222#[inline]
2223pub extern "C-unwind" fn CFURLGetBaseURL(an_url: &CFURL) -> Option<CFRetained<CFURL>> {
2224 extern "C-unwind" {
2225 fn CFURLGetBaseURL(an_url: &CFURL) -> Option<NonNull<CFURL>>;
2226 }
2227 let ret = unsafe { CFURLGetBaseURL(an_url) };
2228 ret.map(|ret| unsafe { CFRetained::retain(ret) })
2229}
2230
2231#[deprecated = "renamed to `CFURL::can_be_decomposed`"]
2232#[inline]
2233pub extern "C-unwind" fn CFURLCanBeDecomposed(an_url: &CFURL) -> bool {
2234 extern "C-unwind" {
2235 fn CFURLCanBeDecomposed(an_url: &CFURL) -> Boolean;
2236 }
2237 let ret = unsafe { CFURLCanBeDecomposed(an_url) };
2238 ret != 0
2239}
2240
2241#[deprecated = "renamed to `CFURL::scheme`"]
2242#[inline]
2243pub extern "C-unwind" fn CFURLCopyScheme(an_url: &CFURL) -> Option<CFRetained<CFString>> {
2244 extern "C-unwind" {
2245 fn CFURLCopyScheme(an_url: &CFURL) -> Option<NonNull<CFString>>;
2246 }
2247 let ret = unsafe { CFURLCopyScheme(an_url) };
2248 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2249}
2250
2251#[deprecated = "renamed to `CFURL::net_location`"]
2252#[inline]
2253pub extern "C-unwind" fn CFURLCopyNetLocation(an_url: &CFURL) -> Option<CFRetained<CFString>> {
2254 extern "C-unwind" {
2255 fn CFURLCopyNetLocation(an_url: &CFURL) -> Option<NonNull<CFString>>;
2256 }
2257 let ret = unsafe { CFURLCopyNetLocation(an_url) };
2258 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2259}
2260
2261#[deprecated = "renamed to `CFURL::path`"]
2262#[inline]
2263pub extern "C-unwind" fn CFURLCopyPath(an_url: &CFURL) -> Option<CFRetained<CFString>> {
2264 extern "C-unwind" {
2265 fn CFURLCopyPath(an_url: &CFURL) -> Option<NonNull<CFString>>;
2266 }
2267 let ret = unsafe { CFURLCopyPath(an_url) };
2268 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2269}
2270
2271#[deprecated = "renamed to `CFURL::strict_path`"]
2272#[inline]
2273pub unsafe extern "C-unwind" fn CFURLCopyStrictPath(
2274 an_url: &CFURL,
2275 is_absolute: *mut Boolean,
2276) -> Option<CFRetained<CFString>> {
2277 extern "C-unwind" {
2278 fn CFURLCopyStrictPath(
2279 an_url: &CFURL,
2280 is_absolute: *mut Boolean,
2281 ) -> Option<NonNull<CFString>>;
2282 }
2283 let ret = unsafe { CFURLCopyStrictPath(an_url, is_absolute) };
2284 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2285}
2286
2287#[deprecated = "renamed to `CFURL::file_system_path`"]
2288#[inline]
2289pub extern "C-unwind" fn CFURLCopyFileSystemPath(
2290 an_url: &CFURL,
2291 path_style: CFURLPathStyle,
2292) -> Option<CFRetained<CFString>> {
2293 extern "C-unwind" {
2294 fn CFURLCopyFileSystemPath(
2295 an_url: &CFURL,
2296 path_style: CFURLPathStyle,
2297 ) -> Option<NonNull<CFString>>;
2298 }
2299 let ret = unsafe { CFURLCopyFileSystemPath(an_url, path_style) };
2300 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2301}
2302
2303#[deprecated = "renamed to `CFURL::has_directory_path`"]
2304#[inline]
2305pub extern "C-unwind" fn CFURLHasDirectoryPath(an_url: &CFURL) -> bool {
2306 extern "C-unwind" {
2307 fn CFURLHasDirectoryPath(an_url: &CFURL) -> Boolean;
2308 }
2309 let ret = unsafe { CFURLHasDirectoryPath(an_url) };
2310 ret != 0
2311}
2312
2313#[deprecated = "renamed to `CFURL::resource_specifier`"]
2314#[inline]
2315pub extern "C-unwind" fn CFURLCopyResourceSpecifier(
2316 an_url: &CFURL,
2317) -> Option<CFRetained<CFString>> {
2318 extern "C-unwind" {
2319 fn CFURLCopyResourceSpecifier(an_url: &CFURL) -> Option<NonNull<CFString>>;
2320 }
2321 let ret = unsafe { CFURLCopyResourceSpecifier(an_url) };
2322 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2323}
2324
2325#[deprecated = "renamed to `CFURL::host_name`"]
2326#[inline]
2327pub extern "C-unwind" fn CFURLCopyHostName(an_url: &CFURL) -> Option<CFRetained<CFString>> {
2328 extern "C-unwind" {
2329 fn CFURLCopyHostName(an_url: &CFURL) -> Option<NonNull<CFString>>;
2330 }
2331 let ret = unsafe { CFURLCopyHostName(an_url) };
2332 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2333}
2334
2335#[deprecated = "renamed to `CFURL::port_number`"]
2336#[inline]
2337pub extern "C-unwind" fn CFURLGetPortNumber(an_url: &CFURL) -> i32 {
2338 extern "C-unwind" {
2339 fn CFURLGetPortNumber(an_url: &CFURL) -> i32;
2340 }
2341 unsafe { CFURLGetPortNumber(an_url) }
2342}
2343
2344#[deprecated = "renamed to `CFURL::user_name`"]
2345#[inline]
2346pub extern "C-unwind" fn CFURLCopyUserName(an_url: &CFURL) -> Option<CFRetained<CFString>> {
2347 extern "C-unwind" {
2348 fn CFURLCopyUserName(an_url: &CFURL) -> Option<NonNull<CFString>>;
2349 }
2350 let ret = unsafe { CFURLCopyUserName(an_url) };
2351 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2352}
2353
2354#[deprecated = "renamed to `CFURL::password`"]
2355#[inline]
2356pub extern "C-unwind" fn CFURLCopyPassword(an_url: &CFURL) -> Option<CFRetained<CFString>> {
2357 extern "C-unwind" {
2358 fn CFURLCopyPassword(an_url: &CFURL) -> Option<NonNull<CFString>>;
2359 }
2360 let ret = unsafe { CFURLCopyPassword(an_url) };
2361 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2362}
2363
2364#[deprecated = "renamed to `CFURL::parameter_string`"]
2365#[inline]
2366pub extern "C-unwind" fn CFURLCopyParameterString(
2367 an_url: &CFURL,
2368 characters_to_leave_escaped: Option<&CFString>,
2369) -> Option<CFRetained<CFString>> {
2370 extern "C-unwind" {
2371 fn CFURLCopyParameterString(
2372 an_url: &CFURL,
2373 characters_to_leave_escaped: Option<&CFString>,
2374 ) -> Option<NonNull<CFString>>;
2375 }
2376 let ret = unsafe { CFURLCopyParameterString(an_url, characters_to_leave_escaped) };
2377 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2378}
2379
2380#[deprecated = "renamed to `CFURL::query_string`"]
2381#[inline]
2382pub extern "C-unwind" fn CFURLCopyQueryString(
2383 an_url: &CFURL,
2384 characters_to_leave_escaped: Option<&CFString>,
2385) -> Option<CFRetained<CFString>> {
2386 extern "C-unwind" {
2387 fn CFURLCopyQueryString(
2388 an_url: &CFURL,
2389 characters_to_leave_escaped: Option<&CFString>,
2390 ) -> Option<NonNull<CFString>>;
2391 }
2392 let ret = unsafe { CFURLCopyQueryString(an_url, characters_to_leave_escaped) };
2393 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2394}
2395
2396#[deprecated = "renamed to `CFURL::fragment`"]
2397#[inline]
2398pub extern "C-unwind" fn CFURLCopyFragment(
2399 an_url: &CFURL,
2400 characters_to_leave_escaped: Option<&CFString>,
2401) -> Option<CFRetained<CFString>> {
2402 extern "C-unwind" {
2403 fn CFURLCopyFragment(
2404 an_url: &CFURL,
2405 characters_to_leave_escaped: Option<&CFString>,
2406 ) -> Option<NonNull<CFString>>;
2407 }
2408 let ret = unsafe { CFURLCopyFragment(an_url, characters_to_leave_escaped) };
2409 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2410}
2411
2412#[deprecated = "renamed to `CFURL::last_path_component`"]
2413#[inline]
2414pub extern "C-unwind" fn CFURLCopyLastPathComponent(url: &CFURL) -> Option<CFRetained<CFString>> {
2415 extern "C-unwind" {
2416 fn CFURLCopyLastPathComponent(url: &CFURL) -> Option<NonNull<CFString>>;
2417 }
2418 let ret = unsafe { CFURLCopyLastPathComponent(url) };
2419 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2420}
2421
2422#[deprecated = "renamed to `CFURL::path_extension`"]
2423#[inline]
2424pub extern "C-unwind" fn CFURLCopyPathExtension(url: &CFURL) -> Option<CFRetained<CFString>> {
2425 extern "C-unwind" {
2426 fn CFURLCopyPathExtension(url: &CFURL) -> Option<NonNull<CFString>>;
2427 }
2428 let ret = unsafe { CFURLCopyPathExtension(url) };
2429 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2430}
2431
2432#[deprecated = "renamed to `CFURL::new_copy_appending_path_component`"]
2433#[inline]
2434pub extern "C-unwind" fn CFURLCreateCopyAppendingPathComponent(
2435 allocator: Option<&CFAllocator>,
2436 url: Option<&CFURL>,
2437 path_component: Option<&CFString>,
2438 is_directory: bool,
2439) -> Option<CFRetained<CFURL>> {
2440 extern "C-unwind" {
2441 fn CFURLCreateCopyAppendingPathComponent(
2442 allocator: Option<&CFAllocator>,
2443 url: Option<&CFURL>,
2444 path_component: Option<&CFString>,
2445 is_directory: Boolean,
2446 ) -> Option<NonNull<CFURL>>;
2447 }
2448 let ret = unsafe {
2449 CFURLCreateCopyAppendingPathComponent(allocator, url, path_component, is_directory as _)
2450 };
2451 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2452}
2453
2454#[deprecated = "renamed to `CFURL::new_copy_deleting_last_path_component`"]
2455#[inline]
2456pub extern "C-unwind" fn CFURLCreateCopyDeletingLastPathComponent(
2457 allocator: Option<&CFAllocator>,
2458 url: Option<&CFURL>,
2459) -> Option<CFRetained<CFURL>> {
2460 extern "C-unwind" {
2461 fn CFURLCreateCopyDeletingLastPathComponent(
2462 allocator: Option<&CFAllocator>,
2463 url: Option<&CFURL>,
2464 ) -> Option<NonNull<CFURL>>;
2465 }
2466 let ret = unsafe { CFURLCreateCopyDeletingLastPathComponent(allocator, url) };
2467 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2468}
2469
2470#[deprecated = "renamed to `CFURL::new_copy_appending_path_extension`"]
2471#[inline]
2472pub extern "C-unwind" fn CFURLCreateCopyAppendingPathExtension(
2473 allocator: Option<&CFAllocator>,
2474 url: Option<&CFURL>,
2475 extension: Option<&CFString>,
2476) -> Option<CFRetained<CFURL>> {
2477 extern "C-unwind" {
2478 fn CFURLCreateCopyAppendingPathExtension(
2479 allocator: Option<&CFAllocator>,
2480 url: Option<&CFURL>,
2481 extension: Option<&CFString>,
2482 ) -> Option<NonNull<CFURL>>;
2483 }
2484 let ret = unsafe { CFURLCreateCopyAppendingPathExtension(allocator, url, extension) };
2485 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2486}
2487
2488#[deprecated = "renamed to `CFURL::new_copy_deleting_path_extension`"]
2489#[inline]
2490pub extern "C-unwind" fn CFURLCreateCopyDeletingPathExtension(
2491 allocator: Option<&CFAllocator>,
2492 url: Option<&CFURL>,
2493) -> Option<CFRetained<CFURL>> {
2494 extern "C-unwind" {
2495 fn CFURLCreateCopyDeletingPathExtension(
2496 allocator: Option<&CFAllocator>,
2497 url: Option<&CFURL>,
2498 ) -> Option<NonNull<CFURL>>;
2499 }
2500 let ret = unsafe { CFURLCreateCopyDeletingPathExtension(allocator, url) };
2501 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2502}
2503
2504extern "C-unwind" {
2505 #[deprecated = "renamed to `CFURL::bytes`"]
2506 pub fn CFURLGetBytes(url: &CFURL, buffer: *mut u8, buffer_length: CFIndex) -> CFIndex;
2507}
2508
2509extern "C-unwind" {
2510 #[deprecated = "renamed to `CFURL::byte_range_for_component`"]
2511 pub fn CFURLGetByteRangeForComponent(
2512 url: &CFURL,
2513 component: CFURLComponentType,
2514 range_including_separators: *mut CFRange,
2515 ) -> CFRange;
2516}
2517
2518#[deprecated = "renamed to `CFURL::new_string_by_replacing_percent_escapes`"]
2519#[inline]
2520pub extern "C-unwind" fn CFURLCreateStringByReplacingPercentEscapes(
2521 allocator: Option<&CFAllocator>,
2522 original_string: Option<&CFString>,
2523 characters_to_leave_escaped: Option<&CFString>,
2524) -> Option<CFRetained<CFString>> {
2525 extern "C-unwind" {
2526 fn CFURLCreateStringByReplacingPercentEscapes(
2527 allocator: Option<&CFAllocator>,
2528 original_string: Option<&CFString>,
2529 characters_to_leave_escaped: Option<&CFString>,
2530 ) -> Option<NonNull<CFString>>;
2531 }
2532 let ret = unsafe {
2533 CFURLCreateStringByReplacingPercentEscapes(
2534 allocator,
2535 original_string,
2536 characters_to_leave_escaped,
2537 )
2538 };
2539 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2540}
2541
2542#[cfg(feature = "CFString")]
2543#[deprecated = "renamed to `CFURL::new_string_by_replacing_percent_escapes_using_encoding`"]
2544#[inline]
2545pub unsafe extern "C-unwind" fn CFURLCreateStringByReplacingPercentEscapesUsingEncoding(
2546 allocator: Option<&CFAllocator>,
2547 orig_string: Option<&CFString>,
2548 chars_to_leave_escaped: Option<&CFString>,
2549 encoding: CFStringEncoding,
2550) -> Option<CFRetained<CFString>> {
2551 extern "C-unwind" {
2552 fn CFURLCreateStringByReplacingPercentEscapesUsingEncoding(
2553 allocator: Option<&CFAllocator>,
2554 orig_string: Option<&CFString>,
2555 chars_to_leave_escaped: Option<&CFString>,
2556 encoding: CFStringEncoding,
2557 ) -> Option<NonNull<CFString>>;
2558 }
2559 let ret = unsafe {
2560 CFURLCreateStringByReplacingPercentEscapesUsingEncoding(
2561 allocator,
2562 orig_string,
2563 chars_to_leave_escaped,
2564 encoding,
2565 )
2566 };
2567 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2568}
2569
2570#[cfg(feature = "CFString")]
2571#[deprecated = "renamed to `CFURL::new_string_by_adding_percent_escapes`"]
2572#[inline]
2573pub unsafe extern "C-unwind" fn CFURLCreateStringByAddingPercentEscapes(
2574 allocator: Option<&CFAllocator>,
2575 original_string: Option<&CFString>,
2576 characters_to_leave_unescaped: Option<&CFString>,
2577 legal_url_characters_to_be_escaped: Option<&CFString>,
2578 encoding: CFStringEncoding,
2579) -> Option<CFRetained<CFString>> {
2580 extern "C-unwind" {
2581 fn CFURLCreateStringByAddingPercentEscapes(
2582 allocator: Option<&CFAllocator>,
2583 original_string: Option<&CFString>,
2584 characters_to_leave_unescaped: Option<&CFString>,
2585 legal_url_characters_to_be_escaped: Option<&CFString>,
2586 encoding: CFStringEncoding,
2587 ) -> Option<NonNull<CFString>>;
2588 }
2589 let ret = unsafe {
2590 CFURLCreateStringByAddingPercentEscapes(
2591 allocator,
2592 original_string,
2593 characters_to_leave_unescaped,
2594 legal_url_characters_to_be_escaped,
2595 encoding,
2596 )
2597 };
2598 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2599}
2600
2601#[deprecated = "renamed to `CFURL::is_file_reference_url`"]
2602#[inline]
2603pub extern "C-unwind" fn CFURLIsFileReferenceURL(url: &CFURL) -> bool {
2604 extern "C-unwind" {
2605 fn CFURLIsFileReferenceURL(url: &CFURL) -> Boolean;
2606 }
2607 let ret = unsafe { CFURLIsFileReferenceURL(url) };
2608 ret != 0
2609}
2610
2611#[cfg(feature = "CFError")]
2612#[deprecated = "renamed to `CFURL::new_file_reference_url`"]
2613#[inline]
2614pub unsafe extern "C-unwind" fn CFURLCreateFileReferenceURL(
2615 allocator: Option<&CFAllocator>,
2616 url: Option<&CFURL>,
2617 error: *mut *mut CFError,
2618) -> Option<CFRetained<CFURL>> {
2619 extern "C-unwind" {
2620 fn CFURLCreateFileReferenceURL(
2621 allocator: Option<&CFAllocator>,
2622 url: Option<&CFURL>,
2623 error: *mut *mut CFError,
2624 ) -> Option<NonNull<CFURL>>;
2625 }
2626 let ret = unsafe { CFURLCreateFileReferenceURL(allocator, url, error) };
2627 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2628}
2629
2630#[cfg(feature = "CFError")]
2631#[deprecated = "renamed to `CFURL::new_file_path_url`"]
2632#[inline]
2633pub unsafe extern "C-unwind" fn CFURLCreateFilePathURL(
2634 allocator: Option<&CFAllocator>,
2635 url: Option<&CFURL>,
2636 error: *mut *mut CFError,
2637) -> Option<CFRetained<CFURL>> {
2638 extern "C-unwind" {
2639 fn CFURLCreateFilePathURL(
2640 allocator: Option<&CFAllocator>,
2641 url: Option<&CFURL>,
2642 error: *mut *mut CFError,
2643 ) -> Option<NonNull<CFURL>>;
2644 }
2645 let ret = unsafe { CFURLCreateFilePathURL(allocator, url, error) };
2646 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2647}
2648
2649#[cfg(feature = "CFError")]
2650#[deprecated = "renamed to `CFURL::resource_property_for_key`"]
2651#[inline]
2652pub unsafe extern "C-unwind" fn CFURLCopyResourcePropertyForKey(
2653 url: &CFURL,
2654 key: Option<&CFString>,
2655 property_value_type_ref_ptr: *mut c_void,
2656 error: *mut *mut CFError,
2657) -> bool {
2658 extern "C-unwind" {
2659 fn CFURLCopyResourcePropertyForKey(
2660 url: &CFURL,
2661 key: Option<&CFString>,
2662 property_value_type_ref_ptr: *mut c_void,
2663 error: *mut *mut CFError,
2664 ) -> Boolean;
2665 }
2666 let ret =
2667 unsafe { CFURLCopyResourcePropertyForKey(url, key, property_value_type_ref_ptr, error) };
2668 ret != 0
2669}
2670
2671#[cfg(all(feature = "CFArray", feature = "CFDictionary", feature = "CFError"))]
2672#[deprecated = "renamed to `CFURL::resource_properties_for_keys`"]
2673#[inline]
2674pub unsafe extern "C-unwind" fn CFURLCopyResourcePropertiesForKeys(
2675 url: &CFURL,
2676 keys: Option<&CFArray>,
2677 error: *mut *mut CFError,
2678) -> Option<CFRetained<CFDictionary>> {
2679 extern "C-unwind" {
2680 fn CFURLCopyResourcePropertiesForKeys(
2681 url: &CFURL,
2682 keys: Option<&CFArray>,
2683 error: *mut *mut CFError,
2684 ) -> Option<NonNull<CFDictionary>>;
2685 }
2686 let ret = unsafe { CFURLCopyResourcePropertiesForKeys(url, keys, error) };
2687 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2688}
2689
2690#[cfg(feature = "CFError")]
2691#[deprecated = "renamed to `CFURL::set_resource_property_for_key`"]
2692#[inline]
2693pub unsafe extern "C-unwind" fn CFURLSetResourcePropertyForKey(
2694 url: &CFURL,
2695 key: Option<&CFString>,
2696 property_value: Option<&CFType>,
2697 error: *mut *mut CFError,
2698) -> bool {
2699 extern "C-unwind" {
2700 fn CFURLSetResourcePropertyForKey(
2701 url: &CFURL,
2702 key: Option<&CFString>,
2703 property_value: Option<&CFType>,
2704 error: *mut *mut CFError,
2705 ) -> Boolean;
2706 }
2707 let ret = unsafe { CFURLSetResourcePropertyForKey(url, key, property_value, error) };
2708 ret != 0
2709}
2710
2711#[cfg(all(feature = "CFDictionary", feature = "CFError"))]
2712#[deprecated = "renamed to `CFURL::set_resource_properties_for_keys`"]
2713#[inline]
2714pub unsafe extern "C-unwind" fn CFURLSetResourcePropertiesForKeys(
2715 url: &CFURL,
2716 keyed_property_values: Option<&CFDictionary>,
2717 error: *mut *mut CFError,
2718) -> bool {
2719 extern "C-unwind" {
2720 fn CFURLSetResourcePropertiesForKeys(
2721 url: &CFURL,
2722 keyed_property_values: Option<&CFDictionary>,
2723 error: *mut *mut CFError,
2724 ) -> Boolean;
2725 }
2726 let ret = unsafe { CFURLSetResourcePropertiesForKeys(url, keyed_property_values, error) };
2727 ret != 0
2728}
2729
2730#[deprecated = "renamed to `CFURL::clear_resource_property_cache_for_key`"]
2731#[inline]
2732pub extern "C-unwind" fn CFURLClearResourcePropertyCacheForKey(
2733 url: &CFURL,
2734 key: Option<&CFString>,
2735) {
2736 extern "C-unwind" {
2737 fn CFURLClearResourcePropertyCacheForKey(url: &CFURL, key: Option<&CFString>);
2738 }
2739 unsafe { CFURLClearResourcePropertyCacheForKey(url, key) }
2740}
2741
2742#[deprecated = "renamed to `CFURL::clear_resource_property_cache`"]
2743#[inline]
2744pub extern "C-unwind" fn CFURLClearResourcePropertyCache(url: &CFURL) {
2745 extern "C-unwind" {
2746 fn CFURLClearResourcePropertyCache(url: &CFURL);
2747 }
2748 unsafe { CFURLClearResourcePropertyCache(url) }
2749}
2750
2751#[deprecated = "renamed to `CFURL::set_temporary_resource_property_for_key`"]
2752#[inline]
2753pub extern "C-unwind" fn CFURLSetTemporaryResourcePropertyForKey(
2754 url: &CFURL,
2755 key: Option<&CFString>,
2756 property_value: Option<&CFType>,
2757) {
2758 extern "C-unwind" {
2759 fn CFURLSetTemporaryResourcePropertyForKey(
2760 url: &CFURL,
2761 key: Option<&CFString>,
2762 property_value: Option<&CFType>,
2763 );
2764 }
2765 unsafe { CFURLSetTemporaryResourcePropertyForKey(url, key, property_value) }
2766}
2767
2768#[cfg(feature = "CFError")]
2769#[deprecated = "renamed to `CFURL::resource_is_reachable`"]
2770#[inline]
2771pub unsafe extern "C-unwind" fn CFURLResourceIsReachable(
2772 url: &CFURL,
2773 error: *mut *mut CFError,
2774) -> bool {
2775 extern "C-unwind" {
2776 fn CFURLResourceIsReachable(url: &CFURL, error: *mut *mut CFError) -> Boolean;
2777 }
2778 let ret = unsafe { CFURLResourceIsReachable(url, error) };
2779 ret != 0
2780}
2781
2782#[cfg(all(feature = "CFArray", feature = "CFData", feature = "CFError"))]
2783#[deprecated = "renamed to `CFURL::new_bookmark_data`"]
2784#[inline]
2785pub unsafe extern "C-unwind" fn CFURLCreateBookmarkData(
2786 allocator: Option<&CFAllocator>,
2787 url: Option<&CFURL>,
2788 options: CFURLBookmarkCreationOptions,
2789 resource_properties_to_include: Option<&CFArray>,
2790 relative_to_url: Option<&CFURL>,
2791 error: *mut *mut CFError,
2792) -> Option<CFRetained<CFData>> {
2793 extern "C-unwind" {
2794 fn CFURLCreateBookmarkData(
2795 allocator: Option<&CFAllocator>,
2796 url: Option<&CFURL>,
2797 options: CFURLBookmarkCreationOptions,
2798 resource_properties_to_include: Option<&CFArray>,
2799 relative_to_url: Option<&CFURL>,
2800 error: *mut *mut CFError,
2801 ) -> Option<NonNull<CFData>>;
2802 }
2803 let ret = unsafe {
2804 CFURLCreateBookmarkData(
2805 allocator,
2806 url,
2807 options,
2808 resource_properties_to_include,
2809 relative_to_url,
2810 error,
2811 )
2812 };
2813 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2814}
2815
2816#[cfg(all(feature = "CFArray", feature = "CFData", feature = "CFError"))]
2817#[deprecated = "renamed to `CFURL::new_by_resolving_bookmark_data`"]
2818#[inline]
2819pub unsafe extern "C-unwind" fn CFURLCreateByResolvingBookmarkData(
2820 allocator: Option<&CFAllocator>,
2821 bookmark: Option<&CFData>,
2822 options: CFURLBookmarkResolutionOptions,
2823 relative_to_url: Option<&CFURL>,
2824 resource_properties_to_include: Option<&CFArray>,
2825 is_stale: *mut Boolean,
2826 error: *mut *mut CFError,
2827) -> Option<CFRetained<CFURL>> {
2828 extern "C-unwind" {
2829 fn CFURLCreateByResolvingBookmarkData(
2830 allocator: Option<&CFAllocator>,
2831 bookmark: Option<&CFData>,
2832 options: CFURLBookmarkResolutionOptions,
2833 relative_to_url: Option<&CFURL>,
2834 resource_properties_to_include: Option<&CFArray>,
2835 is_stale: *mut Boolean,
2836 error: *mut *mut CFError,
2837 ) -> Option<NonNull<CFURL>>;
2838 }
2839 let ret = unsafe {
2840 CFURLCreateByResolvingBookmarkData(
2841 allocator,
2842 bookmark,
2843 options,
2844 relative_to_url,
2845 resource_properties_to_include,
2846 is_stale,
2847 error,
2848 )
2849 };
2850 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2851}
2852
2853#[cfg(all(feature = "CFArray", feature = "CFData", feature = "CFDictionary"))]
2854#[deprecated = "renamed to `CFURL::new_resource_properties_for_keys_from_bookmark_data`"]
2855#[inline]
2856pub unsafe extern "C-unwind" fn CFURLCreateResourcePropertiesForKeysFromBookmarkData(
2857 allocator: Option<&CFAllocator>,
2858 resource_properties_to_return: Option<&CFArray>,
2859 bookmark: Option<&CFData>,
2860) -> Option<CFRetained<CFDictionary>> {
2861 extern "C-unwind" {
2862 fn CFURLCreateResourcePropertiesForKeysFromBookmarkData(
2863 allocator: Option<&CFAllocator>,
2864 resource_properties_to_return: Option<&CFArray>,
2865 bookmark: Option<&CFData>,
2866 ) -> Option<NonNull<CFDictionary>>;
2867 }
2868 let ret = unsafe {
2869 CFURLCreateResourcePropertiesForKeysFromBookmarkData(
2870 allocator,
2871 resource_properties_to_return,
2872 bookmark,
2873 )
2874 };
2875 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2876}
2877
2878#[cfg(feature = "CFData")]
2879#[deprecated = "renamed to `CFURL::new_resource_property_for_key_from_bookmark_data`"]
2880#[inline]
2881pub unsafe extern "C-unwind" fn CFURLCreateResourcePropertyForKeyFromBookmarkData(
2882 allocator: Option<&CFAllocator>,
2883 resource_property_key: Option<&CFString>,
2884 bookmark: Option<&CFData>,
2885) -> Option<CFRetained<CFType>> {
2886 extern "C-unwind" {
2887 fn CFURLCreateResourcePropertyForKeyFromBookmarkData(
2888 allocator: Option<&CFAllocator>,
2889 resource_property_key: Option<&CFString>,
2890 bookmark: Option<&CFData>,
2891 ) -> Option<NonNull<CFType>>;
2892 }
2893 let ret = unsafe {
2894 CFURLCreateResourcePropertyForKeyFromBookmarkData(
2895 allocator,
2896 resource_property_key,
2897 bookmark,
2898 )
2899 };
2900 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2901}
2902
2903#[cfg(all(feature = "CFData", feature = "CFError"))]
2904#[deprecated = "renamed to `CFURL::new_bookmark_data_from_file`"]
2905#[inline]
2906pub unsafe extern "C-unwind" fn CFURLCreateBookmarkDataFromFile(
2907 allocator: Option<&CFAllocator>,
2908 file_url: Option<&CFURL>,
2909 error_ref: *mut *mut CFError,
2910) -> Option<CFRetained<CFData>> {
2911 extern "C-unwind" {
2912 fn CFURLCreateBookmarkDataFromFile(
2913 allocator: Option<&CFAllocator>,
2914 file_url: Option<&CFURL>,
2915 error_ref: *mut *mut CFError,
2916 ) -> Option<NonNull<CFData>>;
2917 }
2918 let ret = unsafe { CFURLCreateBookmarkDataFromFile(allocator, file_url, error_ref) };
2919 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2920}
2921
2922#[cfg(all(feature = "CFData", feature = "CFError"))]
2923#[deprecated = "renamed to `CFURL::write_bookmark_data_to_file`"]
2924#[inline]
2925pub unsafe extern "C-unwind" fn CFURLWriteBookmarkDataToFile(
2926 bookmark_ref: Option<&CFData>,
2927 file_url: Option<&CFURL>,
2928 options: CFURLBookmarkFileCreationOptions,
2929 error_ref: *mut *mut CFError,
2930) -> bool {
2931 extern "C-unwind" {
2932 fn CFURLWriteBookmarkDataToFile(
2933 bookmark_ref: Option<&CFData>,
2934 file_url: Option<&CFURL>,
2935 options: CFURLBookmarkFileCreationOptions,
2936 error_ref: *mut *mut CFError,
2937 ) -> Boolean;
2938 }
2939 let ret = unsafe { CFURLWriteBookmarkDataToFile(bookmark_ref, file_url, options, error_ref) };
2940 ret != 0
2941}
2942
2943#[cfg(feature = "CFData")]
2944#[deprecated = "renamed to `CFURL::new_bookmark_data_from_alias_record`"]
2945#[inline]
2946pub unsafe extern "C-unwind" fn CFURLCreateBookmarkDataFromAliasRecord(
2947 allocator_ref: Option<&CFAllocator>,
2948 alias_record_data_ref: Option<&CFData>,
2949) -> Option<CFRetained<CFData>> {
2950 extern "C-unwind" {
2951 fn CFURLCreateBookmarkDataFromAliasRecord(
2952 allocator_ref: Option<&CFAllocator>,
2953 alias_record_data_ref: Option<&CFData>,
2954 ) -> Option<NonNull<CFData>>;
2955 }
2956 let ret =
2957 unsafe { CFURLCreateBookmarkDataFromAliasRecord(allocator_ref, alias_record_data_ref) };
2958 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2959}
2960
2961#[deprecated = "renamed to `CFURL::start_accessing_security_scoped_resource`"]
2962#[inline]
2963pub unsafe extern "C-unwind" fn CFURLStartAccessingSecurityScopedResource(url: &CFURL) -> bool {
2964 extern "C-unwind" {
2965 fn CFURLStartAccessingSecurityScopedResource(url: &CFURL) -> Boolean;
2966 }
2967 let ret = unsafe { CFURLStartAccessingSecurityScopedResource(url) };
2968 ret != 0
2969}
2970
2971extern "C-unwind" {
2972 #[deprecated = "renamed to `CFURL::stop_accessing_security_scoped_resource`"]
2973 pub fn CFURLStopAccessingSecurityScopedResource(url: &CFURL);
2974}