2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
26 Copyright (c) 1999-2003, Apple, Inc. All rights reserved.
29 #if !defined(__COREFOUNDATION_CFBUNDLEPRIV__)
30 #define __COREFOUNDATION_CFBUNDLEPRIV__ 1
32 #include <CoreFoundation/CFBase.h>
33 #include <CoreFoundation/CFArray.h>
34 #include <CoreFoundation/CFBundle.h>
35 #include <CoreFoundation/CFDictionary.h>
36 #include <CoreFoundation/CFString.h>
37 #include <CoreFoundation/CFURL.h>
39 #if defined(__cplusplus)
45 const CFStringRef _kCFBundlePackageTypeKey
;
47 const CFStringRef _kCFBundleSignatureKey
;
49 const CFStringRef _kCFBundleIconFileKey
;
51 const CFStringRef _kCFBundleDocumentTypesKey
;
53 const CFStringRef _kCFBundleURLTypesKey
;
55 /* Localizable Finder stuff */
57 const CFStringRef _kCFBundleDisplayNameKey
;
59 const CFStringRef _kCFBundleShortVersionStringKey
;
61 const CFStringRef _kCFBundleGetInfoStringKey
;
63 const CFStringRef _kCFBundleGetInfoHTMLKey
;
65 /* Sub-keys for CFBundleDocumentTypes dictionaries */
67 const CFStringRef _kCFBundleTypeNameKey
;
69 const CFStringRef _kCFBundleTypeRoleKey
;
71 const CFStringRef _kCFBundleTypeIconFileKey
;
73 const CFStringRef _kCFBundleTypeOSTypesKey
;
75 const CFStringRef _kCFBundleTypeExtensionsKey
;
77 const CFStringRef _kCFBundleTypeMIMETypesKey
;
79 /* Sub-keys for CFBundleURLTypes dictionaries */
81 const CFStringRef _kCFBundleURLNameKey
;
83 const CFStringRef _kCFBundleURLIconFileKey
;
85 const CFStringRef _kCFBundleURLSchemesKey
;
87 /* Compatibility key names */
89 const CFStringRef _kCFBundleOldExecutableKey
;
91 const CFStringRef _kCFBundleOldInfoDictionaryVersionKey
;
93 const CFStringRef _kCFBundleOldNameKey
;
95 const CFStringRef _kCFBundleOldIconFileKey
;
97 const CFStringRef _kCFBundleOldDocumentTypesKey
;
99 const CFStringRef _kCFBundleOldShortVersionStringKey
;
101 /* Compatibility CFBundleDocumentTypes key names */
103 const CFStringRef _kCFBundleOldTypeNameKey
;
105 const CFStringRef _kCFBundleOldTypeRoleKey
;
107 const CFStringRef _kCFBundleOldTypeIconFileKey
;
109 const CFStringRef _kCFBundleOldTypeExtensions1Key
;
111 const CFStringRef _kCFBundleOldTypeExtensions2Key
;
113 const CFStringRef _kCFBundleOldTypeOSTypesKey
;
116 /* Functions for examining directories that may "look like" bundles */
119 CFURLRef
_CFBundleCopyBundleURLForExecutableURL(CFURLRef url
);
122 Boolean
_CFBundleURLLooksLikeBundle(CFURLRef url
);
125 CFBundleRef
_CFBundleCreateIfLooksLikeBundle(CFAllocatorRef allocator
, CFURLRef url
);
128 CFBundleRef
_CFBundleGetMainBundleIfLooksLikeBundle(void);
131 CFBundleRef
_CFBundleCreateWithExecutableURLIfLooksLikeBundle(CFAllocatorRef allocator
, CFURLRef url
);
134 /* Functions for examining the structure of a bundle */
137 CFURLRef
_CFBundleCopyResourceForkURL(CFBundleRef bundle
);
140 CFURLRef
_CFBundleCopyInfoPlistURL(CFBundleRef bundle
);
143 /* Functions for working without a bundle instance */
146 CFURLRef
_CFBundleCopyExecutableURLInDirectory(CFURLRef url
);
149 CFURLRef
_CFBundleCopyOtherExecutableURLInDirectory(CFURLRef url
);
152 /* Functions for dealing with localizations */
155 void _CFBundleGetLanguageAndRegionCodes(SInt32
*languageCode
, SInt32
*regionCode
);
156 // may return -1 for either one if no code can be found
159 Boolean
CFBundleGetLocalizationInfoForLocalization(CFStringRef localizationName
, SInt32
*languageCode
, SInt32
*regionCode
, SInt32
*scriptCode
, CFStringEncoding
*stringEncoding
);
160 /* Gets the appropriate language and region codes, and the default */
161 /* script code and encoding, for the localization specified. */
162 /* Pass NULL for the localizationName to get these values for the */
163 /* single most preferred localization in the current context. */
164 /* May give -1 if there is no language or region code for a particular */
165 /* localization. Returns false if CFBundle has no information about */
166 /* the given localization. */
169 CFStringRef
CFBundleCopyLocalizationForLocalizationInfo(SInt32 languageCode
, SInt32 regionCode
, SInt32 scriptCode
, CFStringEncoding stringEncoding
);
170 /* Returns the default localization for the combination of codes */
171 /* specified. Pass in -1 for language, region code, or script code, or */
172 /* 0xFFFF for stringEncoding, if you do not wish to specify one of these. */
175 void _CFBundleSetDefaultLocalization(CFStringRef localizationName
);
178 /* Functions for dealing specifically with CFM executables */
181 void *_CFBundleGetCFMFunctionPointerForName(CFBundleRef bundle
, CFStringRef funcName
);
184 void _CFBundleGetCFMFunctionPointersForNames(CFBundleRef bundle
, CFArrayRef functionNames
, void *ftbl
[]);
187 void _CFBundleSetCFMConnectionID(CFBundleRef bundle
, void *connectionID
);
190 /* Miscellaneous functions */
193 CFStringRef
_CFBundleCopyFileTypeForFileURL(CFURLRef url
);
196 Boolean
_CFBundleGetHasChanged(CFBundleRef bundle
);
199 void _CFBundleFlushCaches(void);
202 void _CFBundleSetStringsFilesShared(CFBundleRef bundle
, Boolean flag
);
205 Boolean
_CFBundleGetStringsFilesShared(CFBundleRef bundle
);
208 /* Functions deprecated as SPI */
211 CFDictionaryRef
_CFBundleGetLocalInfoDictionary(CFBundleRef bundle
); // deprecated in favor of CFBundleGetLocalInfoDictionary
214 CFPropertyListRef
_CFBundleGetValueForInfoKey(CFBundleRef bundle
, CFStringRef key
); // deprecated in favor of CFBundleGetValueForInfoDictionaryKey
217 Boolean
_CFBundleGetPackageInfoInDirectory(CFAllocatorRef alloc
, CFURLRef url
, UInt32
*packageType
, UInt32
*packageCreator
); // deprecated in favor of CFBundleGetPackageInfoInDirectory
220 CFDictionaryRef
_CFBundleCopyInfoDictionaryInResourceFork(CFURLRef url
); // CFBundleCopyInfoDictionaryForURL is usually preferred; for the main bundle, however, no special call is necessary, since the info dictionary will automatically be available whether the app is bundled or not
223 CFURLRef
_CFBundleCopyPrivateFrameworksURL(CFBundleRef bundle
); // deprecated in favor of CFBundleCopyPrivateFrameworksURL
226 CFURLRef
_CFBundleCopySharedFrameworksURL(CFBundleRef bundle
); // deprecated in favor of CFBundleCopySharedFrameworksURL
229 CFURLRef
_CFBundleCopySharedSupportURL(CFBundleRef bundle
); // deprecated in favor of CFBundleCopySharedSupportURL
232 CFURLRef
_CFBundleCopyBuiltInPlugInsURL(CFBundleRef bundle
); // deprecated in favor of CFBundleCopyBuiltInPlugInsURL
235 CFArrayRef
_CFBundleCopyBundleRegionsArray(CFBundleRef bundle
); // deprecated in favor of CFBundleCopyBundleLocalizations
238 CFURLRef
_CFBundleCopyResourceURLForLanguage(CFBundleRef bundle
, CFStringRef resourceName
, CFStringRef resourceType
, CFStringRef subDirName
, CFStringRef language
); // deprecated in favor of CFBundleCopyResourceURLForLocalization
241 CFArrayRef
_CFBundleCopyResourceURLsOfTypeForLanguage(CFBundleRef bundle
, CFStringRef resourceType
, CFStringRef subDirName
, CFStringRef language
); // deprecated in favor of CFBundleCopyResourceURLsOfTypeForLocalization
244 short _CFBundleOpenBundleResourceFork(CFBundleRef bundle
); // deprecated in favor of CFBundleOpenBundleResourceMap
247 void _CFBundleCloseBundleResourceFork(CFBundleRef bundle
); // deprecated in favor of CFBundleCloseBundleResourceMap
249 #if defined(__cplusplus)
253 #endif /* ! __COREFOUNDATION_CFBUNDLEPRIV__ */