︙ | | |
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
-
+
-
+
-
+
-
+
-
-
+
|
OF_ASSUME_NONNULL_BEGIN
/** @file */
/**
* @brief A result of a comparison.
*/
typedef enum OFComparisonResult {
typedef enum {
/** The left object is smaller than the right */
OFOrderedAscending = -1,
/** Both objects are equal */
OFOrderedSame = 0,
/** The left object is bigger than the right */
OFOrderedDescending = 1
} OFComparisonResult;
#ifdef OF_HAVE_BLOCKS
/**
* @brief A comparator to compare two objects.
*
* @param left The left object
* @param right The right object
* @return The order of the objects
*/
typedef OFComparisonResult (^OFComparator)(id _Nonnull left, id _Nonnull right);
#endif
/**
* @brief An enum for storing endianess.
* @brief An enum for representing endianess.
*/
typedef enum OFByteOrder {
typedef enum {
/** Most significant byte first (big endian) */
OFByteOrderBigEndian,
/** Least significant byte first (little endian) */
OFByteOrderLittleEndian,
/** Native byte order of the system */
#ifdef OF_BIG_ENDIAN
OFByteOrderNative = OFByteOrderBigEndian
#else
OFByteOrderNative = OFByteOrderLittleEndian
#endif
} OFByteOrder;
/**
* @struct OFRange OFObject.h ObjFW/OFObject.h
*
* @brief A range.
*/
struct OF_BOXABLE OFRange {
typedef struct OF_BOXABLE {
/** The start of the range */
size_t location;
/** The length of the range */
size_t length;
};
typedef struct OFRange OFRange;
} OFRange;
/**
* @brief Creates a new OFRange.
*
* @param start The starting index of the range
* @param length The length of the range
* @return An OFRangeith the specified start and length
|
︙ | | |
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
-
+
-
-
+
|
typedef double OFTimeInterval;
/**
* @struct OFPoint OFObject.h ObjFW/OFObject.h
*
* @brief A point.
*/
struct OF_BOXABLE OFPoint {
typedef struct OF_BOXABLE {
/** The x coordinate of the point */
float x;
/** The y coordinate of the point */
float y;
};
typedef struct OFPoint OFPoint;
} OFPoint;
/**
* @brief Creates a new OFPoint.
*
* @param x The x coordinate of the point
* @param y The x coordinate of the point
* @return An OFPoint with the specified coordinates
|
︙ | | |
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
|
-
+
-
-
+
|
}
/**
* @struct OFSize OFObject.h ObjFW/OFObject.h
*
* @brief A size.
*/
struct OF_BOXABLE OFSize {
typedef struct OF_BOXABLE {
/** The width of the size */
float width;
/** The height of the size */
float height;
};
typedef struct OFSize OFSize;
} OFSize;
/**
* @brief Creates a new OFSize.
*
* @param width The width of the size
* @param height The height of the size
* @return An OFSize with the specified width and height
|
︙ | | |
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
|
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
|
-
+
-
-
+
|
}
/**
* @struct OFRect OFObject.h ObjFW/OFObject.h
*
* @brief A rectangle.
*/
struct OF_BOXABLE OFRect {
typedef struct OF_BOXABLE {
/** The point from where the rectangle originates */
OFPoint origin;
/** The size of the rectangle */
OFSize size;
};
typedef struct OFRect OFRect;
} OFRect;
/**
* @brief Creates a new OFRect.
*
* @param x The x coordinate of the top left corner of the rectangle
* @param y The y coordinate of the top left corner of the rectangle
* @param width The width of the rectangle
|
︙ | | |
283
284
285
286
287
288
289
290
291
292
293
294
295
296
|
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
return false;
if (!OFSizeEqual(rect1.size, rect2.size))
return false;
return true;
}
/**
* @brief Adds the specified byte to the hash.
*
* @param hash A pointer to a hash to add the byte to
* @param byte The byte to add to the hash
*/
static OF_INLINE void
OFHashAdd(unsigned long *_Nonnull hash, unsigned char byte)
{
uint32_t tmp = (uint32_t)*hash;
tmp += byte;
tmp += tmp << 10;
tmp ^= tmp >> 6;
*hash = tmp;
}
/**
* @brief Adds the specified hash to the hash.
*
* @param hash A pointer to a hash to add the hash to
* @param otherHash The hash to add to the hash
*/
static OF_INLINE void
OFHashAddHash(unsigned long *_Nonnull hash, unsigned long otherHash)
{
OFHashAdd(hash, (otherHash >> 24) & 0xFF);
OFHashAdd(hash, (otherHash >> 16) & 0xFF);
OFHashAdd(hash, (otherHash >> 8) & 0xFF);
OFHashAdd(hash, otherHash & 0xFF);
}
/**
* @brief Finalizes the specified hash.
*
* @param hash A pointer to the hash to finalize
*/
static OF_INLINE void
OFHashFinalize(unsigned long *_Nonnull hash)
{
uint32_t tmp = (uint32_t)*hash;
tmp += tmp << 3;
tmp ^= tmp >> 11;
tmp += tmp << 15;
*hash = tmp;
}
static const size_t OFNotFound = SIZE_MAX;
#ifdef __OBJC__
@class OFMethodSignature;
@class OFString;
@class OFThread;
|
︙ | | |
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
|
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
|
-
+
-
-
+
|
/**
* @brief A method which is called when the class is unloaded from the runtime.
*
* Derived classes can override this to execute their own code when the class
* is unloaded.
*
* @warning This is not supported by the Apple runtime and currently only
* called by the ObjFW runtime when objc_unregister_class() or
* called by the ObjFW runtime when @ref objc_deinit has been called!
* objc_exit() has been called!
* In the future, this might also be called by the ObjFW runtime when
* the class is part of a plugin that has been unloaded.
* the class is part of a plugin that is being unloaded.
*/
+ (void)unload;
/**
* @brief A method which is called the moment before the first call to the class
* is being made.
*
|
︙ | | |
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
|
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
|
+
+
+
+
+
+
+
|
/**
* @brief Returns 64 bit or non-cryptographical randomness.
*
* @return 64 bit or non-cryptographical randomness
*/
extern uint64_t OFRandom64(void);
/**
* @brief Initializes the specified hash.
*
* @param hash A pointer to the hash to initialize
*/
extern void OFHashInit(unsigned long *_Nonnull hash);
#ifdef __cplusplus
}
#endif
OF_ASSUME_NONNULL_END
#include "OFBlock.h"
|
︙ | | |