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