]> git.ipfire.org Git - thirdparty/gcc.git/blob - libobjc/objc/Object.h
deprecated: New directory.
[thirdparty/gcc.git] / libobjc / objc / Object.h
1 /* Interface for the Object class for Objective-C.
2 Copyright (C) 1993, 1994, 1995, 2009, 2010 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 /* 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
43 library (such as GNUstep Base) is expected to provide its own root
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
50 /*
51 All classes are derived from Object. As such,
52 this is the overhead tacked onto those objects.
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;
82 - (int)compare:(id)anotherObject;
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;
133 @end
134
135 #include "deprecated/Object.h"
136
137 #ifdef __cplusplus
138 }
139 #endif
140
141 #endif