@@ -13,10 +13,13 @@ * 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 @@ -27,12 +30,12 @@ #include #include #include #include -#import "macros.h" -#import "block.h" +#include "macros.h" +#include "block.h" /* * Some versions of MinGW require to be included before * . Do this here to make sure this is always done in the correct * order, even if another header includes just . @@ -275,10 +278,11 @@ return false; return true; } +#ifdef __OBJC__ @class OFMethodSignature; @class OFString; @class OFThread; /*! @@ -288,15 +292,15 @@ */ @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; @@ -490,37 +494,39 @@ * * @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 { @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; @@ -935,11 +941,11 @@ 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 @@ -1193,11 +1199,11 @@ 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. @@ -1218,11 +1224,15 @@ * * @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. */ @@ -1270,10 +1280,11 @@ * @param object An object to compare the object to * @return The result of the comparison */ - (of_comparison_result_t)compare: (id )object; @end +#endif #ifdef __cplusplus extern "C" { #endif #ifdef OF_APPLE_RUNTIME @@ -1288,7 +1299,11 @@ } #endif OF_ASSUME_NONNULL_END -#import "OFObject+KeyValueCoding.h" -#import "OFObject+Serialization.h" +#ifdef __OBJC__ +# import "OFObject+KeyValueCoding.h" +# import "OFObject+Serialization.h" +#endif + +#endif