2 * Copyright (c) 2012 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
25 Copyright (c) 1998-2012, Apple Inc. All rights reserved.
29 APPLE SPI: NOT TO BE USED OUTSIDE APPLE!
32 #if !defined(__COREFOUNDATION_CFPRIV__)
33 #define __COREFOUNDATION_CFPRIV__ 1
36 #include <CoreFoundation/CFBase.h>
37 #include <CoreFoundation/CFArray.h>
38 #include <CoreFoundation/CFString.h>
39 #include <CoreFoundation/CFURL.h>
40 #include <CoreFoundation/CFLocale.h>
41 #include <CoreFoundation/CFDate.h>
42 #include <CoreFoundation/CFSet.h>
47 #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_OS_LINUX)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)
48 #include <CoreFoundation/CFMachPort.h>
51 #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) || TARGET_OS_WIN32
52 #include <CoreFoundation/CFRunLoop.h>
53 #include <CoreFoundation/CFSocket.h>
54 #include <CoreFoundation/CFBundlePriv.h>
59 CF_EXPORT
intptr_t _CFDoOperation(intptr_t code
, intptr_t subcode1
, intptr_t subcode2
);
61 CF_EXPORT
void _CFRuntimeSetCFMPresent(void *a
);
63 CF_EXPORT
const char *_CFProcessPath(void);
64 CF_EXPORT
const char **_CFGetProcessPath(void);
65 CF_EXPORT
const char **_CFGetProgname(void);
68 #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_OS_LINUX))
69 CF_EXPORT
void _CFRunLoopSetCurrent(CFRunLoopRef rl
);
72 #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_OS_LINUX)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)
73 CF_EXPORT CFRunLoopRef
CFRunLoopGetMain(void);
74 CF_EXPORT SInt32
CFRunLoopRunSpecific(CFRunLoopRef rl
, CFStringRef modeName
, CFTimeInterval seconds
, Boolean returnAfterSourceHandled
);
77 CF_EXPORT
void _CFRunLoopStopMode(CFRunLoopRef rl
, CFStringRef modeName
);
79 CF_EXPORT CFIndex
CFMachPortGetQueuedMessageCount(CFMachPortRef mp
);
81 CF_EXPORT CFPropertyListRef
_CFURLCopyPropertyListRepresentation(CFURLRef url
);
83 CF_EXPORT CFPropertyListRef
_CFURLCopyPropertyListRepresentation(CFURLRef url
);
84 CF_EXPORT CFURLRef
_CFURLCreateFromPropertyListRepresentation(CFAllocatorRef alloc
, CFPropertyListRef pListRepresentation
);
86 CF_EXPORT
void CFPreferencesFlushCaches(void);
89 CF_EXPORT Boolean
_CFURLGetWideFileSystemRepresentation(CFURLRef url
, Boolean resolveAgainstBase
, wchar_t *buffer
, CFIndex bufferLength
);
93 #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)
96 Boolean
_CFGetFSSpecFromURL(CFAllocatorRef alloc
, CFURLRef url
, struct FSSpec
*spec
);
99 CFURLRef
_CFCreateURLFromFSSpec(CFAllocatorRef alloc
, const struct FSSpec
*voidspec
, Boolean isDirectory
);
103 typedef CF_ENUM(CFIndex
, CFURLComponentDecomposition
) {
104 kCFURLComponentDecompositionNonHierarchical
,
105 kCFURLComponentDecompositionRFC1808
, /* use this for RFC 1738 decompositions as well */
106 kCFURLComponentDecompositionRFC2396
111 CFStringRef schemeSpecific
;
112 } CFURLComponentsNonHierarchical
;
117 CFStringRef password
;
119 CFIndex port
; /* kCFNotFound means ignore/omit */
120 CFArrayRef pathComponents
;
121 CFStringRef parameterString
;
123 CFStringRef fragment
;
125 } CFURLComponentsRFC1808
;
130 /* if the registered name form of the net location is used, userinfo is NULL, port is kCFNotFound, and host is the entire registered name. */
131 CFStringRef userinfo
;
135 CFArrayRef pathComponents
;
137 CFStringRef fragment
;
139 } CFURLComponentsRFC2396
;
141 /* Fills components and returns TRUE if the URL can be decomposed according to decompositionType; FALSE (leaving components unchanged) otherwise. components should be a pointer to the CFURLComponents struct defined above that matches decompositionStyle */
143 Boolean
_CFURLCopyComponents(CFURLRef url
, CFURLComponentDecomposition decompositionType
, void *components
);
145 /* Creates and returns the URL described by components; components should point to the CFURLComponents struct defined above that matches decompositionType. */
147 CFURLRef
_CFURLCreateFromComponents(CFAllocatorRef alloc
, CFURLComponentDecomposition decompositionType
, const void *components
);
148 #define CFURLCopyComponents _CFURLCopyComponents
149 #define CFURLCreateFromComponents _CFURLCreateFromComponents
153 CF_EXPORT Boolean
_CFStringGetFileSystemRepresentation(CFStringRef string
, UInt8
*buffer
, CFIndex maxBufLen
);
155 /* If this is publicized, we might need to create a GetBytesPtr type function as well. */
156 CF_EXPORT CFStringRef
_CFStringCreateWithBytesNoCopy(CFAllocatorRef alloc
, const UInt8
*bytes
, CFIndex numBytes
, CFStringEncoding encoding
, Boolean externalFormat
, CFAllocatorRef contentsDeallocator
);
158 /* These return NULL on MacOS 8 */
159 // This one leaks the returned string in order to be thread-safe.
160 // CF cannot help you in this matter if you continue to use this SPI.
162 CFStringRef
CFGetUserName(void);
165 CFStringRef
CFCopyUserName(void);
168 CFURLRef
CFCopyHomeDirectoryURLForUser(CFStringRef uName
); /* Pass NULL for the current user's home directory */
172 CFCopySearchPathForDirectoriesInDomains returns the various
173 standard system directories where apps, resources, etc get
174 installed. Because queries can return multiple directories,
175 you get back a CFArray (which you should free when done) of
176 CFURLs. The directories are returned in search path order;
177 that is, the first place to look is returned first. This API
178 may return directories that do not exist yet. If NSUserDomain
179 is included in a query, then the results will contain "~" to
180 refer to the user's directory. Specify expandTilde to expand
181 this to the current user's home. Some calls might return no
183 ??? On MacOS 8 this function currently returns an empty array.
185 typedef CF_ENUM(CFIndex
, CFSearchPathDirectory
) {
186 kCFApplicationDirectory
= 1, /* supported applications (Applications) */
187 kCFDemoApplicationDirectory
, /* unsupported applications, demonstration versions (Demos) */
188 kCFDeveloperApplicationDirectory
, /* developer applications (Developer/Applications) */
189 kCFAdminApplicationDirectory
, /* system and network administration applications (Administration) */
190 kCFLibraryDirectory
, /* various user-visible documentation, support, and configuration files, resources (Library) */
191 kCFDeveloperDirectory
, /* developer resources (Developer) */
192 kCFUserDirectory
, /* user home directories (Users) */
193 kCFDocumentationDirectory
, /* documentation (Documentation) */
194 kCFDocumentDirectory
, /* documents (Library/Documents) */
196 kCFCoreServiceDirectory
= 10, // location of CoreServices directory (System/Library/CoreServices)
197 kCFAutosavedInformationDirectory
= 11, // location of autosaved documents (Documents/Autosaved)
198 kCFDesktopDirectory
= 12, // location of user's desktop
199 kCFCachesDirectory
= 13, // location of discardable cache files (Library/Caches)
200 kCFApplicationSupportDirectory
= 14, // location of application support files (plug-ins, etc) (Library/Application Support)
201 kCFDownloadsDirectory
= 15, // location of the user's "Downloads" directory
202 kCFInputMethodsDirectory
= 16, // input methods (Library/Input Methods)
203 kCFMoviesDirectory
= 17, // location of user's Movies directory (~/Movies)
204 kCFMusicDirectory
= 18, // location of user's Music directory (~/Music)
205 kCFPicturesDirectory
= 19, // location of user's Pictures directory (~/Pictures)
206 kCFPrinterDescriptionDirectory
= 20, // location of system's PPDs directory (Library/Printers/PPDs)
207 kCFSharedPublicDirectory
= 21, // location of user's Public sharing directory (~/Public)
208 kCFPreferencePanesDirectory
= 22, // location of the PreferencePanes directory for use with System Preferences (Library/PreferencePanes)
210 kCFAllApplicationsDirectory
= 100, /* all directories where applications can occur (ie Applications, Demos, Administration, Developer/Applications) */
211 kCFAllLibrariesDirectory
= 101 /* all directories where resources can occur (Library, Developer) */
214 typedef CF_OPTIONS(CFOptionFlags
, CFSearchPathDomainMask
) {
215 kCFUserDomainMask
= 1, /* user's home directory --- place to install user's personal items (~) */
216 kCFLocalDomainMask
= 2, /* local to the current machine --- place to install items available to everyone on this machine (/Local) */
217 kCFNetworkDomainMask
= 4, /* publically available location in the local area network --- place to install items available on the network (/Network) */
218 kCFSystemDomainMask
= 8, /* provided by Apple, unmodifiable (/System) */
219 kCFAllDomainsMask
= 0x0ffff /* all domains: all of the above and more, future items */
223 CFArrayRef
CFCopySearchPathForDirectoriesInDomains(CFSearchPathDirectory directory
, CFSearchPathDomainMask domainMask
, Boolean expandTilde
);
226 CF_EXPORT
const CFStringRef kCFFileURLExists
;
227 CF_EXPORT
const CFStringRef kCFFileURLPOSIXMode
;
228 CF_EXPORT
const CFStringRef kCFFileURLSize
;
229 CF_EXPORT
const CFStringRef kCFFileURLDirectoryContents
;
230 CF_EXPORT
const CFStringRef kCFFileURLLastModificationTime
;
231 CF_EXPORT
const CFStringRef kCFHTTPURLStatusCode
;
232 CF_EXPORT
const CFStringRef kCFHTTPURLStatusLine
;
235 /* System Version file access */
236 CF_EXPORT CFStringRef
CFCopySystemVersionString(void); // Human-readable string containing both marketing and build version
237 CF_EXPORT CFDictionaryRef
_CFCopySystemVersionDictionary(void);
238 CF_EXPORT CFDictionaryRef
_CFCopyServerVersionDictionary(void);
239 CF_EXPORT
const CFStringRef _kCFSystemVersionProductNameKey
;
240 CF_EXPORT
const CFStringRef _kCFSystemVersionProductCopyrightKey
;
241 CF_EXPORT
const CFStringRef _kCFSystemVersionProductVersionKey
;
242 CF_EXPORT
const CFStringRef _kCFSystemVersionProductVersionExtraKey
;
243 CF_EXPORT
const CFStringRef _kCFSystemVersionProductUserVisibleVersionKey
; // For loginwindow; see 2987512
244 CF_EXPORT
const CFStringRef _kCFSystemVersionBuildVersionKey
;
245 CF_EXPORT
const CFStringRef _kCFSystemVersionProductVersionStringKey
; // Localized string for the string "Version"
246 CF_EXPORT
const CFStringRef _kCFSystemVersionBuildStringKey
; // Localized string for the string "Build"
249 CF_EXPORT
void CFMergeSortArray(void *list
, CFIndex count
, CFIndex elementSize
, CFComparatorFunction comparator
, void *context
);
250 CF_EXPORT
void CFQSortArray(void *list
, CFIndex count
, CFIndex elementSize
, CFComparatorFunction comparator
, void *context
);
252 /* _CFExecutableLinkedOnOrAfter(releaseVersionName) will return YES if the current executable seems to be linked on or after the specified release. Example: If you specify CFSystemVersionPuma (10.1), you will get back true for executables linked on Puma or Jaguar(10.2), but false for those linked on Cheetah (10.0) or any of its software updates (10.0.x). You will also get back false for any app whose version info could not be figured out.
253 This function caches its results, so no need to cache at call sites.
255 Note that for non-MACH this function always returns true.
257 typedef CF_ENUM(CFIndex
, CFSystemVersion
) {
258 CFSystemVersionCheetah
= 0, /* 10.0 */
259 CFSystemVersionPuma
= 1, /* 10.1 */
260 CFSystemVersionJaguar
= 2, /* 10.2 */
261 CFSystemVersionPanther
= 3, /* 10.3 */
262 CFSystemVersionTiger
= 4, /* 10.4 */
263 CFSystemVersionLeopard
= 5, /* 10.5 */
264 CFSystemVersionSnowLeopard
= 6, /* 10.6 */
265 CFSystemVersionLion
= 7, /* 10.7 */
266 CFSystemVersionMountainLion
= 8, /* 10.8 */
267 CFSystemVersionMax
, /* This should bump up when new entries are added */
271 CF_EXPORT Boolean
_CFExecutableLinkedOnOrAfter(CFSystemVersion version
);
274 typedef CF_ENUM(CFIndex
, CFStringCharacterClusterType
) {
275 kCFStringGraphemeCluster
= 1, /* Unicode Grapheme Cluster */
276 kCFStringComposedCharacterCluster
= 2, /* Compose all non-base (including spacing marks) */
277 kCFStringCursorMovementCluster
= 3, /* Cluster suitable for cursor movements */
278 kCFStringBackwardDeletionCluster
= 4 /* Cluster suitable for backward deletion */
281 CF_EXPORT CFRange
CFStringGetRangeOfCharacterClusterAtIndex(CFStringRef string
, CFIndex charIndex
, CFStringCharacterClusterType type
);
283 // Compatibility kCFCompare flags. Use the new public kCFCompareDiacriticInsensitive
285 kCFCompareDiacriticsInsensitive
= 128 /* Use kCFCompareDiacriticInsensitive */
288 /* kCFCompare flags planned to be publicized (Aki 10/20/2008 Does not work with kCFCompareForceOrdering/CFStringFold). see <rdar://problem/6305147>)
291 kCFCompareIgnoreNonAlphanumeric
= (1UL << 16), // Ignores characters NOT in kCFCharacterSetAlphaNumeric
295 /* CFStringEncoding SPI */
296 /* When set, CF encoding conversion engine keeps ASCII compatibility. (i.e. ASCII backslash <-> Unicode backslash in MacJapanese */
297 CF_EXPORT
void _CFStringEncodingSetForceASCIICompatibility(Boolean flag
);
299 extern void __CFSetCharToUniCharFunc(Boolean (*func
)(UInt32 flags
, UInt8 ch
, UniChar
*unicodeChar
));
300 extern UniChar __CFCharToUniCharTable
[256];
303 #if defined(CF_INLINE)
304 CF_INLINE
const UniChar
*CFStringGetCharactersPtrFromInlineBuffer(CFStringInlineBuffer
*buf
, CFRange desiredRange
) {
305 if ((desiredRange
.location
< 0) || ((desiredRange
.location
+ desiredRange
.length
) > buf
->rangeToBuffer
.length
)) return NULL
;
307 if (buf
->directBuffer
) {
308 return buf
->directBuffer
+ buf
->rangeToBuffer
.location
+ desiredRange
.location
;
310 if (desiredRange
.length
> __kCFStringInlineBufferLength
) return NULL
;
312 if (((desiredRange
.location
+ desiredRange
.length
) > buf
->bufferedRangeEnd
) || (desiredRange
.location
< buf
->bufferedRangeStart
)) {
313 buf
->bufferedRangeStart
= desiredRange
.location
;
314 buf
->bufferedRangeEnd
= buf
->bufferedRangeStart
+ __kCFStringInlineBufferLength
;
315 if (buf
->bufferedRangeEnd
> buf
->rangeToBuffer
.length
) buf
->bufferedRangeEnd
= buf
->rangeToBuffer
.length
;
316 CFStringGetCharacters(buf
->theString
, CFRangeMake(buf
->rangeToBuffer
.location
+ buf
->bufferedRangeStart
, buf
->bufferedRangeEnd
- buf
->bufferedRangeStart
), buf
->buffer
);
319 return buf
->buffer
+ (desiredRange
.location
- buf
->bufferedRangeStart
);
323 CF_INLINE
void CFStringGetCharactersFromInlineBuffer(CFStringInlineBuffer
*buf
, CFRange desiredRange
, UniChar
*outBuf
) {
324 if (buf
->directBuffer
) {
325 memmove(outBuf
, buf
->directBuffer
+ buf
->rangeToBuffer
.location
+ desiredRange
.location
, desiredRange
.length
* sizeof(UniChar
));
327 if ((desiredRange
.location
>= buf
->bufferedRangeStart
) && (desiredRange
.location
< buf
->bufferedRangeEnd
)) {
328 CFIndex bufLen
= desiredRange
.length
;
330 if (bufLen
> (buf
->bufferedRangeEnd
- desiredRange
.location
)) bufLen
= (buf
->bufferedRangeEnd
- desiredRange
.location
);
332 memmove(outBuf
, buf
->buffer
+ (desiredRange
.location
- buf
->bufferedRangeStart
), bufLen
* sizeof(UniChar
));
333 outBuf
+= bufLen
; desiredRange
.location
+= bufLen
; desiredRange
.length
-= bufLen
;
335 CFIndex desiredRangeMax
= (desiredRange
.location
+ desiredRange
.length
);
337 if ((desiredRangeMax
> buf
->bufferedRangeStart
) && (desiredRangeMax
< buf
->bufferedRangeEnd
)) {
338 desiredRange
.length
= (buf
->bufferedRangeStart
- desiredRange
.location
);
339 memmove(outBuf
+ desiredRange
.length
, buf
->buffer
, (desiredRangeMax
- buf
->bufferedRangeStart
) * sizeof(UniChar
));
343 if (desiredRange
.length
> 0) CFStringGetCharacters(buf
->theString
, CFRangeMake(buf
->rangeToBuffer
.location
+ desiredRange
.location
, desiredRange
.length
), outBuf
);
348 #define CFStringGetCharactersPtrFromInlineBuffer(buf, desiredRange) ((buf)->directBuffer ? (buf)->directBuffer + (buf)->rangeToBuffer.location + desiredRange.location : NULL)
350 #define CFStringGetCharactersFromInlineBuffer(buf, desiredRange, outBuf) \
351 if (buf->directBuffer) memmove(outBuf, (buf)->directBuffer + (buf)->rangeToBuffer.location + desiredRange.location, desiredRange.length * sizeof(UniChar)); \
352 else CFStringGetCharacters((buf)->theString, CFRangeMake((buf)->rangeToBuffer.location + desiredRange.location, desiredRange.length), outBuf);
354 #endif /* CF_INLINE */
357 CFCharacterSetInlineBuffer related declarations
360 @typedef CFCharacterSetInlineBuffer
361 @field cset The character set this inline buffer is initialized with.
362 The object is not retained by the structure.
363 @field flags The field is a bit mask that carries various settings.
364 @field rangeStart The beginning of the character range that contains all members.
365 It is guaranteed that there is no member below this value.
366 @field rangeLimit The end of the character range that contains all members.
367 It is guaranteed that there is no member above and equal to this value.
368 @field bitmap The bitmap data representing the membership of the Basic Multilingual Plane characters.
369 If NULL, all BMP characters inside the range are members of the character set.
372 CFCharacterSetRef cset
;
376 const uint8_t *bitmap
;
377 } CFCharacterSetInlineBuffer
;
379 // Bits for flags field
381 kCFCharacterSetIsCompactBitmap
= (1UL << 0),
382 kCFCharacterSetNoBitmapAvailable
= (1UL << 1),
383 kCFCharacterSetIsInverted
= (1UL << 2)
387 @function CFCharacterSetInitInlineBuffer
388 Initializes buffer with cset.
389 @param cset The character set used to initialized the buffer.
390 If this parameter is not a valid CFCharacterSet, the behavior is undefined.
391 @param buffer The reference to the inline buffer to be initialized.
394 void CFCharacterSetInitInlineBuffer(CFCharacterSetRef cset
, CFCharacterSetInlineBuffer
*buffer
);
397 @function CFCharacterSetInlineBufferIsLongCharacterMember
398 Reports whether or not the UTF-32 character is in the character set.
399 @param buffer The reference to the inline buffer to be searched.
400 @param character The UTF-32 character for which to test against the
402 @result true, if the value is in the character set, otherwise false.
404 #if defined(CF_INLINE)
405 CF_INLINE
bool CFCharacterSetInlineBufferIsLongCharacterMember(CFCharacterSetInlineBuffer
*buffer
, UTF32Char character
) {
406 bool isInverted
= ((0 == (buffer
->flags
& kCFCharacterSetIsInverted
)) ? false : true);
408 if ((character
>= buffer
->rangeStart
) && (character
< buffer
->rangeLimit
)) {
409 if ((character
> 0xFFFF) || (0 != (buffer
->flags
& kCFCharacterSetNoBitmapAvailable
))) return (CFCharacterSetIsLongCharacterMember(buffer
->cset
, character
) != 0);
410 if (NULL
== buffer
->bitmap
) {
411 if (0 == (buffer
->flags
& kCFCharacterSetIsCompactBitmap
)) isInverted
= !isInverted
;
412 } else if (0 == (buffer
->flags
& kCFCharacterSetIsCompactBitmap
)) {
413 if (buffer
->bitmap
[character
>> 3] & (1UL << (character
& 7))) isInverted
= !isInverted
;
415 uint8_t value
= buffer
->bitmap
[character
>> 8];
418 isInverted
= !isInverted
;
419 } else if (value
> 0) {
420 const uint8_t *segment
= buffer
->bitmap
+ (256 + (32 * (value
- 1)));
422 if (segment
[character
>> 3] & (1UL << (character
% 8))) isInverted
= !isInverted
;
428 #else /* CF_INLINE */
429 #define CFCharacterSetInlineBufferIsLongCharacterMember(buffer, character) (CFCharacterSetIsLongCharacterMember(buffer->cset, character))
430 #endif /* CF_INLINE */
434 CF_EXPORT CFMutableStringRef
_CFCreateApplicationRepositoryPath(CFAllocatorRef alloc
, int nFolder
);
437 CF_EXPORT CFTypeRef
_CFTryRetain(CFTypeRef cf
);
438 CF_EXPORT Boolean
_CFIsDeallocating(CFTypeRef cf
);
441 CFLocaleGetLanguageRegionEncodingForLocaleIdentifier gets the appropriate language and region codes,
442 and the default legacy script code and encoding, for the specified locale (or language) string.
443 Returns false if CFLocale has no information about the given locale; otherwise may set
444 *langCode and/or *regCode to -1 if there is no appropriate legacy value for the locale.
445 This is a replacement for the CFBundle SPI CFBundleGetLocalizationInfoForLocalization (which was intended to be temporary and transitional);
446 this function is more up-to-date in its handling of locale strings, and is in CFLocale where this functionality should belong. Compared
447 to CFBundleGetLocalizationInfoForLocalization, this function does not spcially interpret a NULL localeIdentifier to mean use the single most
448 preferred localization in the current context (this function returns NO for a NULL localeIdentifier); and in this function
449 langCode, regCode, and scriptCode are all SInt16* (not SInt32* like the equivalent parameters in CFBundleGetLocalizationInfoForLocalization).
452 Boolean
CFLocaleGetLanguageRegionEncodingForLocaleIdentifier(CFStringRef localeIdentifier
, LangCode
*langCode
, RegionCode
*regCode
, ScriptCode
*scriptCode
, CFStringEncoding
*stringEncoding
);
455 CF_EXPORT CFMutableStringRef
_CFCreateApplicationRepositoryPath(CFAllocatorRef alloc
, int nFolder
);
459 #include <CoreFoundation/CFMessagePort.h>
461 #define CF_MESSAGE_PORT_CLONE_MESSAGE_ID -1209
462 CF_EXPORT CFMessagePortRef
CFMessagePortCreateUber(CFAllocatorRef allocator
, CFStringRef name
, CFMessagePortCallBack callout
, CFMessagePortContext
*context
, Boolean
*shouldFreeInfo
, Boolean isRemote
);
463 CF_EXPORT
void CFMessagePortSetCloneCallout(CFMessagePortRef ms
, CFMessagePortCallBack cloneCallout
);
466 #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_OS_LINUX)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)
467 #include <CoreFoundation/CFMessagePort.h>
469 CF_EXPORT CFMessagePortRef
CFMessagePortCreatePerProcessLocal(CFAllocatorRef allocator
, CFStringRef name
, CFMessagePortCallBack callout
, CFMessagePortContext
*context
, Boolean
*shouldFreeInfo
);
470 CF_EXPORT CFMessagePortRef
CFMessagePortCreatePerProcessRemote(CFAllocatorRef allocator
, CFStringRef name
, CFIndex pid
);
473 typedef CFDataRef (*CFMessagePortCallBackEx
)(CFMessagePortRef local
, SInt32 msgid
, CFDataRef data
, void *info
, void *trailer
, uintptr_t);
475 CF_EXPORT CFMessagePortRef
_CFMessagePortCreateLocalEx(CFAllocatorRef allocator
, CFStringRef name
, Boolean perPID
, uintptr_t unused
, CFMessagePortCallBackEx callout2
, CFMessagePortContext
*context
, Boolean
*shouldFreeInfo
);
479 #if TARGET_OS_MAC || TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_OS_LINUX
482 // Avoid including the pthread header
483 #ifndef HAVE_STRUCT_TIMESPEC
484 #define HAVE_STRUCT_TIMESPEC 1
485 struct timespec
{ long tv_sec
; long tv_nsec
; };
489 CF_INLINE CFAbsoluteTime
_CFAbsoluteTimeFromFileTimeSpec(struct timespec ts
) {
490 return (CFAbsoluteTime
)((CFTimeInterval
)ts
.tv_sec
- kCFAbsoluteTimeIntervalSince1970
) + (1.0e-9 * (CFTimeInterval
)ts
.tv_nsec
);
493 CF_INLINE
struct timespec
_CFFileTimeSpecFromAbsoluteTime(CFAbsoluteTime at
) {
496 double frac
= modf(at
, &sec
);
502 ts
.tv_sec
= (long)(sec
+ kCFAbsoluteTimeIntervalSince1970
);
504 ts
.tv_sec
= (time_t)(sec
+ kCFAbsoluteTimeIntervalSince1970
);
506 ts
.tv_nsec
= (long)(1000000000UL * frac
+ 0.5);
510 // The 'filtered' function below is preferred to this older one
511 CF_EXPORT
bool _CFPropertyListCreateSingleValue(CFAllocatorRef allocator
, CFDataRef data
, CFOptionFlags option
, CFStringRef keyPath
, CFPropertyListRef
*value
, CFErrorRef
*error
);
513 // Returns a subset of the property list, only including the keyPaths in the CFSet. If the top level object is not a dictionary, you will get back an empty dictionary as the result.
514 CF_EXPORT
bool _CFPropertyListCreateFiltered(CFAllocatorRef allocator
, CFDataRef data
, CFOptionFlags option
, CFSetRef keyPaths
, CFPropertyListRef
*value
, CFErrorRef
*error
) CF_AVAILABLE(10_8
, 6_0
);
516 // Returns a subset of a bundle's Info.plist. The keyPaths follow the same rules as above CFPropertyList function. This function takes platform and product keys into account.
517 typedef CF_OPTIONS(CFOptionFlags
, _CFBundleFilteredPlistOptions
) {
518 _CFBundleFilteredPlistMemoryMapped
= 1
519 } CF_ENUM_AVAILABLE(10_8
, 6_0
);
521 CF_EXPORT CFPropertyListRef
_CFBundleCreateFilteredInfoPlist(CFBundleRef bundle
, CFSetRef keyPaths
, _CFBundleFilteredPlistOptions options
) CF_AVAILABLE(10_8
, 6_0
);
522 CF_EXPORT CFPropertyListRef
_CFBundleCreateFilteredLocalizedInfoPlist(CFBundleRef bundle
, CFSetRef keyPaths
, CFStringRef localizationName
, _CFBundleFilteredPlistOptions options
) CF_AVAILABLE(10_8
, 6_0
);
525 #include <CoreFoundation/CFNotificationCenter.h>
527 CF_EXPORT CFStringRef
_CFGetWindowsAppleAppDataDirectory(void);
528 CF_EXPORT CFArrayRef
_CFGetWindowsBinaryDirectories(void);
529 CF_EXPORT CFStringRef
_CFGetWindowsAppleSystemLibraryDirectory(void);
531 // If your Windows application does not use a CFRunLoop on the main thread (perhaps because it is reserved for handling UI events via Windows API), then call this function to make distributed notifications arrive using a different run loop.
532 CF_EXPORT
void _CFNotificationCenterSetRunLoop(CFNotificationCenterRef nc
, CFRunLoopRef rl
);
534 CF_EXPORT
uint32_t /*DWORD*/ _CFRunLoopGetWindowsMessageQueueMask(CFRunLoopRef rl
, CFStringRef modeName
);
535 CF_EXPORT
void _CFRunLoopSetWindowsMessageQueueMask(CFRunLoopRef rl
, uint32_t /*DWORD*/ mask
, CFStringRef modeName
);
537 CF_EXPORT
uint32_t /*DWORD*/ _CFRunLoopGetWindowsThreadID(CFRunLoopRef rl
);
539 typedef void (*CFWindowsMessageQueueHandler
)(void);
541 // Run Loop parameter must be the current thread's run loop for the next two functions; you cannot use another thread's run loop
542 CF_EXPORT CFWindowsMessageQueueHandler
_CFRunLoopGetWindowsMessageQueueHandler(CFRunLoopRef rl
, CFStringRef modeName
);
543 CF_EXPORT
void _CFRunLoopSetWindowsMessageQueueHandler(CFRunLoopRef rl
, CFStringRef modeName
, CFWindowsMessageQueueHandler func
);
548 CF_EXPORT CFArrayRef
CFDateFormatterCreateDateFormatsFromTemplates(CFAllocatorRef allocator
, CFArrayRef tmplates
, CFOptionFlags options
, CFLocaleRef locale
);
550 #if (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)
551 // Available for internal use on embedded
552 CF_EXPORT CFNotificationCenterRef
CFNotificationCenterGetDistributedCenter(void);
558 #endif /* ! __COREFOUNDATION_CFPRIV__ */