ObjFW  Diff

Differences From Artifact [463e7000aa]:

To Artifact [e10afe8afa]:


20
21
22
23
24
25
26
27
28
29




30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

50
51
52

53
54
55
56
57

58
59
60

61
62
63
64
65

66
67
68

69
70
71
72
73
74
75


76
77
78
79


80
81
82
83
84

85
86
87

88
89
90
91
92

93
94
95

96
97
98
99
100
101


102
103
104
105


106
107
108
109
110

111
112
113

114
115
116
117
118
119
120


121
122
123
124


125
126
127
128
129
130
131
20
21
22
23
24
25
26



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

50
51
52

53
54
55
56
57

58
59
60

61
62
63
64
65

66
67
68

69
70
71
72
73
74


75
76
77
78


79
80
81
82
83
84

85
86
87

88
89
90
91
92

93
94
95

96
97
98
99
100


101
102
103
104


105
106
107
108
109
110

111
112
113

114
115
116
117
118
119


120
121
122
123


124
125
126
127
128
129
130
131
132







-
-
-
+
+
+
+



















-
+


-
+




-
+


-
+




-
+


-
+





-
-
+
+


-
-
+
+




-
+


-
+




-
+


-
+




-
-
+
+


-
-
+
+




-
+


-
+





-
-
+
+


-
-
+
+







#import "OFCollection.h"
#import "OFEnumerator.h"

@class OFDataArray;
@class OFString;

#ifdef OF_HAVE_BLOCKS
typedef void (^of_array_enumeration_block_t)(id obj, size_t idx, BOOL *stop);
typedef BOOL (^of_array_filter_block_t)(id odj, size_t idx);
typedef id (^of_array_map_block_t)(id obj, size_t idx);
typedef void (^of_array_enumeration_block_t)(id object, size_t index,
    BOOL *stop);
typedef BOOL (^of_array_filter_block_t)(id odject, size_t index);
typedef id (^of_array_map_block_t)(id object, size_t index);
#endif

/**
 * \brief A class for storing objects in an array.
 */
@interface OFArray: OFObject <OFCopying, OFMutableCopying, OFCollection,
    OFFastEnumeration>
{
	OFDataArray *array;
}

/**
 * \return A new autoreleased OFArray
 */
+ array;

/**
 * Creates a new OFArray with the specified object.
 *
 * \param obj An object
 * \param object An object
 * \return A new autoreleased OFArray
 */
+ arrayWithObject: (id)obj;
+ arrayWithObject: (id)object;

/**
 * Creates a new OFArray with the specified objects, terminated by nil.
 *
 * \param first The first object in the array
 * \param firstObject The first object in the array
 * \return A new autoreleased OFArray
 */
+ arrayWithObjects: (id)first, ...;
+ arrayWithObjects: (id)firstObject, ...;

/**
 * Creates a new OFArray with the objects from the specified C array.
 *
 * \param objs A C array of objects, terminated with nil
 * \param objects A C array of objects, terminated with nil
 * \return A new autoreleased OFArray
 */
+ arrayWithCArray: (id*)objs;
+ arrayWithCArray: (id*)objects;

/**
 * Creates a new OFArray with the objects from the specified C array of the
 * specified length.
 *
 * \param objs A C array of objects
 * \param len The length of the C array
 * \param objects A C array of objects
 * \param length The length of the C array
 * \return A new autoreleased OFArray
 */
+ arrayWithCArray: (id*)objs
	   length: (size_t)len;
+ arrayWithCArray: (id*)objects
	   length: (size_t)length;

/**
 * Initializes an OFArray with the specified object.
 *
 * \param obj An object
 * \param object An object
 * \return An initialized OFArray
 */
- initWithObject: (id)obj;
- initWithObject: (id)object;

/**
 * Initializes an OFArray with the specified objects.
 *
 * \param first The first object
 * \param firstObject The first object
 * \return An initialized OFArray
 */
- initWithObjects: (id)first, ...;
- initWithObjects: (id)firstObject, ...;

/**
 * Initializes an OFArray with the specified object and a va_list.
 *
 * \param first The first object
 * \param args A va_list
 * \param firstObject The first object
 * \param arguments A va_list
 * \return An initialized OFArray
 */
- initWithObject: (id)first
	 argList: (va_list)args;
- initWithObject: (id)firstObject
    argumentList: (va_list)arguments;

/**
 * Initializes an OFArray with the objects from the specified C array.
 *
 * \param objs A C array of objects, terminated with nil
 * \param objects A C array of objects, terminated with nil
 * \return An initialized OFArray
 */
- initWithCArray: (id*)objs;
- initWithCArray: (id*)objects;

/**
 * Initializes an OFArray with the objects from the specified C array of the
 * specified length.
 *
 * \param objs A C array of objects
 * \param len The length of the C array
 * \param objects A C array of objects
 * \param length The length of the C array
 * \return An initialized OFArray
 */
- initWithCArray: (id*)objs
	  length: (size_t)len;
- initWithCArray: (id*)objects
	  length: (size_t)length;

/**
 * \return The objects of the array as a C array
 */
- (id*)cArray;

/**
139
140
141
142
143
144
145
146

147
148
149
150

151
152
153
154
155
156

157
158
159
160

161
162
163
164
165
166
167
140
141
142
143
144
145
146

147
148
149
150

151
152
153
154
155
156

157
158
159
160

161
162
163
164
165
166
167
168







-
+



-
+





-
+



-
+







 */
- (id)objectAtIndex: (size_t)index;

/**
 * Returns the index of the first object that is equivalent to the specified
 * object or OF_INVALID_INDEX if it was not found.
 *
 * \param obj The object whose index is returned
 * \param object The object whose index is returned
 * \return The index of the first object equivalent to the specified object
 * 	   or OF_INVALID_INDEX if it was not found
 */
- (size_t)indexOfObject: (id)obj;
- (size_t)indexOfObject: (id)object;

/**
 * Returns the index of the first object that has the same address as the
 * specified object or OF_INVALID_INDEX if it was not found.
 *
 * \param obj The object whose index is returned
 * \param object The object whose index is returned
 * \return The index of the first object that has the same aaddress as
 *	   the specified object or OF_INVALID_INDEX if it was not found
 */
- (size_t)indexOfObjectIdenticalTo: (id)obj;
- (size_t)indexOfObjectIdenticalTo: (id)object;

/**
 * Returns the first object of the array or nil.
 *
 * The returned object is <i>not</i> retained and autoreleased for performance
 * reasons!
 *
214
215
216
217
218
219
220
221

222
223
224
225

226
227
228
229
230
231
232
215
216
217
218
219
220
221

222
223
224
225

226
227
228
229
230
231
232
233







-
+



-
+







- (void)makeObjectsPerformSelector: (SEL)selector;

/**
 * Performs the specified selector on all objects in the array with the
 * specified object.
 *
 * \param selector The selector to perform on all objects in the array
 * \param obj The object to perform the selector with on all objects in the
 * \param object The object to perform the selector with on all objects in the
 *	      array
 */
- (void)makeObjectsPerformSelector: (SEL)selector
			withObject: (id)obj;
			withObject: (id)object;

#ifdef OF_HAVE_BLOCKS
/**
 * Executes a block for each object.
 *
 * \param block The block to execute for each object
 */