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