CFRuntime.h
/* CFRuntime.h
Copyright (C) 2010 Free Software Foundation, Inc.
Written by: Stefan Bidigaray
Date: January, 2010
This file is part of CoreBase.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __COREFOUNDATION_CFRUNTIME_H__
#define __COREFOUNDATION_CFRUNTIME_H__
#include <CoreFoundation/CFBase.h>
#include <CoreFoundation/CFDictionary.h>
#include <stddef.h>
CF_EXTERN_C_BEGIN
CF_EXPORT Boolean kCFUseCollectableAllocator;
CF_EXPORT Boolean (*__CFObjCIsCollectable)(void *);
#define CF_USING_COLLECTABLE_MEMORY (kCFUseCollectableAllocator)
#define CF_IS_COLLECTABLE_ALLOCATOR(allocator) 0
#define CF_IS_COLLECTABLE(obj) 0
enum
{
_kCFRuntimeNotATypeID = 0
};
enum
{
_kCFRuntimeScannedObject = (1UL<<0),
_kCFRuntimeResourcefulObject = (1UL<<2),
_kCFRuntimeCustomRefCount = (1UL<<3)
};
typedef struct __CFRuntimeClass CFRuntimeClass;
struct __CFRuntimeClass
{
CFIndex version;
const char *className;
void (*init)(CFTypeRef cf);
CFTypeRef (*copy)(CFAllocatorRef allocator, CFTypeRef cf);
#if OS_API_VERSION(MAC_OS_X_VERSION_10_2, GS_API_LATEST)
void (*finalize)(CFTypeRef cf);
#else
void (*dealloc)(CFTypeRef cf);
#endif
Boolean (*equal)(CFTypeRef cf1, CFTypeRef cf2);
CFHashCode (*hash)(CFTypeRef cf);
CFStringRef (*copyFormattingDesc)(CFTypeRef cf, CFDictionaryRef formatOptions);
CFStringRef (*copyDebugDesc)(CFTypeRef cf);
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
#define CF_RECLAIM_AVAILABLE 1
void (*reclaim)(CFTypeRef cf); /* _kCFRuntimeResourcefulObject */
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
#define CF_REFCOUNT_AVAILABLE 1
UInt32 (*refcount)(intptr_t op, CFTypeRef cf); /* _kCFRuntimeCustomRefCount */
#endif
};
CF_EXPORT CFTypeID
_CFRuntimeRegisterClass (const CFRuntimeClass * const cls);
CF_EXPORT const CFRuntimeClass *
_CFRuntimeGetClassWithTypeID (CFTypeID typeID);
CF_EXPORT void
_CFRuntimeUnregisterClassWithTypeID (CFTypeID typeID);
typedef struct __CFRuntimeBase CFRuntimeBase;
struct __CFRuntimeBase
{
void *_isa;
SInt16 _typeID;
struct
{
SInt16 ro: 1;
SInt16 reserved: 7;
SInt16 info: 8;
} _flags;
};
#define INIT_CFRUNTIME_BASE(...) { 0, 0, { 1, 0, 0 } }
CF_EXPORT CFTypeRef
_CFRuntimeCreateInstance (CFAllocatorRef allocator, CFTypeID typeID,
CFIndex extraBytes, unsigned char *category);
CF_EXPORT void
_CFRuntimeSetInstanceTypeID (CFTypeRef cf, CFTypeID typeID);
CF_EXPORT void
_CFRuntimeInitStaticInstance (void *memory, CFTypeID typeID);
#define CF_HAS_INIT_STATIC_INSTANCE 1
CF_EXTERN_C_END
#endif /* __COREFOUNDATION_CFRUNTIME_H__ */
CFIndex
signed long CFIndex
Definition CFBase.h:165
CFHashCode
unsigned long CFHashCode
Definition CFBase.h:159
CFAllocatorRef
const struct __CFAllocator * CFAllocatorRef
A reference to a CFAllocator object.
Definition CFBase.h:301
__CFRuntimeBase::_isa
void * _isa
Definition CFRuntime.h:128
_CFRuntimeSetInstanceTypeID
void _CFRuntimeSetInstanceTypeID(CFTypeRef cf, CFTypeID typeID)
_CFRuntimeRegisterClass
CFTypeID _CFRuntimeRegisterClass(const CFRuntimeClass *const cls)
_CFRuntimeCreateInstance
CFTypeRef _CFRuntimeCreateInstance(CFAllocatorRef allocator, CFTypeID typeID, CFIndex extraBytes, unsigned char *category)
_CFRuntimeGetClassWithTypeID
const CFRuntimeClass * _CFRuntimeGetClassWithTypeID(CFTypeID typeID)
_CFRuntimeInitStaticInstance
void _CFRuntimeInitStaticInstance(void *memory, CFTypeID typeID)
_CFRuntimeUnregisterClassWithTypeID
void _CFRuntimeUnregisterClassWithTypeID(CFTypeID typeID)
__CFRuntimeBase
Definition CFRuntime.h:127
__CFRuntimeClass
Definition CFRuntime.h:71