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
00209 #ifdef OF_HAVE_BLOCKS
00210
00215 - (void)enumerateObjectsUsingBlock: (of_array_enumeration_block_t)block;
00216
00223 - (OFArray*)mappedArrayUsingBlock: (of_array_map_block_t)block;
00224
00233 - (OFArray*)filteredArrayUsingBlock: (of_array_filter_block_t)block;
00234 #endif
00235 @end
00236
00237 @interface OFArrayEnumerator: OFEnumerator
00238 {
00239 OFDataArray *array;
00240 size_t count;
00241 unsigned long mutations;
00242 unsigned long *mutationsPtr;
00243 size_t pos;
00244 }
00245
00246 - initWithDataArray: (OFDataArray*)data
00247 mutationsPointer: (unsigned long*)mutations_ptr;
00248 @end
00249
00250 #import "OFMutableArray.h"