|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.0 (the 'License'). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License."
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24: /*
25: Object.h
26: Copyright 1988, 1989 NeXT, Inc.
27:
28: DEFINED AS: A common class
29: HEADER FILES: "Object.h"
30:
31: */
32:
33: #ifndef _OBJC_OBJECT_H_
34: #define _OBJC_OBJECT_H_
35:
36: #import "objc.h"
37: #import "objc-class.h"
38: #import "typedstream.h"
39: #import <objc/zone.h>
40: @class Protocol;
41:
42: @interface Object
43: {
44: Class isa; /* A pointer to the instance's class structure */
45: }
46:
47: /* Initializing classes and instances */
48:
49: + initialize;
50: - init;
51:
52: /* Creating, copying, and freeing instances */
53:
54: + new;
55: + free;
56: - free;
57: + alloc;
58: - copy;
59: + allocFromZone:(NXZone *)zone;
60: - copyFromZone:(NXZone *)zone;
61: - (NXZone *)zone;
62:
63: /* Identifying classes */
64:
65: + class;
66: + superclass;
67: + (const char *) name;
68: - class;
69: - superclass;
70: - (const char *) name;
71:
72: /* Identifying and comparing instances */
73:
74: - self;
75: - (unsigned int) hash;
76: - (BOOL) isEqual:anObject;
77:
78: /* Testing inheritance relationships */
79:
80: - (BOOL) isKindOf: aClassObject;
81: - (BOOL) isMemberOf: aClassObject;
82: - (BOOL) isKindOfClassNamed: (const char *)aClassName;
83: - (BOOL) isMemberOfClassNamed: (const char *)aClassName;
84:
85: /* Testing class functionality */
86:
87: + (BOOL) instancesRespondTo:(SEL)aSelector;
88: - (BOOL) respondsTo:(SEL)aSelector;
89:
90: /* Testing protocol conformance */
91:
92: - (BOOL) conformsTo: (Protocol *)aProtocolObject;
93: + (BOOL) conformsTo: (Protocol *)aProtocolObject;
94:
95: /* Obtaining method descriptors from protocols */
96:
97: - (struct objc_method_description *) descriptionForMethod:(SEL)aSel;
98: + (struct objc_method_description *) descriptionForInstanceMethod:(SEL)aSel;
99:
100: /* Obtaining method handles */
101:
102: - (IMP) methodFor:(SEL)aSelector;
103: + (IMP) instanceMethodFor:(SEL)aSelector;
104:
105: /* Sending messages determined at run time */
106:
107: - perform:(SEL)aSelector;
108: - perform:(SEL)aSelector with:anObject;
109: - perform:(SEL)aSelector with:object1 with:object2;
110:
111: /* Posing */
112:
113: + poseAs: aClassObject;
114:
115: /* Enforcing intentions */
116:
117: - subclassResponsibility:(SEL)aSelector;
118: - notImplemented:(SEL)aSelector;
119:
120: /* Error handling */
121:
122: - doesNotRecognize:(SEL)aSelector;
123: - error:(const char *)aString, ...;
124:
125: /* Debugging */
126:
127: - (void) printForDebugger:(NXStream *)stream;
128:
129: /* Archiving */
130:
131: - awake;
132: - write:(NXTypedStream *)stream;
133: - read:(NXTypedStream *)stream;
134: + (int) version;
135: + setVersion: (int) aVersion;
136:
137: /* Forwarding */
138:
139: - forward: (SEL)sel : (marg_list)args;
140: - performv: (SEL)sel : (marg_list)args;
141:
142: @end
143:
144: /* Abstract Protocol for Archiving */
145:
146: @interface Object (Archiving)
147:
148: - startArchiving: (NXTypedStream *)stream;
149: - finishUnarchiving;
150:
151: @end
152:
153: /* Abstract Protocol for Dynamic Loading */
154:
155: @interface Object (DynamicLoading)
156:
157: + finishLoading:(struct mach_header *)header;
158: + startUnloading;
159:
160: @end
161:
162: extern id object_dispose(Object *anObject);
163: extern id object_copy(Object *anObject, unsigned nBytes);
164: extern id object_copyFromZone(Object *anObject, unsigned nBytes, NXZone *);
165: extern id object_realloc(Object *anObject, unsigned nBytes);
166: extern id object_reallocFromZone(Object *anObject, unsigned nBytes, NXZone *);
167:
168: extern Ivar object_setInstanceVariable(id, const char *name, void *);
169: extern Ivar object_getInstanceVariable(id, const char *name, void **);
170:
171: #endif /* _OBJC_OBJECT_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.