]> err.no Git - sope/blob - libFoundation/Foundation/NSInvocation.h
fixed some NGMail framework build issue
[sope] / libFoundation / Foundation / NSInvocation.h
1 /* 
2    NSInvocation.h
3
4    Copyright (C) 1995, 1996 Ovidiu Predescu and Mircea Oancea.
5    All rights reserved.
6
7    Author: Ovidiu Predescu <ovidiu@bx.logicnet.ro>
8
9    This file is part of libFoundation.
10
11    Permission to use, copy, modify, and distribute this software and its
12    documentation for any purpose and without fee is hereby granted, provided
13    that the above copyright notice appear in all copies and that both that
14    copyright notice and this permission notice appear in supporting
15    documentation.
16
17    We disclaim all warranties with regard to this software, including all
18    implied warranties of merchantability and fitness, in no event shall
19    we be liable for any special, indirect or consequential damages or any
20    damages whatsoever resulting from loss of use, data or profits, whether in
21    an action of contract, negligence or other tortious action, arising out of
22    or in connection with the use or performance of this software.
23 */
24
25 #ifndef __NSInvocation_h__
26 #define __NSInvocation_h__
27
28 #ifndef GNUSTEP
29 #  if !NEXT_RUNTIME
30 #    define GNU_RUNTIME 1
31 #  endif
32 #endif
33
34 #include <Foundation/NSMethodSignature.h>
35
36 @interface NSInvocation : NSObject
37 {
38     SEL               selector;
39     id                target;
40     NSMethodSignature *signature;
41     BOOL              argumentsRetained;
42     BOOL              isValid;
43 }
44
45 /* Creating Invocations */
46
47 + (NSInvocation *)invocationWithMethodSignature:(NSMethodSignature *)sig;
48
49 /* Managing Invocation Arguments */
50
51 - (BOOL)argumentsRetained;
52 - (void)retainArguments;
53 - (NSMethodSignature *)methodSignature;
54
55 - (void)setArgument:(void *)argumentLocation atIndex:(int)index;
56 - (void)getArgument:(void *)argumentLocation atIndex:(int)index;
57
58 - (void)setReturnValue:(void *)retLoc;
59 - (void)getReturnValue:(void *)retLoc;
60
61 - (void)setSelector:(SEL)selector;
62 - (SEL)selector;
63
64 - (void)setTarget:(id)target;
65 - (id)target;
66
67 /* Dispatching an Invocation */
68
69 - (void)invoke;
70 - (void)invokeWithTarget:(id)target;
71
72 @end
73
74
75 @interface NSInvocation (Extensions)
76 - (void)setArgumentFrame:(void*)frame;
77 - (retval_t)returnFrame;
78 - (void*)returnValue;
79 @end /* NSInvocation (Extensions) */
80
81 /* typing stuff (added in MacOSX) */
82
83 #if GNU_RUNTIME
84 #  include <objc/objc-api.h>
85 #  ifndef _C_LNG_LNG
86 #    define _C_LNG_LNG  'q' /* old versions of gcc do not define this */
87 #    define _C_ULNG_LNG 'Q'
88 #  endif
89 #endif
90
91 enum _NSObjCValueType {
92 #if GNU_RUNTIME
93     NSObjCNoType       = 0,
94     NSObjCVoidType     = _C_VOID,
95     NSObjCCharType     = _C_CHR,
96     NSObjCShortType    = _C_SHT,
97     NSObjCLongType     = _C_LNG,
98     NSObjCLonglongType = _C_LNG_LNG,
99     NSObjCFloatType    = _C_FLT,
100     NSObjCDoubleType   = _C_DBL,
101     NSObjCSelectorType = _C_SEL,
102     NSObjCObjectType   = _C_ID,
103     NSObjCStructType   = _C_STRUCT_B,
104     NSObjCPointerType  = _C_PTR,
105     NSObjCStringType   = _C_CHARPTR,
106     NSObjCArrayType    = _C_ARY_B,
107     NSObjCUnionType    = _C_UNION_B,
108     NSObjCBitfield     = _C_BFLD
109 #elif NEXT_RUNTIME
110     NSObjCNoType       = 0,
111     NSObjCVoidType     = 'v',
112     NSObjCCharType     = 'c',
113     NSObjCShortType    = 's',
114     NSObjCLongType     = 'l',
115     NSObjCLonglongType = 'q',
116     NSObjCFloatType    = 'f',
117     NSObjCDoubleType   = 'd',
118     NSObjCSelectorType = ':',
119     NSObjCObjectType   = '@',
120     NSObjCStructType   = '{',
121     NSObjCPointerType  = '^',
122     NSObjCStringType   = '*',
123     NSObjCArrayType    = '[',
124     NSObjCUnionType    = '(',
125     NSObjCBitfield     = 'b'
126 #else
127 #   error unsupported ObjC runtime !!!
128 #endif
129 };
130
131 typedef struct {
132     enum _NSObjCValueType type;
133     union {
134         char      charValue;
135         short     shortValue;
136         long      longValue;
137         long long longlongValue;
138         float     floatValue;
139         double    doubleValue;
140         SEL       selectorValue;
141         id        objectValue;
142         void      *pointerValue;
143         void      *structLocation;
144         char      *cStringLocation;
145     } value;
146 } NSObjCValue;
147
148 #endif /* __NSInvocation_h__ */
149
150 /*
151   Local Variables:
152   c-basic-offset: 4
153   tab-width: 8
154   End:
155 */