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