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