ObjFW  Diff

Differences From Artifact [9ffd8ae151]:

To Artifact [59f43aca32]:


23
24
25
26
27
28
29
30
31
32
33
34
35
36
37









38
39
40
41
42
43
44
23
24
25
26
27
28
29








30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45







-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+








/*!
 * @struct of_map_table_functions_t OFMapTable.h ObjFW/OFMapTable.h
 *
 * @brief A struct describing the functions to be used by the map table.
 */
typedef struct {
	/// The function to retain keys / objects
	void *_Nonnull (*_Nullable retain)(void *object);
	/// The function to release keys / objects
	void (*_Nullable release)(void *object);
	/// The function to hash keys
	uint32_t (*_Nullable hash)(void *object);
	/// The function to compare keys / objects
	bool (*_Nullable equal)(void *object1, void *object2);
	/*! The function to retain keys / objects */
	void *_Nullable (*_Nullable retain)(void *_Nullable object);
	/*! The function to release keys / objects */
	void (*_Nullable release)(void *_Nullable object);
	/*! The function to hash keys */
	uint32_t (*_Nullable hash)(void *_Nullable object);
	/*! The function to compare keys / objects */
	bool (*_Nullable equal)(void *_Nullable object1,
	    void *_Nullable object2);
} of_map_table_functions_t;

#ifdef OF_HAVE_BLOCKS
/*!
 * @brief A block for enumerating an OFMapTable.
 *
 * @param key The current key
66
67
68
69
70
71
72
73

74
75
76
77
78
79
80
67
68
69
70
71
72
73

74
75
76
77
78
79
80
81







-
+







 *
 * @brief A class similar to OFDictionary, but providing more options how keys
 *	  and objects should be retained, released, compared and hashed.
 */
@interface OFMapTable: OFObject <OFCopying, OFFastEnumeration>
{
	of_map_table_functions_t _keyFunctions, _objectFunctions;
	struct of_map_table_bucket **_buckets;
	struct of_map_table_bucket *_Nonnull *_Nullable _buckets;
	uint32_t _count, _capacity;
	uint8_t _rotate;
	unsigned long _mutations;
}

/*!
 * The key functions used by the map table.
233
234
235
236
237
238
239
240

241
242
243

244
245
246
247
248
249
250
251
252
253
254

255
256
257
258
259
260
261
262
263
234
235
236
237
238
239
240

241
242
243

244
245
246
247
248
249
250
251
252
253
254

255
256
257
258
259
260
261
262
263
264







-
+


-
+










-
+









 *
 * @brief A class which provides methods to enumerate through an OFMapTable's
 *	  keys or objects.
 */
@interface OFMapTableEnumerator: OFObject
{
	OFMapTable *_mapTable;
	struct of_map_table_bucket **_buckets;
	struct of_map_table_bucket *_Nonnull *_Nullable _buckets;
	uint32_t _capacity;
	unsigned long _mutations;
	unsigned long *_mutationsPtr;
	unsigned long *_Nullable _mutationsPtr;
	uint32_t _position;
}

- init OF_UNAVAILABLE;

/*!
 * @brief Returns the next object.
 *
 * @return The next object
 */
- (void *)nextObject;
- (nullable void *)nextObject;

/*!
 * @brief Resets the enumerator, so the next call to @ref nextKey returns the
 *	  first key again.
 */
- (void)reset;
@end

OF_ASSUME_NONNULL_END