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