1
2
3
4
5
6
7
8
9
|
1
2
3
4
5
6
7
8
9
|
-
+
|
/*
* Copyright (c) 2008-2022 Jonathan Schleifer <js@nil.im>
* Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
|
| ︙ | | |
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
-
|
#endif
#include <stdarg.h>
#import "OFObject.h"
#import "OFCollection.h"
#import "OFEnumerator.h"
#import "OFSerialization.h"
#import "OFJSONRepresentation.h"
#import "OFMessagePackRepresentation.h"
OF_ASSUME_NONNULL_BEGIN
/** @file */
|
| ︙ | | |
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
-
+
|
* @class OFArray OFArray.h ObjFW/OFArray.h
*
* @brief An abstract class for storing objects in an array.
*
* @note Subclasses must implement @ref count and @ref objectAtIndex:.
*/
@interface OFArray OF_GENERIC(ObjectType): OFObject <OFCopying,
OFMutableCopying, OFCollection, OFSerialization, OFJSONRepresentation,
OFMutableCopying, OFCollection, OFJSONRepresentation,
OFMessagePackRepresentation>
#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
# define ObjectType id
#endif
/**
* @brief The objects of the array as a C array.
*
|
| ︙ | | |
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
+
+
+
+
+
+
+
|
* @param objects A C array of objects
* @param count The length of the C array
* @return A new autoreleased OFArray
*/
+ (instancetype)arrayWithObjects: (ObjectType const _Nonnull *_Nonnull)objects
count: (size_t)count;
/**
* @brief Initializes an OFArray with no objects.
*
* @return An initialized OFArray
*/
- (instancetype)init OF_DESIGNATED_INITIALIZER;
/**
* @brief Initializes an OFArray with the specified object.
*
* @param object An object
* @return An initialized OFArray
*/
- (instancetype)initWithObject: (ObjectType)object;
|
| ︙ | | |
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
|
-
+
|
* the specified length.
*
* @param objects A C array of objects
* @param count The length of the C array
* @return An initialized OFArray
*/
- (instancetype)initWithObjects: (ObjectType const _Nonnull *_Nonnull)objects
count: (size_t)count;
count: (size_t)count OF_DESIGNATED_INITIALIZER;
/**
* @brief Returns an OFEnumerator to enumerate through all objects of the array.
*
* @return An OFEnumerator to enumerate through all objects of the array
*/
- (OFEnumerator OF_GENERIC(ObjectType) *)objectEnumerator;
|
| ︙ | | |
401
402
403
404
405
406
407
408
409
410
411
412
413
414
|
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
* @param options The options to use when sorting the array
* @return A sorted copy of the array
*/
- (OFArray OF_GENERIC(ObjectType) *)
sortedArrayUsingSelector: (SEL)selector
options: (OFArraySortOptions)options;
/**
* @brief Returns a copy of the array sorted using the specified function and
* options.
*
* @param compare The function to use to sort the array
* @param context Context passed to the function to compare
* @param options The options to use when sorting the array
* @return A sorted copy of the array
*/
- (OFArray OF_GENERIC(ObjectType) *)
sortedArrayUsingFunction: (OFCompareFunction)compare
context: (nullable void *)context
options: (OFArraySortOptions)options;
#ifdef OF_HAVE_BLOCKS
/**
* @brief Returns a copy of the array sorted using the specified selector and
* options.
*
* @param comparator The comparator to use to sort the array
* @param options The options to use when sorting the array
|
| ︙ | | |