| 1 |
// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT |
| 2 |
// file at the top-level directory of this distribution. |
| 3 |
// |
| 4 |
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
| 5 |
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 6 |
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your |
| 7 |
// option. This file may not be copied, modified, or distributed |
| 8 |
// except according to those terms. |
| 9 |
|
| 10 |
use std::os::raw::c_void; |
| 11 |
|
| 12 |
use crate::array::CFArrayRef; |
| 13 |
use crate::base::{ |
| 14 |
Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFRange, CFTypeID, CFTypeRef, SInt32, |
| 15 |
}; |
| 16 |
use crate::data::CFDataRef; |
| 17 |
use crate::dictionary::CFDictionaryRef; |
| 18 |
use crate::error::CFErrorRef; |
| 19 |
use crate::string::{CFStringEncoding, CFStringRef}; |
| 20 |
|
| 21 |
#[repr(C)] |
| 22 |
pub struct __CFURL(c_void); |
| 23 |
|
| 24 |
pub type CFURLRef = *const __CFURL; |
| 25 |
|
| 26 |
pub type CFURLBookmarkCreationOptions = CFOptionFlags; |
| 27 |
pub type CFURLBookmarkResolutionOptions = CFOptionFlags; |
| 28 |
pub type CFURLBookmarkFileCreationOptions = CFOptionFlags; |
| 29 |
|
| 30 |
pub type CFURLPathStyle = CFIndex; |
| 31 |
|
| 32 |
/* typedef CF_ENUM(CFIndex, CFURLPathStyle) */ |
| 33 |
pub const kCFURLPOSIXPathStyle: CFURLPathStyle = 0; |
| 34 |
pub const kCFURLHFSPathStyle: CFURLPathStyle = 1; |
| 35 |
pub const kCFURLWindowsPathStyle: CFURLPathStyle = 2; |
| 36 |
|
| 37 |
/* Bookmark Data Creation Options */ |
| 38 |
pub static kCFURLBookmarkCreationMinimalBookmarkMask: CFURLBookmarkCreationOptions = |
| 39 |
(1u32 << 9) as usize; |
| 40 |
pub static kCFURLBookmarkCreationSuitableForBookmarkFile: CFURLBookmarkCreationOptions = |
| 41 |
(1u32 << 10) as usize; |
| 42 |
|
| 43 |
#[cfg(target_os = "macos")] |
| 44 |
pub static kCFURLBookmarkCreationWithSecurityScope: CFURLBookmarkCreationOptions = |
| 45 |
(1u32 << 11) as usize; |
| 46 |
|
| 47 |
#[cfg(target_os = "macos")] |
| 48 |
pub static kCFURLBookmarkCreationSecurityScopeAllowOnlyReadAccess: CFURLBookmarkCreationOptions = |
| 49 |
(1u32 << 12) as usize; |
| 50 |
|
| 51 |
pub static kCFURLBookmarkCreationWithoutImplicitSecurityScope: CFURLBookmarkCreationOptions = |
| 52 |
(1u32 << 29) as usize; |
| 53 |
|
| 54 |
pub static kCFURLBookmarkCreationPreferFileIDResolutionMask: CFURLBookmarkCreationOptions = |
| 55 |
(1u32 << 8) as usize; // deprecated |
| 56 |
|
| 57 |
/* The types of components in a URL. */ |
| 58 |
pub type CFURLComponentType = CFIndex; |
| 59 |
pub const kCFURLComponentScheme: CFIndex = 1; |
| 60 |
pub const kCFURLComponentNetLocation: CFIndex = 2; |
| 61 |
pub const kCFURLComponentPath: CFIndex = 3; |
| 62 |
pub const kCFURLComponentResourceSpecifier: CFIndex = 4; |
| 63 |
pub const kCFURLComponentUser: CFIndex = 5; |
| 64 |
pub const kCFURLComponentPassword: CFIndex = 6; |
| 65 |
pub const kCFURLComponentUserInfo: CFIndex = 7; |
| 66 |
pub const kCFURLComponentHost: CFIndex = 8; |
| 67 |
pub const kCFURLComponentPort: CFIndex = 9; |
| 68 |
pub const kCFURLComponentParameterString: CFIndex = 10; |
| 69 |
pub const kCFURLComponentQuery: CFIndex = 11; |
| 70 |
pub const kCFURLComponentFragment: CFIndex = 12; |
| 71 |
|
| 72 |
/* Bookmark Data Resolution Options */ |
| 73 |
pub const kCFURLBookmarkResolutionWithoutUIMask: CFURLBookmarkResolutionOptions = |
| 74 |
(1u32 << 8) as usize; |
| 75 |
pub const kCFURLBookmarkResolutionWithoutMountingMask: CFURLBookmarkResolutionOptions = |
| 76 |
(1u32 << 9) as usize; |
| 77 |
#[cfg(target_os = "macos")] |
| 78 |
pub const kCFURLBookmarkResolutionWithSecurityScope: CFURLBookmarkResolutionOptions = |
| 79 |
(1u32 << 10) as usize; |
| 80 |
//pub const kCFURLBookmarkResolutionWithoutImplicitStartAccessing: CFURLBookmarkResolutionOptions = ( 1u32 << 15 ) as usize; // macos(11.2)+ |
| 81 |
pub const kCFBookmarkResolutionWithoutUIMask: CFURLBookmarkResolutionOptions = (1u32 << 8) as usize; |
| 82 |
pub const kCFBookmarkResolutionWithoutMountingMask: CFURLBookmarkResolutionOptions = |
| 83 |
(1u32 << 9) as usize; |
| 84 |
|
| 85 |
extern "C" { |
| 86 |
/* |
| 87 |
* CFURL.h |
| 88 |
*/ |
| 89 |
|
| 90 |
/* Common File System Resource Keys */ |
| 91 |
pub static kCFURLNameKey: CFStringRef; |
| 92 |
pub static kCFURLLocalizedNameKey: CFStringRef; |
| 93 |
pub static kCFURLIsRegularFileKey: CFStringRef; |
| 94 |
pub static kCFURLIsDirectoryKey: CFStringRef; |
| 95 |
pub static kCFURLIsSymbolicLinkKey: CFStringRef; |
| 96 |
pub static kCFURLIsVolumeKey: CFStringRef; |
| 97 |
pub static kCFURLIsPackageKey: CFStringRef; |
| 98 |
pub static kCFURLIsApplicationKey: CFStringRef; |
| 99 |
// pub static kCFURLApplicationIsScriptableKey: CFStringRef; //macos(10.11)+ |
| 100 |
|
| 101 |
pub static kCFURLIsSystemImmutableKey: CFStringRef; |
| 102 |
pub static kCFURLIsUserImmutableKey: CFStringRef; |
| 103 |
pub static kCFURLIsHiddenKey: CFStringRef; |
| 104 |
pub static kCFURLHasHiddenExtensionKey: CFStringRef; |
| 105 |
pub static kCFURLCreationDateKey: CFStringRef; |
| 106 |
pub static kCFURLContentAccessDateKey: CFStringRef; |
| 107 |
pub static kCFURLContentModificationDateKey: CFStringRef; |
| 108 |
pub static kCFURLAttributeModificationDateKey: CFStringRef; |
| 109 |
// pub static kCFURLFileIdentifierKey: CFStringRef; //macos(13.3)+ |
| 110 |
// pub static kCFURLFileContentIdentifierKey: CFStringRef; //macos(11.0)+ |
| 111 |
// pub static kCFURLMayShareFileContentKey: CFStringRef; //macos(11.0)+ |
| 112 |
// pub static kCFURLMayHaveExtendedAttributesKey: CFStringRef; //macos(11.0)+ |
| 113 |
// pub static kCFURLIsPurgeableKey: CFStringRef; //macos(11.0)+ |
| 114 |
// pub static kCFURLIsSparseKey: CFStringRef; //macos(11.0)+ |
| 115 |
|
| 116 |
pub static kCFURLLinkCountKey: CFStringRef; |
| 117 |
pub static kCFURLParentDirectoryURLKey: CFStringRef; |
| 118 |
pub static kCFURLVolumeURLKey: CFStringRef; |
| 119 |
|
| 120 |
pub static kCFURLTypeIdentifierKey: CFStringRef; //deprecated |
| 121 |
|
| 122 |
pub static kCFURLLocalizedTypeDescriptionKey: CFStringRef; |
| 123 |
pub static kCFURLLabelNumberKey: CFStringRef; |
| 124 |
pub static kCFURLLabelColorKey: CFStringRef; //deprecated |
| 125 |
pub static kCFURLLocalizedLabelKey: CFStringRef; |
| 126 |
pub static kCFURLEffectiveIconKey: CFStringRef; //deprecated |
| 127 |
pub static kCFURLCustomIconKey: CFStringRef; //deprecated |
| 128 |
|
| 129 |
pub static kCFURLFileResourceIdentifierKey: CFStringRef; |
| 130 |
pub static kCFURLVolumeIdentifierKey: CFStringRef; |
| 131 |
pub static kCFURLPreferredIOBlockSizeKey: CFStringRef; |
| 132 |
pub static kCFURLIsReadableKey: CFStringRef; |
| 133 |
pub static kCFURLIsWritableKey: CFStringRef; |
| 134 |
pub static kCFURLIsExecutableKey: CFStringRef; |
| 135 |
pub static kCFURLFileSecurityKey: CFStringRef; |
| 136 |
|
| 137 |
#[cfg(feature = "mac_os_10_8_features")] |
| 138 |
#[cfg_attr(feature = "mac_os_10_7_support", linkage = "extern_weak")] |
| 139 |
pub static kCFURLIsExcludedFromBackupKey: CFStringRef; |
| 140 |
// pub static kCFURLTagNamesKey: CFStringRef; //macos(10.9)+ |
| 141 |
#[cfg(feature = "mac_os_10_8_features")] |
| 142 |
#[cfg_attr(feature = "mac_os_10_7_support", linkage = "extern_weak")] |
| 143 |
pub static kCFURLPathKey: CFStringRef; // macos(10.8)+ |
| 144 |
pub static kCFURLCanonicalPathKey: CFStringRef; // macos(10.12)+ |
| 145 |
|
| 146 |
pub static kCFURLIsMountTriggerKey: CFStringRef; |
| 147 |
|
| 148 |
// pub static kCFURLGenerationIdentifierKey: CFStringRef; // macos(10.10)+ |
| 149 |
// pub static kCFURLDocumentIdentifierKey: CFStringRef; // macos(10.10)+ |
| 150 |
// pub static kCFURLAddedToDirectoryDateKey: CFStringRef; // macos(10.10)+ |
| 151 |
// pub static kCFURLQuarantinePropertiesKey: CFStringRef; // macos(10.10)+ |
| 152 |
|
| 153 |
pub static kCFURLFileResourceTypeKey: CFStringRef; |
| 154 |
|
| 155 |
/* File Resource Types. The file system object type values returned for the kCFURLFileResourceTypeKey */ |
| 156 |
pub static kCFURLFileResourceTypeNamedPipe: CFStringRef; |
| 157 |
pub static kCFURLFileResourceTypeCharacterSpecial: CFStringRef; |
| 158 |
pub static kCFURLFileResourceTypeDirectory: CFStringRef; |
| 159 |
pub static kCFURLFileResourceTypeBlockSpecial: CFStringRef; |
| 160 |
pub static kCFURLFileResourceTypeRegular: CFStringRef; |
| 161 |
pub static kCFURLFileResourceTypeSymbolicLink: CFStringRef; |
| 162 |
pub static kCFURLFileResourceTypeSocket: CFStringRef; |
| 163 |
pub static kCFURLFileResourceTypeUnknown: CFStringRef; |
| 164 |
|
| 165 |
/* File Property Keys */ |
| 166 |
pub static kCFURLFileSizeKey: CFStringRef; |
| 167 |
pub static kCFURLFileAllocatedSizeKey: CFStringRef; |
| 168 |
pub static kCFURLTotalFileSizeKey: CFStringRef; |
| 169 |
pub static kCFURLTotalFileAllocatedSizeKey: CFStringRef; |
| 170 |
pub static kCFURLIsAliasFileKey: CFStringRef; |
| 171 |
|
| 172 |
// pub static kCFURLFileProtectionKey: CFStringRef; // ios(9.0)+ |
| 173 |
|
| 174 |
/* The protection level values returned for the kCFURLFileProtectionKey */ |
| 175 |
// pub static kCFURLFileProtectionNone: CFStringRef; // ios(9.0)+ |
| 176 |
// pub static kCFURLFileProtectionComplete: CFStringRef; // ios(9.0)+ |
| 177 |
// pub static kCFURLFileProtectionCompleteUnlessOpen: CFStringRef; // ios(9.0)+ |
| 178 |
// pub static kCFURLFileProtectionCompleteUntilFirstUserAuthentication: CFStringRef; // ios(9.0)+ |
| 179 |
|
| 180 |
/* Volume Property Keys */ |
| 181 |
pub static kCFURLVolumeLocalizedFormatDescriptionKey: CFStringRef; |
| 182 |
pub static kCFURLVolumeTotalCapacityKey: CFStringRef; |
| 183 |
pub static kCFURLVolumeAvailableCapacityKey: CFStringRef; |
| 184 |
//pub static kCFURLVolumeAvailableCapacityForImportantUsageKey: CFStringRef; //macos(10.13)+ |
| 185 |
//pub static kCFURLVolumeAvailableCapacityForOpportunisticUsageKey: CFStringRef; //macos(10.13)+ |
| 186 |
|
| 187 |
pub static kCFURLVolumeResourceCountKey: CFStringRef; |
| 188 |
pub static kCFURLVolumeSupportsPersistentIDsKey: CFStringRef; |
| 189 |
pub static kCFURLVolumeSupportsSymbolicLinksKey: CFStringRef; |
| 190 |
pub static kCFURLVolumeSupportsHardLinksKey: CFStringRef; |
| 191 |
pub static kCFURLVolumeSupportsJournalingKey: CFStringRef; |
| 192 |
pub static kCFURLVolumeIsJournalingKey: CFStringRef; |
| 193 |
pub static kCFURLVolumeSupportsSparseFilesKey: CFStringRef; |
| 194 |
pub static kCFURLVolumeSupportsZeroRunsKey: CFStringRef; |
| 195 |
pub static kCFURLVolumeSupportsCaseSensitiveNamesKey: CFStringRef; |
| 196 |
pub static kCFURLVolumeSupportsCasePreservedNamesKey: CFStringRef; |
| 197 |
pub static kCFURLVolumeSupportsRootDirectoryDatesKey: CFStringRef; |
| 198 |
pub static kCFURLVolumeSupportsVolumeSizesKey: CFStringRef; |
| 199 |
pub static kCFURLVolumeSupportsRenamingKey: CFStringRef; |
| 200 |
pub static kCFURLVolumeSupportsAdvisoryFileLockingKey: CFStringRef; |
| 201 |
pub static kCFURLVolumeSupportsExtendedSecurityKey: CFStringRef; |
| 202 |
pub static kCFURLVolumeIsBrowsableKey: CFStringRef; |
| 203 |
pub static kCFURLVolumeMaximumFileSizeKey: CFStringRef; |
| 204 |
pub static kCFURLVolumeIsEjectableKey: CFStringRef; |
| 205 |
pub static kCFURLVolumeIsRemovableKey: CFStringRef; |
| 206 |
pub static kCFURLVolumeIsInternalKey: CFStringRef; |
| 207 |
pub static kCFURLVolumeIsAutomountedKey: CFStringRef; |
| 208 |
pub static kCFURLVolumeIsLocalKey: CFStringRef; |
| 209 |
pub static kCFURLVolumeIsReadOnlyKey: CFStringRef; |
| 210 |
pub static kCFURLVolumeCreationDateKey: CFStringRef; |
| 211 |
pub static kCFURLVolumeURLForRemountingKey: CFStringRef; |
| 212 |
pub static kCFURLVolumeUUIDStringKey: CFStringRef; |
| 213 |
pub static kCFURLVolumeNameKey: CFStringRef; |
| 214 |
pub static kCFURLVolumeLocalizedNameKey: CFStringRef; |
| 215 |
// pub static kCFURLVolumeIsEncryptedKey: CFStringRef; //macos(10.12)+ |
| 216 |
// pub static kCFURLVolumeIsRootFileSystemKey: CFStringRef; //macos(10.12)+ |
| 217 |
// pub static kCFURLVolumeSupportsCompressionKey: CFStringRef; //macos(10.12)+ |
| 218 |
// pub static kCFURLVolumeSupportsFileCloningKey: CFStringRef; //macos(10.12)+ |
| 219 |
// pub static kCFURLVolumeSupportsSwapRenamingKey: CFStringRef; //macos(10.12)+ |
| 220 |
// pub static kCFURLVolumeSupportsExclusiveRenamingKey: CFStringRef; //macos(10.12)+ |
| 221 |
// pub static kCFURLVolumeSupportsImmutableFilesKey: CFStringRef; //macos(10.13)+ |
| 222 |
// pub static kCFURLVolumeSupportsAccessPermissionsKey: CFStringRef; //macos(10.13)+ |
| 223 |
// pub static kCFURLVolumeSupportsFileProtectionKey: CFStringRef; //macos(11.0)+ |
| 224 |
// pub static kCFURLVolumeTypeNameKey: CFStringRef; //macos(13.3)+ |
| 225 |
// pub static kCFURLVolumeSubtypeKey: CFStringRef; //macos(13.3)+ |
| 226 |
// pub static kCFURLVolumeMountFromLocationKey: CFStringRef; //macos(13.3)+ |
| 227 |
|
| 228 |
/* iCloud Constants */ |
| 229 |
pub static kCFURLIsUbiquitousItemKey: CFStringRef; |
| 230 |
pub static kCFURLUbiquitousItemHasUnresolvedConflictsKey: CFStringRef; |
| 231 |
pub static kCFURLUbiquitousItemIsDownloadedKey: CFStringRef; // deprecated |
| 232 |
pub static kCFURLUbiquitousItemIsDownloadingKey: CFStringRef; |
| 233 |
pub static kCFURLUbiquitousItemIsUploadedKey: CFStringRef; |
| 234 |
pub static kCFURLUbiquitousItemIsUploadingKey: CFStringRef; |
| 235 |
pub static kCFURLUbiquitousItemPercentDownloadedKey: CFStringRef; // deprecated |
| 236 |
pub static kCFURLUbiquitousItemPercentUploadedKey: CFStringRef; // deprecated |
| 237 |
// pub static kCFURLUbiquitousItemDownloadingStatusKey: CFStringRef; // macos(10.9)+ |
| 238 |
// pub static kCFURLUbiquitousItemDownloadingErrorKey: CFStringRef; // macos(10.9)+ |
| 239 |
// pub static kCFURLUbiquitousItemUploadingErrorKey: CFStringRef; // macos(10.9)+ |
| 240 |
// pub static kCFURLUbiquitousItemIsExcludedFromSyncKey: CFStringRef; // macos(11.3)+ |
| 241 |
|
| 242 |
/* The values returned for kCFURLUbiquitousItemDownloadingStatusKey */ |
| 243 |
// pub static kCFURLUbiquitousItemDownloadingStatusNotDownloaded: CFStringRef; // macos(10.9)+ |
| 244 |
// pub static kCFURLUbiquitousItemDownloadingStatusDownloaded: CFStringRef; // macos(10.9)+ |
| 245 |
// pub static kCFURLUbiquitousItemDownloadingStatusCurrent: CFStringRef; // macos(10.9)+ |
| 246 |
|
| 247 |
/* CFError userInfo Dictionary Keys */ |
| 248 |
pub static kCFURLKeysOfUnsetValuesKey: CFStringRef; |
| 249 |
|
| 250 |
/* Creating a CFURL */ |
| 251 |
pub fn CFURLCopyAbsoluteURL(anURL: CFURLRef) -> CFURLRef; |
| 252 |
pub fn CFURLCreateAbsoluteURLWithBytes( |
| 253 |
allocator: CFAllocatorRef, |
| 254 |
relativeURLBytes: *const u8, |
| 255 |
length: CFIndex, |
| 256 |
encoding: CFStringEncoding, |
| 257 |
baseURL: CFURLRef, |
| 258 |
useCompatibilityMode: Boolean, |
| 259 |
) -> CFURLRef; |
| 260 |
pub fn CFURLCreateByResolvingBookmarkData( |
| 261 |
allocator: CFAllocatorRef, |
| 262 |
bookmark: CFDataRef, |
| 263 |
options: CFURLBookmarkResolutionOptions, |
| 264 |
relativeToURL: CFURLRef, |
| 265 |
resourcePropertiesToInclude: CFArrayRef, |
| 266 |
isStale: *mut Boolean, |
| 267 |
error: *mut CFErrorRef, |
| 268 |
) -> CFURLRef; |
| 269 |
pub fn CFURLCreateCopyAppendingPathComponent( |
| 270 |
allocator: CFAllocatorRef, |
| 271 |
url: CFURLRef, |
| 272 |
pathComponent: CFStringRef, |
| 273 |
isDirectory: Boolean, |
| 274 |
) -> CFURLRef; |
| 275 |
pub fn CFURLCreateCopyAppendingPathExtension( |
| 276 |
allocator: CFAllocatorRef, |
| 277 |
url: CFURLRef, |
| 278 |
extension: CFStringRef, |
| 279 |
) -> CFURLRef; |
| 280 |
pub fn CFURLCreateCopyDeletingLastPathComponent( |
| 281 |
allocator: CFAllocatorRef, |
| 282 |
url: CFURLRef, |
| 283 |
) -> CFURLRef; |
| 284 |
pub fn CFURLCreateCopyDeletingPathExtension( |
| 285 |
allocator: CFAllocatorRef, |
| 286 |
url: CFURLRef, |
| 287 |
) -> CFURLRef; |
| 288 |
pub fn CFURLCreateFilePathURL( |
| 289 |
allocator: CFAllocatorRef, |
| 290 |
url: CFURLRef, |
| 291 |
error: *mut CFErrorRef, |
| 292 |
) -> CFURLRef; |
| 293 |
pub fn CFURLCreateFileReferenceURL( |
| 294 |
allocator: CFAllocatorRef, |
| 295 |
url: CFURLRef, |
| 296 |
error: *mut CFErrorRef, |
| 297 |
) -> CFURLRef; |
| 298 |
pub fn CFURLCreateFromFileSystemRepresentation( |
| 299 |
allocator: CFAllocatorRef, |
| 300 |
buffer: *const u8, |
| 301 |
bufLen: CFIndex, |
| 302 |
isDirectory: Boolean, |
| 303 |
) -> CFURLRef; |
| 304 |
pub fn CFURLCreateFromFileSystemRepresentationRelativeToBase( |
| 305 |
allocator: CFAllocatorRef, |
| 306 |
buffer: *const u8, |
| 307 |
bufLen: CFIndex, |
| 308 |
isDirectory: Boolean, |
| 309 |
baseURL: CFURLRef, |
| 310 |
) -> CFURLRef; |
| 311 |
//pub fn CFURLCreateFromFSRef(allocator: CFAllocatorRef, fsRef: *const FSRef) -> CFURLRef |
| 312 |
pub fn CFURLCreateWithBytes( |
| 313 |
allocator: CFAllocatorRef, |
| 314 |
URLBytes: *const u8, |
| 315 |
length: CFIndex, |
| 316 |
encoding: CFStringEncoding, |
| 317 |
baseURL: CFURLRef, |
| 318 |
) -> CFURLRef; |
| 319 |
pub fn CFURLCreateWithFileSystemPath( |
| 320 |
allocator: CFAllocatorRef, |
| 321 |
filePath: CFStringRef, |
| 322 |
pathStyle: CFURLPathStyle, |
| 323 |
isDirectory: Boolean, |
| 324 |
) -> CFURLRef; |
| 325 |
pub fn CFURLCreateWithFileSystemPathRelativeToBase( |
| 326 |
allocator: CFAllocatorRef, |
| 327 |
filePath: CFStringRef, |
| 328 |
pathStyle: CFURLPathStyle, |
| 329 |
isDirectory: Boolean, |
| 330 |
baseURL: CFURLRef, |
| 331 |
) -> CFURLRef; |
| 332 |
pub fn CFURLCreateWithString( |
| 333 |
allocator: CFAllocatorRef, |
| 334 |
URLString: CFStringRef, |
| 335 |
baseURL: CFURLRef, |
| 336 |
) -> CFURLRef; |
| 337 |
|
| 338 |
/* Accessing the Parts of a URL */ |
| 339 |
pub fn CFURLCanBeDecomposed(anURL: CFURLRef) -> Boolean; |
| 340 |
pub fn CFURLCopyFileSystemPath(anURL: CFURLRef, pathStyle: CFURLPathStyle) -> CFStringRef; |
| 341 |
pub fn CFURLCopyFragment(anURL: CFURLRef, charactersToLeaveEscaped: CFStringRef) |
| 342 |
-> CFStringRef; |
| 343 |
pub fn CFURLCopyHostName(anURL: CFURLRef) -> CFStringRef; |
| 344 |
pub fn CFURLCopyLastPathComponent(anURL: CFURLRef) -> CFStringRef; |
| 345 |
pub fn CFURLCopyNetLocation(anURL: CFURLRef) -> CFStringRef; |
| 346 |
pub fn CFURLCopyParameterString( |
| 347 |
anURL: CFURLRef, |
| 348 |
charactersToLeaveEscaped: CFStringRef, |
| 349 |
) -> CFStringRef; // deprecated |
| 350 |
pub fn CFURLCopyPassword(anURL: CFURLRef) -> CFStringRef; |
| 351 |
pub fn CFURLCopyPath(anURL: CFURLRef) -> CFStringRef; |
| 352 |
pub fn CFURLCopyPathExtension(anURL: CFURLRef) -> CFStringRef; |
| 353 |
pub fn CFURLCopyQueryString( |
| 354 |
anURL: CFURLRef, |
| 355 |
charactersToLeaveEscaped: CFStringRef, |
| 356 |
) -> CFStringRef; |
| 357 |
pub fn CFURLCopyResourceSpecifier(anURL: CFURLRef) -> CFStringRef; |
| 358 |
pub fn CFURLCopyScheme(anURL: CFURLRef) -> CFStringRef; |
| 359 |
pub fn CFURLCopyStrictPath(anURL: CFURLRef, isAbsolute: *mut Boolean) -> CFStringRef; |
| 360 |
pub fn CFURLCopyUserName(anURL: CFURLRef) -> CFStringRef; |
| 361 |
pub fn CFURLGetPortNumber(anURL: CFURLRef) -> SInt32; |
| 362 |
pub fn CFURLHasDirectoryPath(anURL: CFURLRef) -> Boolean; |
| 363 |
|
| 364 |
/* Converting URLs to Other Representations */ |
| 365 |
pub fn CFURLCreateData( |
| 366 |
allocator: CFAllocatorRef, |
| 367 |
url: CFURLRef, |
| 368 |
encoding: CFStringEncoding, |
| 369 |
escapeWhitespace: Boolean, |
| 370 |
) -> CFDataRef; |
| 371 |
pub fn CFURLCreateStringByAddingPercentEscapes( |
| 372 |
allocator: CFAllocatorRef, |
| 373 |
originalString: CFStringRef, |
| 374 |
charactersToLeaveUnescaped: CFStringRef, |
| 375 |
legalURLCharactersToBeEscaped: CFStringRef, |
| 376 |
encoding: CFStringEncoding, |
| 377 |
) -> CFStringRef; // API_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).", macos(10.0,10.11), ios(2.0,9.0), watchos(2.0,2.0), tvos(9.0,9.0)); |
| 378 |
pub fn CFURLCreateStringByReplacingPercentEscapes( |
| 379 |
allocator: CFAllocatorRef, |
| 380 |
originalString: CFStringRef, |
| 381 |
charactersToLeaveEscaped: CFStringRef, |
| 382 |
) -> CFStringRef; |
| 383 |
pub fn CFURLCreateStringByReplacingPercentEscapesUsingEncoding( |
| 384 |
allocator: CFAllocatorRef, |
| 385 |
origString: CFStringRef, |
| 386 |
charsToLeaveEscaped: CFStringRef, |
| 387 |
encoding: CFStringEncoding, |
| 388 |
) -> CFStringRef; // deprecated |
| 389 |
pub fn CFURLGetFileSystemRepresentation( |
| 390 |
anURL: CFURLRef, |
| 391 |
resolveAgainstBase: Boolean, |
| 392 |
buffer: *mut u8, |
| 393 |
maxBufLen: CFIndex, |
| 394 |
) -> Boolean; |
| 395 |
//pub fn CFURLIsFileReferenceURL(url: CFURLRef) -> Boolean; // macos(10.9)+ |
| 396 |
//pub fn CFURLGetFSRef(url: CFURLRef, fsRef: *mut FSRef) -> Boolean; |
| 397 |
pub fn CFURLGetString(anURL: CFURLRef) -> CFStringRef; |
| 398 |
|
| 399 |
/* Getting URL Properties */ |
| 400 |
pub fn CFURLGetBaseURL(anURL: CFURLRef) -> CFURLRef; |
| 401 |
pub fn CFURLGetBytes(anURL: CFURLRef, buffer: *mut u8, bufferLength: CFIndex) -> CFIndex; |
| 402 |
pub fn CFURLGetByteRangeForComponent( |
| 403 |
url: CFURLRef, |
| 404 |
component: CFURLComponentType, |
| 405 |
rangeIncludingSeparators: *mut CFRange, |
| 406 |
) -> CFRange; |
| 407 |
pub fn CFURLGetTypeID() -> CFTypeID; |
| 408 |
pub fn CFURLResourceIsReachable(url: CFURLRef, error: *mut CFErrorRef) -> Boolean; |
| 409 |
|
| 410 |
/* Getting and Setting File System Resource Properties */ |
| 411 |
pub fn CFURLClearResourcePropertyCache(url: CFURLRef); |
| 412 |
pub fn CFURLClearResourcePropertyCacheForKey(url: CFURLRef, key: CFStringRef); |
| 413 |
pub fn CFURLCopyResourcePropertiesForKeys( |
| 414 |
url: CFURLRef, |
| 415 |
keys: CFArrayRef, |
| 416 |
error: *mut CFErrorRef, |
| 417 |
) -> CFDictionaryRef; |
| 418 |
//pub fn CFURLCopyResourcePropertyForKey(url: CFURLRef, key: CFStringRef, propertyValueTypeRefPtr: *mut c_void, error: *mut CFErrorRef) -> Boolean |
| 419 |
pub fn CFURLCreateResourcePropertiesForKeysFromBookmarkData( |
| 420 |
allocator: CFAllocatorRef, |
| 421 |
resourcePropertiesToReturn: CFArrayRef, |
| 422 |
bookmark: CFDataRef, |
| 423 |
) -> CFDictionaryRef; |
| 424 |
pub fn CFURLCreateResourcePropertyForKeyFromBookmarkData( |
| 425 |
allocator: CFAllocatorRef, |
| 426 |
resourcePropertyKey: CFStringRef, |
| 427 |
bookmark: CFDataRef, |
| 428 |
) -> CFTypeRef; |
| 429 |
pub fn CFURLSetResourcePropertiesForKeys( |
| 430 |
url: CFURLRef, |
| 431 |
keyedPropertyValues: CFDictionaryRef, |
| 432 |
error: *mut CFErrorRef, |
| 433 |
) -> Boolean; |
| 434 |
pub fn CFURLSetResourcePropertyForKey( |
| 435 |
url: CFURLRef, |
| 436 |
key: CFStringRef, |
| 437 |
value: CFTypeRef, |
| 438 |
error: *mut CFErrorRef, |
| 439 |
) -> Boolean; |
| 440 |
pub fn CFURLSetTemporaryResourcePropertyForKey( |
| 441 |
url: CFURLRef, |
| 442 |
key: CFStringRef, |
| 443 |
propertyValue: CFTypeRef, |
| 444 |
); |
| 445 |
|
| 446 |
/* Working with Bookmark Data */ |
| 447 |
pub fn CFURLCreateBookmarkData( |
| 448 |
allocator: CFAllocatorRef, |
| 449 |
url: CFURLRef, |
| 450 |
options: CFURLBookmarkCreationOptions, |
| 451 |
resourcePropertiesToInclude: CFArrayRef, |
| 452 |
relativeToURL: CFURLRef, |
| 453 |
error: *mut CFErrorRef, |
| 454 |
) -> CFDataRef; |
| 455 |
|
| 456 |
#[cfg(target_os = "macos")] |
| 457 |
pub fn CFURLCreateBookmarkDataFromAliasRecord( |
| 458 |
allocator: CFAllocatorRef, |
| 459 |
aliasRecordDataRef: CFDataRef, |
| 460 |
) -> CFDataRef; // deprecated |
| 461 |
|
| 462 |
pub fn CFURLCreateBookmarkDataFromFile( |
| 463 |
allocator: CFAllocatorRef, |
| 464 |
fileURL: CFURLRef, |
| 465 |
errorRef: *mut CFErrorRef, |
| 466 |
) -> CFDataRef; |
| 467 |
pub fn CFURLWriteBookmarkDataToFile( |
| 468 |
bookmarkRef: CFDataRef, |
| 469 |
fileURL: CFURLRef, |
| 470 |
options: CFURLBookmarkFileCreationOptions, |
| 471 |
errorRef: *mut CFErrorRef, |
| 472 |
) -> Boolean; |
| 473 |
pub fn CFURLStartAccessingSecurityScopedResource(url: CFURLRef) -> Boolean; |
| 474 |
pub fn CFURLStopAccessingSecurityScopedResource(url: CFURLRef); |
| 475 |
} |
| 476 |
|
| 477 |
#[test] |
| 478 |
#[cfg(feature = "mac_os_10_8_features")] |
| 479 |
fn can_see_excluded_from_backup_key() { |
| 480 |
let _ = unsafe { kCFURLIsExcludedFromBackupKey }; |
| 481 |
} |