CFURL Reference

## Detailed Description

## Typedefs

typedef const struct __CFURL * | CFURLRef
typedef CFOptionFlags | CFURLBookmarkCreationOptions
typedef CFOptionFlags | CFURLBookmarkFileCreationOptions
typedef CFOptionFlags | CFURLBookmarkResolutionOptions

## Constants

enum | CFURLPathStyle { kCFURLPOSIXPathStyle = 0 , kCFURLHFSPathStyle = 1 , kCFURLWindowsPathStyle = 2 }
enum | CFURLComponentType { kCFURLComponentScheme = 1 , kCFURLComponentNetLocation = 2 , kCFURLComponentPath = 3 , kCFURLComponentResourceSpecifier = 4 , kCFURLComponentUser = 5 , kCFURLComponentPassword = 6 , kCFURLComponentUserInfo = 7 , kCFURLComponentHost = 8 , kCFURLComponentPort = 9 , kCFURLComponentParameterString = 10 , kCFURLComponentQuery = 11 , kCFURLComponentFragment = 12 }
enum | { kCFURLBookmarkCreationPreferFileIDResolutionMask = (1 << 8) , kCFURLBookmarkCreationMinimalBookmarkMask = (1 << 9) , kCFURLBookmarkCreationSuitableForBookmarkFile = (1 << 10) }
enum | { kCFBookmarkResolutionWithoutUIMask = (1 << 8) , kCFBookmarkResolutionWithoutMountingMask = (1 << 9) }

## Common File System Resource Keys

const CFStringRef | kCFURLNameKey
const CFStringRef | kCFURLLocalizedNameKey
const CFStringRef | kCFURLIsRegularFileKey
const CFStringRef | kCFURLIsDirectoryKey
const CFStringRef | kCFURLIsSymbolicLinkKey
const CFStringRef | kCFURLIsVolumeKey
const CFStringRef | kCFURLIsPackageKey
const CFStringRef | kCFURLIsSystemImmutableKey
const CFStringRef | kCFURLIsUserImmutableKey
const CFStringRef | kCFURLIsHiddenKey
const CFStringRef | kCFURLHasHiddenExtensionKey
const CFStringRef | kCFURLCreationDateKey
const CFStringRef | kCFURLContentAccessDateKey
const CFStringRef | kCFURLContentModificationDateKey
const CFStringRef | kCFURLAttributeModificationDateKey
const CFStringRef | kCFURLLinkCountKey
const CFStringRef | kCFURLParentDirectoryURLKey
const CFStringRef | kCFURLVolumeURLKey
const CFStringRef | kCFURLTypeIdentifierKey
const CFStringRef | kCFURLLocalizedTypeDescriptionKey
const CFStringRef | kCFURLLabelNumberKey
const CFStringRef | kCFURLLabelColorKey
const CFStringRef | kCFURLLocalizedLabelKey
const CFStringRef | kCFURLEffectiveIconKey
const CFStringRef | kCFURLCustomIconKey
const CFStringRef | kCFURLFileResourceIdentifierKey
const CFStringRef | kCFURLVolumeIdentifierKey
const CFStringRef | kCFURLPreferredIOBlockSizeKey
const CFStringRef | kCFURLIsReadableKey
const CFStringRef | kCFURLIsWritableKey
const CFStringRef | kCFURLIsExecutableKey
const CFStringRef | kCFURLFileSecurityKey
const CFStringRef | kCFURLFileResourceTypeKey

## File Resource Types

const CFStringRef | kCFURLFileResourceTypeBlockSpecial
const CFStringRef | kCFURLFileResourceTypeCharacterSpecial
const CFStringRef | kCFURLFileResourceTypeDirectory
const CFStringRef | kCFURLFileResourceTypeNamedPipe
const CFStringRef | kCFURLFileResourceTypeRegular
const CFStringRef | kCFURLFileResourceTypeSocket
const CFStringRef | kCFURLFileResourceTypeSymbolicLink
const CFStringRef | kCFURLFileResourceTypeUnknown

## File Property Keys

const CFStringRef | kCFURLFileAllocatedSizeKey
const CFStringRef | kCFURLFileSizeKey
const CFStringRef | kCFURLIsAliasFileKey
const CFStringRef | kCFURLIsMountTriggerKey
const CFStringRef | kCFURLTotalFileAllocatedSizeKey
const CFStringRef | kCFURLTotalFileSizeKey

## Volume Property Keys

const CFStringRef | kCFURLVolumeLocalizedFormatDescriptionKey
const CFStringRef | kCFURLVolumeTotalCapacityKey
const CFStringRef | kCFURLVolumeAvailableCapacityKey
const CFStringRef | kCFURLVolumeResourceCountKey
const CFStringRef | kCFURLVolumeSupportsPersistentIDsKey
const CFStringRef | kCFURLVolumeSupportsSymbolicLinksKey
const CFStringRef | kCFURLVolumeSupportsHardLinksKey
const CFStringRef | kCFURLVolumeSupportsJournalingKey
const CFStringRef | kCFURLVolumeIsJournalingKey
const CFStringRef | kCFURLVolumeSupportsSparseFilesKey
const CFStringRef | kCFURLVolumeSupportsZeroRunsKey
const CFStringRef | kCFURLVolumeSupportsCaseSensitiveNamesKey
const CFStringRef | kCFURLVolumeSupportsCasePreservedNamesKey
const CFStringRef | kCFURLVolumeNameKey
const CFStringRef | kCFURLVolumeLocalizedNameKey
const CFStringRef | kCFURLVolumeSupportsRootDirectoryDatesKey
const CFStringRef | kCFURLVolumeSupportsVolumeSizesKey
const CFStringRef | kCFURLVolumeSupportsRenamingKey
const CFStringRef | kCFURLVolumeSupportsAdvisoryFileLockingKey
const CFStringRef | kCFURLVolumeSupportsExtendedSecurityKey
const CFStringRef | kCFURLVolumeIsBrowsableKey
const CFStringRef | kCFURLVolumeMaximumFileSizeKey
const CFStringRef | kCFURLVolumeIsEjectableKey
const CFStringRef | kCFURLVolumeIsRemovableKey
const CFStringRef | kCFURLVolumeIsInternalKey
const CFStringRef | kCFURLVolumeIsAutomountedKey
const CFStringRef | kCFURLVolumeIsLocalKey
const CFStringRef | kCFURLVolumeIsReadOnlyKey
const CFStringRef | kCFURLVolumeCreationDateKey
const CFStringRef | kCFURLVolumeURLForRemountingKey
const CFStringRef | kCFURLVolumeUUIDStringKey

## CFError userInfo Dictionary Keys

const CFStringRef | kCFURLKeysOfUnsetValuesKey

## Getting the CFURL Type ID

CFTypeID | CFURLGetTypeID (void)

## Creating a CFURL Object

CFURLRef | CFURLCopyAbsoluteURL (CFURLRef relativeURL)
CFURLRef | CFURLCreateAbsoluteURLWithBytes (CFAllocatorRef alloc, const UInt8 *relativeURLBytes, CFIndex length, CFStringEncoding encoding, CFURLRef baseURL, Boolean useCompatibilityMode)
CFURLRef | CFURLCreateByResolvingBookmarkData (CFAllocatorRef alloc, CFDataRef bookmark, CFURLBookmarkResolutionOptions options, CFURLRef relativeToURL, CFArrayRef resourcePropertiesToInclude, Boolean *isStale, CFErrorRef *error)
CFURLRef | CFURLCreateCopyAppendingPathComponent (CFAllocatorRef alloc, CFURLRef url, CFStringRef pathComponent, Boolean isDirectory)
CFURLRef | CFURLCreateCopyAppendingPathExtension (CFAllocatorRef alloc, CFURLRef url, CFStringRef extension)
CFURLRef | CFURLCreateCopyDeletingLastPathComponent (CFAllocatorRef alloc, CFURLRef url)
CFURLRef | CFURLCreateCopyDeletingPathExtension (CFAllocatorRef alloc, CFURLRef url)
CFURLRef | CFURLCreateFilePathURL (CFAllocatorRef allocator, CFURLRef url, CFErrorRef *error)
CFURLRef | CFURLCreateFileReferenceURL (CFAllocatorRef allocator, CFURLRef url, CFErrorRef *error)
CFURLRef | CFURLCreateFromFileSystemRepresentation (CFAllocatorRef alloc, const UInt8 *buffer, CFIndex bufLen, Boolean isDirectory)
CFURLRef | CFURLCreateFromFileSystemRepresentationRelativeToBase (CFAllocatorRef alloc, const UInt8 *buffer, CFIndex bufLen, Boolean isDirectory, CFURLRef baseURL)
CFURLRef | CFURLCreateWithBytes (CFAllocatorRef alloc, const UInt8 *bytes, CFIndex length, CFStringEncoding encoding, CFURLRef baseURL)
CFURLRef | CFURLCreateWithFileSystemPath (CFAllocatorRef allocator, CFStringRef fileSystemPath, CFURLPathStyle style, Boolean isDirectory)
CFURLRef | CFURLCreateWithFileSystemPathRelativeToBase (CFAllocatorRef alloc, CFStringRef filePath, CFURLPathStyle style, Boolean isDirectory, CFURLRef baseURL)
CFURLRef | CFURLCreateWithString (CFAllocatorRef allocator, CFStringRef string, CFURLRef baseURL)

## Accessing the Parts of a URL

Boolean | CFURLCanBeDecomposed (CFURLRef url)
CFStringRef | CFURLCopyFileSystemPath (CFURLRef aURL, CFURLPathStyle style)
CFStringRef | CFURLCopyFragment (CFURLRef url, CFStringRef charactersToLeaveEscaped)
CFStringRef | CFURLCopyHostName (CFURLRef url)
CFStringRef | CFURLCopyLastPathComponent (CFURLRef url)
CFStringRef | CFURLCopyNetLocation (CFURLRef url)
CFStringRef | CFURLCopyParameterString (CFURLRef url, CFStringRef charactersToLeaveEscaped)
CFStringRef | CFURLCopyPassword (CFURLRef url)
CFStringRef | CFURLCopyPath (CFURLRef url)
CFStringRef | CFURLCopyPathExtension (CFURLRef url)
CFStringRef | CFURLCopyQueryString (CFURLRef url, CFStringRef charactersToLeaveEscaped)
CFStringRef | CFURLCopyResourceSpecifier (CFURLRef url)
CFStringRef | CFURLCopyScheme (CFURLRef url)
CFStringRef | CFURLCopyStrictPath (CFURLRef url, Boolean *isAbsolute)
CFStringRef | CFURLCopyUserName (CFURLRef url)
SInt32 | CFURLGetPortNumber (CFURLRef url)
Boolean | CFURLHasDirectoryPath (CFURLRef url)

## Converting URLs to Other Representations

CFDataRef | CFURLCreateData (CFAllocatorRef alloc, CFURLRef url, CFStringEncoding encoding, Boolean escapeWhiteSpace)
CFStringRef | CFURLCreateStringByAddingPercentEscapes (CFAllocatorRef alloc, CFStringRef origString, CFStringRef charactersToLeaveUnescaped, CFStringRef legalURLCharactersToBeEscaped, CFStringEncoding encoding)
CFStringRef | CFURLCreateStringByReplacingPercentEscapes (CFAllocatorRef alloc, CFStringRef origString, CFStringRef charactersToLeaveEscaped)
CFStringRef | CFURLCreateStringByReplacingPercentEscapesUsingEncoding (CFAllocatorRef alloc, CFStringRef origString, CFStringRef charactersToLeaveEscaped, CFStringEncoding encoding)
Boolean | CFURLGetFileSystemRepresentation (CFURLRef url, Boolean resolveAgainstBase, UInt8 *buffer, CFIndex bufLen)
CFStringRef | CFURLGetString (CFURLRef url)

## Getting URL Properties

CFURLRef | CFURLGetBaseURL (CFURLRef url)
CFIndex | CFURLGetBytes (CFURLRef url, UInt8 *buffer, CFIndex bufLen)
CFRange | CFURLGetByteRangeForComponent (CFURLRef url, CFURLComponentType comp, CFRange *rangeIncludingSeparators)
Boolean | CFURLResourceIsReachable (CFURLRef url, CFErrorRef *error)

## Getting and Setting File System Resource Properties

void | CFURLClearResourcePropertyCache (CFURLRef url)
void | CFURLClearResourcePropertyCacheForKey (CFURLRef url, CFStringRef key)
CFDictionaryRef | CFURLCopyResourcePropertiesForKeys (CFURLRef url, CFArrayRef keys, CFErrorRef *error)
Boolean | CFURLCopyResourcePropertyForKey (CFURLRef url, CFStringRef key, void *propertyValueTypeRefPtr, CFErrorRef *error)
CFDictionaryRef | CFURLCreateResourcePropertiesForKeysFromBookmarkData (CFAllocatorRef allocator, CFArrayRef resourcePropertiesToReturn, CFDataRef bookmark)
CFTypeRef | CFURLCreateResourcePropertyForKeyFromBookmarkData (CFAllocatorRef allocator, CFStringRef resourcePropertyKey, CFDataRef bookmark)
Boolean | CFURLSetResourcePropertiesForKeys (CFURLRef url, CFDictionaryRef keyedPropertyValues, CFErrorRef *error)
Boolean | CFURLSetResourcePropertyForKey (CFURLRef url, CFStringRef key, CFTypeRef propertValue, CFErrorRef *error)
void | CFURLSetTemporaryResourcePropertyForKey (CFURLRef url, CFStringRef key, CFTypeRef propertyValue)

## Working with Bookmark Data

CFDataRef | CFURLCreateBookmarkData (CFAllocatorRef alloc, CFURLRef url, CFURLBookmarkCreationOptions options, CFArrayRef resourcePropertiesToInclude, CFURLRef relativeToURL, CFErrorRef *error)
CFDataRef | CFURLCreateBookmarkDataFromAliasRecord (CFAllocatorRef alloc, CFDataRef aliasRecordDataRef)
CFDataRef | CFURLCreateBookmarkDataFromFile (CFAllocatorRef allocator, CFURLRef fileURL, CFErrorRef *errorRef)
Boolean | CFURLWriteBookmarkDataToFile (CFDataRef bookmarkRef, CFURLRef fileURL, CFURLBookmarkFileCreationOptions options, CFErrorRef *errorRef)