00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include <stdarg.h>
00018
00019 #import "OFObject.h"
00020 #import "OFCollection.h"
00021 #import "OFEnumerator.h"
00022
00023 @class OFDataArray;
00024 @class OFString;
00025
00026 #ifdef OF_HAVE_BLOCKS
00027 typedef void (^of_array_enumeration_block_t)(id obj, size_t idx, BOOL *stop);
00028 typedef BOOL (^of_array_filter_block_t)(id odj, size_t idx);
00029 typedef id (^of_array_map_block_t)(id obj, size_t idx);
00030 #endif
00031
00035 @interface OFArray: OFObject <OFCopying, OFMutableCopying, OFCollection,
00036 OFFastEnumeration>
00037 {
00038 OFDataArray *array;
00039 }
00040
00044 + array;
00045
00052 + arrayWithObject: (id)obj;
00053
00060 + arrayWithObjects: (id)first, ...;
00061
00068 + arrayWithCArray: (id*)objs;
00069
00078 + arrayWithCArray: (id*)objs
00079 length: (size_t)len;
00080
00087 - initWithObject: (id)obj;
00088
00095 - initWithObjects: (id)first, ...;
00096
00104 - initWithObject: (id)first
00105 argList: (va_list)args;
00106
00113 - initWithCArray: (id*)objs;
00114
00123 - initWithCArray: (id*)objs
00124 length: (size_t)len;
00125
00129 - (id*)cArray;
00130
00140 - (id)objectAtIndex: (size_t)index;
00141
00150 - (size_t)indexOfObject: (id)obj;
00151
00160 - (size_t)indexOfObjectIdenticalTo: (id)obj;
00161
00170 - (id)firstObject;
00171
00180 - (id)lastObject;
00181
00191 - (OFArray*)objectsFromIndex: (size_t)start
00192 toIndex: (size_t)end;
00193
00199 - (OFArray*)objectsInRange: (of_range_t)range;
00200
00207 - (OFString*)componentsJoinedByString: (OFString*)separator;
00208
00214 - (void)makeObjectsPerformSelector: (SEL)selector;
00215
00224 - (void)makeObjectsPerformSelector: (SEL)selector
00225 withObject: (id)obj;
00226
00227 #ifdef OF_HAVE_BLOCKS
00228
00233 - (void)enumerateObjectsUsingBlock: (of_array_enumeration_block_t)block;
00234
00241 - (OFArray*)mappedArrayUsingBlock: (of_array_map_block_t)block;
00242
00251 - (OFArray*)filteredArrayUsingBlock: (of_array_filter_block_t)block;
00252 #endif
00253 @end
00254
00255 @interface OFArrayEnumerator: OFEnumerator
00256 {
00257 OFArray *array;
00258 OFDataArray *dataArray;
00259 size_t count;
00260 unsigned long mutations;
00261 unsigned long *mutationsPtr;
00262 size_t pos;
00263 }
00264
00265 - initWithArray: (OFArray*)data
00266 dataArray: (OFDataArray*)dataArray
00267 mutationsPointer: (unsigned long*)mutationsPtr;
00268 @end
00269
00270 #import "OFMutableArray.h"