17 #import "objfw-defs.h"
19 #ifndef __STDC_LIMIT_MACROS
20 # define __STDC_LIMIT_MACROS
22 #ifndef __STDC_CONSTANT_MACROS
23 # define __STDC_CONSTANT_MACROS
30 #ifdef OF_OBJFW_RUNTIME
33 # import <objc/objc.h>
36 #ifdef OF_APPLE_RUNTIME
37 # import <objc/runtime.h>
41 # define restrict __restrict__
42 #elif __STDC_VERSION__ < 199901L
47 # define __has_feature(x) 0
51 # define __GCC_VERSION__ (__GNUC__ * 100 + __GNUC_MINOR__)
53 # define __GCC_VERSION__ 0
56 #if defined(__clang__)
57 # define OF_HAVE_PROPERTIES
58 # define OF_HAVE_OPTIONAL_PROTOCOLS
59 # define OF_HAVE_FAST_ENUMERATION
60 #elif __GCC_VERSION__ >= 406
61 # define OF_HAVE_PROPERTIES
62 # define OF_HAVE_OPTIONAL_PROTOCOLS
63 # define OF_HAVE_FAST_ENUMERATION
66 #if !__has_feature(objc_instancetype)
67 # define instancetype id
70 #if __has_feature(blocks)
71 # define OF_HAVE_BLOCKS
74 #if __has_feature(objc_bool)
76 # define YES __objc_yes
81 #if defined(__clang__) || __GCC_VERSION__ >= 406
82 # define OF_SENTINEL __attribute__((sentinel))
87 #if __has_feature(objc_arc)
88 # define OF_RETURNS_RETAINED __attribute__((ns_returns_retained))
89 # define OF_RETURNS_NOT_RETAINED __attribute__((ns_returns_not_retained))
90 # define OF_RETURNS_INNER_POINTER __attribute__((objc_returns_inner_pointer))
91 # define OF_CONSUMED __attribute__((ns_consumed))
92 # define OF_WEAK_UNAVAILABLE __attribute__((objc_arc_weak_unavailable))
94 # define OF_RETURNS_RETAINED
95 # define OF_RETURNS_NOT_RETAINED
96 # define OF_RETURNS_INNER_POINTER
98 # define OF_WEAK_UNAVAILABLE
99 # define __unsafe_unretained
101 # define __autoreleasing
104 #define OF_RETAIN_COUNT_MAX UINT_MAX
105 #define OF_NOT_FOUND SIZE_MAX
110 typedef enum of_comparison_result_t {
112 OF_ORDERED_ASCENDING = -1,
116 OF_ORDERED_DESCENDING = 1
117 } of_comparison_result_t;
122 typedef enum of_byte_order_t {
123 OF_BYTE_ORDER_BIG_ENDIAN,
124 OF_BYTE_ORDER_LITTLE_ENDIAN
182 - (BOOL)isKindOfClass: (Class)class_;
191 - (BOOL)isMemberOfClass: (Class)class_;
200 - (BOOL)respondsToSelector: (
SEL)selector;
208 - (BOOL)conformsToProtocol: (Protocol*)protocol;
216 - (IMP)methodForSelector: (
SEL)selector;
224 - (const char*)typeEncodingForSelector: (
SEL)selector;
232 - (id)performSelector: (
SEL)selector;
242 - (id)performSelector: (
SEL)selector
243 withObject: (
id)object;
255 - (id)performSelector: (
SEL)selector
256 withObject: (
id)object1
257 withObject: (
id)object2;
268 - (BOOL)isEqual: (
id)object;
394 + (BOOL)isSubclassOfClass: (Class)class_;
410 + (BOOL)instancesRespondToSelector: (
SEL)selector;
418 + (BOOL)conformsToProtocol: (Protocol*)protocol;
428 + (IMP)instanceMethodForSelector: (
SEL)selector;
437 + (const char*)typeEncodingForInstanceSelector: (
SEL)selector;
455 + (IMP)replaceClassMethod: (
SEL)selector
456 withMethodFromClass: (Class)class_;
466 + (IMP)replaceInstanceMethod: (
SEL)selector
467 withMethodFromClass: (Class)class_;
481 + (IMP)replaceClassMethod: (
SEL)selector
482 withImplementation: (IMP)implementation
483 typeEncoding: (const
char*)typeEncoding;
497 + (IMP)replaceInstanceMethod: (
SEL)selector
498 withImplementation: (IMP)implementation
499 typeEncoding: (const
char*)typeEncoding;
519 + (void)inheritMethodsFromClass: (Class)class_;
529 + (BOOL)resolveClassMethod: (
SEL)selector;
539 + (BOOL)resolveInstanceMethod: (
SEL)selector;
576 - (void*)allocMemoryWithSize: (
size_t)size;
588 - (void*)allocMemoryWithSize: (
size_t)size
589 count: (
size_t)count;
601 - (void*)resizeMemory: (
void*)pointer
616 - (void*)resizeMemory: (
void*)pointer
618 count: (
size_t)count;
627 - (void)freeMemory: (
void*)pointer;
644 - (void)performSelector: (
SEL)selector
645 afterDelay: (
double)delay;
656 - (void)performSelector: (
SEL)selector
657 withObject: (
id)object
658 afterDelay: (
double)delay;
671 - (void)performSelector: (
SEL)selector
672 withObject: (
id)object1
673 withObject: (
id)object2
674 afterDelay: (
double)delay;
683 - (void)performSelector: (
SEL)selector
685 waitUntilDone: (BOOL)waitUntilDone;
697 - (void)performSelector: (
SEL)selector
699 withObject: (
id)object
700 waitUntilDone: (BOOL)waitUntilDone;
714 - (void)performSelector: (
SEL)selector
716 withObject: (
id)object1
717 withObject: (
id)object2
718 waitUntilDone: (BOOL)waitUntilDone;
726 - (void)performSelectorOnMainThread: (
SEL)selector
727 waitUntilDone: (BOOL)waitUntilDone;
738 - (void)performSelectorOnMainThread: (
SEL)selector
739 withObject: (
id)object
740 waitUntilDone: (BOOL)waitUntilDone;
753 - (void)performSelectorOnMainThread: (
SEL)selector
754 withObject: (
id)object1
755 withObject: (
id)object2
756 waitUntilDone: (BOOL)waitUntilDone;
766 - (void)performSelector: (
SEL)selector
768 afterDelay: (
double)delay;
780 - (void)performSelector: (
SEL)selector
782 withObject: (
id)object
783 afterDelay: (
double)delay;
797 - (void)performSelector: (
SEL)selector
799 withObject: (
id)object1
800 withObject: (
id)object2
801 afterDelay: (
double)delay;
847 - (of_comparison_result_t)compare: (
id <
OFComparing>)object;
850 #import "OFObject+Serialization.h"
855 extern size_t of_pagesize;
856 extern size_t of_num_cpus;
857 extern id of_alloc_object(Class class_,
size_t extraSize,
size_t extraAlignment,