ObjFW  Check-in [a18e732a06]

Overview
Comment:Make array literals work.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a18e732a060ebd1c8f44bc3f0c69b94181d1f0d1def3dc338b8946c7c0c0a4ed
User & Date: js on 2012-03-12 12:05:22
Other Links: manifest | tags
Context
2012-03-12
12:14
Add +[OFDictionary dictionaryWithObjects:forKeys:count:]. check-in: d42a56787b user: js tags: trunk
12:05
Make array literals work. check-in: a18e732a06 user: js tags: trunk
11:54
OFArray: +[arrayWithCArray:length:] -> +[arrayWithObjects:count:]. check-in: 008be86a16 user: js tags: trunk
Changes

Modified src/OFArray.h from [bf9a1af9b3] to [1778f85d38].

141
142
143
144
145
146
147

148
149
150
151
152
153
154
 * The returned object is <i>not</i> retained and autoreleased for performance
 * reasons!
 *
 * \param index The number of the object to return
 * \return The specified object of the OFArray
 */
- (id)objectAtIndex: (size_t)index;


/**
 * \brief Copies the objects at the specified range to the specified buffer.
 *
 * \param buffer The buffer to copy the objects to
 * \param range The range to copy
 */







>







141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
 * The returned object is <i>not</i> retained and autoreleased for performance
 * reasons!
 *
 * \param index The number of the object to return
 * \return The specified object of the OFArray
 */
- (id)objectAtIndex: (size_t)index;
- (id)objectAtIndexedSubscript: (size_t)index;

/**
 * \brief Copies the objects at the specified range to the specified buffer.
 *
 * \param buffer The buffer to copy the objects to
 * \param range The range to copy
 */
327
328
329
330
331
332
333





}

- initWithArray: (OFArray*)data
   mutationsPtr: (unsigned long*)mutationsPtr;
@end

#import "OFMutableArray.h"












>
>
>
>
>
328
329
330
331
332
333
334
335
336
337
338
339
}

- initWithArray: (OFArray*)data
   mutationsPtr: (unsigned long*)mutationsPtr;
@end

#import "OFMutableArray.h"

#ifndef NSINTEGER_DEFINED
/* Required for array literals to work */
@compatibility_alias NSArray OFArray;
#endif

Modified src/OFArray.m from [f4dee3f63a] to [652b854188].

266
267
268
269
270
271
272





273
274
275
276
277
278
279
}

- (id)objectAtIndex: (size_t)index
{
	@throw [OFNotImplementedException exceptionWithClass: isa
						    selector: _cmd];
}






- (size_t)indexOfObject: (id)object
{
	size_t i, count = [self count];

	for (i = 0; i < count; i++)
		if ([[self objectAtIndex: i] isEqual: object])







>
>
>
>
>







266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
}

- (id)objectAtIndex: (size_t)index
{
	@throw [OFNotImplementedException exceptionWithClass: isa
						    selector: _cmd];
}

- (id)objectAtIndexedSubscript: (size_t)index
{
	return [self objectAtIndex: index];
}

- (size_t)indexOfObject: (id)object
{
	size_t i, count = [self count];

	for (i = 0; i < count; i++)
		if ([[self objectAtIndex: i] isEqual: object])

Modified src/OFArray_adjacent.m from [cb33472061] to [0afb4e2882].

194
195
196
197
198
199
200





201
202
203
204
205
206
207
- (id*)objects
{
	return [array cArray];
}

- (id)objectAtIndex: (size_t)index
{





	return *((id*)[array itemAtIndex: index]);
}

- (void)getObjects: (id*)buffer
	   inRange: (of_range_t)range
{
	id *objects = [array cArray];







>
>
>
>
>







194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
- (id*)objects
{
	return [array cArray];
}

- (id)objectAtIndex: (size_t)index
{
	return *((id*)[array itemAtIndex: index]);
}

- (id)objectAtIndexedSubscript: (size_t)index
{
	return *((id*)[array itemAtIndex: index]);
}

- (void)getObjects: (id*)buffer
	   inRange: (of_range_t)range
{
	id *objects = [array cArray];

Modified src/OFMutableArray.h from [7347712143] to [7429d32994].

55
56
57
58
59
60
61


62
63
64
65
66
67
68
 * \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;



/**
 * \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







>
>







55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
 * \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
  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

Modified src/OFMutableArray.m from [f7e8e6c2e5] to [ef22d34f56].

190
191
192
193
194
195
196







197
198
199
200
201
202
203

- (void)replaceObjectAtIndex: (size_t)index
		  withObject: (id)object
{
	@throw [OFNotImplementedException exceptionWithClass: isa
						    selector: _cmd];
}








- (void)replaceObject: (id)oldObject
	   withObject: (id)newObject
{
	size_t i, count = [self count];

	for (i = 0; i < count; i++) {







>
>
>
>
>
>
>







190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210

- (void)replaceObjectAtIndex: (size_t)index
		  withObject: (id)object
{
	@throw [OFNotImplementedException exceptionWithClass: isa
						    selector: _cmd];
}

-    (void)setObject: (id)object
  atIndexedSubscript: (size_t)index
{
	[self replaceObjectAtIndex: index
			withObject: object];
}

- (void)replaceObject: (id)oldObject
	   withObject: (id)newObject
{
	size_t i, count = [self count];

	for (i = 0; i < count; i++) {