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