ObjFW  Diff

Differences From Artifact [85eedadac8]:

To Artifact [66a93812a2]:

  • File src/OFDictionary.h — part of check-in [b7097a67b6] at 2015-06-14 10:45:10 on branch trunk — Add OF_NONNULL / OF_NULLABLE and use that instead

    Using __nonnull directly doesn't work on systems using glibc, as glibc
    defines __nonnull as a parameterized define. While this does not fix the
    problem of Clang introducing __nonnull even though it conflicts with
    glibc, this at least means it's possible again to compile things with
    versions of Clang that don't support __nonnull on systems with glibc. (user: js, size: 8287) [annotate] [blame] [check-ins using]


34
35
36
37
38
39
40
41

42
43
44
45
46
47
48
34
35
36
37
38
39
40

41
42
43
44
45
46
47
48







-
+








@class OFArray OF_GENERIC(ObjectType);

#ifdef OF_HAVE_BLOCKS
typedef void (^of_dictionary_enumeration_block_t)(id key, id object,
     bool *stop);
typedef bool (^of_dictionary_filter_block_t)(id key, id object);
typedef __nonnull id (^of_dictionary_map_block_t)(id key, id object);
typedef id OF_NONNULL (^of_dictionary_map_block_t)(id key, id object);
#endif

/*!
 * @class OFDictionary OFDictionary.h ObjFW/OFDictionary.h
 *
 * @brief An abstract class for storing objects in a dictionary.
 *
104
105
106
107
108
109
110
111
112


113
114
115
116
117
118
119
104
105
106
107
108
109
110


111
112
113
114
115
116
117
118
119







-
-
+
+







 *
 * @param keys An array of keys
 * @param objects An array of objects
 * @param count The number of objects in the arrays
 * @return A new autoreleased OFDictionary
 */
+ (instancetype)
    dictionaryWithObjects: (__nonnull ObjectType const *__nonnull)objects
		  forKeys: (__nonnull KeyType const *__nonnull)keys
    dictionaryWithObjects: (ObjectType const OF_NONNULL *OF_NONNULL)objects
		  forKeys: (KeyType const OF_NONNULL *OF_NONNULL)keys
		    count: (size_t)count;

/*!
 * @brief Creates a new OFDictionary with the specified keys objects.
 *
 * @param firstKey The first key
 * @return A new autoreleased OFDictionary
157
158
159
160
161
162
163
164
165


166
167
168
169
170
171
172
157
158
159
160
161
162
163


164
165
166
167
168
169
170
171
172







-
-
+
+







 *	  and objects.
 *
 * @param keys An array of keys
 * @param objects An array of objects
 * @param count The number of objects in the arrays
 * @return An initialized OFDictionary
 */
- initWithObjects: (__nonnull ObjectType const *__nonnull)objects
	  forKeys: (__nonnull KeyType const *__nonnull)keys
- initWithObjects: (ObjectType const OF_NONNULL *OF_NONNULL)objects
	  forKeys: (KeyType const OF_NONNULL *OF_NONNULL)keys
	    count: (size_t)count;

/*!
 * @brief Initializes an already allocated OFDictionary with the specified keys
 *	  and objects.
 *
 * @param firstKey The first key