ObjFW
OFInvocation.h
1 /*
2  * Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This file is part of ObjFW. It may be distributed under the terms of the
7  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
8  * the packaging of this file.
9  *
10  * Alternatively, it may be distributed under the terms of the GNU General
11  * Public License, either version 2 or 3, which can be found in the file
12  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
13  * file.
14  */
15 
16 #import "OFObject.h"
17 
18 OF_ASSUME_NONNULL_BEGIN
19 
20 #ifdef OF_APPLE_RUNTIME
21 # ifdef OF_X86_64
22 # define OF_INVOCATION_CAN_INVOKE
23 # endif
24 #else
25 # ifdef OF_ELF
26 # ifdef OF_X86_64
27 # define OF_INVOCATION_CAN_INVOKE
28 # endif
29 # endif
30 #endif
31 
32 @class OFMethodSignature;
33 @class OFMutableArray OF_GENERIC(ObjectType);
34 @class OFMutableData;
35 
42 {
43  OFMethodSignature *_methodSignature;
44  OFMutableArray OF_GENERIC(OFMutableData *) *_arguments;
45  OFMutableData *_returnValue;
46  OF_RESERVE_IVARS(OFInvocation, 4)
47 }
48 
52 @property (readonly, nonatomic) OFMethodSignature *methodSignature;
53 
60 + (instancetype)invocationWithMethodSignature: (OFMethodSignature *)signature;
61 
69 - (instancetype)initWithMethodSignature: (OFMethodSignature *)signature;
70 
77 - (void)setArgument: (const void *)buffer atIndex: (size_t)index;
78 
85 - (void)getArgument: (void *)buffer atIndex: (size_t)index;
86 
92 - (void)setReturnValue: (const void *)buffer;
93 
99 - (void)getReturnValue: (void *)buffer;
100 
101 #ifdef OF_INVOCATION_CAN_INVOKE
105 - (void)invoke;
106 #endif
107 @end
108 
109 OF_ASSUME_NONNULL_END
A class for storing and accessing invocations, and invoking them.
Definition: OFInvocation.h:42
A class for parsing type encodings and accessing them.
Definition: OFMethodSignature.h:28
An abstract class for storing, adding and removing objects in an array.
Definition: OFMutableArray.h:44
A class for storing and manipulating arbitrary data in an array.
Definition: OFMutableData.h:29
The root class for all other classes inside ObjFW.
Definition: OFObject.h:520