16 #ifndef OBJFW_OF_OBJECT_H
17 #define OBJFW_OF_OBJECT_H
19 #include "objfw-defs.h"
21 #ifndef __STDC_LIMIT_MACROS
22 # define __STDC_LIMIT_MACROS
24 #ifndef __STDC_CONSTANT_MACROS
25 # define __STDC_CONSTANT_MACROS
44 # ifdef __MINGW64_VERSION_MAJOR
45 # include <winsock2.h>
50 OF_ASSUME_NONNULL_BEGIN
109 of_range(
size_t start,
size_t length)
123 static OF_INLINE
bool
161 of_point(
float x,
float y)
175 static OF_INLINE
bool
178 if (point1.
x != point2.
x)
181 if (point1.
y != point2.
y)
222 static OF_INLINE
bool
257 of_rectangle(
float x,
float y,
float width,
float height)
261 of_dimension(width, height)
274 static OF_INLINE
bool
277 if (!of_point_equal(rectangle1.
origin, rectangle2.
origin))
280 if (!of_dimension_equal(rectangle1.
size, rectangle2.
size))
309 - (nullable
Class)superclass;
323 - (
unsigned long)hash;
330 - (
unsigned int)retainCount;
344 - (bool)allowsWeakReference;
352 - (bool)isKindOfClass: (
Class)class_;
361 - (bool)isMemberOfClass: (
Class)class_;
370 - (bool)respondsToSelector: (
SEL)selector;
378 - (bool)conformsToProtocol: (
Protocol *)protocol;
386 - (nullable
IMP)methodForSelector: (
SEL)selector;
394 - (nullable
id)performSelector: (
SEL)selector;
404 - (nullable
id)performSelector: (
SEL)selector withObject: (nullable
id)object;
416 - (nullable
id)performSelector: (
SEL)selector
417 withObject: (nullable
id)object1
418 withObject: (nullable
id)object2;
432 - (nullable
id)performSelector: (
SEL)selector
433 withObject: (nullable
id)object1
434 withObject: (nullable
id)object2
435 withObject: (nullable
id)object3;
451 - (nullable
id)performSelector: (
SEL)selector
452 withObject: (nullable
id)object1
453 withObject: (nullable
id)object2
454 withObject: (nullable
id)object3
455 withObject: (nullable
id)object4;
469 - (bool)isEqual: (nullable
id)object;
500 - (instancetype)
self;
521 # ifndef __clang_analyzer__
524 Class _isa __attribute__((__unused__));
528 # ifdef OF_HAVE_CLASS_PROPERTIES
530 @property (
class, readonly, nonatomic)
Class class;
532 @property (
class, readonly, nonatomic, getter=
class)
Class class_;
535 @property (
class, readonly, nullable, nonatomic)
Class superclass;
540 @property (readonly, nonatomic)
Class class;
542 @property (readonly, nonatomic, getter=
class)
Class class_;
544 @property OF_NULLABLE_PROPERTY (readonly, nonatomic)
Class superclass;
545 @property (readonly, nonatomic)
unsigned long hash;
546 @property (readonly, nonatomic)
unsigned int retainCount;
547 @property (readonly, nonatomic)
bool isProxy;
548 @property (readonly, nonatomic)
bool allowsWeakReference;
606 + (instancetype)
alloc;
636 + (bool)isSubclassOfClass: (
Class)class_;
643 + (nullable
Class)superclass;
652 + (bool)instancesRespondToSelector: (
SEL)selector;
660 + (bool)conformsToProtocol: (
Protocol *)protocol;
670 + (nullable
IMP)instanceMethodForSelector: (
SEL)selector;
682 instanceMethodSignatureForSelector: (
SEL)selector;
700 + (nullable
IMP)replaceClassMethod: (
SEL)selector
701 withMethodFromClass: (
Class)class_;
711 + (nullable
IMP)replaceInstanceMethod: (
SEL)selector
712 withMethodFromClass: (
Class)class_;
732 + (void)inheritMethodsFromClass: (
Class)class_;
742 + (bool)resolveClassMethod: (
SEL)selector;
752 + (bool)resolveInstanceMethod: (
SEL)selector;
795 - (instancetype)
init;
832 - (void)performSelector: (
SEL)selector
833 withObject: (nullable
id)object
847 - (void)performSelector: (
SEL)selector
848 withObject: (nullable
id)object1
849 withObject: (nullable
id)object2
865 - (void)performSelector: (
SEL)selector
866 withObject: (nullable
id)object1
867 withObject: (nullable
id)object2
868 withObject: (nullable
id)object3
886 - (void)performSelector: (
SEL)selector
887 withObject: (nullable
id)object1
888 withObject: (nullable
id)object2
889 withObject: (nullable
id)object3
890 withObject: (nullable
id)object4
893 # ifdef OF_HAVE_THREADS
901 - (void)performSelector: (
SEL)selector
903 waitUntilDone: (
bool)waitUntilDone;
915 - (void)performSelector: (
SEL)selector
917 withObject: (nullable
id)object
918 waitUntilDone: (
bool)waitUntilDone;
932 - (void)performSelector: (
SEL)selector
934 withObject: (nullable
id)object1
935 withObject: (nullable
id)object2
936 waitUntilDone: (
bool)waitUntilDone;
952 - (void)performSelector: (
SEL)selector
954 withObject: (nullable
id)object1
955 withObject: (nullable
id)object2
956 withObject: (nullable
id)object3
957 waitUntilDone: (
bool)waitUntilDone;
975 - (void)performSelector: (
SEL)selector
977 withObject: (nullable
id)object1
978 withObject: (nullable
id)object2
979 withObject: (nullable
id)object3
980 withObject: (nullable
id)object4
981 waitUntilDone: (
bool)waitUntilDone;
989 - (void)performSelectorOnMainThread: (
SEL)selector
990 waitUntilDone: (
bool)waitUntilDone;
1001 - (void)performSelectorOnMainThread: (
SEL)selector
1002 withObject: (nullable
id)object
1003 waitUntilDone: (
bool)waitUntilDone;
1016 - (void)performSelectorOnMainThread: (
SEL)selector
1017 withObject: (nullable
id)object1
1018 withObject: (nullable
id)object2
1019 waitUntilDone: (
bool)waitUntilDone;
1034 - (void)performSelectorOnMainThread: (
SEL)selector
1035 withObject: (nullable
id)object1
1036 withObject: (nullable
id)object2
1037 withObject: (nullable
id)object3
1038 waitUntilDone: (
bool)waitUntilDone;
1055 - (void)performSelectorOnMainThread: (
SEL)selector
1056 withObject: (nullable
id)object1
1057 withObject: (nullable
id)object2
1058 withObject: (nullable
id)object3
1059 withObject: (nullable
id)object4
1060 waitUntilDone: (
bool)waitUntilDone;
1070 - (void)performSelector: (
SEL)selector
1084 - (void)performSelector: (
SEL)selector
1086 withObject: (nullable
id)object
1101 - (void)performSelector: (
SEL)selector
1103 withObject: (nullable
id)object1
1104 withObject: (nullable
id)object2
1121 - (void)performSelector: (
SEL)selector
1123 withObject: (nullable
id)object1
1124 withObject: (nullable
id)object2
1125 withObject: (nullable
id)object3
1144 - (void)performSelector: (
SEL)selector
1146 withObject: (nullable
id)object1
1147 withObject: (nullable
id)object2
1148 withObject: (nullable
id)object3
1149 withObject: (nullable
id)object4
1164 - (nullable
id)forwardingTargetForSelector: (
SEL)selector;
1174 - (void)doesNotRecognizeSelector: (
SEL)selector OF_NO_RETURN;
1251 extern void *_Nullable
of_alloc(
size_t count,
size_t size)
1252 OF_WARN_UNUSED_RESULT;
1269 OF_WARN_UNUSED_RESULT;
1287 extern void *_Nullable
of_realloc(
void *_Nullable pointer,
size_t count,
1288 size_t size) OF_WARN_UNUSED_RESULT;
1290 #ifdef OF_APPLE_RUNTIME
1295 void *_Nullable bytes);
1299 extern id of_alloc_object(
Class class_,
size_t extraSize,
1300 size_t extraAlignment,
void *_Nullable *_Nullable extra);
1301 extern void OF_NO_RETURN_FUNC of_method_not_found(
id self,
SEL _cmd);
1302 extern uint32_t of_hash_seed;
1304 extern uint16_t of_random16(
void);
1305 extern uint32_t of_random32(
void);
1306 extern uint64_t of_random64(
void);
1311 OF_ASSUME_NONNULL_END
1314 # import "OFObject+KeyValueCoding.h"
1315 # import "OFObject+Serialization.h"
of_byte_order_t
An enum for storing endianess.
Definition: OFObject.h:81
@ OF_BYTE_ORDER_BIG_ENDIAN
Definition: OFObject.h:83
@ OF_BYTE_ORDER_LITTLE_ENDIAN
Definition: OFObject.h:85
of_comparison_result_t(^ of_comparator_t)(id _Nonnull left, id _Nonnull right)
A comparator to compare two objects.
Definition: OFObject.h:74
void *_Nullable of_realloc(void *_Nullable pointer, size_t count, size_t size) 1
Resizes memory to the specified number of items of the specified size.
of_comparison_result_t
A result of a comparison.
Definition: OFObject.h:57
@ OF_ORDERED_DESCENDING
Definition: OFObject.h:63
@ OF_ORDERED_ASCENDING
Definition: OFObject.h:59
@ OF_ORDERED_SAME
Definition: OFObject.h:61
double of_time_interval_t
A time interval in seconds.
Definition: OFObject.h:138
void *_Nullable of_alloc(size_t count, size_t size) 1
Allocates memory for the specified number of items of the specified size.
Definition: OFObject.m:100
void *_Nullable of_alloc_zeroed(size_t count, size_t size) 1
Allocates memory for the specified number of items of the specified size and initializes it with zero...
Definition: OFObject.m:118
struct objc_object * id
A pointer to any object.
Definition: ObjFWRT.h:90
id _Nullable(* IMP)(id _Nonnull object, SEL _Nonnull selector,...)
A method implemenation.
Definition: ObjFWRT.h:142
id _Nullable objc_constructInstance(Class _Nullable class_, void *_Nullable bytes)
Constructs an instance of the specified class in the specified array of bytes.
void *_Null_unspecified objc_autoreleasePoolPush(void)
Creates a new autorelease pool and puts it on top of the stack of autorelease pools.
Definition: autorelease.m:61
struct objc_class * Class
A pointer to a class.
Definition: ObjFWRT.h:85
void *_Nullable objc_destructInstance(id _Nullable object)
Destructs the specified object.
void objc_autoreleasePoolPop(void *_Null_unspecified pool)
Drains the specified autorelease pool and all pools on top of it and removes it from the stack of aut...
const struct objc_protocol * Protocol
A protocol.
Definition: ObjFWRT.h:113
A class for parsing type encodings and accessing them.
Definition: OFMethodSignature.h:28
The root class for all other classes inside ObjFW.
Definition: OFObject.h:520
OFString * description
A description for the object.
Definition: OFObject.h:562
OFString * className
The name of the object's class.
Definition: OFObject.h:554
instancetype init()
Initializes an already allocated object.
Definition: OFObject.m:547
void dealloc()
Deallocates the object.
Definition: OFObject.m:1190
id copy()
Returns the class.
Definition: OFObject.m:1248
void unload()
A method which is called when the class is unloaded from the runtime.
Definition: OFObject.m:384
instancetype alloc()
Allocates memory for an instance of the class and sets up the memory pool for the object.
Definition: OFObject.m:392
instancetype new()
Calls alloc on self and then init on the returned object.
Definition: OFObject.m:397
void initialize()
A method which is called the moment before the first call to the class is being made.
Definition: OFObject.m:388
void load()
A method which is called once when the class is loaded into the runtime.
Definition: OFObject.m:349
A class for handling strings.
Definition: OFString.h:132
A class which provides portable threads.
Definition: OFThread.h:63
A protocol for comparing objects.
Definition: OFObject.h:1224
A protocol for the creation of copies.
Definition: OFObject.h:1187
id copy()
Copies the object.
A protocol for the creation of mutable copies.
Definition: OFObject.h:1208
id mutableCopy()
Creates a mutable copy of the object.
instancetype autorelease()
Adds the object to the topmost autorelease pool of the thread's autorelease pool stack.
instancetype self()
Returns the receiver.
void release()
Decreases the retain count.
instancetype retain()
Increases the retain count.
bool retainWeakReference()
Retain a weak reference to this object.
A dimension.
Definition: OFObject.h:192
float width
Definition: OFObject.h:194
float height
Definition: OFObject.h:196
A point.
Definition: OFObject.h:145
float y
Definition: OFObject.h:149
float x
Definition: OFObject.h:147
A range.
Definition: OFObject.h:93
size_t length
Definition: OFObject.h:97
size_t location
Definition: OFObject.h:95
A rectangle.
Definition: OFObject.h:239
of_dimension_t size
Definition: OFObject.h:243
of_point_t origin
Definition: OFObject.h:241