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