GNUstep CoreBase Library  0.2
CFRuntime.h
1 /* CFRuntime.h
2 
3  Copyright (C) 2010 Free Software Foundation, Inc.
4 
5  Written by: Stefan Bidigaray
6  Date: January, 2010
7 
8  This file is part of CoreBase.
9 
10  This library is free software; you can redistribute it and/or
11  modify it under the terms of the GNU Lesser General Public
12  License as published by the Free Software Foundation; either
13  version 2.1 of the License, or (at your option) any later version.
14 
15  This library is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public
21  License along with this library; see the file COPYING.LIB.
22  If not, see <http://www.gnu.org/licenses/> or write to the
23  Free Software Foundation, 51 Franklin Street, Fifth Floor,
24  Boston, MA 02110-1301, USA.
25 */
26 
27 #ifndef __COREFOUNDATION_CFRUNTIME_H__
28 #define __COREFOUNDATION_CFRUNTIME_H__
29 
30 #include <CoreFoundation/CFBase.h>
31 #include <CoreFoundation/CFDictionary.h>
32 #include <stddef.h>
33 
34 CF_EXTERN_C_BEGIN
35 
49 CF_EXPORT Boolean kCFUseCollectableAllocator;
50 CF_EXPORT Boolean (*__CFObjCIsCollectable)(void *);
51 
52 #define CF_USING_COLLECTABLE_MEMORY (kCFUseCollectableAllocator)
53 #define CF_IS_COLLECTABLE_ALLOCATOR(allocator) 0
54 #define CF_IS_COLLECTABLE(obj) 0
57 enum
58 {
59  _kCFRuntimeNotATypeID = 0
60 };
61 
62 enum
63 {
64  _kCFRuntimeScannedObject = (1UL<<0),
65  _kCFRuntimeResourcefulObject = (1UL<<2),
66  _kCFRuntimeCustomRefCount = (1UL<<3)
67 };
68 
69 typedef struct __CFRuntimeClass CFRuntimeClass;
71 {
72  CFIndex version;
73  const char *className;
74  void (*init)(CFTypeRef cf);
75  CFTypeRef (*copy)(CFAllocatorRef allocator, CFTypeRef cf);
76 #if OS_API_VERSION(MAC_OS_X_VERSION_10_2, GS_API_LATEST)
77  void (*finalize)(CFTypeRef cf);
78 #else
79  void (*dealloc)(CFTypeRef cf);
80 #endif
81  Boolean (*equal)(CFTypeRef cf1, CFTypeRef cf2);
82  CFHashCode (*hash)(CFTypeRef cf);
83  CFStringRef (*copyFormattingDesc)(CFTypeRef cf, CFDictionaryRef formatOptions);
84  CFStringRef (*copyDebugDesc)(CFTypeRef cf);
85 #if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
86 #define CF_RECLAIM_AVAILABLE 1
87  void (*reclaim)(CFTypeRef cf); /* _kCFRuntimeResourcefulObject */
88 #endif
89 #if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
90 #define CF_REFCOUNT_AVAILABLE 1
91  UInt32 (*refcount)(intptr_t op, CFTypeRef cf); /* _kCFRuntimeCustomRefCount */
92 #endif
93 };
94 
95 
96 
104 CF_EXPORT CFTypeID
105 _CFRuntimeRegisterClass (const CFRuntimeClass * const cls);
106 
112 CF_EXPORT const CFRuntimeClass *
114 
120 CF_EXPORT void
122 
123 
124 
125 typedef struct __CFRuntimeBase CFRuntimeBase;
127 {
128  void *_isa;
131  SInt16 _typeID;
132  struct
133  {
134  SInt16 ro: 1;
135  SInt16 reserved: 7;
136  SInt16 info: 8;
137  } _flags;
138 };
139 
140 #define INIT_CFRUNTIME_BASE(...) { 0, 0, { 1, 0, 0 } }
141 
153 CF_EXPORT CFTypeRef
154 _CFRuntimeCreateInstance (CFAllocatorRef allocator, CFTypeID typeID,
155  CFIndex extraBytes, unsigned char *category);
156 
161 CF_EXPORT void
162 _CFRuntimeSetInstanceTypeID (CFTypeRef cf, CFTypeID typeID);
163 
168 CF_EXPORT void
169 _CFRuntimeInitStaticInstance (void *memory, CFTypeID typeID);
170 #define CF_HAS_INIT_STATIC_INSTANCE 1
171 
186 CF_EXTERN_C_END
187 
188 #endif /* __COREFOUNDATION_CFRUNTIME_H__ */
189 
void * _isa
Definition: CFRuntime.h:128
void _CFRuntimeSetInstanceTypeID(CFTypeRef cf, CFTypeID typeID)
CFTypeID _CFRuntimeRegisterClass(const CFRuntimeClass *const cls)
CFTypeRef _CFRuntimeCreateInstance(CFAllocatorRef allocator, CFTypeID typeID, CFIndex extraBytes, unsigned char *category)
void _CFRuntimeInitStaticInstance(void *memory, CFTypeID typeID)
const CFRuntimeClass * _CFRuntimeGetClassWithTypeID(CFTypeID typeID)
void _CFRuntimeUnregisterClassWithTypeID(CFTypeID typeID)
Definition: CFRuntime.h:127
Definition: CFRuntime.h:71