20 #include "objfw-defs.h" 22 #ifndef __STDC_LIMIT_MACROS 23 # define __STDC_LIMIT_MACROS 25 #ifndef __STDC_CONSTANT_MACROS 26 # define __STDC_CONSTANT_MACROS 45 # ifdef __MINGW64_VERSION_MAJOR 46 # include <winsock2.h> 51 OF_ASSUME_NONNULL_BEGIN
76 id _Nonnull right,
void *_Nullable context);
124 static OF_INLINE
OFRange OF_CONST_FUNC
127 OFRange range = { start, length };
139 static OF_INLINE
bool 175 static OF_INLINE
OFPoint OF_CONST_FUNC
190 static OF_INLINE
bool 193 if (point1.
x != point2.
x)
196 if (point1.
y != point2.
y)
221 static OF_INLINE
OFSize OF_CONST_FUNC
224 OFSize size = { width, height };
236 static OF_INLINE
bool 269 static OF_INLINE
OFRect OF_CONST_FUNC
287 static OF_INLINE
bool 336 static OF_INLINE
bool 339 if (vector1.
x != vector2.
x)
342 if (vector1.
y != vector2.
y)
345 if (vector1.
z != vector2.
z)
391 static OF_INLINE
bool 394 if (vector1.
x != vector2.
x)
397 if (vector1.
y != vector2.
y)
400 if (vector1.
z != vector2.
z)
403 if (vector1.
w != vector2.
w)
415 static OF_INLINE
void 418 uint32_t tmp = (uint32_t)*hash;
433 static OF_INLINE
void 447 static OF_INLINE
void 450 uint32_t tmp = (uint32_t)*hash;
459 static const size_t OFNotFound = SIZE_MAX;
497 - (
unsigned long)
hash;
519 - (bool)isKindOfClass: (Class)class_;
528 - (bool)isMemberOfClass: (Class)class_;
537 - (bool)respondsToSelector: (
SEL)selector;
545 - (bool)conformsToProtocol: (
Protocol *)protocol;
553 - (nullable
IMP)methodForSelector: (
SEL)selector;
561 - (nullable id)performSelector: (
SEL)selector;
571 - (nullable id)performSelector: (
SEL)selector withObject: (nullable
id)object;
583 - (nullable id)performSelector: (
SEL)selector
584 withObject: (nullable
id)object1
585 withObject: (nullable
id)object2;
599 - (nullable id)performSelector: (
SEL)selector
600 withObject: (nullable
id)object1
601 withObject: (nullable
id)object2
602 withObject: (nullable
id)object3;
618 - (nullable id)performSelector: (
SEL)selector
619 withObject: (nullable
id)object1
620 withObject: (nullable
id)object2
621 withObject: (nullable
id)object3
622 withObject: (nullable
id)object4;
636 - (bool)isEqual: (nullable
id)object;
667 - (instancetype)
self;
693 #ifndef __clang_analyzer__ 696 Class _isa __attribute__((__unused__));
700 #ifdef OF_HAVE_CLASS_PROPERTIES 702 @property (
class, readonly, nonatomic) Class
class;
704 @property (
class, readonly, nonatomic, getter=
class) Class class_;
707 @property (
class, readonly, nullable, nonatomic) Class
superclass;
712 @property (readonly, nonatomic) Class
class;
714 @property (readonly, nonatomic, getter=
class) Class class_;
716 @property OF_NULLABLE_PROPERTY (readonly, nonatomic) Class
superclass;
717 @property (readonly, nonatomic)
unsigned long hash;
718 @property (readonly, nonatomic)
unsigned int retainCount;
719 @property (readonly, nonatomic)
bool isProxy;
779 + (instancetype)
alloc;
802 + (bool)isSubclassOfClass: (Class)class_;
818 + (bool)instancesRespondToSelector: (
SEL)selector;
826 + (bool)conformsToProtocol: (
Protocol *)protocol;
836 + (nullable
IMP)instanceMethodForSelector: (
SEL)selector;
848 instanceMethodSignatureForSelector: (
SEL)selector;
866 + (nullable
IMP)replaceClassMethod: (
SEL)selector
867 withMethodFromClass: (Class)class_;
877 + (nullable
IMP)replaceInstanceMethod: (
SEL)selector
878 withMethodFromClass: (Class)class_;
898 + (void)inheritMethodsFromClass: (Class)class_;
908 + (bool)resolveClassMethod: (
SEL)selector;
918 + (bool)resolveInstanceMethod: (
SEL)selector;
961 - (instancetype)
init;
987 - (void)performSelector: (
SEL)selector afterDelay: (
OFTimeInterval)delay;
998 - (void)performSelector: (
SEL)selector
999 withObject: (nullable
id)object
1013 - (void)performSelector: (
SEL)selector
1014 withObject: (nullable
id)object1
1015 withObject: (nullable
id)object2
1031 - (void)performSelector: (
SEL)selector
1032 withObject: (nullable
id)object1
1033 withObject: (nullable
id)object2
1034 withObject: (nullable
id)object3
1052 - (void)performSelector: (
SEL)selector
1053 withObject: (nullable
id)object1
1054 withObject: (nullable
id)object2
1055 withObject: (nullable
id)object3
1056 withObject: (nullable
id)object4
1059 #ifdef OF_HAVE_THREADS 1067 - (void)performSelector: (
SEL)selector
1069 waitUntilDone: (
bool)waitUntilDone;
1081 - (void)performSelector: (
SEL)selector
1083 withObject: (nullable
id)object
1084 waitUntilDone: (
bool)waitUntilDone;
1098 - (void)performSelector: (
SEL)selector
1100 withObject: (nullable
id)object1
1101 withObject: (nullable
id)object2
1102 waitUntilDone: (
bool)waitUntilDone;
1118 - (void)performSelector: (
SEL)selector
1120 withObject: (nullable
id)object1
1121 withObject: (nullable
id)object2
1122 withObject: (nullable
id)object3
1123 waitUntilDone: (
bool)waitUntilDone;
1141 - (void)performSelector: (
SEL)selector
1143 withObject: (nullable
id)object1
1144 withObject: (nullable
id)object2
1145 withObject: (nullable
id)object3
1146 withObject: (nullable
id)object4
1147 waitUntilDone: (
bool)waitUntilDone;
1155 - (void)performSelectorOnMainThread: (
SEL)selector
1156 waitUntilDone: (
bool)waitUntilDone;
1167 - (void)performSelectorOnMainThread: (
SEL)selector
1168 withObject: (nullable
id)object
1169 waitUntilDone: (
bool)waitUntilDone;
1182 - (void)performSelectorOnMainThread: (
SEL)selector
1183 withObject: (nullable
id)object1
1184 withObject: (nullable
id)object2
1185 waitUntilDone: (
bool)waitUntilDone;
1200 - (void)performSelectorOnMainThread: (
SEL)selector
1201 withObject: (nullable
id)object1
1202 withObject: (nullable
id)object2
1203 withObject: (nullable
id)object3
1204 waitUntilDone: (
bool)waitUntilDone;
1221 - (void)performSelectorOnMainThread: (
SEL)selector
1222 withObject: (nullable
id)object1
1223 withObject: (nullable
id)object2
1224 withObject: (nullable
id)object3
1225 withObject: (nullable
id)object4
1226 waitUntilDone: (
bool)waitUntilDone;
1236 - (void)performSelector: (
SEL)selector
1250 - (void)performSelector: (
SEL)selector
1252 withObject: (nullable
id)object
1267 - (void)performSelector: (
SEL)selector
1269 withObject: (nullable
id)object1
1270 withObject: (nullable
id)object2
1287 - (void)performSelector: (
SEL)selector
1289 withObject: (nullable
id)object1
1290 withObject: (nullable
id)object2
1291 withObject: (nullable
id)object3
1310 - (void)performSelector: (
SEL)selector
1312 withObject: (nullable
id)object1
1313 withObject: (nullable
id)object2
1314 withObject: (nullable
id)object3
1315 withObject: (nullable
id)object4
1330 - (nullable id)forwardingTargetForSelector: (
SEL)selector;
1341 - (void)doesNotRecognizeSelector: (
SEL)selector OF_NO_RETURN;
1414 extern void *_Nullable
OFAllocMemory(
size_t count,
size_t size)
1415 OF_WARN_UNUSED_RESULT;
1432 OF_WARN_UNUSED_RESULT;
1451 extern void *_Nullable
OFResizeMemory(
void *_Nullable pointer,
size_t count,
1452 size_t size) OF_WARN_UNUSED_RESULT;
1463 #ifdef OF_APPLE_RUNTIME 1466 # ifdef OF_DECLARE_CONSTRUCT_INSTANCE 1468 void *_Nullable bytes);
1471 # ifdef OF_DECLARE_SET_ASSOCIATED_OBJECT 1480 const void *_Nonnull key,
id _Nullable value,
1483 const void *_Nonnull key);
1500 extern id OFAllocObject(Class class_,
size_t extraSize,
size_t extraAlignment,
1501 void *_Nullable *_Nullable extra);
1532 extern void OFHashInit(
unsigned long *_Nonnull hash);
1558 OF_ASSUME_NONNULL_END
1561 #import "OFObject+KeyValueCoding.h" float y
Definition: OFObject.h:165
static OF_INLINE bool OFEqualRects(OFRect rect1, OFRect rect2)
Returns whether the two rectangles are equal.
Definition: OFObject.h:288
bool allowsWeakReference()
Returns whether the object allows a weak reference.
void load()
A method which is called once when the class is loaded into the runtime.
Definition: OFObject.m:505
void * objc_destructInstance(id object)
Destructs the specified object.
Definition: instance.m:83
id objc_constructInstance(Class class_, void *bytes)
Constructs an instance of the specified class in the specified array of bytes.
Definition: instance.m:67
float height
Definition: OFObject.h:211
Definition: OFObject.h:101
A protocol for comparing objects.
Definition: OFObject.h:1388
Definition: OFObject.h:64
void release()
Decreases the retain count.
id copy()
Copies the object.
static OF_INLINE OFSize OF_CONST_FUNC OFMakeSize(float width, float height)
Creates a new OFSize.
Definition: OFObject.h:222
The root class for all other classes inside ObjFW.
Definition: OFObject.h:690
void objc_setAssociatedObject(id object, const void *key, id value, objc_associationPolicy policy)
Sets an associated object on the specified object for the specified key.
Definition: association.m:116
Associate the object like a retained, nonatomic property.
Definition: ObjFWRT.h:187
A class for parsing type encodings and accessing them.
Definition: OFMethodSignature.h:32
void OFMethodNotFound(id self, SEL _cmd)
This function is called when a method is not found.
Definition: OFObject.m:388
static OF_INLINE void OFHashFinalize(unsigned long *hash)
Finalizes the specified hash.
Definition: OFObject.h:448
float y
Definition: OFObject.h:360
Definition: OFObject.h:62
OFString * description()
Returns a description for the class, which is usually the class name.
bool retainWeakReference()
Retain a weak reference to this object.
instancetype retain()
Increases the retain count.
size_t length
Definition: OFObject.h:114
static OF_INLINE OFPoint OF_CONST_FUNC OFMakePoint(float x, float y)
Creates a new OFPoint.
Definition: OFObject.h:176
float x
Definition: OFObject.h:306
float w
Definition: OFObject.h:364
static OF_INLINE void OFHashAddByte(unsigned long *hash, unsigned char byte)
Adds the specified byte to the hash.
Definition: OFObject.h:416
uint16_t OFRandom16(void)
Returns 16 bit or non-cryptographical randomness.
Definition: OFObject.m:228
Associate the object like an assigned property.
Definition: ObjFWRT.h:185
Associate the object like a copied, nonatomic property.
Definition: ObjFWRT.h:191
Associate the object like a retained property.
Definition: ObjFWRT.h:189
id mutableCopy()
Creates a mutable copy of the object.
void OFFreeMemory(void *pointer)
Frees memory allocated by OFAllocMemory, OFAllocZeroedMemory or OFResizeMemory.
Definition: OFObject.m:167
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...
Definition: OFObject.h:60
A class for handling strings.
Definition: OFString.h:142
Associate the object like a copied property.
Definition: ObjFWRT.h:193
static OF_INLINE void OFHashAddHash(unsigned long *hash, unsigned long otherHash)
Adds the specified hash to the hash.
Definition: OFObject.h:434
static OF_INLINE OFVector4D OF_CONST_FUNC OFMakeVector4D(float x, float y, float z, float w)
Creates a new OFVector4D.
Definition: OFObject.h:377
A rectangle.
Definition: OFObject.h:253
id copy()
Returns the class.
Definition: OFObject.m:1407
OFComparisonResult
A result of a comparison.
Definition: OFObject.h:58
float y
Definition: OFObject.h:308
void * OFResizeMemory(void *pointer, size_t count, size_t size)
Resizes memory to the specified number of items of the specified size.
Definition: OFObject.m:149
void * OFAllocMemory(size_t count, size_t size)
Allocates memory for the specified number of items of the specified size.
Definition: OFObject.m:112
A class which provides portable threads.
Definition: OFThread.h:65
void objc_removeAssociatedObjects(id object)
Removes all associated objects for the specified object.
Definition: association.m:228
instancetype autorelease()
Adds the object to the topmost autorelease pool of the thread's autorelease pool stack.
static OF_INLINE bool OFEqualVectors3D(OFVector3D vector1, OFVector3D vector2)
Returns whether the two vectors are equal.
Definition: OFObject.h:337
instancetype self()
Returns the receiver.
static OF_INLINE bool OFEqualVectors4D(OFVector4D vector1, OFVector4D vector2)
Returns whether the two vectors are equal.
Definition: OFObject.h:392
uint64_t OFRandom64(void)
Returns 64 bit or non-cryptographical randomness.
Definition: OFObject.m:284
unsigned int retainCount()
Returns the retain count.
void dealloc()
Deallocates the object.
Definition: OFObject.m:1339
OFSize size
Definition: OFObject.h:257
objc_associationPolicy
A policy for object association, see objc_setAssociatedObject.
Definition: ObjFWRT.h:183
Definition: OFObject.h:96
OFByteOrder
An enum for representing endianness.
Definition: OFObject.h:92
double OFTimeInterval
A time interval in seconds.
Definition: OFObject.h:154
instancetype init()
Initializes an already allocated object.
Definition: OFObject.m:696
bool isProxy()
Returns whether the object is a proxy object.
void initialize()
A method which is called the moment before the first call to the class is being made.
Definition: OFObject.m:544
OFString * className()
Returns the name of the class as a string.
static OF_INLINE OFVector3D OF_CONST_FUNC OFMakeVector3D(float x, float y, float z)
Creates a new OFVector3D.
Definition: OFObject.h:322
instancetype alloc()
Allocates memory for an instance of the class and sets up the memory pool for the object...
Definition: OFObject.m:548
static OF_INLINE bool OFEqualPoints(OFPoint point1, OFPoint point2)
Returns whether the two points are equal.
Definition: OFObject.h:191
OFComparisonResult(^ OFComparator)(id left, id right)
A comparator to compare two objects.
Definition: OFObject.h:86
uint32_t OFRandom32(void)
Returns 32 bit or non-cryptographical randomness.
Definition: OFObject.m:258
static OF_INLINE OFRect OF_CONST_FUNC OFMakeRect(float x, float y, float width, float height)
Creates a new OFRect.
Definition: OFObject.h:270
A size.
Definition: OFObject.h:207
void * OFAllocZeroedMemory(size_t count, size_t size)
Allocates memory for the specified number of items of the specified size and initializes it with zero...
Definition: OFObject.m:130
A protocol for the creation of mutable copies.
Definition: OFObject.h:1371
static OF_INLINE OFRange OF_CONST_FUNC OFMakeRange(size_t start, size_t length)
Creates a new OFRange.
Definition: OFObject.h:125
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:70
A protocol for the creation of copies.
Definition: OFObject.h:1350
float z
Definition: OFObject.h:362
unsigned long hash()
Returns a hash for the object.
size_t location
Definition: OFObject.h:112
Class class()
Returns the class.
OFPoint origin
Definition: OFObject.h:255
id OFAllocObject(Class class_, size_t extraSize, size_t extraAlignment, void **extra)
Allocates a new object.
Definition: OFObject.m:408
static OF_INLINE bool OFEqualSizes(OFSize size1, OFSize size2)
Returns whether the two sizes are equal.
Definition: OFObject.h:237
float z
Definition: OFObject.h:310
const struct objc_protocol * Protocol
A protocol.
Definition: ObjFWRT.h:117
id(* IMP)(id object, SEL selector,...)
A method implementation.
Definition: ObjFWRT.h:146
float x
Definition: OFObject.h:163
id objc_getAssociatedObject(id object, const void *key)
Returns the associated object on the specified object for the specified key.
Definition: association.m:186
A vector in 3D space.
Definition: OFObject.h:304
Definition: OFObject.h:94
static OF_INLINE bool OFEqualRanges(OFRange range1, OFRange range2)
Returns whether the two ranges are equal.
Definition: OFObject.h:140
void unload()
A method which is called when the class is unloaded from the runtime.
Definition: OFObject.m:540
A range.
Definition: OFObject.h:110
float width
Definition: OFObject.h:209
A vector in 4D space.
Definition: OFObject.h:356
void OFHashInit(unsigned long *hash)
Initializes the specified hash.
Definition: OFObject.m:314
float x
Definition: OFObject.h:358
OFComparisonResult(* OFCompareFunction)(id left, id right, void *context)
A function to compare two objects.
Definition: OFObject.h:75
A point in 2D space.
Definition: OFObject.h:161
nullable Class superclass()
Returns the superclass of the class.