︙ | | |
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
+
+
+
-
-
+
+
|
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#ifndef OBJFW_OF_OBJECT_H
#define OBJFW_OF_OBJECT_H
#include "objfw-defs.h"
#ifndef __STDC_LIMIT_MACROS
# define __STDC_LIMIT_MACROS
#endif
#ifndef __STDC_CONSTANT_MACROS
# define __STDC_CONSTANT_MACROS
#endif
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <limits.h>
#import "macros.h"
#import "block.h"
#include "macros.h"
#include "block.h"
/*
* Some versions of MinGW require <winsock2.h> to be included before
* <windows.h>. Do this here to make sure this is always done in the correct
* order, even if another header includes just <windows.h>.
*/
#ifdef __MINGW32__
|
︙ | | |
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
-
+
+
-
+
|
} of_byte_order_t;
/*!
* @struct of_range_t OFObject.h ObjFW/OFObject.h
*
* @brief A range.
*/
typedef struct OF_BOXABLE {
struct OF_BOXABLE of_range_t {
/*! The start of the range */
size_t location;
/*! The length of the range */
size_t length;
};
} of_range_t;
typedef struct of_range_t of_range_t;
/*!
* @brief Creates a new of_range_t.
*
* @param start The starting index of the range
* @param length The length of the range
* @return An of_range with the specified start and length
|
︙ | | |
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
-
+
+
-
+
|
typedef double of_time_interval_t;
/*!
* @struct of_point_t OFObject.h ObjFW/OFObject.h
*
* @brief A point.
*/
typedef struct OF_BOXABLE {
struct OF_BOXABLE of_point_t {
/*! The x coordinate of the point */
float x;
/*! The y coordinate of the point */
float y;
};
} of_point_t;
typedef struct of_point_t of_point_t;
/*!
* @brief Creates a new of_point_t.
*
* @param x The x coordinate of the point
* @param y The x coordinate of the point
* @return An of_point_t with the specified coordinates
|
︙ | | |
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
-
+
+
-
+
|
}
/*!
* @struct of_dimension_t OFObject.h ObjFW/OFObject.h
*
* @brief A dimension.
*/
typedef struct OF_BOXABLE {
struct OF_BOXABLE of_dimension_t {
/*! The width of the dimension */
float width;
/*! The height of the dimension */
float height;
};
} of_dimension_t;
typedef struct of_dimension_t of_dimension_t;
/*!
* @brief Creates a new of_dimension_t.
*
* @param width The width of the dimension
* @param height The height of the dimension
* @return An of_dimension_t with the specified width and height
|
︙ | | |
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
|
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
|
-
+
+
-
+
|
}
/*!
* @struct of_rectangle_t OFObject.h ObjFW/OFObject.h
*
* @brief A rectangle.
*/
typedef struct OF_BOXABLE {
struct OF_BOXABLE of_rectangle_t {
/*! The point from where the rectangle originates */
of_point_t origin;
/*! The size of the rectangle */
of_dimension_t size;
};
} of_rectangle_t;
typedef struct of_rectangle_t of_rectangle_t;
/*!
* @brief Creates a new of_rectangle_t.
*
* @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
|
︙ | | |
273
274
275
276
277
278
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
|
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
|
+
-
+
-
+
-
+
|
if (!of_dimension_equal(rectangle1.size, rectangle2.size))
return false;
return true;
}
#ifdef __OBJC__
@class OFMethodSignature;
@class OFString;
@class OFThread;
/*!
* @protocol OFObject OFObject.h ObjFW/OFObject.h
*
* @brief The protocol which all root classes implement.
*/
@protocol OFObject
/*!
* @brief The class of the object.
*/
#ifndef __cplusplus
# ifndef __cplusplus
@property (readonly, nonatomic) Class class;
#else
# else
@property (readonly, nonatomic, getter=class) Class class_;
#endif
# endif
/*!
* @brief The superclass of the object.
*/
@property OF_NULLABLE_PROPERTY (readonly, nonatomic) Class superclass;
/*!
|
︙ | | |
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
|
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
|
+
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
|
/*!
* @brief Retain a weak reference to this object.
*
* @return Whether a weak reference to this object has been retained
*/
- (bool)retainWeakReference;
@end
#endif
/*!
* @class OFObject OFObject.h ObjFW/OFObject.h
*
* @brief The root class for all other classes inside ObjFW.
*/
#ifdef __OBJC__
OF_ROOT_CLASS
@interface OFObject <OFObject>
{
@private
#ifndef __clang_analyzer__
# ifndef __clang_analyzer__
Class _isa;
#else
# else
Class _isa __attribute__((__unused__));
#endif
# endif
}
#ifdef OF_HAVE_CLASS_PROPERTIES
# ifndef __cplusplus
# ifdef OF_HAVE_CLASS_PROPERTIES
# ifndef __cplusplus
@property (class, readonly, nonatomic) Class class;
# else
# else
@property (class, readonly, nonatomic, getter=class) Class class_;
# endif
# endif
@property (class, readonly, nonatomic) OFString *className;
@property (class, readonly, nullable, nonatomic) Class superclass;
@property (class, readonly, nonatomic) OFString *description;
#endif
# endif
/*!
* @brief The name of the object's class.
*/
@property (readonly, nonatomic) OFString *className;
/*!
|
︙ | | |
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
|
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
|
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
|
* @return The class of the object
*/
+ (id)copy;
/*!
* @brief Initializes an already allocated object.
*
* Derived classes may override this, but need to do
* Derived classes may override this, but need to use the following pattern:
* @code
* self = [super init]
* self = [super init];
*
* @try {
* // Custom initialization code goes here.
* } @catch (id e) {
* [self release];
* @throw e;
* }
*
* return self;
* @endcode
*
* With ARC enabled, the following pattern needs to be used instead:
* @code
* self = [super init];
*
* before they do any initialization themselves. @ref init may never return
* `nil`, instead an exception (for example @ref
* OFInitializationFailedException) should be thrown.
* // Custom initialization code goes here.
*
* return self;
* @endcode
*
* @ref init may never return `nil`, instead an exception (for example
* @ref OFInitializationFailedException) should be thrown.
*
* @return An initialized object
*/
- (instancetype)init;
/*!
* @brief Returns the method signature for the specified selector.
|
︙ | | |
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
|
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
|
-
+
|
- (void)performSelector: (SEL)selector
withObject: (nullable id)object1
withObject: (nullable id)object2
withObject: (nullable id)object3
withObject: (nullable id)object4
afterDelay: (of_time_interval_t)delay;
#ifdef OF_HAVE_THREADS
# ifdef OF_HAVE_THREADS
/*!
* @brief Performs the specified selector on the specified thread.
*
* @param selector The selector to perform
* @param thread The thread on which to perform the selector
* @param waitUntilDone Whether to wait until the perform finished
*/
|
︙ | | |
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
|
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
|
-
+
|
- (void)performSelector: (SEL)selector
onThread: (OFThread *)thread
withObject: (nullable id)object1
withObject: (nullable id)object2
withObject: (nullable id)object3
withObject: (nullable id)object4
afterDelay: (of_time_interval_t)delay;
#endif
# endif
/*!
* @brief This method is called when @ref resolveClassMethod: or
* @ref resolveInstanceMethod: returned false. It should return a target
* to which the message should be forwarded.
*
* @note When the message should not be forwarded, you should not return `nil`,
|
︙ | | |
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
|
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
|
+
+
+
+
|
* @warning If you override this method, you must make sure that it never
* returns!
*
* @param selector The selector not understood by the receiver
*/
- (void)doesNotRecognizeSelector: (SEL)selector OF_NO_RETURN;
@end
#else
typedef void OFObject;
#endif
#ifdef __OBJC__
/*!
* @protocol OFCopying OFObject.h ObjFW/OFObject.h
*
* @brief A protocol for the creation of copies.
*/
@protocol OFCopying
/*!
|
︙ | | |
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
|
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
|
+
+
-
-
+
+
+
+
+
|
* @brief Compares the object with another object.
*
* @param object An object to compare the object to
* @return The result of the comparison
*/
- (of_comparison_result_t)compare: (id <OFComparing>)object;
@end
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifdef OF_APPLE_RUNTIME
extern void *_Null_unspecified objc_autoreleasePoolPush(void);
extern void objc_autoreleasePoolPop(void *_Null_unspecified pool);
#endif
extern id of_alloc_object(Class class_, size_t extraSize,
size_t extraAlignment, void *_Nullable *_Nullable extra);
extern void OF_NO_RETURN_FUNC of_method_not_found(id self, SEL _cmd);
extern uint32_t of_hash_seed;
#ifdef __cplusplus
}
#endif
OF_ASSUME_NONNULL_END
#ifdef __OBJC__
#import "OFObject+KeyValueCoding.h"
#import "OFObject+Serialization.h"
# import "OFObject+KeyValueCoding.h"
# import "OFObject+Serialization.h"
#endif
#endif
|