20 #ifndef __STDC_LIMIT_MACROS 21 # define __STDC_LIMIT_MACROS 23 #ifndef __STDC_CONSTANT_MACROS 24 # define __STDC_CONSTANT_MACROS 30 #import "OFCollection.h" 31 #import "OFEnumerator.h" 32 #import "OFJSONRepresentation.h" 33 #import "OFMessagePackRepresentation.h" 35 OF_ASSUME_NONNULL_BEGIN
110 #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) 111 # define ObjectType id 120 @property (readonly, nonatomic)
121 ObjectType
const __unsafe_unretained _Nonnull *_Nonnull
objects;
129 @property OF_NULLABLE_PROPERTY (readonly, nonatomic) ObjectType
firstObject;
137 @property OF_NULLABLE_PROPERTY (readonly, nonatomic) ObjectType
lastObject;
154 + (instancetype)
array;
162 + (instancetype)arrayWithObject: (ObjectType)object;
170 + (instancetype)arrayWithObjects: (ObjectType)firstObject, ... OF_SENTINEL;
178 + (instancetype)arrayWithArray: (
OFArray OF_GENERIC(ObjectType) *)array;
188 + (instancetype)arrayWithObjects: (ObjectType const _Nonnull *_Nonnull)objects
189 count: (
size_t)count;
196 - (instancetype)
init OF_DESIGNATED_INITIALIZER;
204 - (instancetype)initWithObject: (ObjectType)object;
212 - (instancetype)initWithObjects: (ObjectType)firstObject, ... OF_SENTINEL;
221 - (instancetype)initWithObject: (ObjectType)firstObject
222 arguments: (va_list)arguments;
230 - (instancetype)initWithArray: (
OFArray OF_GENERIC(ObjectType) *)array;
240 - (instancetype)initWithObjects: (ObjectType const _Nonnull *_Nonnull)objects
241 count: (
size_t)count OF_DESIGNATED_INITIALIZER;
259 - (ObjectType)objectAtIndex: (
size_t)index;
260 - (ObjectType)objectAtIndexedSubscript: (
size_t)index;
275 - (nullable id)valueForKey: (
OFString *)key;
287 - (void)setValue: (nullable
id)value forKey: (
OFString *)key;
295 - (void)getObjects: (ObjectType __unsafe_unretained _Nonnull *_Nonnull)buffer
306 - (size_t)indexOfObject: (ObjectType)object;
316 - (size_t)indexOfObjectIdenticalTo: (ObjectType)object;
325 - (bool)containsObject: (ObjectType)object;
335 - (bool)containsObjectIdenticalTo: (ObjectType)object;
343 - (
OFArray OF_GENERIC(ObjectType) *)objectsInRange: (
OFRange)range;
372 usingSelector: (
SEL)selector;
384 usingSelector: (
SEL)selector
392 - (void)makeObjectsPerformSelector: (
SEL)selector;
402 - (void)makeObjectsPerformSelector: (
SEL)selector
403 withObject: (nullable
id)object;
414 - (
OFArray OF_GENERIC(ObjectType) *)
415 sortedArrayUsingSelector: (
SEL)selector
427 - (
OFArray OF_GENERIC(ObjectType) *)
429 context: (nullable
void *)context
432 #ifdef OF_HAVE_BLOCKS 441 - (
OFArray OF_GENERIC(ObjectType) *)
452 - (
OFArray OF_GENERIC(ObjectType) *)arrayByAddingObject: (ObjectType)object;
460 - (
OFArray OF_GENERIC(ObjectType) *)arrayByAddingObjectsFromArray:
461 (
OFArray OF_GENERIC(ObjectType) *)array;
463 #ifdef OF_HAVE_BLOCKS 487 - (
OFArray OF_GENERIC(ObjectType) *)filteredArrayUsingBlock:
508 #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) 513 OF_ASSUME_NONNULL_END
517 #if !defined(NSINTEGER_DEFINED) && !__has_feature(modules) 519 @compatibility_alias NSArray
OFArray;
OFArray * reversedArray
The array with the order reversed.
Definition: OFArray.h:147
instancetype array()
Creates a new OFArray.
Definition: OFArray.m:120
An abstract class for storing objects in an array.
Definition: OFArray.h:107
OFArrayJoinOptions
Options for joining the objects of an array.
Definition: OFArray.h:46
OFArraySortOptions
Options for sorting an array.
Definition: OFArray.h:56
ObjectType firstObject
The first object of the array or nil.
Definition: OFArray.h:129
The root class for all other classes inside ObjFW.
Definition: OFObject.h:690
void(^ OFArrayEnumerationBlock)(id object, size_t index, bool *stop)
A block for enumerating an OFArray.
Definition: OFArray.h:70
A protocol implemented by classes that support encoding to a JSON representation. ...
Definition: OFJSONRepresentation.h:49
OFEnumerator * objectEnumerator()
Returns an OFEnumerator to enumerate through all objects of the array.
Definition: OFArray.m:797
A class for handling strings.
Definition: OFString.h:142
OFArray * sortedArray
The array sorted in ascending order.
Definition: OFArray.h:142
A protocol with methods common for all collections.
id(^ OFArrayMapBlock)(id object, size_t index)
A block for mapping objects to objects in an OFArray.
Definition: OFArray.h:88
ObjectType const __unsafe_unretained * objects
The objects of the array as a C array.
Definition: OFArray.h:121
A protocol implemented by classes that support encoding to a MessagePack representation.
Definition: OFMessagePackRepresentation.h:33
bool(^ OFArrayFilterBlock)(id object, size_t index)
A block for filtering an OFArray.
Definition: OFArray.h:79
ObjectType lastObject
The last object of the array or nil.
Definition: OFArray.h:137
OFComparisonResult(^ OFComparator)(id left, id right)
A comparator to compare two objects.
Definition: OFObject.h:86
A protocol for the creation of mutable copies.
Definition: OFObject.h:1371
A protocol for the creation of copies.
Definition: OFObject.h:1350
instancetype init()
Initializes an OFArray with no objects.
Definition: OFArray.m:155
A class which provides methods to enumerate through collections.
Definition: OFEnumerator.h:103
A range.
Definition: OFObject.h:110
id(^ OFArrayFoldBlock)(id left, id right)
A block for folding an OFArray.
Definition: OFArray.h:97
OFComparisonResult(* OFCompareFunction)(id left, id right, void *context)
A function to compare two objects.
Definition: OFObject.h:75