1 /* Interface for the Object class for Objective-C. 2 Copyright (C) 1993, 1994, 1995, 2009 Free Software Foundation, Inc. 3 4 This file is part of GCC. 5 6 GCC 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 3, or (at your option) any 9 later version. 10 11 GCC 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 Under Section 7 of GPL version 3, you are granted additional 17 permissions described in the GCC Runtime Library Exception, version 18 3.1, as published by the Free Software Foundation. 19 20 You should have received a copy of the GNU General Public License and 21 a copy of the GCC Runtime Library Exception along with this program; 22 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 <http://www.gnu.org/licenses/>. */ 24 25 26 #ifndef __object_INCLUDE_GNU 27 #define __object_INCLUDE_GNU 28 29 #include "objc.h" 30 #include "typedstream.h" 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 /* 37 * All classes are derived from Object. As such, 38 * this is the overhead tacked onto those objects. 39 */ 40 @interface Object 41 { 42 Class isa; /* A pointer to the instance's class structure */ 43 } 44 45 /* Initializing classes and instances */ 46 + initialize; 47 - init; 48 49 /* Creating, freeing, and copying instances */ 50 + new; 51 + alloc; 52 - free; 53 - copy; 54 - shallowCopy; 55 - deepen; 56 - deepCopy; 57 58 /* Identifying classes */ 59 - (Class)class; 60 - (Class)superClass; 61 - (MetaClass)metaClass; 62 - (const char *)name; 63 64 /* Identifying and comparing objects */ 65 - self; 66 - (unsigned int)hash; 67 - (BOOL)isEqual:anObject; 68 - (int)compare:(id)anotherObject; 69 70 /* Testing object type */ 71 - (BOOL)isMetaClass; 72 - (BOOL)isClass; 73 - (BOOL)isInstance; 74 75 /* Testing inheritance relationships */ 76 - (BOOL)isKindOf:(Class)aClassObject; 77 - (BOOL)isMemberOf:(Class)aClassObject; 78 - (BOOL)isKindOfClassNamed:(const char *)aClassName; 79 - (BOOL)isMemberOfClassNamed:(const char *)aClassName; 80 81 /* Testing class functionality */ 82 + (BOOL)instancesRespondTo:(SEL)aSel; 83 - (BOOL)respondsTo:(SEL)aSel; 84 85 /* Testing protocol conformance */ 86 - (BOOL)conformsTo:(Protocol*)aProtocol; 87 88 /* Introspection */ 89 + (IMP)instanceMethodFor:(SEL)aSel; 90 - (IMP)methodFor:(SEL)aSel; 91 + (struct objc_method_description *)descriptionForInstanceMethod:(SEL)aSel; 92 - (struct objc_method_description *)descriptionForMethod:(SEL)aSel; 93 94 /* Sending messages determined at run time */ 95 - perform:(SEL)aSel; 96 - perform:(SEL)aSel with:anObject; 97 - perform:(SEL)aSel with:anObject1 with:anObject2; 98 99 /* Forwarding */ 100 - (retval_t)forward:(SEL)aSel :(arglist_t)argFrame; 101 - (retval_t)performv:(SEL)aSel :(arglist_t)argFrame; 102 103 /* Posing */ 104 + poseAs:(Class)aClassObject; 105 - (Class)transmuteClassTo:(Class)aClassObject; 106 107 /* Enforcing intentions */ 108 - subclassResponsibility:(SEL)aSel; 109 - notImplemented:(SEL)aSel; 110 - shouldNotImplement:(SEL)aSel; 111 112 /* Error handling */ 113 - doesNotRecognize:(SEL)aSel; 114 - error:(const char *)aString, ...; 115 116 /* Archiving */ 117 + (int)version; 118 + setVersion:(int)aVersion; 119 + (int)streamVersion: (TypedStream*)aStream; 120 121 - read: (TypedStream*)aStream; 122 - write: (TypedStream*)aStream; 123 - awake; 124 125 @end 126 127 #ifdef __cplusplus 128 } 129 #endif 130 131 #endif 132