16 #ifndef __STDC_LIMIT_MACROS
17 # define __STDC_LIMIT_MACROS
19 #ifndef __STDC_CONSTANT_MACROS
20 # define __STDC_CONSTANT_MACROS
26 #import "OFCollection.h"
27 #import "OFEnumerator.h"
28 #import "OFSerialization.h"
29 #import "OFJSONRepresentation.h"
30 #import "OFMessagePackRepresentation.h"
32 OF_ASSUME_NONNULL_BEGIN
39 OF_ARRAY_SKIP_EMPTY = 1,
40 OF_ARRAY_SORT_DESCENDING = 2
93 #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
94 # define ObjectType id
103 @property (readonly, nonatomic)
104 ObjectType
const __unsafe_unretained _Nonnull *_Nonnull
objects;
112 @property OF_NULLABLE_PROPERTY (readonly, nonatomic) ObjectType
firstObject;
120 @property OF_NULLABLE_PROPERTY (readonly, nonatomic) ObjectType
lastObject;
137 + (instancetype)
array;
145 + (instancetype)arrayWithObject: (ObjectType)object;
153 + (instancetype)arrayWithObjects: (ObjectType)firstObject, ... OF_SENTINEL;
161 + (instancetype)arrayWithArray: (
OFArray OF_GENERIC(ObjectType) *)array;
172 arrayWithObjects: (ObjectType const _Nonnull *_Nonnull)objects
173 count: (
size_t)count;
181 - (instancetype)initWithObject: (ObjectType)object;
189 - (instancetype)initWithObjects: (ObjectType)firstObject, ... OF_SENTINEL;
198 - (instancetype)initWithObject: (ObjectType)firstObject
199 arguments: (va_list)arguments;
207 - (instancetype)initWithArray: (
OFArray OF_GENERIC(ObjectType) *)array;
217 - (instancetype)initWithObjects: (ObjectType const _Nonnull *_Nonnull)objects
218 count: (
size_t)count;
229 - (ObjectType)objectAtIndex: (
size_t)index;
230 - (ObjectType)objectAtIndexedSubscript: (
size_t)index;
257 - (void)setValue: (nullable
id)value forKey: (
OFString *)key;
265 - (void)getObjects: (ObjectType __unsafe_unretained _Nonnull *_Nonnull)buffer
276 - (size_t)indexOfObject: (ObjectType)object;
286 - (size_t)indexOfObjectIdenticalTo: (ObjectType)object;
295 - (bool)containsObject: (ObjectType)object;
305 - (bool)containsObjectIdenticalTo: (ObjectType)object;
335 options: (
int)options;
346 usingSelector: (
SEL)selector;
362 usingSelector: (
SEL)selector
363 options: (
int)options;
370 - (void)makeObjectsPerformSelector: (
SEL)selector;
380 - (void)makeObjectsPerformSelector: (
SEL)selector
381 withObject: (nullable
id)object;
396 - (
OFArray OF_GENERIC(ObjectType) *)sortedArrayUsingSelector: (
SEL)selector
397 options: (
int)options;
399 #ifdef OF_HAVE_BLOCKS
412 - (
OFArray OF_GENERIC(ObjectType) *)
414 options: (
int)options;
423 - (
OFArray OF_GENERIC(ObjectType) *)arrayByAddingObject: (ObjectType)object;
431 - (
OFArray OF_GENERIC(ObjectType) *)arrayByAddingObjectsFromArray:
432 (
OFArray OF_GENERIC(ObjectType) *)array;
440 - (
OFArray OF_GENERIC(ObjectType) *)arrayByRemovingObject: (ObjectType)object;
442 #ifdef OF_HAVE_BLOCKS
466 - (
OFArray OF_GENERIC(ObjectType) *)filteredArrayUsingBlock:
487 #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
492 OF_ASSUME_NONNULL_END
496 #if !defined(NSINTEGER_DEFINED) && !__has_feature(modules)
498 @compatibility_alias NSArray
OFArray;
bool(^ of_array_filter_block_t)(id object, size_t index)
A block for filtering an OFArray.
Definition: OFArray.h:62
void(^ of_array_enumeration_block_t)(id object, size_t index, bool *stop)
A block for enumerating an OFArray.
Definition: OFArray.h:52
id _Nullable(^ of_array_fold_block_t)(id _Nullable left, id right)
A block for folding an OFArray.
Definition: OFArray.h:80
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:71
of_comparison_result_t(^ of_comparator_t)(id _Nonnull left, id _Nonnull right)
A comparator to compare two objects.
Definition: OFObject.h:74
struct objc_object * id
A pointer to any object.
Definition: ObjFWRT.h:90
An abstract class for storing objects in an array.
Definition: OFArray.h:92
ObjectType const __unsafe_unretained _Nonnull *_Nonnull objects
The objects of the array as a C array.
Definition: OFArray.h:104
OFArray * sortedArray
The array sorted in ascending order.
Definition: OFArray.h:125
ObjectType lastObject
The last object of the array or nil.
Definition: OFArray.h:120
ObjectType firstObject
The first object of the array or nil.
Definition: OFArray.h:112
instancetype array()
Creates a new OFArray.
Definition: OFArray.m:131
OFArray * reversedArray
The array with the order reversed.
Definition: OFArray.h:130
The root class for all other classes inside ObjFW.
Definition: OFObject.h:520
A class for handling strings.
Definition: OFString.h:132
A protocol with methods common for all collections.
Definition: OFCollection.h:25
A protocol for the creation of copies.
Definition: OFObject.h:1187
A protocol implemented by classes that support encoding to a JSON representation.
Definition: OFJSONRepresentation.h:39
A protocol implemented by classes that support encoding to a MessagePack representation.
Definition: OFMessagePackRepresentation.h:29
A protocol for the creation of mutable copies.
Definition: OFObject.h:1208
A protocol for serializing objects.
Definition: OFSerialization.h:29
A range.
Definition: OFObject.h:93