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
111 #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) 112 # define ObjectType id 121 @property (readonly, nonatomic)
122 ObjectType
const __unsafe_unretained _Nonnull *_Nonnull
objects;
130 @property OF_NULLABLE_PROPERTY (readonly, nonatomic) ObjectType
firstObject;
138 @property OF_NULLABLE_PROPERTY (readonly, nonatomic) ObjectType
lastObject;
155 + (instancetype)
array;
163 + (instancetype)arrayWithObject: (ObjectType)object;
171 + (instancetype)arrayWithObjects: (ObjectType)firstObject, ... OF_SENTINEL;
179 + (instancetype)arrayWithArray: (
OFArray OF_GENERIC(ObjectType) *)array;
189 + (instancetype)arrayWithObjects: (ObjectType const _Nonnull *_Nonnull)objects
190 count: (
size_t)count;
197 - (instancetype)
init OF_DESIGNATED_INITIALIZER;
205 - (instancetype)initWithObject: (ObjectType)object;
213 - (instancetype)initWithObjects: (ObjectType)firstObject, ... OF_SENTINEL;
222 - (instancetype)initWithObject: (ObjectType)firstObject
223 arguments: (va_list)arguments;
231 - (instancetype)initWithArray: (
OFArray OF_GENERIC(ObjectType) *)array;
241 - (instancetype)initWithObjects: (ObjectType const _Nonnull *_Nonnull)objects
242 count: (
size_t)count OF_DESIGNATED_INITIALIZER;
260 - (ObjectType)objectAtIndex: (
size_t)index;
261 - (ObjectType)objectAtIndexedSubscript: (
size_t)index;
276 - (nullable id)valueForKey: (
OFString *)key;
288 - (void)setValue: (nullable
id)value forKey: (
OFString *)key;
296 - (void)getObjects: (ObjectType __unsafe_unretained _Nonnull *_Nonnull)buffer
307 - (size_t)indexOfObject: (ObjectType)object;
317 - (size_t)indexOfObjectIdenticalTo: (ObjectType)object;
326 - (bool)containsObject: (ObjectType)object;
336 - (bool)containsObjectIdenticalTo: (ObjectType)object;
344 - (
OFArray OF_GENERIC(ObjectType) *)objectsInRange: (
OFRange)range;
381 usingSelector: (
SEL)selector;
393 usingSelector: (
SEL)selector
403 - (void)makeObjectsPerformSelector: (
SEL)selector
404 OF_DEPRECATED(ObjFW, 1, 4, "Use fast enumeration instead");
416 - (void)makeObjectsPerformSelector: (
SEL)selector
417 withObject: (nullable
id)object
418 OF_DEPRECATED(ObjFW, 1, 4, "Use fast enumeration instead");
429 - (
OFArray OF_GENERIC(ObjectType) *)
430 sortedArrayUsingSelector: (
SEL)selector
442 - (
OFArray OF_GENERIC(ObjectType) *)
444 context: (nullable
void *)context
447 #ifdef OF_HAVE_BLOCKS 456 - (
OFArray OF_GENERIC(ObjectType) *)
467 - (
OFArray OF_GENERIC(ObjectType) *)arrayByAddingObject: (ObjectType)object;
475 - (
OFArray OF_GENERIC(ObjectType) *)arrayByAddingObjectsFromArray:
476 (
OFArray OF_GENERIC(ObjectType) *)array;
478 #ifdef OF_HAVE_BLOCKS 502 - (
OFArray OF_GENERIC(ObjectType) *)filteredArrayUsingBlock:
523 #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) 528 OF_ASSUME_NONNULL_END
532 #if !defined(NSINTEGER_DEFINED) && !__has_feature(objc_modules) 534 @compatibility_alias NSArray
OFArray;
OFArray * reversedArray
The array with the order reversed.
Definition: OFArray.h:148
instancetype array()
Creates a new OFArray.
Definition: OFArray.m:137
An abstract class for storing objects in an array.
Definition: OFArray.h:108
OFArrayJoinOptions
Options for joining the objects of an array.
Definition: OFArray.h:47
OFArraySortOptions
Options for sorting an array.
Definition: OFArray.h:57
ObjectType firstObject
The first object of the array or nil.
Definition: OFArray.h:130
The root class for all other classes inside ObjFW.
Definition: OFObject.h:954
void(^ OFArrayEnumerationBlock)(id object, size_t index, bool *stop)
A block for enumerating an OFArray.
Definition: OFArray.h:71
A class storing a set of indexes as sorted ranges.
Definition: OFIndexSet.h:29
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:832
A class for handling strings.
Definition: OFString.h:142
OFArray * sortedArray
The array sorted in ascending order.
Definition: OFArray.h:143
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:89
ObjectType const __unsafe_unretained * objects
The objects of the array as a C array.
Definition: OFArray.h:122
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:80
ObjectType lastObject
The last object of the array or nil.
Definition: OFArray.h:138
OFComparisonResult(^ OFComparator)(id left, id right)
A comparator to compare two objects.
Definition: OFObject.h:92
A protocol for the creation of mutable copies.
Definition: OFObject.h:1639
A protocol for the creation of copies.
Definition: OFObject.h:1618
instancetype init()
Initializes an OFArray with no objects.
Definition: OFArray.m:174
A class which provides methods to enumerate through collections.
Definition: OFEnumerator.h:105
A range.
Definition: OFObject.h:116
id(^ OFArrayFoldBlock)(id left, id right)
A block for folding an OFArray.
Definition: OFArray.h:98
OFComparisonResult(* OFCompareFunction)(id left, id right, void *context)
A function to compare two objects.
Definition: OFObject.h:81