@@ -32,11 +32,20 @@ /*! * @class OFMutableDictionary OFDictionary.h ObjFW/OFDictionary.h * * @brief An abstract class for storing and changing objects in a dictionary. */ +#ifdef OF_HAVE_GENERICS +@interface OFMutableDictionary : + OFDictionary +#else +# ifndef DOXYGEN +# define KeyType id +# define ObjectType id +# endif @interface OFMutableDictionary: OFDictionary +#endif /*! * @brief Creates a new OFMutableDictionary with enough memory to hold the * specified number of objects. * * @param capacity The initial capacity for the OFMutableDictionary @@ -59,21 +68,21 @@ * A key can be any object that conforms to the OFCopying protocol. * * @param key The key to set * @param object The object to set the key to */ -- (void)setObject: (id)object - forKey: (id)key; -- (void)setObject: (id)object - forKeyedSubscript: (id)key; +- (void)setObject: (ObjectType)object + forKey: (KeyType)key; +- (void)setObject: (ObjectType)object + forKeyedSubscript: (KeyType)key; /*! * @brief Removes the object for the specified key from the dictionary. * * @param key The key whose object should be removed */ -- (void)removeObjectForKey: (id)key; +- (void)removeObjectForKey: (KeyType)key; /*! * @brief Removes all objects. */ - (void)removeAllObjects; @@ -90,5 +99,9 @@ /*! * @brief Converts the mutable dictionary to an immutable dictionary. */ - (void)makeImmutable; @end +#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) +# undef KeyType +# undef ObjectType +#endif