| 1 | /* Interface for the Object class for Objective-C.
|
|---|
| 2 | Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
|
|---|
| 3 |
|
|---|
| 4 | This file is part of GNU CC.
|
|---|
| 5 |
|
|---|
| 6 | GNU CC is free software; you can redistribute it and/or modify it
|
|---|
| 7 | under the terms of the GNU General Public License as published by the
|
|---|
| 8 | Free Software Foundation; either version 2, or (at your option) any
|
|---|
| 9 | later version.
|
|---|
| 10 |
|
|---|
| 11 | GNU CC is distributed in the hope that it will be useful, but WITHOUT
|
|---|
| 12 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|---|
| 13 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|---|
| 14 | License for more details.
|
|---|
| 15 |
|
|---|
| 16 | You should have received a copy of the GNU General Public License
|
|---|
| 17 | along with GNU CC; see the file COPYING. If not, write to
|
|---|
| 18 | the Free Software Foundation, 59 Temple Place - Suite 330,
|
|---|
| 19 | Boston, MA 02111-1307, USA. */
|
|---|
| 20 |
|
|---|
| 21 | /* As a special exception, if you link this library with files compiled
|
|---|
| 22 | with GCC to produce an executable, this does not cause the resulting
|
|---|
| 23 | executable to be covered by the GNU General Public License. This
|
|---|
| 24 | exception does not however invalidate any other reasons why the
|
|---|
| 25 | executable file might be covered by the GNU General Public License. */
|
|---|
| 26 |
|
|---|
| 27 | #ifndef __object_INCLUDE_GNU
|
|---|
| 28 | #define __object_INCLUDE_GNU
|
|---|
| 29 |
|
|---|
| 30 | #include <objc/objc.h>
|
|---|
| 31 | #include <objc/typedstream.h>
|
|---|
| 32 |
|
|---|
| 33 | /*
|
|---|
| 34 | * All classes are derived from Object. As such,
|
|---|
| 35 | * this is the overhead tacked onto those objects.
|
|---|
| 36 | */
|
|---|
| 37 | @interface Object
|
|---|
| 38 | {
|
|---|
| 39 | Class isa; /* A pointer to the instance's class structure */
|
|---|
| 40 | }
|
|---|
| 41 |
|
|---|
| 42 | /* Initializing classes and instances */
|
|---|
| 43 | + initialize;
|
|---|
| 44 | - init;
|
|---|
| 45 |
|
|---|
| 46 | /* Creating, freeing, and copying instances */
|
|---|
| 47 | + new;
|
|---|
| 48 | + alloc;
|
|---|
| 49 | - free;
|
|---|
| 50 | - copy;
|
|---|
| 51 | - shallowCopy;
|
|---|
| 52 | - deepen;
|
|---|
| 53 | - deepCopy;
|
|---|
| 54 |
|
|---|
| 55 | /* Identifying classes */
|
|---|
| 56 | - (Class)class;
|
|---|
| 57 | - (Class)superClass;
|
|---|
| 58 | - (MetaClass)metaClass;
|
|---|
| 59 | - (const char *)name;
|
|---|
| 60 |
|
|---|
| 61 | /* Identifying and comparing objects */
|
|---|
| 62 | - self;
|
|---|
| 63 | - (unsigned int)hash;
|
|---|
| 64 | - (BOOL)isEqual:anObject;
|
|---|
| 65 | - (int)compare:anotherObject;
|
|---|
| 66 |
|
|---|
| 67 | /* Testing object type */
|
|---|
| 68 | - (BOOL)isMetaClass;
|
|---|
| 69 | - (BOOL)isClass;
|
|---|
| 70 | - (BOOL)isInstance;
|
|---|
| 71 |
|
|---|
| 72 | /* Testing inheritance relationships */
|
|---|
| 73 | - (BOOL)isKindOf:(Class)aClassObject;
|
|---|
| 74 | - (BOOL)isMemberOf:(Class)aClassObject;
|
|---|
| 75 | - (BOOL)isKindOfClassNamed:(const char *)aClassName;
|
|---|
| 76 | - (BOOL)isMemberOfClassNamed:(const char *)aClassName;
|
|---|
| 77 |
|
|---|
| 78 | /* Testing class functionality */
|
|---|
| 79 | + (BOOL)instancesRespondTo:(SEL)aSel;
|
|---|
| 80 | - (BOOL)respondsTo:(SEL)aSel;
|
|---|
| 81 |
|
|---|
| 82 | /* Testing protocol conformance */
|
|---|
| 83 | - (BOOL)conformsTo:(Protocol*)aProtocol;
|
|---|
| 84 |
|
|---|
| 85 | /* Introspection */
|
|---|
| 86 | + (IMP)instanceMethodFor:(SEL)aSel;
|
|---|
| 87 | - (IMP)methodFor:(SEL)aSel;
|
|---|
| 88 | + (struct objc_method_description *)descriptionForInstanceMethod:(SEL)aSel;
|
|---|
| 89 | - (struct objc_method_description *)descriptionForMethod:(SEL)aSel;
|
|---|
| 90 |
|
|---|
| 91 | /* Sending messages determined at run time */
|
|---|
| 92 | - perform:(SEL)aSel;
|
|---|
| 93 | - perform:(SEL)aSel with:anObject;
|
|---|
| 94 | - perform:(SEL)aSel with:anObject1 with:anObject2;
|
|---|
| 95 |
|
|---|
| 96 | /* Forwarding */
|
|---|
| 97 | - (retval_t)forward:(SEL)aSel :(arglist_t)argFrame;
|
|---|
| 98 | - (retval_t)performv:(SEL)aSel :(arglist_t)argFrame;
|
|---|
| 99 |
|
|---|
| 100 | /* Posing */
|
|---|
| 101 | + poseAs:(Class)aClassObject;
|
|---|
| 102 | - (Class)transmuteClassTo:(Class)aClassObject;
|
|---|
| 103 |
|
|---|
| 104 | /* Enforcing intentions */
|
|---|
| 105 | - subclassResponsibility:(SEL)aSel;
|
|---|
| 106 | - notImplemented:(SEL)aSel;
|
|---|
| 107 | - shouldNotImplement:(SEL)aSel;
|
|---|
| 108 |
|
|---|
| 109 | /* Error handling */
|
|---|
| 110 | - doesNotRecognize:(SEL)aSel;
|
|---|
| 111 | - error:(const char *)aString, ...;
|
|---|
| 112 |
|
|---|
| 113 | /* Archiving */
|
|---|
| 114 | + (int)version;
|
|---|
| 115 | + setVersion:(int)aVersion;
|
|---|
| 116 | + (int)streamVersion: (TypedStream*)aStream;
|
|---|
| 117 |
|
|---|
| 118 | - read: (TypedStream*)aStream;
|
|---|
| 119 | - write: (TypedStream*)aStream;
|
|---|
| 120 | - awake;
|
|---|
| 121 |
|
|---|
| 122 | @end
|
|---|
| 123 |
|
|---|
| 124 | #endif
|
|---|