ObjFW  Diff

Differences From Artifact [687d488ccc]:

To Artifact [d606689457]:


31
32
33
34
35
36
37






38

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







+
+
+
+
+
+

+








/*!
 * @class OFMutableArray OFArray.h ObjFW/OFArray.h
 *
 * @brief An abstract class for storing, adding and removing objects in an
 *	  array.
 */
#ifdef OF_HAVE_GENERICS
@interface OFMutableArray <ObjectType>: OFArray <ObjectType>
#else
# ifndef DOXYGEN
#  define ObjectType id
# endif
@interface OFMutableArray: OFArray
#endif
/*!
 * @brief Creates a new OFMutableArray with enough memory to hold the specified
 *	  number of objects.
 *
 * @param capacity The initial capacity for the OFMutableArray
 * @return A new autoreleased OFMutableArray
 */
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
133

134
135
136
137
138
139
140
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
133
134
135
136
137
138
139

140
141
142
143
144
145
146
147







-
+






-
+







-
+








-
+









-
-
+
+








-
-
+
+









-
-
+
+






-
+







-
+







- initWithCapacity: (size_t)capacity;

/*!
 * @brief Adds an object to the end of the array.
 *
 * @param object An object to add
 */
- (void)addObject: (id)object;
- (void)addObject: (ObjectType)object;

/*!
 * @brief Adds the objects from the specified OFArray to the end of the array.
 *
 * @param array An array of objects to add
 */
- (void)addObjectsFromArray: (OFArray*)array;
- (void)addObjectsFromArray: (OFArray OF_GENERIC(ObjectType)*)array;

/*!
 * @brief Inserts an object to the OFArray at the specified index.
 *
 * @param object An object to add
 * @param index The index where the object should be inserted
 */
- (void)insertObject: (id)object
- (void)insertObject: (ObjectType)object
	     atIndex: (size_t)index;

/*!
 * @brief Inserts the objects from the specified OFArray at the specified index.
 *
 * @param array An array of objects
 * @param index The index where the objects should be inserted
 */
- (void)insertObjectsFromArray: (OFArray*)array
- (void)insertObjectsFromArray: (OFArray OF_GENERIC(ObjectType)*)array
		       atIndex: (size_t)index;

/*!
 * @brief Replaces the first object equivalent to the specified object with the
 *	  other specified object.
 *
 * @param oldObject The object to replace
 * @param newObject The replacement object
 */
- (void)replaceObject: (id)oldObject
	   withObject: (id)newObject;
- (void)replaceObject: (ObjectType)oldObject
	   withObject: (ObjectType)newObject;

/*!
 * @brief Replaces the object at the specified index with the specified object.
 *
 * @param index The index of the object to replace
 * @param object The replacement object
 */
- (void)replaceObjectAtIndex: (size_t)index
		  withObject: (id)object;
-    (void)setObject: (id)object
		  withObject: (ObjectType)object;
-    (void)setObject: (ObjectType)object
  atIndexedSubscript: (size_t)index;

/*!
 * @brief Replaces the first object that has the same address as the specified
 *	  object with the other specified object.
 *
 * @param oldObject The object to replace
 * @param newObject The replacement object
 */
- (void)replaceObjectIdenticalTo: (id)oldObject
		      withObject: (id)newObject;
- (void)replaceObjectIdenticalTo: (ObjectType)oldObject
		      withObject: (ObjectType)newObject;

/*!
 * @brief Removes the first object equivalent to the specified object.
 *
 * @param object The object to remove
 */
- (void)removeObject: (id)object;
- (void)removeObject: (ObjectType)object;

/*!
 * @brief Removes the first object that has the same address as the specified
 *	  object.
 *
 * @param object The object to remove
 */
- (void)removeObjectIdenticalTo: (id)object;
- (void)removeObjectIdenticalTo: (ObjectType)object;

/*!
 * @brief Removes the object at the specified index.
 *
 * @param index The index of the object to remove
 */
- (void)removeObjectAtIndex: (size_t)index;
196
197
198
199
200
201
202



203
204
205
206
207
208
209
210
211
212







+
+
+
- (void)reverse;

/*!
 * @brief Converts the mutable array to an immutable array.
 */
- (void)makeImmutable;
@end
#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
# undef ObjectType
#endif