1 { CFBundle.h
2 Copyright (c) 1999-2013, Apple Inc. All rights reserved.
3 }
4 {
5 Modified for use with Free Pascal
6 Version 308
7 Please report any bugs to <gpc@microbizz.nl>
8 }
9
10 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
11 {$mode macpas}
12 {$modeswitch cblocks}
13 {$packenum 1}
14 {$macro on}
15 {$inline on}
16 {$calling mwpascal}
17
18 unit CFBundle;
19 interface
20 {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
21 {$setc GAP_INTERFACES_VERSION := $0308}
22
23 {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
24 {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
25 {$endc}
26
27 {$ifc defined CPUPOWERPC and defined CPUI386}
28 {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
29 {$endc}
30 {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
31 {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
32 {$endc}
33
34 {$ifc not defined __ppc__ and defined CPUPOWERPC32}
35 {$setc __ppc__ := 1}
36 {$elsec}
37 {$setc __ppc__ := 0}
38 {$endc}
39 {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
40 {$setc __ppc64__ := 1}
41 {$elsec}
42 {$setc __ppc64__ := 0}
43 {$endc}
44 {$ifc not defined __i386__ and defined CPUI386}
45 {$setc __i386__ := 1}
46 {$elsec}
47 {$setc __i386__ := 0}
48 {$endc}
49 {$ifc not defined __x86_64__ and defined CPUX86_64}
50 {$setc __x86_64__ := 1}
51 {$elsec}
52 {$setc __x86_64__ := 0}
53 {$endc}
54 {$ifc not defined __arm__ and defined CPUARM}
55 {$setc __arm__ := 1}
56 {$elsec}
57 {$setc __arm__ := 0}
58 {$endc}
59 {$ifc not defined __arm64__ and defined CPUAARCH64}
60 {$setc __arm64__ := 1}
61 {$elsec}
62 {$setc __arm64__ := 0}
63 {$endc}
64
65 {$ifc defined cpu64}
66 {$setc __LP64__ := 1}
67 {$elsec}
68 {$setc __LP64__ := 0}
69 {$endc}
70
71
72 {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
73 {$error Conflicting definitions for __ppc__ and __i386__}
74 {$endc}
75
76 {$ifc defined __ppc__ and __ppc__}
77 {$setc TARGET_CPU_PPC := TRUE}
78 {$setc TARGET_CPU_PPC64 := FALSE}
79 {$setc TARGET_CPU_X86 := FALSE}
80 {$setc TARGET_CPU_X86_64 := FALSE}
81 {$setc TARGET_CPU_ARM := FALSE}
82 {$setc TARGET_CPU_ARM64 := FALSE}
83 {$setc TARGET_OS_MAC := TRUE}
84 {$setc TARGET_OS_IPHONE := FALSE}
85 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
86 {$setc TARGET_OS_EMBEDDED := FALSE}
87 {$elifc defined __ppc64__ and __ppc64__}
88 {$setc TARGET_CPU_PPC := FALSE}
89 {$setc TARGET_CPU_PPC64 := TRUE}
90 {$setc TARGET_CPU_X86 := FALSE}
91 {$setc TARGET_CPU_X86_64 := FALSE}
92 {$setc TARGET_CPU_ARM := FALSE}
93 {$setc TARGET_CPU_ARM64 := FALSE}
94 {$setc TARGET_OS_MAC := TRUE}
95 {$setc TARGET_OS_IPHONE := FALSE}
96 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
97 {$setc TARGET_OS_EMBEDDED := FALSE}
98 {$elifc defined __i386__ and __i386__}
99 {$setc TARGET_CPU_PPC := FALSE}
100 {$setc TARGET_CPU_PPC64 := FALSE}
101 {$setc TARGET_CPU_X86 := TRUE}
102 {$setc TARGET_CPU_X86_64 := FALSE}
103 {$setc TARGET_CPU_ARM := FALSE}
104 {$setc TARGET_CPU_ARM64 := FALSE}
105 {$ifc defined iphonesim}
106 {$setc TARGET_OS_MAC := FALSE}
107 {$setc TARGET_OS_IPHONE := TRUE}
108 {$setc TARGET_IPHONE_SIMULATOR := TRUE}
109 {$elsec}
110 {$setc TARGET_OS_MAC := TRUE}
111 {$setc TARGET_OS_IPHONE := FALSE}
112 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
113 {$endc}
114 {$setc TARGET_OS_EMBEDDED := FALSE}
115 {$elifc defined __x86_64__ and __x86_64__}
116 {$setc TARGET_CPU_PPC := FALSE}
117 {$setc TARGET_CPU_PPC64 := FALSE}
118 {$setc TARGET_CPU_X86 := FALSE}
119 {$setc TARGET_CPU_X86_64 := TRUE}
120 {$setc TARGET_CPU_ARM := FALSE}
121 {$setc TARGET_CPU_ARM64 := FALSE}
122 {$ifc defined iphonesim}
123 {$setc TARGET_OS_MAC := FALSE}
124 {$setc TARGET_OS_IPHONE := TRUE}
125 {$setc TARGET_IPHONE_SIMULATOR := TRUE}
126 {$elsec}
127 {$setc TARGET_OS_MAC := TRUE}
128 {$setc TARGET_OS_IPHONE := FALSE}
129 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
130 {$endc}
131 {$setc TARGET_OS_EMBEDDED := FALSE}
132 {$elifc defined __arm__ and __arm__}
133 {$setc TARGET_CPU_PPC := FALSE}
134 {$setc TARGET_CPU_PPC64 := FALSE}
135 {$setc TARGET_CPU_X86 := FALSE}
136 {$setc TARGET_CPU_X86_64 := FALSE}
137 {$setc TARGET_CPU_ARM := TRUE}
138 {$setc TARGET_CPU_ARM64 := FALSE}
139 {$setc TARGET_OS_MAC := FALSE}
140 {$setc TARGET_OS_IPHONE := TRUE}
141 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
142 {$setc TARGET_OS_EMBEDDED := TRUE}
143 {$elifc defined __arm64__ and __arm64__}
144 {$setc TARGET_CPU_PPC := FALSE}
145 {$setc TARGET_CPU_PPC64 := FALSE}
146 {$setc TARGET_CPU_X86 := FALSE}
147 {$setc TARGET_CPU_X86_64 := FALSE}
148 {$setc TARGET_CPU_ARM := FALSE}
149 {$setc TARGET_CPU_ARM64 := TRUE}
150 {$ifc defined ios}
151 {$setc TARGET_OS_MAC := FALSE}
152 {$setc TARGET_OS_IPHONE := TRUE}
153 {$setc TARGET_OS_EMBEDDED := TRUE}
154 {$elsec}
155 {$setc TARGET_OS_MAC := TRUE}
156 {$setc TARGET_OS_IPHONE := FALSE}
157 {$setc TARGET_OS_EMBEDDED := FALSE}
158 {$endc}
159 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
160 {$elsec}
161 {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
162 {$endc}
163
164 {$ifc defined __LP64__ and __LP64__ }
165 {$setc TARGET_CPU_64 := TRUE}
166 {$elsec}
167 {$setc TARGET_CPU_64 := FALSE}
168 {$endc}
169
170 {$ifc defined FPC_BIG_ENDIAN}
171 {$setc TARGET_RT_BIG_ENDIAN := TRUE}
172 {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
173 {$elifc defined FPC_LITTLE_ENDIAN}
174 {$setc TARGET_RT_BIG_ENDIAN := FALSE}
175 {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
176 {$elsec}
177 {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
178 {$endc}
179 {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
180 {$setc CALL_NOT_IN_CARBON := FALSE}
181 {$setc OLDROUTINENAMES := FALSE}
182 {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
183 {$setc OPAQUE_UPP_TYPES := TRUE}
184 {$setc OTCARBONAPPLICATION := TRUE}
185 {$setc OTKERNEL := FALSE}
186 {$setc PM_USE_SESSION_APIS := TRUE}
187 {$setc TARGET_API_MAC_CARBON := TRUE}
188 {$setc TARGET_API_MAC_OS8 := FALSE}
189 {$setc TARGET_API_MAC_OSX := TRUE}
190 {$setc TARGET_CARBON := TRUE}
191 {$setc TARGET_CPU_68K := FALSE}
192 {$setc TARGET_CPU_MIPS := FALSE}
193 {$setc TARGET_CPU_SPARC := FALSE}
194 {$setc TARGET_OS_UNIX := FALSE}
195 {$setc TARGET_OS_WIN32 := FALSE}
196 {$setc TARGET_RT_MAC_68881 := FALSE}
197 {$setc TARGET_RT_MAC_CFM := FALSE}
198 {$setc TARGET_RT_MAC_MACHO := TRUE}
199 {$setc TYPED_FUNCTION_POINTERS := TRUE}
200 {$setc TYPE_BOOL := FALSE}
201 {$setc TYPE_EXTENDED := FALSE}
202 {$setc TYPE_LONGLONG := TRUE}
203 uses MacTypes,CFBase,CFArray,CFDictionary,CFError,CFString,CFURL;
204 {$endc} {not MACOSALLINCLUDE}
205
206 {$ALIGN POWER}
207
208
209 type
210 CFBundleRef = ^__CFBundle; { an opaque type }
211 __CFBundle = record end;
212 CFBundleRefPtr = ^CFBundleRef;
213 CFPlugInRef = ^__CFBundle; { an opaque type }
214 CFPlugInRefPtr = ^CFPlugInRef;
215
216 { ===================== Standard Info.plist keys ===================== }
217 var kCFBundleInfoDictionaryVersionKey: CFStringRef; external name '_kCFBundleInfoDictionaryVersionKey'; (* attribute const *)
218 { The version of the Info.plist format }
219 var kCFBundleExecutableKey: CFStringRef; external name '_kCFBundleExecutableKey'; (* attribute const *)
220 { The name of the executable in this bundle, if any }
221 var kCFBundleIdentifierKey: CFStringRef; external name '_kCFBundleIdentifierKey'; (* attribute const *)
222 { The bundle identifier (for CFBundleGetBundleWithIdentifier()) }
223 var kCFBundleVersionKey: CFStringRef; external name '_kCFBundleVersionKey'; (* attribute const *)
224 { The version number of the bundle. For Mac OS 9 style version numbers (for example "2.5.3d5"), }
225 { clients can use CFBundleGetVersionNumber() instead of accessing this key directly since that }
226 { function will properly convert the version string into its compact integer representation. }
227 var kCFBundleDevelopmentRegionKey: CFStringRef; external name '_kCFBundleDevelopmentRegionKey'; (* attribute const *)
228 { The name of the development language of the bundle. }
229 var kCFBundleNameKey: CFStringRef; external name '_kCFBundleNameKey'; (* attribute const *)
230 { The human-readable name of the bundle. This key is often found in the InfoPlist.strings since it is usually localized. }
231 {#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED}
232 var kCFBundleLocalizationsKey: CFStringRef; external name '_kCFBundleLocalizationsKey'; (* attribute const *)
233 { Allows an unbundled application that handles localization itself to specify which localizations it has available. }
234 {#endif}
235
236 { ===================== Finding Bundles ===================== }
237
CFBundleGetMainBundlenull238 function CFBundleGetMainBundle: CFBundleRef; external name '_CFBundleGetMainBundle';
239
CFBundleGetBundleWithIdentifiernull240 function CFBundleGetBundleWithIdentifier( bundleID: CFStringRef ): CFBundleRef; external name '_CFBundleGetBundleWithIdentifier';
241 { A bundle can name itself by providing a key in the info dictionary. }
242 { This facility is meant to allow bundle-writers to get hold of their }
243 { bundle from their code without having to know where it was on the disk. }
244 { This is meant to be a replacement mechanism for +bundleForClass: users. }
245 { Note that this does not search for bundles on the disk; it will locate }
246 { only bundles already loaded or otherwise known to the current process. }
247
CFBundleGetAllBundlesnull248 function CFBundleGetAllBundles: CFArrayRef; external name '_CFBundleGetAllBundles';
249 { This is potentially expensive, and not thread-safe. Use with care. }
250 { Best used for debuggging or other diagnostic purposes. }
251
252 { ===================== Creating Bundles ===================== }
253
CFBundleGetTypeIDnull254 function CFBundleGetTypeID: CFTypeID; external name '_CFBundleGetTypeID';
255
CFBundleCreatenull256 function CFBundleCreate( allocator: CFAllocatorRef; bundleURL: CFURLRef ): CFBundleRef; external name '_CFBundleCreate';
257 { Might return an existing instance with the ref-count bumped. }
258
CFBundleCreateBundlesFromDirectorynull259 function CFBundleCreateBundlesFromDirectory( allocator: CFAllocatorRef; directoryURL: CFURLRef; bundleType: CFStringRef ): CFArrayRef; external name '_CFBundleCreateBundlesFromDirectory';
260 { Create instances for all bundles in the given directory matching the given type }
261 { (or all of them if bundleType is NULL). Instances are created using CFBundleCreate() and are not released. }
262
263 { ==================== Basic Bundle Info ==================== }
264
CFBundleCopyBundleURLnull265 function CFBundleCopyBundleURL( bundle: CFBundleRef ): CFURLRef; external name '_CFBundleCopyBundleURL';
266
CFBundleGetValueForInfoDictionaryKeynull267 function CFBundleGetValueForInfoDictionaryKey( bundle: CFBundleRef; key: CFStringRef ): CFTypeRef; external name '_CFBundleGetValueForInfoDictionaryKey';
268 { Returns a localized value if available, otherwise the global value. }
269 { This is the recommended function for examining the info dictionary. }
270
CFBundleGetInfoDictionarynull271 function CFBundleGetInfoDictionary( bundle: CFBundleRef ): CFDictionaryRef; external name '_CFBundleGetInfoDictionary';
272 { This is the global info dictionary. Note that CFBundle may add }
273 { extra keys to the dictionary for its own use. }
274
CFBundleGetLocalInfoDictionarynull275 function CFBundleGetLocalInfoDictionary( bundle: CFBundleRef ): CFDictionaryRef; external name '_CFBundleGetLocalInfoDictionary';
276 { This is the localized info dictionary. }
277
278 procedure CFBundleGetPackageInfo( bundle: CFBundleRef; var packageType: OSType; var packageCreator: OSType ); external name '_CFBundleGetPackageInfo';
279
CFBundleGetIdentifiernull280 function CFBundleGetIdentifier( bundle: CFBundleRef ): CFStringRef; external name '_CFBundleGetIdentifier';
281
CFBundleGetVersionNumbernull282 function CFBundleGetVersionNumber( bundle: CFBundleRef ): UInt32; external name '_CFBundleGetVersionNumber';
283
CFBundleGetDevelopmentRegionnull284 function CFBundleGetDevelopmentRegion( bundle: CFBundleRef ): CFStringRef; external name '_CFBundleGetDevelopmentRegion';
285
CFBundleCopySupportFilesDirectoryURLnull286 function CFBundleCopySupportFilesDirectoryURL( bundle: CFBundleRef ): CFURLRef; external name '_CFBundleCopySupportFilesDirectoryURL';
287
CFBundleCopyResourcesDirectoryURLnull288 function CFBundleCopyResourcesDirectoryURL( bundle: CFBundleRef ): CFURLRef; external name '_CFBundleCopyResourcesDirectoryURL';
289
CFBundleCopyPrivateFrameworksURLnull290 function CFBundleCopyPrivateFrameworksURL( bundle: CFBundleRef ): CFURLRef; external name '_CFBundleCopyPrivateFrameworksURL';
291
CFBundleCopySharedFrameworksURLnull292 function CFBundleCopySharedFrameworksURL( bundle: CFBundleRef ): CFURLRef; external name '_CFBundleCopySharedFrameworksURL';
293
CFBundleCopySharedSupportURLnull294 function CFBundleCopySharedSupportURL( bundle: CFBundleRef ): CFURLRef; external name '_CFBundleCopySharedSupportURL';
295
CFBundleCopyBuiltInPlugInsURLnull296 function CFBundleCopyBuiltInPlugInsURL( bundle: CFBundleRef ): CFURLRef; external name '_CFBundleCopyBuiltInPlugInsURL';
297
298 { ------------- Basic Bundle Info without a CFBundle instance ------------- }
299 { This API is provided to enable developers to retrieve basic information }
300 { about a bundle without having to create an instance of CFBundle. }
301 { Because of caching behavior when a CFBundle instance exists, it will be faster }
302 { to actually create a CFBundle if you need to retrieve multiple pieces of info. }
CFBundleCopyInfoDictionaryInDirectorynull303 function CFBundleCopyInfoDictionaryInDirectory( bundleURL: CFURLRef ): CFDictionaryRef; external name '_CFBundleCopyInfoDictionaryInDirectory';
304
CFBundleGetPackageInfoInDirectorynull305 function CFBundleGetPackageInfoInDirectory( url: CFURLRef; var packageType: UInt32; var packageCreator: UInt32 ): Boolean; external name '_CFBundleGetPackageInfoInDirectory';
306
307 { ==================== Resource Handling API ==================== }
308
CFBundleCopyResourceURLnull309 function CFBundleCopyResourceURL( bundle: CFBundleRef; resourceName: CFStringRef; resourceType: CFStringRef; subDirName: CFStringRef ): CFURLRef; external name '_CFBundleCopyResourceURL';
310
CFBundleCopyResourceURLsOfTypenull311 function CFBundleCopyResourceURLsOfType( bundle: CFBundleRef; resourceType: CFStringRef; subDirName: CFStringRef ): CFArrayRef; external name '_CFBundleCopyResourceURLsOfType';
312
CFBundleCopyLocalizedStringnull313 function CFBundleCopyLocalizedString( bundle: CFBundleRef; key: CFStringRef; value: CFStringRef; tableName: CFStringRef ): CFStringRef; external name '_CFBundleCopyLocalizedString';
314
CFCopyLocalizedStringnull315 function CFCopyLocalizedString( key: CFStringRef; comment: PChar ): CFStringRef; inline;
CFCopyLocalizedStringFromTablenull316 function CFCopyLocalizedStringFromTable( key: CFStringRef; tableName: CFStringRef; comment: PChar ): CFStringRef; inline;
CFCopyLocalizedStringFromTableInBundlenull317 function CFCopyLocalizedStringFromTableInBundle( key: CFStringRef; tableName: CFStringRef; bundle: CFBundleRef; comment: PChar ): CFStringRef; inline;
CFCopyLocalizedStringWithDefaultValuenull318 function CFCopyLocalizedStringWithDefaultValue( key: CFStringRef; tableName: CFStringRef; bundle: CFBundleRef; value: CFStringRef; comment: PChar ): CFStringRef; inline;
319
320 { ------------- Resource Handling without a CFBundle instance ------------- }
321 { This API is provided to enable developers to use the CFBundle resource }
322 { searching policy without having to create an instance of CFBundle. }
323 { Because of caching behavior when a CFBundle instance exists, it will be faster }
324 { to actually create a CFBundle if you need to access several resources. }
325
CFBundleCopyResourceURLInDirectorynull326 function CFBundleCopyResourceURLInDirectory( bundleURL: CFURLRef; resourceName: CFStringRef; resourceType: CFStringRef; subDirName: CFStringRef ): CFURLRef; external name '_CFBundleCopyResourceURLInDirectory';
327
CFBundleCopyResourceURLsOfTypeInDirectorynull328 function CFBundleCopyResourceURLsOfTypeInDirectory( bundleURL: CFURLRef; resourceType: CFStringRef; subDirName: CFStringRef ): CFArrayRef; external name '_CFBundleCopyResourceURLsOfTypeInDirectory';
329
330 { =========== Localization-specific Resource Handling API =========== }
331 { This API allows finer-grained control over specific localizations, }
332 { as distinguished from the above API, which always uses the user's }
333 { preferred localizations for the bundle in the current app context. }
334
CFBundleCopyBundleLocalizationsnull335 function CFBundleCopyBundleLocalizations( bundle: CFBundleRef ): CFArrayRef; external name '_CFBundleCopyBundleLocalizations';
336 { Lists the localizations that a bundle contains. }
337
CFBundleCopyPreferredLocalizationsFromArraynull338 function CFBundleCopyPreferredLocalizationsFromArray( locArray: CFArrayRef ): CFArrayRef; external name '_CFBundleCopyPreferredLocalizationsFromArray';
339 { Given an array of possible localizations, returns the one or more }
340 { of them that CFBundle would use in the current application context. }
341 { To determine the localizations that would be used for a particular }
342 { bundle in the current application context, apply this function to the }
343 { result of CFBundleCopyBundleLocalizations(). }
344
345 {#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED}
CFBundleCopyLocalizationsForPreferencesnull346 function CFBundleCopyLocalizationsForPreferences( locArray: CFArrayRef; prefArray: CFArrayRef ): CFArrayRef; external name '_CFBundleCopyLocalizationsForPreferences';
347 { Given an array of possible localizations, returns the one or more of }
348 { them that CFBundle would use, without reference to the current application }
349 { context, if the user's preferred localizations were given by prefArray. }
350 { If prefArray is NULL, the current user's actual preferred localizations will }
351 { be used. This is not the same as CFBundleCopyPreferredLocalizationsFromArray(), }
352 { because that function takes the current application context into account. }
353 { To determine the localizations that another application would use, apply }
354 { this function to the result of CFBundleCopyBundleLocalizations(). }
355 {#endif}
356
CFBundleCopyResourceURLForLocalizationnull357 function CFBundleCopyResourceURLForLocalization( bundle: CFBundleRef; resourceName: CFStringRef; resourceType: CFStringRef; subDirName: CFStringRef; localizationName: CFStringRef ): CFURLRef; external name '_CFBundleCopyResourceURLForLocalization';
358
CFBundleCopyResourceURLsOfTypeForLocalizationnull359 function CFBundleCopyResourceURLsOfTypeForLocalization( bundle: CFBundleRef; resourceType: CFStringRef; subDirName: CFStringRef; localizationName: CFStringRef ): CFArrayRef; external name '_CFBundleCopyResourceURLsOfTypeForLocalization';
360 { The localizationName argument to CFBundleCopyResourceURLForLocalization() or }
361 { CFBundleCopyResourceURLsOfTypeForLocalization() must be identical to one of the }
362 { localizations in the bundle, as returned by CFBundleCopyBundleLocalizations(). }
363 { It is recommended that either CFBundleCopyPreferredLocalizationsFromArray() or }
364 { CFBundleCopyLocalizationsForPreferences() be used to select the localization. }
365
366 {#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED}
367 { =================== Unbundled application info ===================== }
368 { This API is provided to enable developers to retrieve bundle-related }
369 { information about an application that may be bundled or unbundled. }
CFBundleCopyInfoDictionaryForURLnull370 function CFBundleCopyInfoDictionaryForURL( url: CFURLRef ): CFDictionaryRef; external name '_CFBundleCopyInfoDictionaryForURL';
371 { For a directory URL, this is equivalent to CFBundleCopyInfoDictionaryInDirectory(). }
372 { For a plain file URL representing an unbundled executable, this will attempt to read }
373 { an info dictionary from the (__TEXT, __info_plist) section, if it is a Mach-o file, }
374 { or from a 'plst' resource. }
375
CFBundleCopyLocalizationsForURLnull376 function CFBundleCopyLocalizationsForURL( url: CFURLRef ): CFArrayRef; external name '_CFBundleCopyLocalizationsForURL';
377 { For a directory URL, this is equivalent to calling CFBundleCopyBundleLocalizations() }
378 { on the corresponding bundle. For a plain file URL representing an unbundled executable, }
379 { this will attempt to determine its localizations using the CFBundleLocalizations and }
380 { CFBundleDevelopmentRegion keys in the dictionary returned by CFBundleCopyInfoDictionaryForURL,}
381 { or from a 'vers' resource if those are not present. }
382 {#endif}
383
CFBundleCopyExecutableArchitecturesForURLnull384 function CFBundleCopyExecutableArchitecturesForURL( url: CFURLRef ): CFArrayRef; external name '_CFBundleCopyExecutableArchitecturesForURL';
385 (* CF_AVAILABLE_STARTING(10_5, 2_0) *)
386 { For a directory URL, this is equivalent to calling CFBundleCopyExecutableArchitectures() }
387 { on the corresponding bundle. For a plain file URL representing an unbundled executable, }
388 { this will return the architectures it provides, if it is a Mach-o file, or NULL otherwise. }
389
390 { ==================== Primitive Code Loading API ==================== }
391 { This API abstracts the various different executable formats supported on }
392 { various platforms. It can load DYLD, CFM, or DLL shared libraries (on their }
393 { appropriate platforms) and gives a uniform API for looking up functions. }
394 { Note that Cocoa-based bundles containing Objective-C or Java code must }
395 { be loaded with NSBundle, not CFBundle. Once they are loaded, however, }
396 { either CFBundle or NSBundle can be used. }
397
CFBundleCopyExecutableURLnull398 function CFBundleCopyExecutableURL( bundle: CFBundleRef ): CFURLRef; external name '_CFBundleCopyExecutableURL';
399
400 {#if MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED}
401 const
402 kCFBundleExecutableArchitectureI386 = $00000007;
403 kCFBundleExecutableArchitecturePPC = $00000012;
404 kCFBundleExecutableArchitectureX86_64 = $01000007;
405 kCFBundleExecutableArchitecturePPC64 = $01000012;
406 {#endif} { MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED }
407
CFBundleCopyExecutableArchitecturesnull408 function CFBundleCopyExecutableArchitectures( bundle: CFBundleRef ): CFArrayRef; external name '_CFBundleCopyExecutableArchitectures';
409 (* CF_AVAILABLE_STARTING(10_5, 2_0) *)
410 { If the bundle's executable exists and is a Mach-o file, this function will return an array }
411 { of CFNumbers whose values are integers representing the architectures the file provides. }
412 { The values currently in use are those listed in the enum above, but others may be added }
413 { in the future. If the executable is not a Mach-o file, this function returns NULL. }
414
CFBundlePreflightExecutablenull415 function CFBundlePreflightExecutable( bundle: CFBundleRef; var error: CFErrorRef ): Boolean; external name '_CFBundlePreflightExecutable';
416 (* CF_AVAILABLE_STARTING(10_5, 2_0) *)
417 { This function will return true if the bundle is loaded, or if the bundle appears to be }
418 { loadable upon inspection. This does not mean that the bundle is definitively loadable, }
419 { since it may fail to load due to link errors or other problems not readily detectable. }
420 { If this function detects problems, it will return false, and return a CFError by reference. }
421 { It is the responsibility of the caller to release the CFError. }
422
CFBundleLoadExecutableAndReturnErrornull423 function CFBundleLoadExecutableAndReturnError( bundle: CFBundleRef; var error: CFErrorRef ): Boolean; external name '_CFBundleLoadExecutableAndReturnError';
424 (* CF_AVAILABLE_STARTING(10_5, 2_0) *)
425 { If the bundle is already loaded, this function will return true. Otherwise, it will attempt }
426 { to load the bundle, and it will return true if that attempt succeeds. If the bundle fails }
427 { to load, this function will return false, and it will return a CFError by reference. }
428 { It is the responsibility of the caller to release the CFError. }
429
CFBundleLoadExecutablenull430 function CFBundleLoadExecutable( bundle: CFBundleRef ): Boolean; external name '_CFBundleLoadExecutable';
431
CFBundleIsExecutableLoadednull432 function CFBundleIsExecutableLoaded( bundle: CFBundleRef ): Boolean; external name '_CFBundleIsExecutableLoaded';
433
434 procedure CFBundleUnloadExecutable( bundle: CFBundleRef ); external name '_CFBundleUnloadExecutable';
435
CFBundleGetFunctionPointerForNamenull436 function CFBundleGetFunctionPointerForName( bundle: CFBundleRef; functionName: CFStringRef ): UnivPtr; external name '_CFBundleGetFunctionPointerForName';
437
438 procedure CFBundleGetFunctionPointersForNames( bundle: CFBundleRef; functionNames: CFArrayRef; ftbl: {variable-size-array} UnivPtrPtr ); external name '_CFBundleGetFunctionPointersForNames';
439
CFBundleGetDataPointerForNamenull440 function CFBundleGetDataPointerForName( bundle: CFBundleRef; symbolName: CFStringRef ): UnivPtr; external name '_CFBundleGetDataPointerForName';
441
442 procedure CFBundleGetDataPointersForNames( bundle: CFBundleRef; symbolNames: CFArrayRef; stbl: {variable-size-array} UnivPtrPtr ); external name '_CFBundleGetDataPointersForNames';
443
CFBundleCopyAuxiliaryExecutableURLnull444 function CFBundleCopyAuxiliaryExecutableURL( bundle: CFBundleRef; executableName: CFStringRef ): CFURLRef; external name '_CFBundleCopyAuxiliaryExecutableURL';
445 { This function can be used to find executables other than your main }
446 { executable. This is useful, for instance, for applications that have }
447 { some command line tool that is packaged with and used by the application. }
448 { The tool can be packaged in the various platform executable directories }
449 { in the bundle and can be located with this function. This allows an }
450 { app to ship versions of the tool for each platform as it does for the }
451 { main app executable. }
452
453 { ==================== Getting a bundle's plugIn ==================== }
454
CFBundleGetPlugInnull455 function CFBundleGetPlugIn( bundle: CFBundleRef ): CFPlugInRef; external name '_CFBundleGetPlugIn';
456
457 { ==================== Resource Manager-Related API ==================== }
458
459 {$ifc TARGET_CPU_64}
460 type
461 CFBundleRefNum = SInt32;
462 {$elsec}
463 type
464 CFBundleRefNum = SInt16;
465 {$endc}
466
CFBundleOpenBundleResourceMapnull467 function CFBundleOpenBundleResourceMap( bundle: CFBundleRef ): CFBundleRefNum; external name '_CFBundleOpenBundleResourceMap';
468 { This function opens the non-localized and the localized resource files }
469 { (if any) for the bundle, creates and makes current a single read-only }
470 { resource map combining both, and returns a reference number for it. }
471 { If it is called multiple times, it opens the files multiple times, }
472 { and returns distinct reference numbers. }
473
CFBundleOpenBundleResourceFilesnull474 function CFBundleOpenBundleResourceFiles( bundle: CFBundleRef; var refNum: CFBundleRefNum; var localizedRefNum: CFBundleRefNum ): SInt32; external name '_CFBundleOpenBundleResourceFiles';
475 { Similar to CFBundleOpenBundleResourceMap(), except that it creates two }
476 { separate resource maps and returns reference numbers for both. }
477
478 procedure CFBundleCloseBundleResourceMap( bundle: CFBundleRef; refNum: CFBundleRefNum ); external name '_CFBundleCloseBundleResourceMap';
479
480
481 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
482 implementation
483
484
485 {$R-}
486
CFCopyLocalizedStringnull487 function CFCopyLocalizedString( key: CFStringRef; comment: PChar ): CFStringRef; inline;
488 begin
489 CFCopyLocalizedString := CFBundleCopyLocalizedString( CFBundleGetMainBundle, key, key, nil );
490 end;
491
CFCopyLocalizedStringFromTablenull492 function CFCopyLocalizedStringFromTable( key: CFStringRef; tableName: CFStringRef; comment: PChar ): CFStringRef; inline;
493 begin
494 CFCopyLocalizedStringFromTable := CFBundleCopyLocalizedString( CFBundleGetMainBundle, key, key, tableName );
495 end;
496
CFCopyLocalizedStringFromTableInBundlenull497 function CFCopyLocalizedStringFromTableInBundle( key: CFStringRef; tableName: CFStringRef; bundle: CFBundleRef; comment: PChar ): CFStringRef; inline;
498 begin
499 CFCopyLocalizedStringFromTableInBundle := CFBundleCopyLocalizedString( bundle, key, key, tableName );
500 end;
501
CFCopyLocalizedStringWithDefaultValuenull502 function CFCopyLocalizedStringWithDefaultValue( key: CFStringRef; tableName: CFStringRef; bundle: CFBundleRef; value: CFStringRef; comment: PChar ): CFStringRef; inline;
503 begin
504 CFCopyLocalizedStringWithDefaultValue := CFBundleCopyLocalizedString( bundle, key, value, tableName );
505 end;
506
507
508 end.
509
510 {$endc} {not MACOSALLINCLUDE}
511