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 "OFJSONRepresentation.h"
29#import "OFMessagePackRepresentation.h"
31OF_ASSUME_NONNULL_BEGIN
106#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
107# define ObjectType id
116@property (readonly, nonatomic)
117 ObjectType
const __unsafe_unretained _Nonnull *_Nonnull
objects;
125@property OF_NULLABLE_PROPERTY (readonly, nonatomic) ObjectType
firstObject;
133@property OF_NULLABLE_PROPERTY (readonly, nonatomic) ObjectType
lastObject;
150+ (instancetype)
array;
158+ (instancetype)arrayWithObject: (ObjectType)object;
166+ (instancetype)arrayWithObjects: (ObjectType)firstObject, ... OF_SENTINEL;
174+ (instancetype)arrayWithArray: (
OFArray OF_GENERIC(ObjectType) *)array;
184+ (instancetype)arrayWithObjects: (ObjectType const _Nonnull *_Nonnull)objects
185 count: (
size_t)count;
192- (instancetype)
init OF_DESIGNATED_INITIALIZER;
200- (instancetype)initWithObject: (ObjectType)object;
208- (instancetype)initWithObjects: (ObjectType)firstObject, ... OF_SENTINEL;
217- (instancetype)initWithObject: (ObjectType)firstObject
218 arguments: (va_list)arguments;
226- (instancetype)initWithArray: (
OFArray OF_GENERIC(ObjectType) *)array;
236- (instancetype)initWithObjects: (ObjectType const _Nonnull *_Nonnull)objects
237 count: (
size_t)count OF_DESIGNATED_INITIALIZER;
255- (ObjectType)objectAtIndex: (
size_t)index;
256- (ObjectType)objectAtIndexedSubscript: (
size_t)index;
271- (nullable id)valueForKey: (
OFString *)key;
283- (void)setValue: (nullable
id)value forKey: (
OFString *)key;
291- (void)getObjects: (ObjectType __unsafe_unretained _Nonnull *_Nonnull)buffer
302- (size_t)indexOfObject: (ObjectType)object;
312- (size_t)indexOfObjectIdenticalTo: (ObjectType)object;
321- (bool)containsObject: (ObjectType)object;
331- (bool)containsObjectIdenticalTo: (ObjectType)object;
339- (
OFArray OF_GENERIC(ObjectType) *)objectsInRange: (
OFRange)range;
368 usingSelector: (
SEL)selector;
380 usingSelector: (
SEL)selector
388- (void)makeObjectsPerformSelector: (
SEL)selector;
398- (void)makeObjectsPerformSelector: (
SEL)selector
399 withObject: (nullable
id)object;
410- (
OFArray OF_GENERIC(ObjectType) *)
411 sortedArrayUsingSelector: (
SEL)selector
423- (
OFArray OF_GENERIC(ObjectType) *)
425 context: (nullable
void *)context
437- (
OFArray OF_GENERIC(ObjectType) *)
448- (
OFArray OF_GENERIC(ObjectType) *)arrayByAddingObject: (ObjectType)object;
456- (
OFArray OF_GENERIC(ObjectType) *)arrayByAddingObjectsFromArray:
457 (
OFArray OF_GENERIC(ObjectType) *)array;
483- (
OFArray OF_GENERIC(ObjectType) *)filteredArrayUsingBlock:
504#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
513#if !defined(NSINTEGER_DEFINED) && !__has_feature(modules)
515@compatibility_alias NSArray
OFArray;
bool(^ OFArrayFilterBlock)(id object, size_t index)
A block for filtering an OFArray.
Definition OFArray.h:75
id(^ OFArrayFoldBlock)(id left, id right)
A block for folding an OFArray.
Definition OFArray.h:93
OFArraySortOptions
Options for sorting an array.
Definition OFArray.h:52
@ OFArraySortDescending
Definition OFArray.h:54
void(^ OFArrayEnumerationBlock)(id object, size_t index, bool *stop)
A block for enumerating an OFArray.
Definition OFArray.h:66
id(^ OFArrayMapBlock)(id object, size_t index)
A block for mapping objects to objects in an OFArray.
Definition OFArray.h:84
OFArrayJoinOptions
Options for joining the objects of an array.
Definition OFArray.h:42
@ OFArraySkipEmptyComponents
Definition OFArray.h:44
OFComparisonResult(^ OFComparator)(id left, id right)
A comparator to compare two objects.
Definition OFObject.h:82
OFComparisonResult(* OFCompareFunction)(id left, id right, void *context)
A function to compare two objects.
Definition OFObject.h:71
An abstract class for storing objects in an array.
Definition OFArray.h:105
ObjectType const __unsafe_unretained * objects
The objects of the array as a C array.
Definition OFArray.h:117
instancetype init()
Initializes an OFArray with no objects.
Definition OFArray.m:151
OFArray * sortedArray
The array sorted in ascending order.
Definition OFArray.h:138
ObjectType lastObject
The last object of the array or nil.
Definition OFArray.h:133
ObjectType firstObject
The first object of the array or nil.
Definition OFArray.h:125
instancetype array()
Creates a new OFArray.
Definition OFArray.m:116
OFEnumerator * objectEnumerator()
Returns an OFEnumerator to enumerate through all objects of the array.
Definition OFArray.m:793
OFArray * reversedArray
The array with the order reversed.
Definition OFArray.h:143
A class which provides methods to enumerate through collections.
Definition OFEnumerator.h:99
The root class for all other classes inside ObjFW.
Definition OFObject.h:688
A class for handling strings.
Definition OFString.h:135
A protocol with methods common for all collections.
Definition OFCollection.h:25
A protocol for the creation of copies.
Definition OFObject.h:1346
A protocol implemented by classes that support encoding to a JSON representation.
Definition OFJSONRepresentation.h:44
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:1367
A range.
Definition OFObject.h:106