]> git.saurik.com Git - apple/objc4.git/blob - runtime/Object.h
objc4-680.tar.gz
[apple/objc4.git] / runtime / Object.h
1 /*
2 * Copyright (c) 1999-2003, 2005-2007 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 Object.h
25 Copyright 1988-1996 NeXT Software, Inc.
26
27 DEFINED AS: A common class
28 HEADER FILES: <objc/Object.h>
29
30 */
31
32 #ifndef _OBJC_OBJECT_H_
33 #define _OBJC_OBJECT_H_
34
35 #include <stdarg.h>
36 #include <objc/objc-runtime.h>
37
38 #if __OBJC__ && !__OBJC2__
39
40 __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA)
41 OBJC_ROOT_CLASS
42 @interface Object
43 {
44 Class isa; /* A pointer to the instance's class structure */
45 }
46
47 /* Initializing classes and instances */
48
49 + (id)initialize;
50 - (id)init;
51
52 /* Creating, copying, and freeing instances */
53
54 + (id)new;
55 + (id)free;
56 - (id)free;
57 + (id)alloc;
58 - (id)copy;
59 + (id)allocFromZone:(void *)zone;
60 - (id)copyFromZone:(void *)zone;
61 - (void *)zone;
62
63 /* Identifying classes */
64
65 + (id)class;
66 + (id)superclass;
67 + (const char *) name;
68 - (id)class;
69 - (id)superclass;
70 - (const char *) name;
71
72 /* Identifying and comparing instances */
73
74 - (id)self;
75 - (unsigned int) hash;
76 - (BOOL) isEqual:anObject;
77
78 /* Testing inheritance relationships */
79
80 - (BOOL) isKindOf: aClassObject;
81 - (BOOL) isMemberOf: aClassObject;
82 - (BOOL) isKindOfClassNamed: (const char *)aClassName;
83 - (BOOL) isMemberOfClassNamed: (const char *)aClassName;
84
85 /* Testing class functionality */
86
87 + (BOOL) instancesRespondTo:(SEL)aSelector;
88 - (BOOL) respondsTo:(SEL)aSelector;
89
90 /* Testing protocol conformance */
91
92 - (BOOL) conformsTo: (Protocol *)aProtocolObject;
93 + (BOOL) conformsTo: (Protocol *)aProtocolObject;
94
95 /* Obtaining method descriptors from protocols */
96
97 - (struct objc_method_description *) descriptionForMethod:(SEL)aSel;
98 + (struct objc_method_description *) descriptionForInstanceMethod:(SEL)aSel;
99
100 /* Obtaining method handles */
101
102 - (IMP) methodFor:(SEL)aSelector;
103 + (IMP) instanceMethodFor:(SEL)aSelector;
104
105 /* Sending messages determined at run time */
106
107 - (id)perform:(SEL)aSelector;
108 - (id)perform:(SEL)aSelector with:anObject;
109 - (id)perform:(SEL)aSelector with:object1 with:object2;
110
111 /* Posing */
112
113 + (id)poseAs: aClassObject;
114
115 /* Enforcing intentions */
116
117 - (id)subclassResponsibility:(SEL)aSelector;
118 - (id)notImplemented:(SEL)aSelector;
119
120 /* Error handling */
121
122 - (id)doesNotRecognize:(SEL)aSelector;
123 - (id)error:(const char *)aString, ...;
124
125 /* Debugging */
126
127 - (void) printForDebugger:(void *)stream;
128
129 /* Archiving */
130
131 - (id)awake;
132 - (id)write:(void *)stream;
133 - (id)read:(void *)stream;
134 + (int) version;
135 + (id)setVersion: (int) aVersion;
136
137 /* Forwarding */
138
139 - (id)forward: (SEL)sel : (marg_list)args;
140 - (id)performv: (SEL)sel : (marg_list)args;
141
142 @end
143
144 /* Abstract Protocol for Archiving */
145
146 @interface Object (Archiving)
147
148 - (id)startArchiving: (void *)stream;
149 - (id)finishUnarchiving;
150
151 @end
152
153 /* Abstract Protocol for Dynamic Loading */
154
155 @interface Object (DynamicLoading)
156
157 //+ finishLoading:(headerType *)header;
158 struct mach_header;
159 + (id)finishLoading:(struct mach_header *)header;
160 + (id)startUnloading;
161
162 @end
163
164 #endif
165
166 #endif /* _OBJC_OBJECT_H_ */