]>
Commit | Line | Data |
---|---|---|
88e17b57 | 1 | /* Interface for the Object class for Objective-C. |
4470254f | 2 | Copyright (C) 1993, 1994, 1995, 2009, 2010 Free Software Foundation, Inc. |
88e17b57 | 3 | |
6c82ad25 | 4 | This file is part of GCC. |
88e17b57 | 5 | |
6c82ad25 | 6 | GCC is free software; you can redistribute it and/or modify it |
88e17b57 | 7 | under the terms of the GNU General Public License as published by the |
748086b7 | 8 | Free Software Foundation; either version 3, or (at your option) any |
88e17b57 BE |
9 | later version. |
10 | ||
6c82ad25 | 11 | GCC is distributed in the hope that it will be useful, but WITHOUT |
88e17b57 BE |
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 | ||
748086b7 JJ |
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/>. */ | |
88e17b57 | 24 | |
88e17b57 BE |
25 | |
26 | #ifndef __object_INCLUDE_GNU | |
27 | #define __object_INCLUDE_GNU | |
28 | ||
cf223603 DA |
29 | #include "objc.h" |
30 | #include "typedstream.h" | |
9567d415 | 31 | |
1a6213c3 ZL |
32 | #ifdef __cplusplus |
33 | extern "C" { | |
34 | #endif | |
35 | ||
4470254f NP |
36 | /* The Object class is a minimal (but fully functional) root class |
37 | included with the runtime. | |
38 | ||
39 | It is mostly for testing the runtime; very handy in configure | |
40 | tests, and when writing language/runtime testcases. | |
41 | ||
42 | Because Objective-C allows multiple root classes, a Foundation | |
e976a775 | 43 | library (such as GNUstep Base) is expected to provide its own root |
4470254f NP |
44 | class (typically called NSObject), fully integrated with the |
45 | library's own high-level features. If you are using such a | |
46 | Foundation library, you should most likely use its root class for | |
47 | everything and ignore Object. | |
48 | */ | |
49 | ||
88e17b57 | 50 | /* |
4470254f NP |
51 | All classes are derived from Object. As such, |
52 | this is the overhead tacked onto those objects. | |
88e17b57 BE |
53 | */ |
54 | @interface Object | |
55 | { | |
56 | Class isa; /* A pointer to the instance's class structure */ | |
57 | } | |
58 | ||
59 | /* Initializing classes and instances */ | |
60 | + initialize; | |
61 | - init; | |
62 | ||
63 | /* Creating, freeing, and copying instances */ | |
64 | + new; | |
65 | + alloc; | |
66 | - free; | |
67 | - copy; | |
68 | - shallowCopy; | |
69 | - deepen; | |
70 | - deepCopy; | |
71 | ||
72 | /* Identifying classes */ | |
73 | - (Class)class; | |
74 | - (Class)superClass; | |
75 | - (MetaClass)metaClass; | |
76 | - (const char *)name; | |
77 | ||
78 | /* Identifying and comparing objects */ | |
79 | - self; | |
80 | - (unsigned int)hash; | |
81 | - (BOOL)isEqual:anObject; | |
c24aadf3 | 82 | - (int)compare:(id)anotherObject; |
88e17b57 BE |
83 | |
84 | /* Testing object type */ | |
85 | - (BOOL)isMetaClass; | |
86 | - (BOOL)isClass; | |
87 | - (BOOL)isInstance; | |
88 | ||
89 | /* Testing inheritance relationships */ | |
90 | - (BOOL)isKindOf:(Class)aClassObject; | |
91 | - (BOOL)isMemberOf:(Class)aClassObject; | |
92 | - (BOOL)isKindOfClassNamed:(const char *)aClassName; | |
93 | - (BOOL)isMemberOfClassNamed:(const char *)aClassName; | |
94 | ||
95 | /* Testing class functionality */ | |
96 | + (BOOL)instancesRespondTo:(SEL)aSel; | |
97 | - (BOOL)respondsTo:(SEL)aSel; | |
98 | ||
99 | /* Testing protocol conformance */ | |
100 | - (BOOL)conformsTo:(Protocol*)aProtocol; | |
101 | ||
102 | /* Introspection */ | |
103 | + (IMP)instanceMethodFor:(SEL)aSel; | |
104 | - (IMP)methodFor:(SEL)aSel; | |
105 | + (struct objc_method_description *)descriptionForInstanceMethod:(SEL)aSel; | |
106 | - (struct objc_method_description *)descriptionForMethod:(SEL)aSel; | |
107 | ||
108 | /* Sending messages determined at run time */ | |
109 | - perform:(SEL)aSel; | |
110 | - perform:(SEL)aSel with:anObject; | |
111 | - perform:(SEL)aSel with:anObject1 with:anObject2; | |
112 | ||
113 | /* Forwarding */ | |
114 | - (retval_t)forward:(SEL)aSel :(arglist_t)argFrame; | |
115 | - (retval_t)performv:(SEL)aSel :(arglist_t)argFrame; | |
116 | ||
117 | /* Posing */ | |
118 | + poseAs:(Class)aClassObject; | |
119 | - (Class)transmuteClassTo:(Class)aClassObject; | |
120 | ||
121 | /* Enforcing intentions */ | |
122 | - subclassResponsibility:(SEL)aSel; | |
123 | - notImplemented:(SEL)aSel; | |
124 | - shouldNotImplement:(SEL)aSel; | |
125 | ||
126 | /* Error handling */ | |
127 | - doesNotRecognize:(SEL)aSel; | |
128 | - error:(const char *)aString, ...; | |
129 | ||
130 | /* Archiving */ | |
131 | + (int)version; | |
132 | + setVersion:(int)aVersion; | |
88e17b57 BE |
133 | @end |
134 | ||
e976a775 NP |
135 | #include "deprecated/Object.h" |
136 | ||
1a6213c3 ZL |
137 | #ifdef __cplusplus |
138 | } | |
139 | #endif | |
140 | ||
88e17b57 | 141 | #endif |