]> git.saurik.com Git - apple/objc4.git/blob - runtime/Object.h
objc4-267.tar.gz
[apple/objc4.git] / runtime / Object.h
1 /*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25 /*
26 Object.h
27 Copyright 1988-1996 NeXT Software, Inc.
28
29 DEFINED AS: A common class
30 HEADER FILES: <objc/Object.h>
31
32 */
33
34 #ifndef _OBJC_OBJECT_H_
35 #define _OBJC_OBJECT_H_
36
37 #include <objc/objc-runtime.h>
38
39 @class Protocol;
40
41 @interface Object
42 {
43 Class isa; /* A pointer to the instance's class structure */
44 }
45
46 /* Initializing classes and instances */
47
48 + initialize;
49 - init;
50
51 /* Creating, copying, and freeing instances */
52
53 + new;
54 + free;
55 - free;
56 + alloc;
57 - copy;
58 + allocFromZone:(void *)zone;
59 - copyFromZone:(void *)zone;
60 - (void *)zone;
61
62 /* Identifying classes */
63
64 + class;
65 + superclass;
66 + (const char *) name;
67 - class;
68 - superclass;
69 - (const char *) name;
70
71 /* Identifying and comparing instances */
72
73 - 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 - perform:(SEL)aSelector;
107 - perform:(SEL)aSelector with:anObject;
108 - perform:(SEL)aSelector with:object1 with:object2;
109
110 /* Posing */
111
112 + poseAs: aClassObject;
113
114 /* Enforcing intentions */
115
116 - subclassResponsibility:(SEL)aSelector;
117 - notImplemented:(SEL)aSelector;
118
119 /* Error handling */
120
121 - doesNotRecognize:(SEL)aSelector;
122 - error:(const char *)aString, ...;
123
124 /* Debugging */
125
126 - (void) printForDebugger:(void *)stream;
127
128 /* Archiving */
129
130 - awake;
131 - write:(void *)stream;
132 - read:(void *)stream;
133 + (int) version;
134 + setVersion: (int) aVersion;
135
136 /* Forwarding */
137
138 - forward: (SEL)sel : (marg_list)args;
139 - performv: (SEL)sel : (marg_list)args;
140
141 @end
142
143 /* Abstract Protocol for Archiving */
144
145 @interface Object (Archiving)
146
147 - startArchiving: (void *)stream;
148 - finishUnarchiving;
149
150 @end
151
152 /* Abstract Protocol for Dynamic Loading */
153
154 @interface Object (DynamicLoading)
155
156 //+ finishLoading:(headerType *)header;
157 + finishLoading:(struct mach_header *)header;
158 + startUnloading;
159
160 @end
161
162 OBJC_EXPORT id object_dispose(Object *anObject);
163 OBJC_EXPORT id object_copy(Object *anObject, unsigned nBytes);
164 OBJC_EXPORT id object_copyFromZone(Object *anObject, unsigned nBytes, void *z);
165 OBJC_EXPORT id object_realloc(Object *anObject, unsigned nBytes);
166 OBJC_EXPORT id object_reallocFromZone(Object *anObject, unsigned nBytes, void *z);
167
168 #endif /* _OBJC_OBJECT_H_ */