@@ -15,26 +15,29 @@ */ #import "OFObject.h" #import "OFEnumerator.h" +OF_ASSUME_NONNULL_BEGIN + /*! @file */ /*! * @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 / values - void* (*retain)(void *value); + __nonnull void* (*__nullable retain)(__nonnull void *value); /// The function to release keys / values - void (*release)(void *value); + void (*__nullable release)(__nonnull void *value); /// The function to hash keys - uint32_t (*hash)(void *value); + uint32_t (*__nullable hash)(__nonnull void *value); /// The function to compare keys / values - bool (*equal)(void *value1, void *value2); + bool (*__nullable equal)(__nonnull void *value1, + __nonnull void *value2); } of_map_table_functions_t; #ifdef OF_HAVE_BLOCKS /*! * @brief A block for enumerating an OFMapTable. @@ -52,11 +55,11 @@ * * @param key The key of the value to replace * @param value The value to replace * @return The value to replace the value with */ -typedef void* (^of_map_table_replace_block_t)(void *key, void *value); +typedef __nonnull void* (^of_map_table_replace_block_t)(void *key, void *value); #endif @class OFMapTableEnumerator; /*! @@ -131,16 +134,16 @@ * @return The number of objects in the map table */ - (size_t)count; /*! - * @brief Returns the value for the given key or nil if the key was not found. + * @brief Returns the value for the given key or NULL if the key was not found. * * @param key The key whose object should be returned - * @return The value for the given key or nil if the key was not found + * @return The value for the given key or NULL if the key was not found */ -- (void*)valueForKey: (void*)key; +- (nullable void*)valueForKey: (void*)key; /*! * @brief Sets a value for a key. * * @param key The key to set @@ -166,21 +169,21 @@ * value. * * @param value The value which is checked for being in the map table * @return A boolean whether the map table contains the specified value */ -- (bool)containsValue: (void*)value; +- (bool)containsValue: (nullable void*)value; /*! * @brief Checks whether the map table contains a value with the specified * address. * * @param value The value which is checked for being in the map table * @return A boolean whether the map table contains a value with the specified * address. */ -- (bool)containsValueIdenticalTo: (void*)value; +- (bool)containsValueIdenticalTo: (nullable void*)value; /*! * @brief Returns an OFMapTableEnumerator to enumerate through the map table's * keys. * @@ -255,5 +258,7 @@ * @brief Resets the enumerator, so the next call to nextKey returns the first * key again. */ - (void)reset; @end + +OF_ASSUME_NONNULL_END