]> git.saurik.com Git - apple/cf.git/blob - CFBase.h
CF-1152.14.tar.gz
[apple/cf.git] / CFBase.h
1 /*
2 * Copyright (c) 2015 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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
11 * file.
12 *
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.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 /* CFBase.h
25 Copyright (c) 1998-2014, Apple Inc. All rights reserved.
26 */
27
28 #if !defined(__COREFOUNDATION_CFBASE__)
29 #define __COREFOUNDATION_CFBASE__ 1
30
31 #include <TargetConditionals.h>
32 #include <CoreFoundation/CFAvailability.h>
33
34 #if (defined(__CYGWIN32__) || defined(_WIN32)) && !defined(__WIN32__)
35 #define __WIN32__ 1
36 #endif
37
38 #if defined(_WIN64) && !defined(__WIN64__)
39 #define __WIN64__ 1
40 #endif
41
42 #if defined(__WIN64__) && !defined(__LLP64__)
43 #define __LLP64__ 1
44 #endif
45
46 #if defined(_MSC_VER) && defined(_M_IX86)
47 #define __i386__ 1
48 #endif
49
50 #if (defined(__i386__) || defined(__x86_64__)) && !defined(__LITTLE_ENDIAN__)
51 #define __LITTLE_ENDIAN__ 1
52 #endif
53
54 #if !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)
55 #error Do not know the endianess of this architecture
56 #endif
57
58 #if !__BIG_ENDIAN__ && !__LITTLE_ENDIAN__
59 #error Both __BIG_ENDIAN__ and __LITTLE_ENDIAN__ cannot be false
60 #endif
61
62 #if __BIG_ENDIAN__ && __LITTLE_ENDIAN__
63 #error Both __BIG_ENDIAN__ and __LITTLE_ENDIAN__ cannot be true
64 #endif
65
66 // Some compilers provide the capability to test if certain features are available. This macro provides a compatibility path for other compilers.
67 #ifndef __has_feature
68 #define __has_feature(x) 0
69 #endif
70
71 // Some compilers provide the capability to test if certain attributes are available. This macro provides a compatibility path for other compilers.
72 #ifndef __has_attribute
73 #define __has_attribute(x) 0
74 #endif
75
76 #ifndef __has_extension
77 #define __has_extension(x) 0
78 #endif
79
80 #if defined(__GNUC__) || TARGET_OS_WIN32
81 #include <stdint.h>
82 #include <stdbool.h>
83 #endif
84
85 #if __BLOCKS__
86 #include <Block.h>
87 #endif
88
89 #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)
90 #include <libkern/OSTypes.h>
91 #endif
92
93 #if !defined(__MACTYPES__)
94 #if !defined(_OS_OSTYPES_H)
95 typedef unsigned char Boolean;
96 typedef unsigned char UInt8;
97 typedef signed char SInt8;
98 typedef unsigned short UInt16;
99 typedef signed short SInt16;
100 typedef unsigned int UInt32;
101 typedef signed int SInt32;
102 typedef uint64_t UInt64;
103 typedef int64_t SInt64;
104 typedef SInt32 OSStatus;
105 #endif
106 typedef float Float32;
107 typedef double Float64;
108 typedef unsigned short UniChar;
109 typedef unsigned long UniCharCount;
110 typedef unsigned char * StringPtr;
111 typedef const unsigned char * ConstStringPtr;
112 typedef unsigned char Str255[256];
113 typedef const unsigned char * ConstStr255Param;
114 typedef SInt16 OSErr;
115 typedef SInt16 RegionCode;
116 typedef SInt16 LangCode;
117 typedef SInt16 ScriptCode;
118 typedef UInt32 FourCharCode;
119 typedef FourCharCode OSType;
120 typedef UInt8 Byte;
121 typedef SInt8 SignedByte;
122 #endif
123 #if !defined(__MACTYPES__) || (defined(UNIVERSAL_INTERFACES_VERSION) && UNIVERSAL_INTERFACES_VERSION < 0x0340)
124 typedef UInt32 UTF32Char;
125 typedef UInt16 UTF16Char;
126 typedef UInt8 UTF8Char;
127 #endif
128
129 #if !defined(CF_EXTERN_C_BEGIN)
130 #if defined(__cplusplus)
131 #define CF_EXTERN_C_BEGIN extern "C" {
132 #define CF_EXTERN_C_END }
133 #else
134 #define CF_EXTERN_C_BEGIN
135 #define CF_EXTERN_C_END
136 #endif
137 #endif
138
139 #if TARGET_OS_WIN32
140
141 #if !defined(CF_EXPORT)
142 #if defined(CF_BUILDING_CF) && defined(__cplusplus)
143 #define CF_EXPORT extern "C" __declspec(dllexport)
144 #elif defined(CF_BUILDING_CF) && !defined(__cplusplus)
145 #define CF_EXPORT extern __declspec(dllexport)
146 #elif defined(__cplusplus)
147 #define CF_EXPORT extern "C" __declspec(dllimport)
148 #else
149 #define CF_EXPORT extern __declspec(dllimport)
150 #endif
151 #endif
152
153 #else
154 #define CF_EXPORT extern
155 #endif
156
157 CF_EXTERN_C_BEGIN
158
159 #if !defined(NULL)
160 #if defined(__GNUG__)
161 #define NULL __null
162 #elif defined(__cplusplus)
163 #define NULL 0
164 #else
165 #define NULL ((void *)0)
166 #endif
167 #endif
168
169 #if !defined(TRUE)
170 #define TRUE 1
171 #endif
172
173 #if !defined(FALSE)
174 #define FALSE 0
175 #endif
176
177 #if !defined(CF_INLINE)
178 #if defined(__GNUC__) && (__GNUC__ == 4) && !defined(DEBUG)
179 #define CF_INLINE static __inline__ __attribute__((always_inline))
180 #elif defined(__GNUC__)
181 #define CF_INLINE static __inline__
182 #elif defined(__cplusplus)
183 #define CF_INLINE static inline
184 #elif defined(_MSC_VER)
185 #define CF_INLINE static __inline
186 #elif TARGET_OS_WIN32
187 #define CF_INLINE static __inline__
188 #endif
189 #endif
190
191 // Marks functions which return a CF type that needs to be released by the caller but whose names are not consistent with CoreFoundation naming rules. The recommended fix to this is to rename the functions, but this macro can be used to let the clang static analyzer know of any exceptions that cannot be fixed.
192 // This macro is ONLY to be used in exceptional circumstances, not to annotate functions which conform to the CoreFoundation naming rules.
193 #ifndef CF_RETURNS_RETAINED
194 #if __has_feature(attribute_cf_returns_retained)
195 #define CF_RETURNS_RETAINED __attribute__((cf_returns_retained))
196 #else
197 #define CF_RETURNS_RETAINED
198 #endif
199 #endif
200
201 // Marks functions which return a CF type that may need to be retained by the caller but whose names are not consistent with CoreFoundation naming rules. The recommended fix to this is to rename the functions, but this macro can be used to let the clang static analyzer know of any exceptions that cannot be fixed.
202 // This macro is ONLY to be used in exceptional circumstances, not to annotate functions which conform to the CoreFoundation naming rules.
203 #ifndef CF_RETURNS_NOT_RETAINED
204 #if __has_feature(attribute_cf_returns_not_retained)
205 #define CF_RETURNS_NOT_RETAINED __attribute__((cf_returns_not_retained))
206 #else
207 #define CF_RETURNS_NOT_RETAINED
208 #endif
209 #endif
210
211 // Marks function arguments which are released by the callee.
212 #ifndef CF_RELEASES_ARGUMENT
213 #if __has_feature(attribute_cf_consumed)
214 #define CF_RELEASES_ARGUMENT __attribute__((cf_consumed))
215 #else
216 #define CF_RELEASES_ARGUMENT
217 #endif
218 #endif
219
220 // Compatibility
221 #ifndef CF_CONSUMED
222 #if __has_feature(attribute_cf_consumed)
223 #define CF_CONSUMED __attribute__((cf_consumed))
224 #else
225 #define CF_CONSUMED
226 #endif
227 #endif
228
229 // Marks functions which cannot be used when compiling in automatic reference counting mode.
230 #if __has_feature(objc_arc)
231 #define CF_AUTOMATED_REFCOUNT_UNAVAILABLE __attribute__((unavailable("not available in automatic reference counting mode")))
232 #else
233 #define CF_AUTOMATED_REFCOUNT_UNAVAILABLE
234 #endif
235
236 #ifndef CF_IMPLICIT_BRIDGING_ENABLED
237 #if __has_feature(arc_cf_code_audited)
238 #define CF_IMPLICIT_BRIDGING_ENABLED _Pragma("clang arc_cf_code_audited begin")
239 #else
240 #define CF_IMPLICIT_BRIDGING_ENABLED
241 #endif
242 #endif
243
244 #ifndef CF_IMPLICIT_BRIDGING_DISABLED
245 #if __has_feature(arc_cf_code_audited)
246 #define CF_IMPLICIT_BRIDGING_DISABLED _Pragma("clang arc_cf_code_audited end")
247 #else
248 #define CF_IMPLICIT_BRIDGING_DISABLED
249 #endif
250 #endif
251
252 #if __has_attribute(objc_bridge)
253
254 #ifdef __OBJC__
255 @class NSArray;
256 @class NSAttributedString;
257 @class NSString;
258 @class NSNull;
259 @class NSCharacterSet;
260 @class NSData;
261 @class NSDate;
262 @class NSTimeZone;
263 @class NSDictionary;
264 @class NSError;
265 @class NSLocale;
266 @class NSNumber;
267 @class NSNumber;
268 @class NSSet;
269 @class NSURL;
270 #endif
271
272 #define CF_BRIDGED_TYPE(T) __attribute__((objc_bridge(T)))
273 #define CF_BRIDGED_MUTABLE_TYPE(T) __attribute__((objc_bridge_mutable(T)))
274 #define CF_RELATED_TYPE(T,C,I) __attribute__((objc_bridge_related(T,C,I)))
275 #else
276 #define CF_BRIDGED_TYPE(T)
277 #define CF_BRIDGED_MUTABLE_TYPE(T)
278 #define CF_RELATED_TYPE(T,C,I)
279 #endif
280
281
282 CF_EXPORT double kCFCoreFoundationVersionNumber;
283
284 #if TARGET_OS_MAC
285 #define kCFCoreFoundationVersionNumber10_0 196.40
286 #define kCFCoreFoundationVersionNumber10_0_3 196.50
287 #define kCFCoreFoundationVersionNumber10_1 226.00
288 #define kCFCoreFoundationVersionNumber10_1_1 226.00
289 /* Note the next three do not follow the usual numbering policy from the base release */
290 #define kCFCoreFoundationVersionNumber10_1_2 227.20
291 #define kCFCoreFoundationVersionNumber10_1_3 227.20
292 #define kCFCoreFoundationVersionNumber10_1_4 227.30
293 #define kCFCoreFoundationVersionNumber10_2 263.00
294 #define kCFCoreFoundationVersionNumber10_2_1 263.10
295 #define kCFCoreFoundationVersionNumber10_2_2 263.10
296 #define kCFCoreFoundationVersionNumber10_2_3 263.30
297 #define kCFCoreFoundationVersionNumber10_2_4 263.30
298 #define kCFCoreFoundationVersionNumber10_2_5 263.50
299 #define kCFCoreFoundationVersionNumber10_2_6 263.50
300 #define kCFCoreFoundationVersionNumber10_2_7 263.50
301 #define kCFCoreFoundationVersionNumber10_2_8 263.50
302 #define kCFCoreFoundationVersionNumber10_3 299.00
303 #define kCFCoreFoundationVersionNumber10_3_1 299.00
304 #define kCFCoreFoundationVersionNumber10_3_2 299.00
305 #define kCFCoreFoundationVersionNumber10_3_3 299.30
306 #define kCFCoreFoundationVersionNumber10_3_4 299.31
307 #define kCFCoreFoundationVersionNumber10_3_5 299.31
308 #define kCFCoreFoundationVersionNumber10_3_6 299.32
309 #define kCFCoreFoundationVersionNumber10_3_7 299.33
310 #define kCFCoreFoundationVersionNumber10_3_8 299.33
311 #define kCFCoreFoundationVersionNumber10_3_9 299.35
312 #define kCFCoreFoundationVersionNumber10_4 368.00
313 #define kCFCoreFoundationVersionNumber10_4_1 368.10
314 #define kCFCoreFoundationVersionNumber10_4_2 368.11
315 #define kCFCoreFoundationVersionNumber10_4_3 368.18
316 #define kCFCoreFoundationVersionNumber10_4_4_Intel 368.26
317 #define kCFCoreFoundationVersionNumber10_4_4_PowerPC 368.25
318 #define kCFCoreFoundationVersionNumber10_4_5_Intel 368.26
319 #define kCFCoreFoundationVersionNumber10_4_5_PowerPC 368.25
320 #define kCFCoreFoundationVersionNumber10_4_6_Intel 368.26
321 #define kCFCoreFoundationVersionNumber10_4_6_PowerPC 368.25
322 #define kCFCoreFoundationVersionNumber10_4_7 368.27
323 #define kCFCoreFoundationVersionNumber10_4_8 368.27
324 #define kCFCoreFoundationVersionNumber10_4_9 368.28
325 #define kCFCoreFoundationVersionNumber10_4_10 368.28
326 #define kCFCoreFoundationVersionNumber10_4_11 368.31
327 #define kCFCoreFoundationVersionNumber10_5 476.00
328 #define kCFCoreFoundationVersionNumber10_5_1 476.00
329 #define kCFCoreFoundationVersionNumber10_5_2 476.10
330 #define kCFCoreFoundationVersionNumber10_5_3 476.13
331 #define kCFCoreFoundationVersionNumber10_5_4 476.14
332 #define kCFCoreFoundationVersionNumber10_5_5 476.15
333 #define kCFCoreFoundationVersionNumber10_5_6 476.17
334 #define kCFCoreFoundationVersionNumber10_5_7 476.18
335 #define kCFCoreFoundationVersionNumber10_5_8 476.19
336 #define kCFCoreFoundationVersionNumber10_6 550.00
337 #define kCFCoreFoundationVersionNumber10_6_1 550.00
338 #define kCFCoreFoundationVersionNumber10_6_2 550.13
339 #define kCFCoreFoundationVersionNumber10_6_3 550.19
340 #define kCFCoreFoundationVersionNumber10_6_4 550.29
341 #define kCFCoreFoundationVersionNumber10_6_5 550.42
342 #define kCFCoreFoundationVersionNumber10_6_6 550.42
343 #define kCFCoreFoundationVersionNumber10_6_7 550.42
344 #define kCFCoreFoundationVersionNumber10_6_8 550.43
345 #define kCFCoreFoundationVersionNumber10_7 635.00
346 #define kCFCoreFoundationVersionNumber10_7_1 635.00
347 #define kCFCoreFoundationVersionNumber10_7_2 635.15
348 #define kCFCoreFoundationVersionNumber10_7_3 635.19
349 #define kCFCoreFoundationVersionNumber10_7_4 635.21
350 #define kCFCoreFoundationVersionNumber10_7_5 635.21
351 #define kCFCoreFoundationVersionNumber10_8 744.00
352 #define kCFCoreFoundationVersionNumber10_8_1 744.00
353 #define kCFCoreFoundationVersionNumber10_8_2 744.12
354 #define kCFCoreFoundationVersionNumber10_8_3 744.18
355 #define kCFCoreFoundationVersionNumber10_8_4 744.19
356 #define kCFCoreFoundationVersionNumber10_9 855.11
357 #define kCFCoreFoundationVersionNumber10_9_1 855.11
358 #define kCFCoreFoundationVersionNumber10_9_2 855.14
359 #endif
360
361 #if TARGET_OS_IPHONE
362 #define kCFCoreFoundationVersionNumber_iPhoneOS_2_0 478.23
363 #define kCFCoreFoundationVersionNumber_iPhoneOS_2_1 478.26
364 #define kCFCoreFoundationVersionNumber_iPhoneOS_2_2 478.29
365 #define kCFCoreFoundationVersionNumber_iPhoneOS_3_0 478.47
366 #define kCFCoreFoundationVersionNumber_iPhoneOS_3_1 478.52
367 #define kCFCoreFoundationVersionNumber_iPhoneOS_3_2 478.61
368 #define kCFCoreFoundationVersionNumber_iOS_4_0 550.32
369 #define kCFCoreFoundationVersionNumber_iOS_4_1 550.38
370 #define kCFCoreFoundationVersionNumber_iOS_4_2 550.52
371 #define kCFCoreFoundationVersionNumber_iOS_4_3 550.52
372 #define kCFCoreFoundationVersionNumber_iOS_5_0 675.00
373 #define kCFCoreFoundationVersionNumber_iOS_5_1 690.10
374 #define kCFCoreFoundationVersionNumber_iOS_6_0 793.00
375 #define kCFCoreFoundationVersionNumber_iOS_6_1 793.00
376 #define kCFCoreFoundationVersionNumber_iOS_7_0 847.20
377 #define kCFCoreFoundationVersionNumber_iOS_7_1 847.24
378 #endif
379
380 #if __LLP64__
381 typedef unsigned long long CFTypeID;
382 typedef unsigned long long CFOptionFlags;
383 typedef unsigned long long CFHashCode;
384 typedef signed long long CFIndex;
385 #else
386 typedef unsigned long CFTypeID;
387 typedef unsigned long CFOptionFlags;
388 typedef unsigned long CFHashCode;
389 typedef signed long CFIndex;
390 #endif
391
392 /* Base "type" of all "CF objects", and polymorphic functions on them */
393 typedef const void * CFTypeRef;
394
395 typedef const struct CF_BRIDGED_TYPE(NSString) __CFString * CFStringRef;
396 typedef struct CF_BRIDGED_MUTABLE_TYPE(NSMutableString) __CFString * CFMutableStringRef;
397
398 /*
399 Type to mean any instance of a property list type;
400 currently, CFString, CFData, CFNumber, CFBoolean, CFDate,
401 CFArray, and CFDictionary.
402 */
403 typedef CFTypeRef CFPropertyListRef;
404
405 /* Values returned from comparison functions */
406 typedef CF_ENUM(CFIndex, CFComparisonResult) {
407 kCFCompareLessThan = -1L,
408 kCFCompareEqualTo = 0,
409 kCFCompareGreaterThan = 1
410 };
411
412 /* A standard comparison function */
413 typedef CFComparisonResult (*CFComparatorFunction)(const void *val1, const void *val2, void *context);
414
415 /* Constant used by some functions to indicate failed searches. */
416 /* This is of type CFIndex. */
417 enum {
418 kCFNotFound = -1
419 };
420
421
422 /* Range type */
423 typedef struct {
424 CFIndex location;
425 CFIndex length;
426 } CFRange;
427
428 #if defined(CF_INLINE)
429 CF_INLINE CFRange CFRangeMake(CFIndex loc, CFIndex len) {
430 CFRange range;
431 range.location = loc;
432 range.length = len;
433 return range;
434 }
435 #else
436 #define CFRangeMake(LOC, LEN) __CFRangeMake(LOC, LEN)
437 #endif
438
439 /* Private; do not use */
440 CF_EXPORT
441 CFRange __CFRangeMake(CFIndex loc, CFIndex len);
442
443
444 /* Null representant */
445
446 typedef const struct CF_BRIDGED_TYPE(NSNull) __CFNull * CFNullRef;
447
448 CF_EXPORT
449 CFTypeID CFNullGetTypeID(void);
450
451 CF_EXPORT
452 const CFNullRef kCFNull; // the singleton null instance
453
454
455 /* Allocator API
456
457 Most of the time when specifying an allocator to Create functions, the NULL
458 argument indicates "use the default"; this is the same as using kCFAllocatorDefault
459 or the return value from CFAllocatorGetDefault(). This assures that you will use
460 the allocator in effect at that time.
461 */
462 typedef const struct __CFAllocator * CFAllocatorRef;
463
464 /* This is a synonym for NULL, if you'd rather use a named constant. */
465 CF_EXPORT
466 const CFAllocatorRef kCFAllocatorDefault;
467
468 /* Default system allocator; you rarely need to use this. */
469 CF_EXPORT
470 const CFAllocatorRef kCFAllocatorSystemDefault;
471
472 /* This allocator uses malloc(), realloc(), and free(). This should not be
473 generally used; stick to kCFAllocatorDefault whenever possible. This
474 allocator is useful as the "bytesDeallocator" in CFData or
475 "contentsDeallocator" in CFString where the memory was obtained as a
476 result of malloc() type functions.
477 */
478 CF_EXPORT
479 const CFAllocatorRef kCFAllocatorMalloc;
480
481 /* This allocator explicitly uses the default malloc zone, returned by
482 malloc_default_zone(). It should only be used when an object is
483 safe to be allocated in non-scanned memory.
484 */
485 CF_EXPORT
486 const CFAllocatorRef kCFAllocatorMallocZone;
487
488 /* Null allocator which does nothing and allocates no memory. This allocator
489 is useful as the "bytesDeallocator" in CFData or "contentsDeallocator"
490 in CFString where the memory should not be freed.
491 */
492 CF_EXPORT
493 const CFAllocatorRef kCFAllocatorNull;
494
495 /* Special allocator argument to CFAllocatorCreate() which means
496 "use the functions given in the context to allocate the allocator
497 itself as well".
498 */
499 CF_EXPORT
500 const CFAllocatorRef kCFAllocatorUseContext;
501
502 typedef const void * (*CFAllocatorRetainCallBack)(const void *info);
503 typedef void (*CFAllocatorReleaseCallBack)(const void *info);
504 typedef CFStringRef (*CFAllocatorCopyDescriptionCallBack)(const void *info);
505 typedef void * (*CFAllocatorAllocateCallBack)(CFIndex allocSize, CFOptionFlags hint, void *info);
506 typedef void * (*CFAllocatorReallocateCallBack)(void *ptr, CFIndex newsize, CFOptionFlags hint, void *info);
507 typedef void (*CFAllocatorDeallocateCallBack)(void *ptr, void *info);
508 typedef CFIndex (*CFAllocatorPreferredSizeCallBack)(CFIndex size, CFOptionFlags hint, void *info);
509 typedef struct {
510 CFIndex version;
511 void * info;
512 CFAllocatorRetainCallBack retain;
513 CFAllocatorReleaseCallBack release;
514 CFAllocatorCopyDescriptionCallBack copyDescription;
515 CFAllocatorAllocateCallBack allocate;
516 CFAllocatorReallocateCallBack reallocate;
517 CFAllocatorDeallocateCallBack deallocate;
518 CFAllocatorPreferredSizeCallBack preferredSize;
519 } CFAllocatorContext;
520
521 CF_EXPORT
522 CFTypeID CFAllocatorGetTypeID(void);
523
524 /*
525 CFAllocatorSetDefault() sets the allocator that is used in the current
526 thread whenever NULL is specified as an allocator argument. This means
527 that most, if not all allocations will go through this allocator. It
528 also means that any allocator set as the default needs to be ready to
529 deal with arbitrary memory allocation requests; in addition, the size
530 and number of requests will change between releases.
531
532 An allocator set as the default will never be released, even if later
533 another allocator replaces it as the default. Not only is it impractical
534 for it to be released (as there might be caches created under the covers
535 that refer to the allocator), in general it's also safer and more
536 efficient to keep it around.
537
538 If you wish to use a custom allocator in a context, it's best to provide
539 it as the argument to the various creation functions rather than setting
540 it as the default. Setting the default allocator is not encouraged.
541
542 If you do set an allocator as the default, either do it for all time in
543 your app, or do it in a nested fashion (by restoring the previous allocator
544 when you exit your context). The latter might be appropriate for plug-ins
545 or libraries that wish to set the default allocator.
546 */
547 CF_EXPORT
548 void CFAllocatorSetDefault(CFAllocatorRef allocator);
549
550 CF_EXPORT
551 CFAllocatorRef CFAllocatorGetDefault(void);
552
553 CF_EXPORT
554 CFAllocatorRef CFAllocatorCreate(CFAllocatorRef allocator, CFAllocatorContext *context);
555
556 CF_EXPORT
557 void *CFAllocatorAllocate(CFAllocatorRef allocator, CFIndex size, CFOptionFlags hint);
558
559 CF_EXPORT
560 void *CFAllocatorReallocate(CFAllocatorRef allocator, void *ptr, CFIndex newsize, CFOptionFlags hint);
561
562 CF_EXPORT
563 void CFAllocatorDeallocate(CFAllocatorRef allocator, void *ptr);
564
565 CF_EXPORT
566 CFIndex CFAllocatorGetPreferredSizeForSize(CFAllocatorRef allocator, CFIndex size, CFOptionFlags hint);
567
568 CF_EXPORT
569 void CFAllocatorGetContext(CFAllocatorRef allocator, CFAllocatorContext *context);
570
571
572 /* Polymorphic CF functions */
573
574 CF_IMPLICIT_BRIDGING_ENABLED
575
576 CF_EXPORT
577 CFTypeID CFGetTypeID(CFTypeRef cf);
578
579 CF_EXPORT
580 CFStringRef CFCopyTypeIDDescription(CFTypeID type_id);
581
582 CF_EXPORT
583 CFTypeRef CFRetain(CFTypeRef cf);
584
585 CF_EXPORT
586 void CFRelease(CFTypeRef cf);
587
588 CF_EXPORT
589 CFTypeRef CFAutorelease(CFTypeRef CF_RELEASES_ARGUMENT arg) CF_AVAILABLE(10_9, 7_0);
590
591 CF_EXPORT
592 CFIndex CFGetRetainCount(CFTypeRef cf);
593
594 CF_EXPORT
595 Boolean CFEqual(CFTypeRef cf1, CFTypeRef cf2);
596
597 CF_EXPORT
598 CFHashCode CFHash(CFTypeRef cf);
599
600 CF_EXPORT
601 CFStringRef CFCopyDescription(CFTypeRef cf);
602
603 CF_EXPORT
604 CFAllocatorRef CFGetAllocator(CFTypeRef cf);
605
606 CF_IMPLICIT_BRIDGING_DISABLED
607
608 // This function is unavailable in ARC mode.
609 CF_EXPORT
610 CFTypeRef CFMakeCollectable(CFTypeRef cf) CF_AUTOMATED_REFCOUNT_UNAVAILABLE;
611
612 CF_EXTERN_C_END
613
614 #endif /* ! __COREFOUNDATION_CFBASE__ */
615