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#[cfg(feature = "CFBase")]
15#[repr(transparent)]
16#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
17pub struct CFURLPathStyle(pub CFIndex);
18#[cfg(feature = "CFBase")]
19impl CFURLPathStyle {
20 #[doc(alias = "kCFURLPOSIXPathStyle")]
21 pub const CFURLPOSIXPathStyle: Self = Self(0);
22 #[deprecated = "Carbon File Manager is deprecated, use kCFURLPOSIXPathStyle where possible"]
23 #[doc(alias = "kCFURLHFSPathStyle")]
24 pub const CFURLHFSPathStyle: Self = Self(1);
25 #[doc(alias = "kCFURLWindowsPathStyle")]
26 pub const CFURLWindowsPathStyle: Self = Self(2);
27}
28
29#[cfg(all(feature = "CFBase", feature = "objc2"))]
30unsafe impl Encode for CFURLPathStyle {
31 const ENCODING: Encoding = CFIndex::ENCODING;
32}
33
34#[cfg(all(feature = "CFBase", feature = "objc2"))]
35unsafe impl RefEncode for CFURLPathStyle {
36 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
37}
38
39#[repr(C)]
41pub struct CFURL {
42 inner: [u8; 0],
43 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
44}
45
46cf_type!(
47 #[encoding_name = "__CFURL"]
48 unsafe impl CFURL {}
49);
50
51#[cfg(feature = "CFBase")]
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
63#[cfg(all(feature = "CFBase", feature = "CFString"))]
64#[inline]
65pub unsafe extern "C-unwind" fn CFURLCreateWithBytes(
66 allocator: Option<&CFAllocator>,
67 url_bytes: *const u8,
68 length: CFIndex,
69 encoding: CFStringEncoding,
70 base_url: Option<&CFURL>,
71) -> Option<CFRetained<CFURL>> {
72 extern "C-unwind" {
73 fn CFURLCreateWithBytes(
74 allocator: Option<&CFAllocator>,
75 url_bytes: *const u8,
76 length: CFIndex,
77 encoding: CFStringEncoding,
78 base_url: Option<&CFURL>,
79 ) -> Option<NonNull<CFURL>>;
80 }
81 let ret = unsafe { CFURLCreateWithBytes(allocator, url_bytes, length, encoding, base_url) };
82 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
83}
84
85#[cfg(all(feature = "CFBase", feature = "CFData", feature = "CFString"))]
86#[inline]
87pub unsafe extern "C-unwind" fn CFURLCreateData(
88 allocator: Option<&CFAllocator>,
89 url: Option<&CFURL>,
90 encoding: CFStringEncoding,
91 escape_whitespace: bool,
92) -> Option<CFRetained<CFData>> {
93 extern "C-unwind" {
94 fn CFURLCreateData(
95 allocator: Option<&CFAllocator>,
96 url: Option<&CFURL>,
97 encoding: CFStringEncoding,
98 escape_whitespace: Boolean,
99 ) -> Option<NonNull<CFData>>;
100 }
101 let ret = unsafe { CFURLCreateData(allocator, url, encoding, escape_whitespace as _) };
102 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
103}
104
105#[cfg(feature = "CFBase")]
106#[inline]
107pub unsafe extern "C-unwind" fn CFURLCreateWithString(
108 allocator: Option<&CFAllocator>,
109 url_string: Option<&CFString>,
110 base_url: Option<&CFURL>,
111) -> Option<CFRetained<CFURL>> {
112 extern "C-unwind" {
113 fn CFURLCreateWithString(
114 allocator: Option<&CFAllocator>,
115 url_string: Option<&CFString>,
116 base_url: Option<&CFURL>,
117 ) -> Option<NonNull<CFURL>>;
118 }
119 let ret = unsafe { CFURLCreateWithString(allocator, url_string, base_url) };
120 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
121}
122
123#[cfg(all(feature = "CFBase", feature = "CFString"))]
124#[inline]
125pub unsafe extern "C-unwind" fn CFURLCreateAbsoluteURLWithBytes(
126 alloc: Option<&CFAllocator>,
127 relative_url_bytes: *const u8,
128 length: CFIndex,
129 encoding: CFStringEncoding,
130 base_url: Option<&CFURL>,
131 use_compatibility_mode: bool,
132) -> Option<CFRetained<CFURL>> {
133 extern "C-unwind" {
134 fn CFURLCreateAbsoluteURLWithBytes(
135 alloc: Option<&CFAllocator>,
136 relative_url_bytes: *const u8,
137 length: CFIndex,
138 encoding: CFStringEncoding,
139 base_url: Option<&CFURL>,
140 use_compatibility_mode: Boolean,
141 ) -> Option<NonNull<CFURL>>;
142 }
143 let ret = unsafe {
144 CFURLCreateAbsoluteURLWithBytes(
145 alloc,
146 relative_url_bytes,
147 length,
148 encoding,
149 base_url,
150 use_compatibility_mode as _,
151 )
152 };
153 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
154}
155
156#[cfg(feature = "CFBase")]
157#[inline]
158pub unsafe extern "C-unwind" fn CFURLCreateWithFileSystemPath(
159 allocator: Option<&CFAllocator>,
160 file_path: Option<&CFString>,
161 path_style: CFURLPathStyle,
162 is_directory: bool,
163) -> Option<CFRetained<CFURL>> {
164 extern "C-unwind" {
165 fn CFURLCreateWithFileSystemPath(
166 allocator: Option<&CFAllocator>,
167 file_path: Option<&CFString>,
168 path_style: CFURLPathStyle,
169 is_directory: Boolean,
170 ) -> Option<NonNull<CFURL>>;
171 }
172 let ret = unsafe {
173 CFURLCreateWithFileSystemPath(allocator, file_path, path_style, is_directory as _)
174 };
175 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
176}
177
178#[cfg(feature = "CFBase")]
179#[inline]
180pub unsafe extern "C-unwind" fn CFURLCreateFromFileSystemRepresentation(
181 allocator: Option<&CFAllocator>,
182 buffer: *const u8,
183 buf_len: CFIndex,
184 is_directory: bool,
185) -> Option<CFRetained<CFURL>> {
186 extern "C-unwind" {
187 fn CFURLCreateFromFileSystemRepresentation(
188 allocator: Option<&CFAllocator>,
189 buffer: *const u8,
190 buf_len: CFIndex,
191 is_directory: Boolean,
192 ) -> Option<NonNull<CFURL>>;
193 }
194 let ret = unsafe {
195 CFURLCreateFromFileSystemRepresentation(allocator, buffer, buf_len, is_directory as _)
196 };
197 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
198}
199
200#[cfg(feature = "CFBase")]
201#[inline]
202pub unsafe extern "C-unwind" fn CFURLCreateWithFileSystemPathRelativeToBase(
203 allocator: Option<&CFAllocator>,
204 file_path: Option<&CFString>,
205 path_style: CFURLPathStyle,
206 is_directory: bool,
207 base_url: Option<&CFURL>,
208) -> Option<CFRetained<CFURL>> {
209 extern "C-unwind" {
210 fn CFURLCreateWithFileSystemPathRelativeToBase(
211 allocator: Option<&CFAllocator>,
212 file_path: Option<&CFString>,
213 path_style: CFURLPathStyle,
214 is_directory: Boolean,
215 base_url: Option<&CFURL>,
216 ) -> Option<NonNull<CFURL>>;
217 }
218 let ret = unsafe {
219 CFURLCreateWithFileSystemPathRelativeToBase(
220 allocator,
221 file_path,
222 path_style,
223 is_directory as _,
224 base_url,
225 )
226 };
227 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
228}
229
230#[cfg(feature = "CFBase")]
231#[inline]
232pub unsafe extern "C-unwind" fn CFURLCreateFromFileSystemRepresentationRelativeToBase(
233 allocator: Option<&CFAllocator>,
234 buffer: *const u8,
235 buf_len: CFIndex,
236 is_directory: bool,
237 base_url: Option<&CFURL>,
238) -> Option<CFRetained<CFURL>> {
239 extern "C-unwind" {
240 fn CFURLCreateFromFileSystemRepresentationRelativeToBase(
241 allocator: Option<&CFAllocator>,
242 buffer: *const u8,
243 buf_len: CFIndex,
244 is_directory: Boolean,
245 base_url: Option<&CFURL>,
246 ) -> Option<NonNull<CFURL>>;
247 }
248 let ret = unsafe {
249 CFURLCreateFromFileSystemRepresentationRelativeToBase(
250 allocator,
251 buffer,
252 buf_len,
253 is_directory as _,
254 base_url,
255 )
256 };
257 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
258}
259
260#[cfg(feature = "CFBase")]
261#[inline]
262pub unsafe extern "C-unwind" fn CFURLGetFileSystemRepresentation(
263 url: &CFURL,
264 resolve_against_base: bool,
265 buffer: *mut u8,
266 max_buf_len: CFIndex,
267) -> bool {
268 extern "C-unwind" {
269 fn CFURLGetFileSystemRepresentation(
270 url: &CFURL,
271 resolve_against_base: Boolean,
272 buffer: *mut u8,
273 max_buf_len: CFIndex,
274 ) -> Boolean;
275 }
276 let ret = unsafe {
277 CFURLGetFileSystemRepresentation(url, resolve_against_base as _, buffer, max_buf_len)
278 };
279 ret != 0
280}
281
282#[inline]
283pub unsafe extern "C-unwind" fn CFURLCopyAbsoluteURL(
284 relative_url: &CFURL,
285) -> Option<CFRetained<CFURL>> {
286 extern "C-unwind" {
287 fn CFURLCopyAbsoluteURL(relative_url: &CFURL) -> Option<NonNull<CFURL>>;
288 }
289 let ret = unsafe { CFURLCopyAbsoluteURL(relative_url) };
290 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
291}
292
293#[cfg(feature = "CFBase")]
294#[inline]
295pub unsafe extern "C-unwind" fn CFURLGetString(an_url: &CFURL) -> Option<CFRetained<CFString>> {
296 extern "C-unwind" {
297 fn CFURLGetString(an_url: &CFURL) -> Option<NonNull<CFString>>;
298 }
299 let ret = unsafe { CFURLGetString(an_url) };
300 ret.map(|ret| unsafe { CFRetained::retain(ret) })
301}
302
303#[inline]
304pub unsafe extern "C-unwind" fn CFURLGetBaseURL(an_url: &CFURL) -> Option<CFRetained<CFURL>> {
305 extern "C-unwind" {
306 fn CFURLGetBaseURL(an_url: &CFURL) -> Option<NonNull<CFURL>>;
307 }
308 let ret = unsafe { CFURLGetBaseURL(an_url) };
309 ret.map(|ret| unsafe { CFRetained::retain(ret) })
310}
311
312#[inline]
313pub unsafe extern "C-unwind" fn CFURLCanBeDecomposed(an_url: &CFURL) -> bool {
314 extern "C-unwind" {
315 fn CFURLCanBeDecomposed(an_url: &CFURL) -> Boolean;
316 }
317 let ret = unsafe { CFURLCanBeDecomposed(an_url) };
318 ret != 0
319}
320
321#[cfg(feature = "CFBase")]
322#[inline]
323pub unsafe extern "C-unwind" fn CFURLCopyScheme(an_url: &CFURL) -> Option<CFRetained<CFString>> {
324 extern "C-unwind" {
325 fn CFURLCopyScheme(an_url: &CFURL) -> Option<NonNull<CFString>>;
326 }
327 let ret = unsafe { CFURLCopyScheme(an_url) };
328 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
329}
330
331#[cfg(feature = "CFBase")]
332#[inline]
333pub unsafe extern "C-unwind" fn CFURLCopyNetLocation(
334 an_url: &CFURL,
335) -> Option<CFRetained<CFString>> {
336 extern "C-unwind" {
337 fn CFURLCopyNetLocation(an_url: &CFURL) -> Option<NonNull<CFString>>;
338 }
339 let ret = unsafe { CFURLCopyNetLocation(an_url) };
340 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
341}
342
343#[cfg(feature = "CFBase")]
344#[inline]
345pub unsafe extern "C-unwind" fn CFURLCopyPath(an_url: &CFURL) -> Option<CFRetained<CFString>> {
346 extern "C-unwind" {
347 fn CFURLCopyPath(an_url: &CFURL) -> Option<NonNull<CFString>>;
348 }
349 let ret = unsafe { CFURLCopyPath(an_url) };
350 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
351}
352
353#[cfg(feature = "CFBase")]
354#[inline]
355pub unsafe extern "C-unwind" fn CFURLCopyStrictPath(
356 an_url: &CFURL,
357 is_absolute: *mut Boolean,
358) -> Option<CFRetained<CFString>> {
359 extern "C-unwind" {
360 fn CFURLCopyStrictPath(
361 an_url: &CFURL,
362 is_absolute: *mut Boolean,
363 ) -> Option<NonNull<CFString>>;
364 }
365 let ret = unsafe { CFURLCopyStrictPath(an_url, is_absolute) };
366 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
367}
368
369#[cfg(feature = "CFBase")]
370#[inline]
371pub unsafe extern "C-unwind" fn CFURLCopyFileSystemPath(
372 an_url: &CFURL,
373 path_style: CFURLPathStyle,
374) -> Option<CFRetained<CFString>> {
375 extern "C-unwind" {
376 fn CFURLCopyFileSystemPath(
377 an_url: &CFURL,
378 path_style: CFURLPathStyle,
379 ) -> Option<NonNull<CFString>>;
380 }
381 let ret = unsafe { CFURLCopyFileSystemPath(an_url, path_style) };
382 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
383}
384
385#[inline]
386pub unsafe extern "C-unwind" fn CFURLHasDirectoryPath(an_url: &CFURL) -> bool {
387 extern "C-unwind" {
388 fn CFURLHasDirectoryPath(an_url: &CFURL) -> Boolean;
389 }
390 let ret = unsafe { CFURLHasDirectoryPath(an_url) };
391 ret != 0
392}
393
394#[cfg(feature = "CFBase")]
395#[inline]
396pub unsafe extern "C-unwind" fn CFURLCopyResourceSpecifier(
397 an_url: &CFURL,
398) -> Option<CFRetained<CFString>> {
399 extern "C-unwind" {
400 fn CFURLCopyResourceSpecifier(an_url: &CFURL) -> Option<NonNull<CFString>>;
401 }
402 let ret = unsafe { CFURLCopyResourceSpecifier(an_url) };
403 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
404}
405
406#[cfg(feature = "CFBase")]
407#[inline]
408pub unsafe extern "C-unwind" fn CFURLCopyHostName(an_url: &CFURL) -> Option<CFRetained<CFString>> {
409 extern "C-unwind" {
410 fn CFURLCopyHostName(an_url: &CFURL) -> Option<NonNull<CFString>>;
411 }
412 let ret = unsafe { CFURLCopyHostName(an_url) };
413 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
414}
415
416extern "C-unwind" {
417 pub fn CFURLGetPortNumber(an_url: &CFURL) -> i32;
418}
419
420#[cfg(feature = "CFBase")]
421#[inline]
422pub unsafe extern "C-unwind" fn CFURLCopyUserName(an_url: &CFURL) -> Option<CFRetained<CFString>> {
423 extern "C-unwind" {
424 fn CFURLCopyUserName(an_url: &CFURL) -> Option<NonNull<CFString>>;
425 }
426 let ret = unsafe { CFURLCopyUserName(an_url) };
427 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
428}
429
430#[cfg(feature = "CFBase")]
431#[inline]
432pub unsafe extern "C-unwind" fn CFURLCopyPassword(an_url: &CFURL) -> Option<CFRetained<CFString>> {
433 extern "C-unwind" {
434 fn CFURLCopyPassword(an_url: &CFURL) -> Option<NonNull<CFString>>;
435 }
436 let ret = unsafe { CFURLCopyPassword(an_url) };
437 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
438}
439
440#[cfg(feature = "CFBase")]
441#[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."]
442#[inline]
443pub unsafe extern "C-unwind" fn CFURLCopyParameterString(
444 an_url: &CFURL,
445 characters_to_leave_escaped: Option<&CFString>,
446) -> Option<CFRetained<CFString>> {
447 extern "C-unwind" {
448 fn CFURLCopyParameterString(
449 an_url: &CFURL,
450 characters_to_leave_escaped: Option<&CFString>,
451 ) -> Option<NonNull<CFString>>;
452 }
453 let ret = unsafe { CFURLCopyParameterString(an_url, characters_to_leave_escaped) };
454 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
455}
456
457#[cfg(feature = "CFBase")]
458#[inline]
459pub unsafe extern "C-unwind" fn CFURLCopyQueryString(
460 an_url: &CFURL,
461 characters_to_leave_escaped: Option<&CFString>,
462) -> Option<CFRetained<CFString>> {
463 extern "C-unwind" {
464 fn CFURLCopyQueryString(
465 an_url: &CFURL,
466 characters_to_leave_escaped: Option<&CFString>,
467 ) -> Option<NonNull<CFString>>;
468 }
469 let ret = unsafe { CFURLCopyQueryString(an_url, characters_to_leave_escaped) };
470 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
471}
472
473#[cfg(feature = "CFBase")]
474#[inline]
475pub unsafe extern "C-unwind" fn CFURLCopyFragment(
476 an_url: &CFURL,
477 characters_to_leave_escaped: Option<&CFString>,
478) -> Option<CFRetained<CFString>> {
479 extern "C-unwind" {
480 fn CFURLCopyFragment(
481 an_url: &CFURL,
482 characters_to_leave_escaped: Option<&CFString>,
483 ) -> Option<NonNull<CFString>>;
484 }
485 let ret = unsafe { CFURLCopyFragment(an_url, characters_to_leave_escaped) };
486 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
487}
488
489#[cfg(feature = "CFBase")]
490#[inline]
491pub unsafe extern "C-unwind" fn CFURLCopyLastPathComponent(
492 url: &CFURL,
493) -> Option<CFRetained<CFString>> {
494 extern "C-unwind" {
495 fn CFURLCopyLastPathComponent(url: &CFURL) -> Option<NonNull<CFString>>;
496 }
497 let ret = unsafe { CFURLCopyLastPathComponent(url) };
498 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
499}
500
501#[cfg(feature = "CFBase")]
502#[inline]
503pub unsafe extern "C-unwind" fn CFURLCopyPathExtension(
504 url: &CFURL,
505) -> Option<CFRetained<CFString>> {
506 extern "C-unwind" {
507 fn CFURLCopyPathExtension(url: &CFURL) -> Option<NonNull<CFString>>;
508 }
509 let ret = unsafe { CFURLCopyPathExtension(url) };
510 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
511}
512
513#[cfg(feature = "CFBase")]
514#[inline]
515pub unsafe extern "C-unwind" fn CFURLCreateCopyAppendingPathComponent(
516 allocator: Option<&CFAllocator>,
517 url: Option<&CFURL>,
518 path_component: Option<&CFString>,
519 is_directory: bool,
520) -> Option<CFRetained<CFURL>> {
521 extern "C-unwind" {
522 fn CFURLCreateCopyAppendingPathComponent(
523 allocator: Option<&CFAllocator>,
524 url: Option<&CFURL>,
525 path_component: Option<&CFString>,
526 is_directory: Boolean,
527 ) -> Option<NonNull<CFURL>>;
528 }
529 let ret = unsafe {
530 CFURLCreateCopyAppendingPathComponent(allocator, url, path_component, is_directory as _)
531 };
532 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
533}
534
535#[cfg(feature = "CFBase")]
536#[inline]
537pub unsafe extern "C-unwind" fn CFURLCreateCopyDeletingLastPathComponent(
538 allocator: Option<&CFAllocator>,
539 url: Option<&CFURL>,
540) -> Option<CFRetained<CFURL>> {
541 extern "C-unwind" {
542 fn CFURLCreateCopyDeletingLastPathComponent(
543 allocator: Option<&CFAllocator>,
544 url: Option<&CFURL>,
545 ) -> Option<NonNull<CFURL>>;
546 }
547 let ret = unsafe { CFURLCreateCopyDeletingLastPathComponent(allocator, url) };
548 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
549}
550
551#[cfg(feature = "CFBase")]
552#[inline]
553pub unsafe extern "C-unwind" fn CFURLCreateCopyAppendingPathExtension(
554 allocator: Option<&CFAllocator>,
555 url: Option<&CFURL>,
556 extension: Option<&CFString>,
557) -> Option<CFRetained<CFURL>> {
558 extern "C-unwind" {
559 fn CFURLCreateCopyAppendingPathExtension(
560 allocator: Option<&CFAllocator>,
561 url: Option<&CFURL>,
562 extension: Option<&CFString>,
563 ) -> Option<NonNull<CFURL>>;
564 }
565 let ret = unsafe { CFURLCreateCopyAppendingPathExtension(allocator, url, extension) };
566 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
567}
568
569#[cfg(feature = "CFBase")]
570#[inline]
571pub unsafe extern "C-unwind" fn CFURLCreateCopyDeletingPathExtension(
572 allocator: Option<&CFAllocator>,
573 url: Option<&CFURL>,
574) -> Option<CFRetained<CFURL>> {
575 extern "C-unwind" {
576 fn CFURLCreateCopyDeletingPathExtension(
577 allocator: Option<&CFAllocator>,
578 url: Option<&CFURL>,
579 ) -> Option<NonNull<CFURL>>;
580 }
581 let ret = unsafe { CFURLCreateCopyDeletingPathExtension(allocator, url) };
582 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
583}
584
585extern "C-unwind" {
586 #[cfg(feature = "CFBase")]
587 pub fn CFURLGetBytes(url: &CFURL, buffer: *mut u8, buffer_length: CFIndex) -> CFIndex;
588}
589
590#[cfg(feature = "CFBase")]
593#[repr(transparent)]
594#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
595pub struct CFURLComponentType(pub CFIndex);
596#[cfg(feature = "CFBase")]
597impl CFURLComponentType {
598 #[doc(alias = "kCFURLComponentScheme")]
599 pub const Scheme: Self = Self(1);
600 #[doc(alias = "kCFURLComponentNetLocation")]
601 pub const NetLocation: Self = Self(2);
602 #[doc(alias = "kCFURLComponentPath")]
603 pub const Path: Self = Self(3);
604 #[doc(alias = "kCFURLComponentResourceSpecifier")]
605 pub const ResourceSpecifier: Self = Self(4);
606 #[doc(alias = "kCFURLComponentUser")]
607 pub const User: Self = Self(5);
608 #[doc(alias = "kCFURLComponentPassword")]
609 pub const Password: Self = Self(6);
610 #[doc(alias = "kCFURLComponentUserInfo")]
611 pub const UserInfo: Self = Self(7);
612 #[doc(alias = "kCFURLComponentHost")]
613 pub const Host: Self = Self(8);
614 #[doc(alias = "kCFURLComponentPort")]
615 pub const Port: Self = Self(9);
616 #[doc(alias = "kCFURLComponentParameterString")]
617 pub const ParameterString: Self = Self(10);
618 #[doc(alias = "kCFURLComponentQuery")]
619 pub const Query: Self = Self(11);
620 #[doc(alias = "kCFURLComponentFragment")]
621 pub const Fragment: Self = Self(12);
622}
623
624#[cfg(all(feature = "CFBase", feature = "objc2"))]
625unsafe impl Encode for CFURLComponentType {
626 const ENCODING: Encoding = CFIndex::ENCODING;
627}
628
629#[cfg(all(feature = "CFBase", feature = "objc2"))]
630unsafe impl RefEncode for CFURLComponentType {
631 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
632}
633
634extern "C-unwind" {
635 #[cfg(feature = "CFBase")]
636 pub fn CFURLGetByteRangeForComponent(
637 url: &CFURL,
638 component: CFURLComponentType,
639 range_including_separators: *mut CFRange,
640 ) -> CFRange;
641}
642
643#[cfg(feature = "CFBase")]
644#[inline]
645pub unsafe extern "C-unwind" fn CFURLCreateStringByReplacingPercentEscapes(
646 allocator: Option<&CFAllocator>,
647 original_string: Option<&CFString>,
648 characters_to_leave_escaped: Option<&CFString>,
649) -> Option<CFRetained<CFString>> {
650 extern "C-unwind" {
651 fn CFURLCreateStringByReplacingPercentEscapes(
652 allocator: Option<&CFAllocator>,
653 original_string: Option<&CFString>,
654 characters_to_leave_escaped: Option<&CFString>,
655 ) -> Option<NonNull<CFString>>;
656 }
657 let ret = unsafe {
658 CFURLCreateStringByReplacingPercentEscapes(
659 allocator,
660 original_string,
661 characters_to_leave_escaped,
662 )
663 };
664 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
665}
666
667#[cfg(all(feature = "CFBase", feature = "CFString"))]
668#[deprecated = "Use [NSString stringByRemovingPercentEncoding] or CFURLCreateStringByReplacingPercentEscapes() instead, which always uses the recommended UTF-8 encoding."]
669#[inline]
670pub unsafe extern "C-unwind" fn CFURLCreateStringByReplacingPercentEscapesUsingEncoding(
671 allocator: Option<&CFAllocator>,
672 orig_string: Option<&CFString>,
673 chars_to_leave_escaped: Option<&CFString>,
674 encoding: CFStringEncoding,
675) -> Option<CFRetained<CFString>> {
676 extern "C-unwind" {
677 fn CFURLCreateStringByReplacingPercentEscapesUsingEncoding(
678 allocator: Option<&CFAllocator>,
679 orig_string: Option<&CFString>,
680 chars_to_leave_escaped: Option<&CFString>,
681 encoding: CFStringEncoding,
682 ) -> Option<NonNull<CFString>>;
683 }
684 let ret = unsafe {
685 CFURLCreateStringByReplacingPercentEscapesUsingEncoding(
686 allocator,
687 orig_string,
688 chars_to_leave_escaped,
689 encoding,
690 )
691 };
692 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
693}
694
695#[cfg(all(feature = "CFBase", feature = "CFString"))]
696#[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)."]
697#[inline]
698pub unsafe extern "C-unwind" fn CFURLCreateStringByAddingPercentEscapes(
699 allocator: Option<&CFAllocator>,
700 original_string: Option<&CFString>,
701 characters_to_leave_unescaped: Option<&CFString>,
702 legal_url_characters_to_be_escaped: Option<&CFString>,
703 encoding: CFStringEncoding,
704) -> Option<CFRetained<CFString>> {
705 extern "C-unwind" {
706 fn CFURLCreateStringByAddingPercentEscapes(
707 allocator: Option<&CFAllocator>,
708 original_string: Option<&CFString>,
709 characters_to_leave_unescaped: Option<&CFString>,
710 legal_url_characters_to_be_escaped: Option<&CFString>,
711 encoding: CFStringEncoding,
712 ) -> Option<NonNull<CFString>>;
713 }
714 let ret = unsafe {
715 CFURLCreateStringByAddingPercentEscapes(
716 allocator,
717 original_string,
718 characters_to_leave_unescaped,
719 legal_url_characters_to_be_escaped,
720 encoding,
721 )
722 };
723 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
724}
725
726#[inline]
727pub unsafe extern "C-unwind" fn CFURLIsFileReferenceURL(url: &CFURL) -> bool {
728 extern "C-unwind" {
729 fn CFURLIsFileReferenceURL(url: &CFURL) -> Boolean;
730 }
731 let ret = unsafe { CFURLIsFileReferenceURL(url) };
732 ret != 0
733}
734
735#[cfg(all(feature = "CFBase", feature = "CFError"))]
736#[inline]
737pub unsafe extern "C-unwind" fn CFURLCreateFileReferenceURL(
738 allocator: Option<&CFAllocator>,
739 url: Option<&CFURL>,
740 error: *mut *mut CFError,
741) -> Option<CFRetained<CFURL>> {
742 extern "C-unwind" {
743 fn CFURLCreateFileReferenceURL(
744 allocator: Option<&CFAllocator>,
745 url: Option<&CFURL>,
746 error: *mut *mut CFError,
747 ) -> Option<NonNull<CFURL>>;
748 }
749 let ret = unsafe { CFURLCreateFileReferenceURL(allocator, url, error) };
750 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
751}
752
753#[cfg(all(feature = "CFBase", feature = "CFError"))]
754#[inline]
755pub unsafe extern "C-unwind" fn CFURLCreateFilePathURL(
756 allocator: Option<&CFAllocator>,
757 url: Option<&CFURL>,
758 error: *mut *mut CFError,
759) -> Option<CFRetained<CFURL>> {
760 extern "C-unwind" {
761 fn CFURLCreateFilePathURL(
762 allocator: Option<&CFAllocator>,
763 url: Option<&CFURL>,
764 error: *mut *mut CFError,
765 ) -> Option<NonNull<CFURL>>;
766 }
767 let ret = unsafe { CFURLCreateFilePathURL(allocator, url, error) };
768 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
769}
770
771#[cfg(all(feature = "CFBase", feature = "CFError"))]
772#[inline]
773pub unsafe extern "C-unwind" fn CFURLCopyResourcePropertyForKey(
774 url: &CFURL,
775 key: Option<&CFString>,
776 property_value_type_ref_ptr: *mut c_void,
777 error: *mut *mut CFError,
778) -> bool {
779 extern "C-unwind" {
780 fn CFURLCopyResourcePropertyForKey(
781 url: &CFURL,
782 key: Option<&CFString>,
783 property_value_type_ref_ptr: *mut c_void,
784 error: *mut *mut CFError,
785 ) -> Boolean;
786 }
787 let ret =
788 unsafe { CFURLCopyResourcePropertyForKey(url, key, property_value_type_ref_ptr, error) };
789 ret != 0
790}
791
792#[cfg(all(feature = "CFArray", feature = "CFDictionary", feature = "CFError"))]
793#[inline]
794pub unsafe extern "C-unwind" fn CFURLCopyResourcePropertiesForKeys(
795 url: &CFURL,
796 keys: Option<&CFArray>,
797 error: *mut *mut CFError,
798) -> Option<CFRetained<CFDictionary>> {
799 extern "C-unwind" {
800 fn CFURLCopyResourcePropertiesForKeys(
801 url: &CFURL,
802 keys: Option<&CFArray>,
803 error: *mut *mut CFError,
804 ) -> Option<NonNull<CFDictionary>>;
805 }
806 let ret = unsafe { CFURLCopyResourcePropertiesForKeys(url, keys, error) };
807 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
808}
809
810#[cfg(all(feature = "CFBase", feature = "CFError"))]
811#[inline]
812pub unsafe extern "C-unwind" fn CFURLSetResourcePropertyForKey(
813 url: &CFURL,
814 key: Option<&CFString>,
815 property_value: Option<&CFType>,
816 error: *mut *mut CFError,
817) -> bool {
818 extern "C-unwind" {
819 fn CFURLSetResourcePropertyForKey(
820 url: &CFURL,
821 key: Option<&CFString>,
822 property_value: Option<&CFType>,
823 error: *mut *mut CFError,
824 ) -> Boolean;
825 }
826 let ret = unsafe { CFURLSetResourcePropertyForKey(url, key, property_value, error) };
827 ret != 0
828}
829
830#[cfg(all(feature = "CFDictionary", feature = "CFError"))]
831#[inline]
832pub unsafe extern "C-unwind" fn CFURLSetResourcePropertiesForKeys(
833 url: &CFURL,
834 keyed_property_values: Option<&CFDictionary>,
835 error: *mut *mut CFError,
836) -> bool {
837 extern "C-unwind" {
838 fn CFURLSetResourcePropertiesForKeys(
839 url: &CFURL,
840 keyed_property_values: Option<&CFDictionary>,
841 error: *mut *mut CFError,
842 ) -> Boolean;
843 }
844 let ret = unsafe { CFURLSetResourcePropertiesForKeys(url, keyed_property_values, error) };
845 ret != 0
846}
847
848extern "C" {
849 #[cfg(feature = "CFBase")]
851 pub static kCFURLKeysOfUnsetValuesKey: Option<&'static CFString>;
852}
853
854extern "C-unwind" {
855 #[cfg(feature = "CFBase")]
856 pub fn CFURLClearResourcePropertyCacheForKey(url: &CFURL, key: Option<&CFString>);
857}
858
859extern "C-unwind" {
860 pub fn CFURLClearResourcePropertyCache(url: &CFURL);
861}
862
863extern "C-unwind" {
864 #[cfg(feature = "CFBase")]
865 pub fn CFURLSetTemporaryResourcePropertyForKey(
866 url: &CFURL,
867 key: Option<&CFString>,
868 property_value: Option<&CFType>,
869 );
870}
871
872#[cfg(feature = "CFError")]
873#[inline]
874pub unsafe extern "C-unwind" fn CFURLResourceIsReachable(
875 url: &CFURL,
876 error: *mut *mut CFError,
877) -> bool {
878 extern "C-unwind" {
879 fn CFURLResourceIsReachable(url: &CFURL, error: *mut *mut CFError) -> Boolean;
880 }
881 let ret = unsafe { CFURLResourceIsReachable(url, error) };
882 ret != 0
883}
884
885extern "C" {
886 #[cfg(feature = "CFBase")]
888 pub static kCFURLNameKey: Option<&'static CFString>;
889}
890
891extern "C" {
892 #[cfg(feature = "CFBase")]
894 pub static kCFURLLocalizedNameKey: Option<&'static CFString>;
895}
896
897extern "C" {
898 #[cfg(feature = "CFBase")]
900 pub static kCFURLIsRegularFileKey: Option<&'static CFString>;
901}
902
903extern "C" {
904 #[cfg(feature = "CFBase")]
906 pub static kCFURLIsDirectoryKey: Option<&'static CFString>;
907}
908
909extern "C" {
910 #[cfg(feature = "CFBase")]
912 pub static kCFURLIsSymbolicLinkKey: Option<&'static CFString>;
913}
914
915extern "C" {
916 #[cfg(feature = "CFBase")]
918 pub static kCFURLIsVolumeKey: Option<&'static CFString>;
919}
920
921extern "C" {
922 #[cfg(feature = "CFBase")]
924 pub static kCFURLIsPackageKey: Option<&'static CFString>;
925}
926
927extern "C" {
928 #[cfg(feature = "CFBase")]
930 pub static kCFURLIsApplicationKey: Option<&'static CFString>;
931}
932
933extern "C" {
934 #[cfg(feature = "CFBase")]
936 pub static kCFURLApplicationIsScriptableKey: Option<&'static CFString>;
937}
938
939extern "C" {
940 #[cfg(feature = "CFBase")]
942 pub static kCFURLIsSystemImmutableKey: Option<&'static CFString>;
943}
944
945extern "C" {
946 #[cfg(feature = "CFBase")]
948 pub static kCFURLIsUserImmutableKey: Option<&'static CFString>;
949}
950
951extern "C" {
952 #[cfg(feature = "CFBase")]
954 pub static kCFURLIsHiddenKey: Option<&'static CFString>;
955}
956
957extern "C" {
958 #[cfg(feature = "CFBase")]
960 pub static kCFURLHasHiddenExtensionKey: Option<&'static CFString>;
961}
962
963extern "C" {
964 #[cfg(feature = "CFBase")]
966 pub static kCFURLCreationDateKey: Option<&'static CFString>;
967}
968
969extern "C" {
970 #[cfg(feature = "CFBase")]
972 pub static kCFURLContentAccessDateKey: Option<&'static CFString>;
973}
974
975extern "C" {
976 #[cfg(feature = "CFBase")]
978 pub static kCFURLContentModificationDateKey: Option<&'static CFString>;
979}
980
981extern "C" {
982 #[cfg(feature = "CFBase")]
984 pub static kCFURLAttributeModificationDateKey: Option<&'static CFString>;
985}
986
987extern "C" {
988 #[cfg(feature = "CFBase")]
990 pub static kCFURLFileIdentifierKey: Option<&'static CFString>;
991}
992
993extern "C" {
994 #[cfg(feature = "CFBase")]
996 pub static kCFURLFileContentIdentifierKey: Option<&'static CFString>;
997}
998
999extern "C" {
1000 #[cfg(feature = "CFBase")]
1002 pub static kCFURLMayShareFileContentKey: Option<&'static CFString>;
1003}
1004
1005extern "C" {
1006 #[cfg(feature = "CFBase")]
1008 pub static kCFURLMayHaveExtendedAttributesKey: Option<&'static CFString>;
1009}
1010
1011extern "C" {
1012 #[cfg(feature = "CFBase")]
1014 pub static kCFURLIsPurgeableKey: Option<&'static CFString>;
1015}
1016
1017extern "C" {
1018 #[cfg(feature = "CFBase")]
1020 pub static kCFURLIsSparseKey: Option<&'static CFString>;
1021}
1022
1023extern "C" {
1024 #[cfg(feature = "CFBase")]
1026 pub static kCFURLLinkCountKey: Option<&'static CFString>;
1027}
1028
1029extern "C" {
1030 #[cfg(feature = "CFBase")]
1032 pub static kCFURLParentDirectoryURLKey: Option<&'static CFString>;
1033}
1034
1035extern "C" {
1036 #[cfg(feature = "CFBase")]
1038 pub static kCFURLVolumeURLKey: Option<&'static CFString>;
1039}
1040
1041extern "C" {
1042 #[cfg(feature = "CFBase")]
1044 pub static kCFURLTypeIdentifierKey: Option<&'static CFString>;
1045}
1046
1047extern "C" {
1048 #[cfg(feature = "CFBase")]
1050 pub static kCFURLLocalizedTypeDescriptionKey: Option<&'static CFString>;
1051}
1052
1053extern "C" {
1054 #[cfg(feature = "CFBase")]
1056 pub static kCFURLLabelNumberKey: Option<&'static CFString>;
1057}
1058
1059extern "C" {
1060 #[cfg(feature = "CFBase")]
1062 pub static kCFURLLabelColorKey: Option<&'static CFString>;
1063}
1064
1065extern "C" {
1066 #[cfg(feature = "CFBase")]
1068 pub static kCFURLLocalizedLabelKey: Option<&'static CFString>;
1069}
1070
1071extern "C" {
1072 #[cfg(feature = "CFBase")]
1074 pub static kCFURLEffectiveIconKey: Option<&'static CFString>;
1075}
1076
1077extern "C" {
1078 #[cfg(feature = "CFBase")]
1080 pub static kCFURLCustomIconKey: Option<&'static CFString>;
1081}
1082
1083extern "C" {
1084 #[cfg(feature = "CFBase")]
1086 pub static kCFURLFileResourceIdentifierKey: Option<&'static CFString>;
1087}
1088
1089extern "C" {
1090 #[cfg(feature = "CFBase")]
1092 pub static kCFURLVolumeIdentifierKey: Option<&'static CFString>;
1093}
1094
1095extern "C" {
1096 #[cfg(feature = "CFBase")]
1098 pub static kCFURLPreferredIOBlockSizeKey: Option<&'static CFString>;
1099}
1100
1101extern "C" {
1102 #[cfg(feature = "CFBase")]
1104 pub static kCFURLIsReadableKey: Option<&'static CFString>;
1105}
1106
1107extern "C" {
1108 #[cfg(feature = "CFBase")]
1110 pub static kCFURLIsWritableKey: Option<&'static CFString>;
1111}
1112
1113extern "C" {
1114 #[cfg(feature = "CFBase")]
1116 pub static kCFURLIsExecutableKey: Option<&'static CFString>;
1117}
1118
1119extern "C" {
1120 #[cfg(feature = "CFBase")]
1122 pub static kCFURLFileSecurityKey: Option<&'static CFString>;
1123}
1124
1125extern "C" {
1126 #[cfg(feature = "CFBase")]
1128 pub static kCFURLIsExcludedFromBackupKey: Option<&'static CFString>;
1129}
1130
1131extern "C" {
1132 #[cfg(feature = "CFBase")]
1134 pub static kCFURLTagNamesKey: Option<&'static CFString>;
1135}
1136
1137extern "C" {
1138 #[cfg(feature = "CFBase")]
1140 pub static kCFURLPathKey: Option<&'static CFString>;
1141}
1142
1143extern "C" {
1144 #[cfg(feature = "CFBase")]
1146 pub static kCFURLCanonicalPathKey: Option<&'static CFString>;
1147}
1148
1149extern "C" {
1150 #[cfg(feature = "CFBase")]
1152 pub static kCFURLIsMountTriggerKey: Option<&'static CFString>;
1153}
1154
1155extern "C" {
1156 #[cfg(feature = "CFBase")]
1158 pub static kCFURLGenerationIdentifierKey: Option<&'static CFString>;
1159}
1160
1161extern "C" {
1162 #[cfg(feature = "CFBase")]
1164 pub static kCFURLDocumentIdentifierKey: Option<&'static CFString>;
1165}
1166
1167extern "C" {
1168 #[cfg(feature = "CFBase")]
1170 pub static kCFURLAddedToDirectoryDateKey: Option<&'static CFString>;
1171}
1172
1173extern "C" {
1174 #[cfg(feature = "CFBase")]
1176 pub static kCFURLQuarantinePropertiesKey: Option<&'static CFString>;
1177}
1178
1179extern "C" {
1180 #[cfg(feature = "CFBase")]
1182 pub static kCFURLFileResourceTypeKey: Option<&'static CFString>;
1183}
1184
1185extern "C" {
1186 #[cfg(feature = "CFBase")]
1188 pub static kCFURLFileResourceTypeNamedPipe: Option<&'static CFString>;
1189}
1190
1191extern "C" {
1192 #[cfg(feature = "CFBase")]
1194 pub static kCFURLFileResourceTypeCharacterSpecial: Option<&'static CFString>;
1195}
1196
1197extern "C" {
1198 #[cfg(feature = "CFBase")]
1200 pub static kCFURLFileResourceTypeDirectory: Option<&'static CFString>;
1201}
1202
1203extern "C" {
1204 #[cfg(feature = "CFBase")]
1206 pub static kCFURLFileResourceTypeBlockSpecial: Option<&'static CFString>;
1207}
1208
1209extern "C" {
1210 #[cfg(feature = "CFBase")]
1212 pub static kCFURLFileResourceTypeRegular: Option<&'static CFString>;
1213}
1214
1215extern "C" {
1216 #[cfg(feature = "CFBase")]
1218 pub static kCFURLFileResourceTypeSymbolicLink: Option<&'static CFString>;
1219}
1220
1221extern "C" {
1222 #[cfg(feature = "CFBase")]
1224 pub static kCFURLFileResourceTypeSocket: Option<&'static CFString>;
1225}
1226
1227extern "C" {
1228 #[cfg(feature = "CFBase")]
1230 pub static kCFURLFileResourceTypeUnknown: Option<&'static CFString>;
1231}
1232
1233extern "C" {
1234 #[cfg(feature = "CFBase")]
1236 pub static kCFURLFileSizeKey: Option<&'static CFString>;
1237}
1238
1239extern "C" {
1240 #[cfg(feature = "CFBase")]
1242 pub static kCFURLFileAllocatedSizeKey: Option<&'static CFString>;
1243}
1244
1245extern "C" {
1246 #[cfg(feature = "CFBase")]
1248 pub static kCFURLTotalFileSizeKey: Option<&'static CFString>;
1249}
1250
1251extern "C" {
1252 #[cfg(feature = "CFBase")]
1254 pub static kCFURLTotalFileAllocatedSizeKey: Option<&'static CFString>;
1255}
1256
1257extern "C" {
1258 #[cfg(feature = "CFBase")]
1260 pub static kCFURLIsAliasFileKey: Option<&'static CFString>;
1261}
1262
1263extern "C" {
1264 #[cfg(feature = "CFBase")]
1266 pub static kCFURLFileProtectionKey: Option<&'static CFString>;
1267}
1268
1269extern "C" {
1270 #[cfg(feature = "CFBase")]
1272 pub static kCFURLFileProtectionNone: Option<&'static CFString>;
1273}
1274
1275extern "C" {
1276 #[cfg(feature = "CFBase")]
1278 pub static kCFURLFileProtectionComplete: Option<&'static CFString>;
1279}
1280
1281extern "C" {
1282 #[cfg(feature = "CFBase")]
1284 pub static kCFURLFileProtectionCompleteUnlessOpen: Option<&'static CFString>;
1285}
1286
1287extern "C" {
1288 #[cfg(feature = "CFBase")]
1290 pub static kCFURLFileProtectionCompleteUntilFirstUserAuthentication: Option<&'static CFString>;
1291}
1292
1293extern "C" {
1294 #[cfg(feature = "CFBase")]
1296 pub static kCFURLFileProtectionCompleteWhenUserInactive: Option<&'static CFString>;
1297}
1298
1299extern "C" {
1300 #[cfg(feature = "CFBase")]
1302 pub static kCFURLDirectoryEntryCountKey: Option<&'static CFString>;
1303}
1304
1305extern "C" {
1306 #[cfg(feature = "CFBase")]
1308 pub static kCFURLVolumeLocalizedFormatDescriptionKey: Option<&'static CFString>;
1309}
1310
1311extern "C" {
1312 #[cfg(feature = "CFBase")]
1314 pub static kCFURLVolumeTotalCapacityKey: Option<&'static CFString>;
1315}
1316
1317extern "C" {
1318 #[cfg(feature = "CFBase")]
1320 pub static kCFURLVolumeAvailableCapacityKey: Option<&'static CFString>;
1321}
1322
1323extern "C" {
1324 #[cfg(feature = "CFBase")]
1326 pub static kCFURLVolumeAvailableCapacityForImportantUsageKey: Option<&'static CFString>;
1327}
1328
1329extern "C" {
1330 #[cfg(feature = "CFBase")]
1332 pub static kCFURLVolumeAvailableCapacityForOpportunisticUsageKey: Option<&'static CFString>;
1333}
1334
1335extern "C" {
1336 #[cfg(feature = "CFBase")]
1338 pub static kCFURLVolumeResourceCountKey: Option<&'static CFString>;
1339}
1340
1341extern "C" {
1342 #[cfg(feature = "CFBase")]
1344 pub static kCFURLVolumeSupportsPersistentIDsKey: Option<&'static CFString>;
1345}
1346
1347extern "C" {
1348 #[cfg(feature = "CFBase")]
1350 pub static kCFURLVolumeSupportsSymbolicLinksKey: Option<&'static CFString>;
1351}
1352
1353extern "C" {
1354 #[cfg(feature = "CFBase")]
1356 pub static kCFURLVolumeSupportsHardLinksKey: Option<&'static CFString>;
1357}
1358
1359extern "C" {
1360 #[cfg(feature = "CFBase")]
1362 pub static kCFURLVolumeSupportsJournalingKey: Option<&'static CFString>;
1363}
1364
1365extern "C" {
1366 #[cfg(feature = "CFBase")]
1368 pub static kCFURLVolumeIsJournalingKey: Option<&'static CFString>;
1369}
1370
1371extern "C" {
1372 #[cfg(feature = "CFBase")]
1374 pub static kCFURLVolumeSupportsSparseFilesKey: Option<&'static CFString>;
1375}
1376
1377extern "C" {
1378 #[cfg(feature = "CFBase")]
1380 pub static kCFURLVolumeSupportsZeroRunsKey: Option<&'static CFString>;
1381}
1382
1383extern "C" {
1384 #[cfg(feature = "CFBase")]
1386 pub static kCFURLVolumeSupportsCaseSensitiveNamesKey: Option<&'static CFString>;
1387}
1388
1389extern "C" {
1390 #[cfg(feature = "CFBase")]
1392 pub static kCFURLVolumeSupportsCasePreservedNamesKey: Option<&'static CFString>;
1393}
1394
1395extern "C" {
1396 #[cfg(feature = "CFBase")]
1398 pub static kCFURLVolumeSupportsRootDirectoryDatesKey: Option<&'static CFString>;
1399}
1400
1401extern "C" {
1402 #[cfg(feature = "CFBase")]
1404 pub static kCFURLVolumeSupportsVolumeSizesKey: Option<&'static CFString>;
1405}
1406
1407extern "C" {
1408 #[cfg(feature = "CFBase")]
1410 pub static kCFURLVolumeSupportsRenamingKey: Option<&'static CFString>;
1411}
1412
1413extern "C" {
1414 #[cfg(feature = "CFBase")]
1416 pub static kCFURLVolumeSupportsAdvisoryFileLockingKey: Option<&'static CFString>;
1417}
1418
1419extern "C" {
1420 #[cfg(feature = "CFBase")]
1422 pub static kCFURLVolumeSupportsExtendedSecurityKey: Option<&'static CFString>;
1423}
1424
1425extern "C" {
1426 #[cfg(feature = "CFBase")]
1428 pub static kCFURLVolumeIsBrowsableKey: Option<&'static CFString>;
1429}
1430
1431extern "C" {
1432 #[cfg(feature = "CFBase")]
1434 pub static kCFURLVolumeMaximumFileSizeKey: Option<&'static CFString>;
1435}
1436
1437extern "C" {
1438 #[cfg(feature = "CFBase")]
1440 pub static kCFURLVolumeIsEjectableKey: Option<&'static CFString>;
1441}
1442
1443extern "C" {
1444 #[cfg(feature = "CFBase")]
1446 pub static kCFURLVolumeIsRemovableKey: Option<&'static CFString>;
1447}
1448
1449extern "C" {
1450 #[cfg(feature = "CFBase")]
1452 pub static kCFURLVolumeIsInternalKey: Option<&'static CFString>;
1453}
1454
1455extern "C" {
1456 #[cfg(feature = "CFBase")]
1458 pub static kCFURLVolumeIsAutomountedKey: Option<&'static CFString>;
1459}
1460
1461extern "C" {
1462 #[cfg(feature = "CFBase")]
1464 pub static kCFURLVolumeIsLocalKey: Option<&'static CFString>;
1465}
1466
1467extern "C" {
1468 #[cfg(feature = "CFBase")]
1470 pub static kCFURLVolumeIsReadOnlyKey: Option<&'static CFString>;
1471}
1472
1473extern "C" {
1474 #[cfg(feature = "CFBase")]
1476 pub static kCFURLVolumeCreationDateKey: Option<&'static CFString>;
1477}
1478
1479extern "C" {
1480 #[cfg(feature = "CFBase")]
1482 pub static kCFURLVolumeURLForRemountingKey: Option<&'static CFString>;
1483}
1484
1485extern "C" {
1486 #[cfg(feature = "CFBase")]
1488 pub static kCFURLVolumeUUIDStringKey: Option<&'static CFString>;
1489}
1490
1491extern "C" {
1492 #[cfg(feature = "CFBase")]
1494 pub static kCFURLVolumeNameKey: Option<&'static CFString>;
1495}
1496
1497extern "C" {
1498 #[cfg(feature = "CFBase")]
1500 pub static kCFURLVolumeLocalizedNameKey: Option<&'static CFString>;
1501}
1502
1503extern "C" {
1504 #[cfg(feature = "CFBase")]
1506 pub static kCFURLVolumeIsEncryptedKey: Option<&'static CFString>;
1507}
1508
1509extern "C" {
1510 #[cfg(feature = "CFBase")]
1512 pub static kCFURLVolumeIsRootFileSystemKey: Option<&'static CFString>;
1513}
1514
1515extern "C" {
1516 #[cfg(feature = "CFBase")]
1518 pub static kCFURLVolumeSupportsCompressionKey: Option<&'static CFString>;
1519}
1520
1521extern "C" {
1522 #[cfg(feature = "CFBase")]
1524 pub static kCFURLVolumeSupportsFileCloningKey: Option<&'static CFString>;
1525}
1526
1527extern "C" {
1528 #[cfg(feature = "CFBase")]
1530 pub static kCFURLVolumeSupportsSwapRenamingKey: Option<&'static CFString>;
1531}
1532
1533extern "C" {
1534 #[cfg(feature = "CFBase")]
1536 pub static kCFURLVolumeSupportsExclusiveRenamingKey: Option<&'static CFString>;
1537}
1538
1539extern "C" {
1540 #[cfg(feature = "CFBase")]
1542 pub static kCFURLVolumeSupportsImmutableFilesKey: Option<&'static CFString>;
1543}
1544
1545extern "C" {
1546 #[cfg(feature = "CFBase")]
1548 pub static kCFURLVolumeSupportsAccessPermissionsKey: Option<&'static CFString>;
1549}
1550
1551extern "C" {
1552 #[cfg(feature = "CFBase")]
1554 pub static kCFURLVolumeSupportsFileProtectionKey: Option<&'static CFString>;
1555}
1556
1557extern "C" {
1558 #[cfg(feature = "CFBase")]
1560 pub static kCFURLVolumeTypeNameKey: Option<&'static CFString>;
1561}
1562
1563extern "C" {
1564 #[cfg(feature = "CFBase")]
1566 pub static kCFURLVolumeSubtypeKey: Option<&'static CFString>;
1567}
1568
1569extern "C" {
1570 #[cfg(feature = "CFBase")]
1572 pub static kCFURLVolumeMountFromLocationKey: Option<&'static CFString>;
1573}
1574
1575extern "C" {
1576 #[cfg(feature = "CFBase")]
1578 pub static kCFURLIsUbiquitousItemKey: Option<&'static CFString>;
1579}
1580
1581extern "C" {
1582 #[cfg(feature = "CFBase")]
1584 pub static kCFURLUbiquitousItemHasUnresolvedConflictsKey: Option<&'static CFString>;
1585}
1586
1587extern "C" {
1588 #[cfg(feature = "CFBase")]
1590 pub static kCFURLUbiquitousItemIsDownloadedKey: Option<&'static CFString>;
1591}
1592
1593extern "C" {
1594 #[cfg(feature = "CFBase")]
1596 pub static kCFURLUbiquitousItemIsDownloadingKey: Option<&'static CFString>;
1597}
1598
1599extern "C" {
1600 #[cfg(feature = "CFBase")]
1602 pub static kCFURLUbiquitousItemIsUploadedKey: Option<&'static CFString>;
1603}
1604
1605extern "C" {
1606 #[cfg(feature = "CFBase")]
1608 pub static kCFURLUbiquitousItemIsUploadingKey: Option<&'static CFString>;
1609}
1610
1611extern "C" {
1612 #[cfg(feature = "CFBase")]
1614 pub static kCFURLUbiquitousItemPercentDownloadedKey: Option<&'static CFString>;
1615}
1616
1617extern "C" {
1618 #[cfg(feature = "CFBase")]
1620 pub static kCFURLUbiquitousItemPercentUploadedKey: Option<&'static CFString>;
1621}
1622
1623extern "C" {
1624 #[cfg(feature = "CFBase")]
1626 pub static kCFURLUbiquitousItemDownloadingStatusKey: Option<&'static CFString>;
1627}
1628
1629extern "C" {
1630 #[cfg(feature = "CFBase")]
1632 pub static kCFURLUbiquitousItemDownloadingErrorKey: Option<&'static CFString>;
1633}
1634
1635extern "C" {
1636 #[cfg(feature = "CFBase")]
1638 pub static kCFURLUbiquitousItemUploadingErrorKey: Option<&'static CFString>;
1639}
1640
1641extern "C" {
1642 #[cfg(feature = "CFBase")]
1644 pub static kCFURLUbiquitousItemIsExcludedFromSyncKey: Option<&'static CFString>;
1645}
1646
1647extern "C" {
1648 #[cfg(feature = "CFBase")]
1650 pub static kCFURLUbiquitousItemDownloadingStatusNotDownloaded: Option<&'static CFString>;
1651}
1652
1653extern "C" {
1654 #[cfg(feature = "CFBase")]
1656 pub static kCFURLUbiquitousItemDownloadingStatusDownloaded: Option<&'static CFString>;
1657}
1658
1659extern "C" {
1660 #[cfg(feature = "CFBase")]
1662 pub static kCFURLUbiquitousItemDownloadingStatusCurrent: Option<&'static CFString>;
1663}
1664
1665#[cfg(feature = "CFBase")]
1668#[repr(transparent)]
1669#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1670pub struct CFURLBookmarkCreationOptions(pub CFOptionFlags);
1671#[cfg(feature = "CFBase")]
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#[deprecated = "kCFURLBookmarkCreationPreferFileIDResolutionMask does nothing and has no effect on bookmark resolution"]
1685 #[doc(alias = "kCFURLBookmarkCreationPreferFileIDResolutionMask")]
1686 const PreferFileIDResolutionMask = 1<<8;
1687 }
1688}
1689
1690#[cfg(all(feature = "CFBase", feature = "objc2"))]
1691unsafe impl Encode for CFURLBookmarkCreationOptions {
1692 const ENCODING: Encoding = CFOptionFlags::ENCODING;
1693}
1694
1695#[cfg(all(feature = "CFBase", feature = "objc2"))]
1696unsafe impl RefEncode for CFURLBookmarkCreationOptions {
1697 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1698}
1699
1700#[cfg(feature = "CFBase")]
1703#[repr(transparent)]
1704#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1705pub struct CFURLBookmarkResolutionOptions(pub CFOptionFlags);
1706#[cfg(feature = "CFBase")]
1707bitflags::bitflags! {
1708 impl CFURLBookmarkResolutionOptions: CFOptionFlags {
1709 #[doc(alias = "kCFURLBookmarkResolutionWithoutUIMask")]
1710 const CFURLBookmarkResolutionWithoutUIMask = 1<<8;
1711 #[doc(alias = "kCFURLBookmarkResolutionWithoutMountingMask")]
1712 const CFURLBookmarkResolutionWithoutMountingMask = 1<<9;
1713 #[doc(alias = "kCFURLBookmarkResolutionWithSecurityScope")]
1714 const CFURLBookmarkResolutionWithSecurityScope = 1<<10;
1715 #[doc(alias = "kCFURLBookmarkResolutionWithoutImplicitStartAccessing")]
1716 const CFURLBookmarkResolutionWithoutImplicitStartAccessing = 1<<15;
1717 #[doc(alias = "kCFBookmarkResolutionWithoutUIMask")]
1718 const CFBookmarkResolutionWithoutUIMask = CFURLBookmarkResolutionOptions::CFURLBookmarkResolutionWithoutUIMask.0;
1719 #[doc(alias = "kCFBookmarkResolutionWithoutMountingMask")]
1720 const CFBookmarkResolutionWithoutMountingMask = CFURLBookmarkResolutionOptions::CFURLBookmarkResolutionWithoutMountingMask.0;
1721 }
1722}
1723
1724#[cfg(all(feature = "CFBase", feature = "objc2"))]
1725unsafe impl Encode for CFURLBookmarkResolutionOptions {
1726 const ENCODING: Encoding = CFOptionFlags::ENCODING;
1727}
1728
1729#[cfg(all(feature = "CFBase", feature = "objc2"))]
1730unsafe impl RefEncode for CFURLBookmarkResolutionOptions {
1731 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1732}
1733
1734#[cfg(feature = "CFBase")]
1736pub type CFURLBookmarkFileCreationOptions = CFOptionFlags;
1737
1738#[cfg(all(
1739 feature = "CFArray",
1740 feature = "CFBase",
1741 feature = "CFData",
1742 feature = "CFError"
1743))]
1744#[inline]
1745pub unsafe extern "C-unwind" fn CFURLCreateBookmarkData(
1746 allocator: Option<&CFAllocator>,
1747 url: Option<&CFURL>,
1748 options: CFURLBookmarkCreationOptions,
1749 resource_properties_to_include: Option<&CFArray>,
1750 relative_to_url: Option<&CFURL>,
1751 error: *mut *mut CFError,
1752) -> Option<CFRetained<CFData>> {
1753 extern "C-unwind" {
1754 fn CFURLCreateBookmarkData(
1755 allocator: Option<&CFAllocator>,
1756 url: Option<&CFURL>,
1757 options: CFURLBookmarkCreationOptions,
1758 resource_properties_to_include: Option<&CFArray>,
1759 relative_to_url: Option<&CFURL>,
1760 error: *mut *mut CFError,
1761 ) -> Option<NonNull<CFData>>;
1762 }
1763 let ret = unsafe {
1764 CFURLCreateBookmarkData(
1765 allocator,
1766 url,
1767 options,
1768 resource_properties_to_include,
1769 relative_to_url,
1770 error,
1771 )
1772 };
1773 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1774}
1775
1776#[cfg(all(
1777 feature = "CFArray",
1778 feature = "CFBase",
1779 feature = "CFData",
1780 feature = "CFError"
1781))]
1782#[inline]
1783pub unsafe extern "C-unwind" fn CFURLCreateByResolvingBookmarkData(
1784 allocator: Option<&CFAllocator>,
1785 bookmark: Option<&CFData>,
1786 options: CFURLBookmarkResolutionOptions,
1787 relative_to_url: Option<&CFURL>,
1788 resource_properties_to_include: Option<&CFArray>,
1789 is_stale: *mut Boolean,
1790 error: *mut *mut CFError,
1791) -> Option<CFRetained<CFURL>> {
1792 extern "C-unwind" {
1793 fn CFURLCreateByResolvingBookmarkData(
1794 allocator: Option<&CFAllocator>,
1795 bookmark: Option<&CFData>,
1796 options: CFURLBookmarkResolutionOptions,
1797 relative_to_url: Option<&CFURL>,
1798 resource_properties_to_include: Option<&CFArray>,
1799 is_stale: *mut Boolean,
1800 error: *mut *mut CFError,
1801 ) -> Option<NonNull<CFURL>>;
1802 }
1803 let ret = unsafe {
1804 CFURLCreateByResolvingBookmarkData(
1805 allocator,
1806 bookmark,
1807 options,
1808 relative_to_url,
1809 resource_properties_to_include,
1810 is_stale,
1811 error,
1812 )
1813 };
1814 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1815}
1816
1817#[cfg(all(
1818 feature = "CFArray",
1819 feature = "CFBase",
1820 feature = "CFData",
1821 feature = "CFDictionary"
1822))]
1823#[inline]
1824pub unsafe extern "C-unwind" fn CFURLCreateResourcePropertiesForKeysFromBookmarkData(
1825 allocator: Option<&CFAllocator>,
1826 resource_properties_to_return: Option<&CFArray>,
1827 bookmark: Option<&CFData>,
1828) -> Option<CFRetained<CFDictionary>> {
1829 extern "C-unwind" {
1830 fn CFURLCreateResourcePropertiesForKeysFromBookmarkData(
1831 allocator: Option<&CFAllocator>,
1832 resource_properties_to_return: Option<&CFArray>,
1833 bookmark: Option<&CFData>,
1834 ) -> Option<NonNull<CFDictionary>>;
1835 }
1836 let ret = unsafe {
1837 CFURLCreateResourcePropertiesForKeysFromBookmarkData(
1838 allocator,
1839 resource_properties_to_return,
1840 bookmark,
1841 )
1842 };
1843 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1844}
1845
1846#[cfg(all(feature = "CFBase", feature = "CFData"))]
1847#[inline]
1848pub unsafe extern "C-unwind" fn CFURLCreateResourcePropertyForKeyFromBookmarkData(
1849 allocator: Option<&CFAllocator>,
1850 resource_property_key: Option<&CFString>,
1851 bookmark: Option<&CFData>,
1852) -> Option<CFRetained<CFType>> {
1853 extern "C-unwind" {
1854 fn CFURLCreateResourcePropertyForKeyFromBookmarkData(
1855 allocator: Option<&CFAllocator>,
1856 resource_property_key: Option<&CFString>,
1857 bookmark: Option<&CFData>,
1858 ) -> Option<NonNull<CFType>>;
1859 }
1860 let ret = unsafe {
1861 CFURLCreateResourcePropertyForKeyFromBookmarkData(
1862 allocator,
1863 resource_property_key,
1864 bookmark,
1865 )
1866 };
1867 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1868}
1869
1870#[cfg(all(feature = "CFBase", feature = "CFData", feature = "CFError"))]
1871#[inline]
1872pub unsafe extern "C-unwind" fn CFURLCreateBookmarkDataFromFile(
1873 allocator: Option<&CFAllocator>,
1874 file_url: Option<&CFURL>,
1875 error_ref: *mut *mut CFError,
1876) -> Option<CFRetained<CFData>> {
1877 extern "C-unwind" {
1878 fn CFURLCreateBookmarkDataFromFile(
1879 allocator: Option<&CFAllocator>,
1880 file_url: Option<&CFURL>,
1881 error_ref: *mut *mut CFError,
1882 ) -> Option<NonNull<CFData>>;
1883 }
1884 let ret = unsafe { CFURLCreateBookmarkDataFromFile(allocator, file_url, error_ref) };
1885 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1886}
1887
1888#[cfg(all(feature = "CFBase", feature = "CFData", feature = "CFError"))]
1889#[inline]
1890pub unsafe extern "C-unwind" fn CFURLWriteBookmarkDataToFile(
1891 bookmark_ref: Option<&CFData>,
1892 file_url: Option<&CFURL>,
1893 options: CFURLBookmarkFileCreationOptions,
1894 error_ref: *mut *mut CFError,
1895) -> bool {
1896 extern "C-unwind" {
1897 fn CFURLWriteBookmarkDataToFile(
1898 bookmark_ref: Option<&CFData>,
1899 file_url: Option<&CFURL>,
1900 options: CFURLBookmarkFileCreationOptions,
1901 error_ref: *mut *mut CFError,
1902 ) -> Boolean;
1903 }
1904 let ret = unsafe { CFURLWriteBookmarkDataToFile(bookmark_ref, file_url, options, error_ref) };
1905 ret != 0
1906}
1907
1908#[cfg(all(feature = "CFBase", feature = "CFData"))]
1909#[deprecated = "The Carbon Alias Manager is deprecated. This function should only be used to convert Carbon AliasRecords to bookmark data."]
1910#[inline]
1911pub unsafe extern "C-unwind" fn CFURLCreateBookmarkDataFromAliasRecord(
1912 allocator_ref: Option<&CFAllocator>,
1913 alias_record_data_ref: Option<&CFData>,
1914) -> Option<CFRetained<CFData>> {
1915 extern "C-unwind" {
1916 fn CFURLCreateBookmarkDataFromAliasRecord(
1917 allocator_ref: Option<&CFAllocator>,
1918 alias_record_data_ref: Option<&CFData>,
1919 ) -> Option<NonNull<CFData>>;
1920 }
1921 let ret =
1922 unsafe { CFURLCreateBookmarkDataFromAliasRecord(allocator_ref, alias_record_data_ref) };
1923 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1924}
1925
1926#[inline]
1927pub unsafe extern "C-unwind" fn CFURLStartAccessingSecurityScopedResource(url: &CFURL) -> bool {
1928 extern "C-unwind" {
1929 fn CFURLStartAccessingSecurityScopedResource(url: &CFURL) -> Boolean;
1930 }
1931 let ret = unsafe { CFURLStartAccessingSecurityScopedResource(url) };
1932 ret != 0
1933}
1934
1935extern "C-unwind" {
1936 pub fn CFURLStopAccessingSecurityScopedResource(url: &CFURL);
1937}