36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
-
+
-
+
|
/**
* @brief A block for enumerating an OFSet.
*
* @param object The current object
* @param stop A pointer to a variable that can be set to true to stop the
* enumeration
*/
typedef void (^of_set_enumeration_block_t)(id object, bool *stop);
typedef void (^OFSetEnumerationBlock)(id object, bool *stop);
/**
* @brief A block for filtering an OFSet.
*
* @param object The object to inspect
* @return Whether the object should be in the filtered set
*/
typedef bool (^of_set_filter_block_t)(id object);
typedef bool (^OFSetFilterBlock)(id object);
#endif
/**
* @class OFSet OFSet.h ObjFW/OFSet.h
*
* @brief An abstract class for an unordered set of unique objects.
*
|
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
+
+
+
+
+
+
+
|
* @param firstObject The first object for the set
* @param arguments A va_list with the other objects
* @return An initialized set with the specified object and va_list
*/
- (instancetype)initWithObject: (ObjectType)firstObject
arguments: (va_list)arguments;
/**
* @brief Returns an OFEnumerator to enumerate through all objects of the set.
*
* @return An OFEnumerator to enumerate through all objects of the set
*/
- (OFEnumerator OF_GENERIC(ObjectType) *)objectEnumerator;
/**
* @brief Returns whether the receiver is a subset of the specified set.
*
* @return Whether the receiver is a subset of the specified set
*/
- (bool)isSubsetOfSet: (OFSet OF_GENERIC(ObjectType) *)set;
|
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
|
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
|
-
+
-
-
+
+
|
#ifdef OF_HAVE_BLOCKS
/**
* @brief Executes a block for each object in the set.
*
* @param block The block to execute for each object in the set
*/
- (void)enumerateObjectsUsingBlock: (of_set_enumeration_block_t)block;
- (void)enumerateObjectsUsingBlock: (OFSetEnumerationBlock)block;
/**
* @brief Creates a new set, only containing the objects for which the block
* returns true.
*
* @param block A block which determines if the object should be in the new set
* @return A new, autoreleased OFSet
*/
- (OFSet OF_GENERIC(ObjectType) *)filteredSetUsingBlock:
(of_set_filter_block_t)block;
- (OFSet OF_GENERIC(ObjectType) *)
filteredSetUsingBlock: (OFSetFilterBlock)block;
#endif
#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
# undef ObjectType
#endif
@end
OF_ASSUME_NONNULL_END
#import "OFMutableSet.h"
|