home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / OpenStepConversion / IntermediateFrameworks3 / Foundation.framework / Headers / NSInvocation.h < prev    next >
Text File  |  1996-03-27  |  2KB  |  90 lines

  1. /*      NSInvocation.h
  2.     An Objective C message object
  3.     Copyright 1994, NeXT Computer, Inc.
  4.     All rights reserved.
  5. */
  6.  
  7. #import <Foundation/NSObject.h>
  8.  
  9. @class NSMutableArray, NSMethodSignature;
  10.  
  11. #if !defined(STRICT_OPENSTEP)
  12.  
  13. typedef struct {
  14.     enum {
  15.         NSObjCNoType = 0,
  16.         NSObjCVoidType = 'v',
  17.         NSObjCCharType = 'c',
  18.     NSObjCShortType = 's',
  19.     NSObjCLongType = 'l',
  20.     NSObjCLonglongType = 'q',
  21.     NSObjCFloatType = 'f',
  22.     NSObjCDoubleType = 'd',
  23.     NSObjCSelectorType = ':',
  24.     NSObjCObjectType = '@',
  25.     NSObjCStructType = '{',
  26.     NSObjCPointerType = '^',
  27.     NSObjCStringType = '*',
  28.     NSObjCArrayType = '[', // not used in return values
  29.     NSObjCUnionType = '(', // not used in return values
  30.     NSObjCBitfield = 'b', // not used in return values
  31.     } type;
  32.     union {
  33.         char charValue;
  34.     short shortValue;
  35.     long longValue;
  36.     long long longlongValue;
  37.     float floatValue;
  38.     double doubleValue;
  39.     SEL selectorValue;
  40.     id objectValue;
  41.     void *pointerValue;
  42.     void *structLocation;
  43.     char *cStringLocation;
  44.     } value;
  45. } NSObjCValue;
  46.  
  47. #else /* STRICT_OPENSTEP */
  48.  
  49. typedef struct {
  50.     int        type;
  51.     long long    value;
  52. } NSObjCValue;
  53.  
  54. #endif /* !STRICT_OPENSTEP */
  55.     
  56. @interface NSInvocation : NSObject <NSCoding> {
  57.     @private
  58.     NSObjCValue    returnValue;    // first since it has largest alignment
  59.     void    *argumentFrame;
  60.     NSMethodSignature    *signature;
  61.     NSMutableArray    *container;
  62.     unsigned     retainedArgs:1;
  63.     unsigned    isInvalid:1;
  64.     unsigned    signatureValid:1;
  65.     unsigned    unused:5;
  66.     unsigned    refCount:24;
  67.     void    *reserved;
  68. }
  69.  
  70. + (NSInvocation *)invocationWithMethodSignature:(NSMethodSignature *)sig;
  71. - (SEL)selector;
  72. - (void)setSelector:(SEL)selector;
  73. - (id)target;
  74. - (id)setTarget:(id)target;
  75. - (void)retainArguments; // retain objects; copy char * strings
  76. - (BOOL)argumentsRetained;
  77. - (void)getReturnValue:(void *)retLoc;
  78. - (void)setReturnValue:(void *)retLoc;
  79. - (void)getArgument:(void *)argumentLocation atIndex:(int)index;
  80.     //  0 target; 1 selector; ...
  81. - (void)setArgument:(void *)argumentLocation atIndex:(int)index;
  82.  
  83. - (NSMethodSignature *)methodSignature;
  84.  
  85. - (void)invoke;
  86. - (void)invokeWithTarget:(id)target;
  87.     // dispatch the message and collect the result
  88. @end
  89.  
  90.