GNUstep CoreBase Library 0.2
CFURL.h
1/* CFURL.h
2
3 Copyright (C) 2010 Free Software Foundation, Inc.
4
5 Written by: Eric Wasylishen <ewasylishen@gmail.com>
6 Date: January, 2010
7
8 This file is part of the GNUstep CoreBase Library.
9
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 2.1 of the License, or (at your option) any later version.
14
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public
21 License along with this library; see the file COPYING.LIB.
22 If not, see <http://www.gnu.org/licenses/> or write to the
23 Free Software Foundation, 51 Franklin Street, Fifth Floor,
24 Boston, MA 02110-1301, USA.
25*/
26
27#ifndef __COREFOUNDATION_CFURL_H__
28#define __COREFOUNDATION_CFURL_H__
29
30#include <CoreFoundation/CFBase.h>
31#include <CoreFoundation/CFArray.h>
32#include <CoreFoundation/CFDictionary.h>
33#include <CoreFoundation/CFError.h>
34#include <CoreFoundation/CFString.h>
35
36CF_EXTERN_C_BEGIN
40typedef const struct __CFURL *CFURLRef;
41
42#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
43typedef CFOptionFlags CFURLBookmarkCreationOptions;
44typedef CFOptionFlags CFURLBookmarkFileCreationOptions;
45typedef CFOptionFlags CFURLBookmarkResolutionOptions;
46#endif
47
51typedef enum
52{
53 kCFURLPOSIXPathStyle = 0,
54 kCFURLHFSPathStyle = 1,
55 kCFURLWindowsPathStyle = 2
56} CFURLPathStyle;
57
58#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
59typedef enum
60{
61 kCFURLComponentScheme = 1,
62 kCFURLComponentNetLocation = 2,
63 kCFURLComponentPath = 3,
64 kCFURLComponentResourceSpecifier = 4,
65 kCFURLComponentUser = 5,
66 kCFURLComponentPassword = 6,
67 kCFURLComponentUserInfo = 7,
68 kCFURLComponentHost = 8,
69 kCFURLComponentPort = 9,
70 kCFURLComponentParameterString = 10,
71 kCFURLComponentQuery = 11,
72 kCFURLComponentFragment = 12
73} CFURLComponentType;
74#endif
75
76#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
77enum
78{
79 kCFURLBookmarkCreationPreferFileIDResolutionMask = (1 << 8),
80 kCFURLBookmarkCreationMinimalBookmarkMask = (1 << 9),
81 kCFURLBookmarkCreationSuitableForBookmarkFile = (1 << 10)
82};
83
84enum
85{
86 kCFBookmarkResolutionWithoutUIMask = (1 << 8),
87 kCFBookmarkResolutionWithoutMountingMask = (1 << 9)
88};
94CF_EXPORT const CFStringRef kCFURLNameKey;
95CF_EXPORT const CFStringRef kCFURLLocalizedNameKey;
96CF_EXPORT const CFStringRef kCFURLIsRegularFileKey;
97CF_EXPORT const CFStringRef kCFURLIsDirectoryKey;
98CF_EXPORT const CFStringRef kCFURLIsSymbolicLinkKey;
99CF_EXPORT const CFStringRef kCFURLIsVolumeKey;
100CF_EXPORT const CFStringRef kCFURLIsPackageKey;
101CF_EXPORT const CFStringRef kCFURLIsSystemImmutableKey;
102CF_EXPORT const CFStringRef kCFURLIsUserImmutableKey;
103CF_EXPORT const CFStringRef kCFURLIsHiddenKey;
104CF_EXPORT const CFStringRef kCFURLHasHiddenExtensionKey;
105CF_EXPORT const CFStringRef kCFURLCreationDateKey;
106CF_EXPORT const CFStringRef kCFURLContentAccessDateKey;
107CF_EXPORT const CFStringRef kCFURLContentModificationDateKey;
108CF_EXPORT const CFStringRef kCFURLAttributeModificationDateKey;
109CF_EXPORT const CFStringRef kCFURLLinkCountKey;
110CF_EXPORT const CFStringRef kCFURLParentDirectoryURLKey;
111CF_EXPORT const CFStringRef kCFURLVolumeURLKey;
112CF_EXPORT const CFStringRef kCFURLTypeIdentifierKey;
113CF_EXPORT const CFStringRef kCFURLLocalizedTypeDescriptionKey;
114CF_EXPORT const CFStringRef kCFURLLabelNumberKey;
115CF_EXPORT const CFStringRef kCFURLLabelColorKey;
116CF_EXPORT const CFStringRef kCFURLLocalizedLabelKey;
117CF_EXPORT const CFStringRef kCFURLEffectiveIconKey;
118CF_EXPORT const CFStringRef kCFURLCustomIconKey;
119#endif
120#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
121CF_EXPORT const CFStringRef kCFURLFileResourceIdentifierKey;
122CF_EXPORT const CFStringRef kCFURLVolumeIdentifierKey;
123CF_EXPORT const CFStringRef kCFURLPreferredIOBlockSizeKey;
124CF_EXPORT const CFStringRef kCFURLIsReadableKey;
125CF_EXPORT const CFStringRef kCFURLIsWritableKey;
126CF_EXPORT const CFStringRef kCFURLIsExecutableKey;
127CF_EXPORT const CFStringRef kCFURLFileSecurityKey;
128CF_EXPORT const CFStringRef kCFURLFileResourceTypeKey;
129#endif
135#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
136CF_EXPORT const CFStringRef kCFURLFileResourceTypeBlockSpecial;
137CF_EXPORT const CFStringRef kCFURLFileResourceTypeCharacterSpecial;
138CF_EXPORT const CFStringRef kCFURLFileResourceTypeDirectory;
139CF_EXPORT const CFStringRef kCFURLFileResourceTypeNamedPipe;
140CF_EXPORT const CFStringRef kCFURLFileResourceTypeRegular;
141CF_EXPORT const CFStringRef kCFURLFileResourceTypeSocket;
142CF_EXPORT const CFStringRef kCFURLFileResourceTypeSymbolicLink;
143CF_EXPORT const CFStringRef kCFURLFileResourceTypeUnknown;
144#endif
150#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
151CF_EXPORT const CFStringRef kCFURLFileAllocatedSizeKey;
152CF_EXPORT const CFStringRef kCFURLFileSizeKey;
153CF_EXPORT const CFStringRef kCFURLIsAliasFileKey;
154#endif
155#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
156CF_EXPORT const CFStringRef kCFURLIsMountTriggerKey;
157CF_EXPORT const CFStringRef kCFURLTotalFileAllocatedSizeKey;
158CF_EXPORT const CFStringRef kCFURLTotalFileSizeKey;
159#endif
165#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
166CF_EXPORT const CFStringRef kCFURLVolumeLocalizedFormatDescriptionKey;
167CF_EXPORT const CFStringRef kCFURLVolumeTotalCapacityKey;
168CF_EXPORT const CFStringRef kCFURLVolumeAvailableCapacityKey;
169CF_EXPORT const CFStringRef kCFURLVolumeResourceCountKey;
170CF_EXPORT const CFStringRef kCFURLVolumeSupportsPersistentIDsKey;
171CF_EXPORT const CFStringRef kCFURLVolumeSupportsSymbolicLinksKey;
172CF_EXPORT const CFStringRef kCFURLVolumeSupportsHardLinksKey;
173CF_EXPORT const CFStringRef kCFURLVolumeSupportsJournalingKey;
174CF_EXPORT const CFStringRef kCFURLVolumeIsJournalingKey;
175CF_EXPORT const CFStringRef kCFURLVolumeSupportsSparseFilesKey;
176CF_EXPORT const CFStringRef kCFURLVolumeSupportsZeroRunsKey;
177CF_EXPORT const CFStringRef kCFURLVolumeSupportsCaseSensitiveNamesKey;
178CF_EXPORT const CFStringRef kCFURLVolumeSupportsCasePreservedNamesKey;
179#endif
180#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
181CF_EXPORT const CFStringRef kCFURLVolumeNameKey;
182CF_EXPORT const CFStringRef kCFURLVolumeLocalizedNameKey;
183CF_EXPORT const CFStringRef kCFURLVolumeSupportsRootDirectoryDatesKey;
184CF_EXPORT const CFStringRef kCFURLVolumeSupportsVolumeSizesKey;
185CF_EXPORT const CFStringRef kCFURLVolumeSupportsRenamingKey;
186CF_EXPORT const CFStringRef kCFURLVolumeSupportsAdvisoryFileLockingKey;
187CF_EXPORT const CFStringRef kCFURLVolumeSupportsExtendedSecurityKey;
188CF_EXPORT const CFStringRef kCFURLVolumeIsBrowsableKey;
189CF_EXPORT const CFStringRef kCFURLVolumeMaximumFileSizeKey;
190CF_EXPORT const CFStringRef kCFURLVolumeIsEjectableKey;
191CF_EXPORT const CFStringRef kCFURLVolumeIsRemovableKey;
192CF_EXPORT const CFStringRef kCFURLVolumeIsInternalKey;
193CF_EXPORT const CFStringRef kCFURLVolumeIsAutomountedKey;
194CF_EXPORT const CFStringRef kCFURLVolumeIsLocalKey;
195CF_EXPORT const CFStringRef kCFURLVolumeIsReadOnlyKey;
196CF_EXPORT const CFStringRef kCFURLVolumeCreationDateKey;
197CF_EXPORT const CFStringRef kCFURLVolumeURLForRemountingKey;
198CF_EXPORT const CFStringRef kCFURLVolumeUUIDStringKey;
199#endif
205#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
206CF_EXPORT const CFStringRef kCFURLKeysOfUnsetValuesKey;
207#endif
213CF_EXPORT CFTypeID CFURLGetTypeID (void);
219CF_EXPORT CFURLRef CFURLCopyAbsoluteURL (CFURLRef relativeURL);
220
221#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
222CF_EXPORT CFURLRef
223CFURLCreateAbsoluteURLWithBytes (CFAllocatorRef alloc,
224 const UInt8 * relativeURLBytes, CFIndex length,
225 CFStringEncoding encoding, CFURLRef baseURL,
226 Boolean useCompatibilityMode);
227#endif
228
229#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
230CF_EXPORT CFURLRef
231CFURLCreateByResolvingBookmarkData (CFAllocatorRef alloc, CFDataRef bookmark,
232 CFURLBookmarkResolutionOptions options,
233 CFURLRef relativeToURL,
234 CFArrayRef resourcePropertiesToInclude,
235 Boolean * isStale, CFErrorRef * error);
236#endif
237
238CF_EXPORT CFURLRef
239CFURLCreateCopyAppendingPathComponent (CFAllocatorRef alloc, CFURLRef url,
240 CFStringRef pathComponent,
241 Boolean isDirectory);
242
243CF_EXPORT CFURLRef
244CFURLCreateCopyAppendingPathExtension (CFAllocatorRef alloc, CFURLRef url,
245 CFStringRef extension);
246
247CF_EXPORT CFURLRef
248CFURLCreateCopyDeletingLastPathComponent (CFAllocatorRef alloc, CFURLRef url);
249
250CF_EXPORT CFURLRef
251CFURLCreateCopyDeletingPathExtension (CFAllocatorRef alloc, CFURLRef url);
252
253#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
254CF_EXPORT CFURLRef
255CFURLCreateFilePathURL (CFAllocatorRef allocator, CFURLRef url,
256 CFErrorRef * error);
257
258CF_EXPORT CFURLRef
259CFURLCreateFileReferenceURL (CFAllocatorRef allocator, CFURLRef url,
260 CFErrorRef * error);
261#endif
262
263CF_EXPORT CFURLRef
264CFURLCreateFromFileSystemRepresentation (CFAllocatorRef alloc,
265 const UInt8 * buffer, CFIndex bufLen,
266 Boolean isDirectory);
267
268CF_EXPORT CFURLRef
269CFURLCreateFromFileSystemRepresentationRelativeToBase (CFAllocatorRef alloc,
270 const UInt8 * buffer,
271 CFIndex bufLen,
272 Boolean isDirectory,
273 CFURLRef baseURL);
274
275#if 0 /* No FSRef support */
276CF_EXPORT CFURLRef
277CFURLCreateFromFSRef (CFAllocatorRef alloc, const struct FSRef *fsRef);
278#endif
279
280CF_EXPORT CFURLRef
281CFURLCreateWithBytes (CFAllocatorRef alloc, const UInt8 * bytes, CFIndex length,
282 CFStringEncoding encoding, CFURLRef baseURL);
283
284CF_EXPORT CFURLRef
285CFURLCreateWithFileSystemPath (CFAllocatorRef allocator,
286 CFStringRef fileSystemPath, CFURLPathStyle style,
287 Boolean isDirectory);
288
289CF_EXPORT CFURLRef
290CFURLCreateWithFileSystemPathRelativeToBase (CFAllocatorRef alloc,
291 CFStringRef filePath,
292 CFURLPathStyle style,
293 Boolean isDirectory,
294 CFURLRef baseURL);
295
296CF_EXPORT CFURLRef
297CFURLCreateWithString (CFAllocatorRef allocator, CFStringRef string,
298 CFURLRef baseURL);
304CF_EXPORT Boolean CFURLCanBeDecomposed (CFURLRef url);
305
306CFStringRef CFURLCopyFileSystemPath (CFURLRef aURL, CFURLPathStyle style);
307
308CF_EXPORT CFStringRef
309CFURLCopyFragment (CFURLRef url, CFStringRef charactersToLeaveEscaped);
310
311CF_EXPORT CFStringRef CFURLCopyHostName (CFURLRef url);
312
313CF_EXPORT CFStringRef CFURLCopyLastPathComponent (CFURLRef url);
314
315CF_EXPORT CFStringRef CFURLCopyNetLocation (CFURLRef url);
316
317CF_EXPORT CFStringRef
318CFURLCopyParameterString (CFURLRef url, CFStringRef charactersToLeaveEscaped);
319
320CF_EXPORT CFStringRef CFURLCopyPassword (CFURLRef url);
321
322CF_EXPORT CFStringRef CFURLCopyPath (CFURLRef url);
323
324CF_EXPORT CFStringRef CFURLCopyPathExtension (CFURLRef url);
325
326CF_EXPORT CFStringRef
327CFURLCopyQueryString (CFURLRef url, CFStringRef charactersToLeaveEscaped);
328
329CF_EXPORT CFStringRef CFURLCopyResourceSpecifier (CFURLRef url);
330
331CF_EXPORT CFStringRef CFURLCopyScheme (CFURLRef url);
332
333CF_EXPORT CFStringRef CFURLCopyStrictPath (CFURLRef url, Boolean * isAbsolute);
334
335CF_EXPORT CFStringRef CFURLCopyUserName (CFURLRef url);
336
337CF_EXPORT SInt32 CFURLGetPortNumber (CFURLRef url);
338
339CF_EXPORT Boolean CFURLHasDirectoryPath (CFURLRef url);
345CF_EXPORT CFDataRef
346CFURLCreateData (CFAllocatorRef alloc, CFURLRef url, CFStringEncoding encoding,
347 Boolean escapeWhiteSpace);
348
349CF_EXPORT CFStringRef
350CFURLCreateStringByAddingPercentEscapes (CFAllocatorRef alloc,
351 CFStringRef origString,
352 CFStringRef charactersToLeaveUnescaped,
353 CFStringRef
354 legalURLCharactersToBeEscaped,
355 CFStringEncoding encoding);
356
357CF_EXPORT CFStringRef
358CFURLCreateStringByReplacingPercentEscapes (CFAllocatorRef alloc,
359 CFStringRef origString,
360 CFStringRef
361 charactersToLeaveEscaped);
362
363#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
364CF_EXPORT CFStringRef
365CFURLCreateStringByReplacingPercentEscapesUsingEncoding (CFAllocatorRef alloc,
366 CFStringRef origString,
367 CFStringRef
368 charactersToLeaveEscaped,
369 CFStringEncoding
370 encoding);
371#endif
372
373CF_EXPORT Boolean
374CFURLGetFileSystemRepresentation (CFURLRef url, Boolean resolveAgainstBase,
375 UInt8 * buffer, CFIndex bufLen);
376
377#if 0 /* FSRef unsupported */
378CF_EXPORT Boolean CFURLGetFSRef (CFURLRef url, struct FSRef *fsRef);
379#endif
380
381CF_EXPORT CFStringRef CFURLGetString (CFURLRef url);
387CF_EXPORT CFURLRef CFURLGetBaseURL (CFURLRef url);
388
389#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
390CF_EXPORT CFIndex CFURLGetBytes (CFURLRef url, UInt8 * buffer, CFIndex bufLen);
391
392CF_EXPORT CFRange
393CFURLGetByteRangeForComponent (CFURLRef url, CFURLComponentType comp,
394 CFRange * rangeIncludingSeparators);
395
396CF_EXPORT Boolean CFURLResourceIsReachable (CFURLRef url, CFErrorRef * error);
397#endif
403#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
404CF_EXPORT void CFURLClearResourcePropertyCache (CFURLRef url);
405
406CF_EXPORT void
407CFURLClearResourcePropertyCacheForKey (CFURLRef url, CFStringRef key);
408
409CF_EXPORT CFDictionaryRef
410CFURLCopyResourcePropertiesForKeys (CFURLRef url, CFArrayRef keys,
411 CFErrorRef * error);
412
413CF_EXPORT Boolean
414CFURLCopyResourcePropertyForKey (CFURLRef url, CFStringRef key,
415 void *propertyValueTypeRefPtr,
416 CFErrorRef * error);
417
418CF_EXPORT CFDictionaryRef
419CFURLCreateResourcePropertiesForKeysFromBookmarkData (CFAllocatorRef allocator,
421 resourcePropertiesToReturn,
422 CFDataRef bookmark);
423
424CF_EXPORT CFTypeRef
425CFURLCreateResourcePropertyForKeyFromBookmarkData (CFAllocatorRef allocator,
426 CFStringRef
427 resourcePropertyKey,
428 CFDataRef bookmark);
429
430CF_EXPORT Boolean
431CFURLSetResourcePropertiesForKeys (CFURLRef url,
432 CFDictionaryRef keyedPropertyValues,
433 CFErrorRef * error);
434
435CF_EXPORT Boolean
436CFURLSetResourcePropertyForKey (CFURLRef url, CFStringRef key,
437 CFTypeRef propertValue, CFErrorRef * error);
438
439CF_EXPORT void
440CFURLSetTemporaryResourcePropertyForKey (CFURLRef url, CFStringRef key,
441 CFTypeRef propertyValue);
447CF_EXPORT CFDataRef
448CFURLCreateBookmarkData (CFAllocatorRef alloc, CFURLRef url,
449 CFURLBookmarkCreationOptions options,
450 CFArrayRef resourcePropertiesToInclude,
451 CFURLRef relativeToURL, CFErrorRef * error);
452
453CF_EXPORT CFDataRef
454CFURLCreateBookmarkDataFromAliasRecord (CFAllocatorRef alloc,
455 CFDataRef aliasRecordDataRef);
456
457CF_EXPORT CFDataRef
458CFURLCreateBookmarkDataFromFile (CFAllocatorRef allocator, CFURLRef fileURL,
459 CFErrorRef * errorRef);
460
461CF_EXPORT Boolean
462CFURLWriteBookmarkDataToFile (CFDataRef bookmarkRef, CFURLRef fileURL,
463 CFURLBookmarkFileCreationOptions options,
464 CFErrorRef * errorRef);
465#endif
469CF_EXTERN_C_END
470#endif /* __COREFOUNDATION_CFURL_H__ */
unsigned long CFOptionFlags
Definition CFBase.h:163
signed long CFIndex
Definition CFBase.h:165
Definition CFBase.h:172
const struct __CFAllocator * CFAllocatorRef
A reference to a CFAllocator object.
Definition CFBase.h:301
const struct __CFArray * CFArrayRef
Reference to an immutable array object.
Definition CFArray.h:37