ObjFW  Check-in [88a584a16f]

Overview
Comment:-[OFMutableDictionary addEntiresFromDictionary:]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 88a584a16f1434f08f13556f22634043cb8cccc90442b1e78fb2b764e9563063
User & Date: js on 2017-05-25 15:09:45
Other Links: manifest | tags
Context
2017-05-27
08:56
+[OFHTTPCookie requestHeaderFieldsWithCookies:] check-in: 8896ef883e user: js tags: trunk
2017-05-25
15:09
-[OFMutableDictionary addEntiresFromDictionary:] check-in: 88a584a16f user: js tags: trunk
2017-05-22
23:31
Make includes of unistd.h and fcntl.h conditional check-in: 1287e77e04 user: js tags: trunk
Changes

Modified src/OFMutableDictionary.h from [50af542eae] to [6f52e16281].

85
86
87
88
89
90
91








92
93
94
95
96
97
98
- (void)removeObjectForKey: (KeyType)key;

/*!
 * @brief Removes all objects.
 */
- (void)removeAllObjects;









#ifdef OF_HAVE_BLOCKS
/*!
 * @brief Replaces each object with the object returned by the block.
 *
 * @param block The block which returns a new object for each object
 */
- (void)replaceObjectsUsingBlock: (of_dictionary_replace_block_t)block;







>
>
>
>
>
>
>
>







85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
- (void)removeObjectForKey: (KeyType)key;

/*!
 * @brief Removes all objects.
 */
- (void)removeAllObjects;

/*!
 * @brief Adds the entries from the specified dictionary.
 *
 * @param dictionary The dictionary whose entries should be added
 */
- (void)addEntriesFromDictionary:
    (OFDictionary OF_GENERIC(KeyType, ObjectType) *)dictionary;

#ifdef OF_HAVE_BLOCKS
/*!
 * @brief Replaces each object with the object returned by the block.
 *
 * @param block The block which returns a new object for each object
 */
- (void)replaceObjectsUsingBlock: (of_dictionary_replace_block_t)block;

Modified src/OFMutableDictionary.m from [63b8a9aaca] to [d718ec6322].

189
190
191
192
193
194
195















196
197
198
199
200
201
202
	objc_autoreleasePoolPop(pool);
}

- copy
{
	return [[OFDictionary alloc] initWithDictionary: self];
}
















#ifdef OF_HAVE_BLOCKS
- (void)replaceObjectsUsingBlock: (of_dictionary_replace_block_t)block
{
	[self enumerateKeysAndObjectsUsingBlock: ^ (id key, id object,
	    bool *stop) {
		id new = block(key, object);







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
	objc_autoreleasePoolPop(pool);
}

- copy
{
	return [[OFDictionary alloc] initWithDictionary: self];
}

- (void)addEntriesFromDictionary: (OFDictionary *)dictionary
{
	void *pool = objc_autoreleasePoolPush();
	OFEnumerator *keyEnumerator = [dictionary keyEnumerator];
	OFEnumerator *objectEnumerator = [dictionary objectEnumerator];
	id key, object;

	while ((key = [keyEnumerator nextObject]) != nil &&
	    (object = [objectEnumerator nextObject]) != nil)
		[self setObject: object
			 forKey: key];

	objc_autoreleasePoolPop(pool);
}

#ifdef OF_HAVE_BLOCKS
- (void)replaceObjectsUsingBlock: (of_dictionary_replace_block_t)block
{
	[self enumerateKeysAndObjectsUsingBlock: ^ (id key, id object,
	    bool *stop) {
		id new = block(key, object);