ObjFW  Diff

Differences From Artifact [2d197e0288]:

To Artifact [dff64e5368]:

  • File src/OFDictionary.h — part of check-in [f816d1ec7c] at 2016-06-05 15:11:04 on branch trunk — Move -[setValue:forKey:] to OFDictionary

    If this is only overridden in OFMutableDictionary, this would lead to
    inconsistent behavior, as it could be called on an OFDictionary as well
    due to the fact that -[setValue:forKey:] is defined in OFObject.
    Instead, if the dictionary is immutable, an OFUndefinedKeyException is
    thrown. (user: js, size: 9203) [annotate] [blame] [check-ins using]


208
209
210
211
212
213
214















215
216
217
218
219
220
221
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







 * @ref objectForKey:.
 *
 * @param key The key whose value should be returned
 * @return The value for the given key or `nil` if the key was not found
 */
- (nullable id)valueForKey: (OFString*)key;

/*!
 * @brief Sets a value for a key.
 *
 * If the key starts with an `@`, the `@` is stripped and
 * `[super setValue:forKey:]` is called.
 * If the key does not start with an `@`, this is equivalent to
 * @ref setObject:forKey:. In this case, if the dictionary is immutable, an
 * @ref OFUndefinedKeyException is thrown.
 *
 * @param key The key to set
 * @param value The value to set the key to
 */
- (void)setValue: (nullable id)value
	  forKey: (OFString*)key;

/*!
 * @brief Checks whether the dictionary contains an object equal to the
 *	  specified object.
 *
 * @param object The object which is checked for being in the dictionary
 * @return A boolean whether the dictionary contains the specified object
 */