-
Notifications
You must be signed in to change notification settings - Fork 0
/
protocol.h
121 lines (115 loc) · 2.9 KB
/
protocol.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#include "selector.h"
#include <stdlib.h>
struct objc_method_description_list
{
/**
* Number of method descriptions in this list.
*/
int count;
/**
* Methods in this list. Note: these selectors are NOT resolved. The name
* field points to the name, not to the index of the uniqued version of the
* name. You must not use them for dispatch.
*/
struct objc_selector methods[];
};
#ifdef __OBJC__
@interface Object { id isa; } @end
/**
* Definition of the Protocol type. Protocols are objects, but are rarely used
* as such.
*/
@interface Protocol : Object
{
@public
#else
struct objc_protocol
{
/** Class pointer. */
id isa;
#endif
/**
* The name of this protocol. Two protocols are regarded as identical if
* they have the same name.
*/
char *name;
/**
* The list of protocols that this protocol conforms to.
*/
struct objc_protocol_list *protocol_list;
/**
* List of instance methods required by this protocol.
*/
struct objc_method_description_list *instance_methods;
/**
* List of class methods required by this protocol.
*/
struct objc_method_description_list *class_methods;
}
#ifdef __OBJC__
@end
#else
;
#endif
#ifdef __OBJC__
@interface Protocol2 : Protocol
{
@public
#else
typedef struct objc_protocol2
{
/**
* Redefinition of the superclass ivars in the C version.
*/
id isa;
char *name;
struct objc_protocol_list *protocol_list;
struct objc_method_description_list *instance_methods;
struct objc_method_description_list *class_methods;
#endif
/**
* Instance methods that are declared as optional for this protocol.
*/
struct objc_method_description_list *optional_instance_methods;
/**
* Class methods that are declared as optional for this protocol.
*/
struct objc_method_description_list *optional_class_methods;
/**
* Properties that are required by this protocol.
*/
struct objc_property_list *properties;
/**
* Optional properties.
*/
struct objc_property_list *optional_properties;
}
#ifdef __OBJC__
@end
#else
Protocol2;
#endif
/**
* List of protocols. Attached to a class or a category by the compiler and to
* a class by the runtime.
*/
struct objc_protocol_list
{
/**
* Additional protocol lists. Loading a category that declares protocols
* will cause a new list to be prepended using this pointer to the protocol
* list for the class. Unlike methods, protocols can not be overridden,
* although it is possible for a protocol to appear twice.
*/
struct objc_protocol_list *next;
/**
* The number of protocols in this list.
*/
size_t count;
/**
* An array of protocols. Actually contains count elements, not 1.
*
* The instances in this array may be any version of protocols.
*/
Protocol2 *list[];
};