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
|
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
|
-
+
-
+
-
+
-
+
-
+
-
+
|
continue;
[_delegates removeItemAtIndex: i];
return;
}
}
- (BOOL)broadcastSelector: (SEL)selector
- (bool)broadcastSelector: (SEL)selector
withObject: (id)object
{
OFDataArray *currentDelegates = [_delegates copy];
id *items = [currentDelegates items];
size_t i, count = [currentDelegates count];
BOOL handled = NO;
bool handled = false;
for (i = 0; i < count; i++) {
id responder = items[i];
if (![responder respondsToSelector: selector])
continue;
BOOL (*imp)(id, SEL, id) = (BOOL(*)(id, SEL, id))
bool (*imp)(id, SEL, id) = (bool(*)(id, SEL, id))
[responder methodForSelector: selector];
handled |= imp(responder, selector, object);
}
return handled;
}
- (BOOL)broadcastSelector: (SEL)selector
- (bool)broadcastSelector: (SEL)selector
withObject: (id)object1
withObject: (id)object2
{
OFDataArray *currentDelegates = [_delegates copy];
id *items = [currentDelegates items];
size_t i, count = [currentDelegates count];
BOOL handled = NO;
bool handled = false;
for (i = 0; i < count; i++) {
id responder = items[i];
if (![responder respondsToSelector: selector])
continue;
BOOL (*imp)(id, SEL, id, id) = (BOOL(*)(id, SEL, id, id))
bool (*imp)(id, SEL, id, id) = (bool(*)(id, SEL, id, id))
[responder methodForSelector: selector];
handled |= imp(responder, selector, object1, object2);
}
return handled;
}
|