17 #ifndef __STDC_LIMIT_MACROS 18 # define __STDC_LIMIT_MACROS 20 #ifndef __STDC_CONSTANT_MACROS 21 # define __STDC_CONSTANT_MACROS 27 #import "OFCollection.h" 28 #import "OFEnumerator.h" 29 #import "OFSerialization.h" 30 #import "OFJSONRepresentation.h" 31 #import "OFMessagePackRepresentation.h" 33 OF_ASSUME_NONNULL_BEGIN
40 OF_ARRAY_SKIP_EMPTY = 1,
41 OF_ARRAY_SORT_DESCENDING = 2
92 #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) 93 # define ObjectType id 100 + (instancetype)
array;
108 + (instancetype)arrayWithObject: (ObjectType)object;
116 + (instancetype)arrayWithObjects: (ObjectType)firstObject, ... OF_SENTINEL;
124 + (instancetype)arrayWithArray: (
OFArray OF_GENERIC(ObjectType) *)array;
135 arrayWithObjects: (ObjectType const _Nonnull *_Nonnull)objects
136 count: (
size_t)count;
144 - initWithObject: (ObjectType)object;
152 - initWithObjects: (ObjectType)firstObject, ... OF_SENTINEL;
161 - initWithObject: (ObjectType)firstObject
162 arguments: (va_list)arguments;
170 - initWithArray: (
OFArray OF_GENERIC(ObjectType) *)array;
180 - initWithObjects: (ObjectType const _Nonnull *_Nonnull)objects
181 count: (
size_t)count;
192 - (ObjectType)objectAtIndex: (
size_t)index;
193 - (ObjectType)objectAtIndexedSubscript: (
size_t)index;
208 - (nullable id)valueForKey: (
OFString *)key;
223 - (void)setValue: (
id)value
232 - (void)getObjects: (ObjectType __unsafe_unretained _Nonnull *_Nonnull)buffer
240 - (ObjectType const __unsafe_unretained _Nonnull *_Nonnull)
objects;
250 - (size_t)indexOfObject: (ObjectType)object;
260 - (size_t)indexOfObjectIdenticalTo: (ObjectType)object;
269 - (bool)containsObject: (ObjectType)object;
279 - (bool)containsObjectIdenticalTo: (ObjectType)object;
329 options: (
int)options;
340 usingSelector: (
SEL)selector;
356 usingSelector: (
SEL)selector
357 options: (
int)options;
364 - (void)makeObjectsPerformSelector: (
SEL)selector;
374 - (void)makeObjectsPerformSelector: (
SEL)selector
375 withObject: (nullable
id)object;
394 - (
OFArray OF_GENERIC(ObjectType) *)sortedArrayWithOptions: (
int)options;
409 - (
OFArray OF_GENERIC(ObjectType) *)arrayByAddingObject: (ObjectType)object;
417 - (
OFArray OF_GENERIC(ObjectType) *)arrayByAddingObjectsFromArray:
418 (
OFArray OF_GENERIC(ObjectType) *)array;
426 - (
OFArray OF_GENERIC(ObjectType) *)arrayByRemovingObject: (ObjectType)object;
436 #ifdef OF_HAVE_BLOCKS 460 - (
OFArray OF_GENERIC(ObjectType) *)filteredArrayUsingBlock:
481 #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) 490 unsigned long _mutations;
491 unsigned long *_Nullable _mutationsPtr;
495 - initWithArray: (
OFArray *)data
496 mutationsPtr: (nullable
unsigned long *)mutationsPtr;
499 OF_ASSUME_NONNULL_END
503 #if !defined(NSINTEGER_DEFINED) && !__has_feature(modules) 505 @compatibility_alias NSArray
OFArray;
instancetype array()
Creates a new OFArray.
Definition: OFArray.m:131
A protocol for the creation of mutable copies.
Definition: OFObject.h:935
void(^ of_array_enumeration_block_t)(id object, size_t index, bool *stop)
A block for enumerating an OFArray.
Definition: OFArray.h:53
ObjectType const __unsafe_unretained _Nonnull *_Nonnull objects()
Returns the objects of the array as a C array.
Definition: OFArray.m:239
A class for handling strings.
Definition: OFString.h:114
A protocol implemented by classes that support encoding to a JSON representation. ...
Definition: OFJSONRepresentation.h:38
OFEnumerator * objectEnumerator()
Returns an OFEnumerator to enumerate through all objects of the array.
Definition: OFArray.m:797
A class which provides methods to enumerate through collections.
Definition: OFEnumerator.h:44
A protocol with methods common for all collections.
bool(^ of_array_filter_block_t)(id object, size_t index)
A block for filtering an OFArray.
Definition: OFArray.h:63
id _Nonnull(^ of_array_map_block_t)(id object, size_t index)
A block for mapping objects to objects in an OFArray.
Definition: OFArray.h:72
nullable ObjectType lastObject()
Returns the last object of the array or nil.
Definition: OFArray.m:378
A protocol implemented by classes that support encoding to a MessagePack representation.
Definition: OFMessagePackRepresentation.h:30
id _Nullable(^ of_array_fold_block_t)(id _Nullable left, id right)
A block for folding an OFArray.
Definition: OFArray.h:81
OFArray * reversedArray()
Returns a copy of the array with the order reversed.
Definition: OFArray.m:761
A protocol for the creation of copies.
Definition: OFObject.h:914
nullable ObjectType firstObject()
Returns the first object of the array or nil.
Definition: OFArray.m:370
OFArray * sortedArray()
Returns a sorted copy of the array.
Definition: OFArray.m:739
The root class for all other classes inside ObjFW.
Definition: OFObject.h:379
A range.
Definition: OFObject.h:66
An abstract class for storing objects in an array.
Definition: OFArray.h:89
A protocol for serializing objects.
Definition: OFSerialization.h:30