Index: src/OFArray.h ================================================================== --- src/OFArray.h +++ src/OFArray.h @@ -143,10 +143,11 @@ * * \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 @@ -329,5 +330,10 @@ - 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 Index: src/OFArray.m ================================================================== --- src/OFArray.m +++ src/OFArray.m @@ -268,10 +268,15 @@ - (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]; Index: src/OFArray_adjacent.m ================================================================== --- src/OFArray_adjacent.m +++ src/OFArray_adjacent.m @@ -196,10 +196,15 @@ 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 Index: src/OFMutableArray.h ================================================================== --- src/OFMutableArray.h +++ src/OFMutableArray.h @@ -57,10 +57,12 @@ * \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. * Index: src/OFMutableArray.m ================================================================== --- src/OFMutableArray.m +++ src/OFMutableArray.m @@ -192,10 +192,17 @@ 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];