Index: Doxyfile ================================================================== --- Doxyfile +++ Doxyfile @@ -6,12 +6,11 @@ HAVE_DOT = NO GENERATE_LATEX = NO HIDE_UNDOC_CLASSES = YES HIDE_UNDOC_MEMBERS = YES TYPEDEF_HIDES_STRUCT = YES -PREDEFINED = __OBJC__ \ - _Nonnull= \ +PREDEFINED = _Nonnull= \ _Nullable= \ DOXYGEN \ OF_BOXABLE= \ OF_CONSUMED= \ OF_DESIGNATED_INITIALIZER= \ Index: src/OFConstantString.h ================================================================== --- src/OFConstantString.h +++ src/OFConstantString.h @@ -11,14 +11,11 @@ * 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_CONSTANT_STRING_H -#define OBJFW_OF_CONSTANT_STRING_H - -#include "OFString.h" +#import "OFString.h" OF_ASSUME_NONNULL_BEGIN #if !defined(OF_CONSTANT_STRING_M) && \ defined(OF_APPLE_RUNTIME) && !defined(__OBJC2__) @@ -29,11 +26,10 @@ # ifdef __cplusplus } # endif #endif -#ifdef __OBJC__ /** * @class OFConstantString OFConstantString.h ObjFW/OFConstantString.h * * @brief A class for storing constant strings using the `@""` literal. */ @@ -42,10 +38,7 @@ { char *_cString; unsigned int _cStringLength; } @end -#endif OF_ASSUME_NONNULL_END - -#endif Index: src/OFMutableString.h ================================================================== --- src/OFMutableString.h +++ src/OFMutableString.h @@ -11,18 +11,14 @@ * 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_MUTABLE_STRING_H -#define OBJFW_OF_MUTABLE_STRING_H - -#include "OFString.h" +#import "OFString.h" OF_ASSUME_NONNULL_BEGIN -#ifdef __OBJC__ /** * @class OFMutableString OFString.h ObjFW/OFString.h * * @brief A class for storing and modifying strings. */ @@ -208,10 +204,7 @@ /** * @brief Converts the mutable string to an immutable string. */ - (void)makeImmutable; @end -#endif OF_ASSUME_NONNULL_END - -#endif Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -11,13 +11,10 @@ * 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 @@ -30,11 +27,11 @@ #include #include #include "macros.h" -#include "OFOnce.h" +#import "OFOnce.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 . @@ -455,11 +452,10 @@ *hash = tmp; } static const size_t OFNotFound = SIZE_MAX; -#ifdef __OBJC__ @class OFMethodSignature; @class OFString; @class OFThread; /** @@ -678,43 +674,41 @@ * * @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 -# ifndef __cplusplus +#ifndef __cplusplus @property (readonly, nonatomic) Class class; -# else +#else @property (readonly, nonatomic, getter=class) Class class_; #endif @property OF_NULLABLE_PROPERTY (readonly, nonatomic) Class superclass; @property (readonly, nonatomic) unsigned long hash; @property (readonly, nonatomic) unsigned int retainCount; @@ -1056,11 +1050,11 @@ withObject: (nullable id)object2 withObject: (nullable id)object3 withObject: (nullable id)object4 afterDelay: (OFTimeInterval)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 @@ -1314,11 +1308,11 @@ withObject: (nullable id)object1 withObject: (nullable id)object2 withObject: (nullable id)object3 withObject: (nullable id)object4 afterDelay: (OFTimeInterval)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. @@ -1340,15 +1334,11 @@ * @param selector The selector not understood by the receiver * @throw OFNotImplementedException */ - (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. */ @@ -1396,11 +1386,10 @@ * @param object An object to compare the object to * @return The result of the comparison */ - (OFComparisonResult)compare: (id )object; @end -#endif #ifdef __cplusplus extern "C" { #endif /** @@ -1510,12 +1499,7 @@ } #endif OF_ASSUME_NONNULL_END -#include "OFBlock.h" - -#ifdef __OBJC__ -# import "OFObject+KeyValueCoding.h" -#endif - -#endif +#import "OFBlock.h" +#import "OFObject+KeyValueCoding.h" Index: src/OFSocket+Private.h ================================================================== --- src/OFSocket+Private.h +++ src/OFSocket+Private.h @@ -22,11 +22,11 @@ #endif #ifdef HAVE_NETDB_H # include #endif -#include "OFSocket.h" +#import "OFSocket.h" #ifndef INADDR_NONE # define INADDR_NONE ((in_addr_t)-1) #endif Index: src/OFStdIOStream.m ================================================================== --- src/OFStdIOStream.m +++ src/OFStdIOStream.m @@ -30,11 +30,11 @@ #import "OFStdIOStream+Private.h" #import "OFColor.h" #import "OFDate.h" #import "OFApplication.h" #ifdef OF_WINDOWS -# include "OFWin32ConsoleStdIOStream.h" +# import "OFWin32ConsoleStdIOStream.h" #endif #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" #import "OFNotOpenException.h" Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -11,13 +11,10 @@ * 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_STRING_H -#define OBJFW_OF_STRING_H - #ifndef __STDC_LIMIT_MACROS # define __STDC_LIMIT_MACROS #endif #ifndef __STDC_CONSTANT_MACROS # define __STDC_CONSTANT_MACROS @@ -33,26 +30,23 @@ #include #ifdef OF_HAVE_INTTYPES_H # include #endif -#include "OFObject.h" -#ifdef __OBJC__ -# import "OFJSONRepresentation.h" -# import "OFMessagePackRepresentation.h" -#endif +#import "OFObject.h" +#import "OFJSONRepresentation.h" +#import "OFMessagePackRepresentation.h" OF_ASSUME_NONNULL_BEGIN /** @file */ -#ifdef __OBJC__ +@class OFArray OF_GENERIC(ObjectType); +@class OFCharacterSet; @class OFConstantString; +@class OFIRI; @class OFString; -#else -typedef void OFString; -#endif #if defined(__cplusplus) && __cplusplus >= 201103L typedef char16_t OFChar16; typedef char32_t OFChar32; #else @@ -130,15 +124,10 @@ * enumeration */ typedef void (^OFStringLineEnumerationBlock)(OFString *line, bool *stop); #endif -#ifdef __OBJC__ -@class OFArray OF_GENERIC(ObjectType); -@class OFCharacterSet; -@class OFIRI; - /** * @class OFString OFString.h ObjFW/OFString.h * * @brief A class for handling strings. */ @@ -275,11 +264,11 @@ /** * @brief The string with leading and trailing whitespaces deleted. */ @property (readonly, nonatomic) OFString *stringByDeletingEnclosingWhitespaces; -# ifdef OF_HAVE_UNICODE_TABLES +#ifdef OF_HAVE_UNICODE_TABLES /** * @brief The string in Unicode Normalization Form D (NFD). */ @property (readonly, nonatomic) OFString *decomposedStringWithCanonicalMapping; @@ -286,19 +275,19 @@ /** * @brief The string in Unicode Normalization Form KD (NFKD). */ @property (readonly, nonatomic) OFString *decomposedStringWithCompatibilityMapping; -# endif +#endif -# ifdef OF_WINDOWS +#ifdef OF_WINDOWS /** * @brief The string with the Windows Environment Strings expanded. */ @property (readonly, nonatomic) OFString *stringByExpandingWindowsEnvironmentStrings; -# endif +#endif /** * @brief Creates a new OFString. * * @return A new, autoreleased OFString @@ -524,11 +513,11 @@ * @throw OFInvalidEncodingException The resulting string is not in not in UTF-8 * encoding */ + (instancetype)stringWithFormat: (OFConstantString *)format, ...; -# ifdef OF_HAVE_FILES +#ifdef OF_HAVE_FILES /** * @brief Creates a new OFString with the contents of the specified UTF-8 * encoded file. * * @param path The path to the file @@ -546,11 +535,11 @@ * @return A new autoreleased OFString * @throw OFInvalidEncodingException The string is not in the specified encoding */ + (instancetype)stringWithContentsOfFile: (OFString *)path encoding: (OFStringEncoding)encoding; -# endif +#endif /** * @brief Creates a new OFString with the contents of the specified IRI. * * If the IRI's scheme is file, it tries UTF-8 encoding. @@ -817,11 +806,11 @@ * encoding */ - (instancetype)initWithFormat: (OFConstantString *)format arguments: (va_list)arguments; -# ifdef OF_HAVE_FILES +#ifdef OF_HAVE_FILES /** * @brief Initializes an already allocated OFString with the contents of the * specified file in the specified encoding. * * @param path The path to the file @@ -839,11 +828,11 @@ * @return An initialized OFString * @throw OFInvalidEncodingException The string is not in the specified encoding */ - (instancetype)initWithContentsOfFile: (OFString *)path encoding: (OFStringEncoding)encoding; -# endif +#endif /** * @brief Initializes an already allocated OFString with the contents of the * specified IRI. * @@ -1276,11 +1265,11 @@ * @throw OFInvalidEncodingException The string cannot be represented in the * specified encoding */ - (OFData *)dataWithEncoding: (OFStringEncoding)encoding; -# ifdef OF_HAVE_FILES +#ifdef OF_HAVE_FILES /** * @brief Writes the string into the specified file using UTF-8 encoding. * * @param path The path of the file to write to */ @@ -1294,11 +1283,11 @@ * @param encoding The encoding to use to write the string into the file * @throw OFInvalidEncodingException The string cannot be represented in the * specified encoding */ - (void)writeToFile: (OFString *)path encoding: (OFStringEncoding)encoding; -# endif +#endif /** * @brief Writes the string to the specified IRI using UTF-8 encoding. * * @param IRI The IRI to write to @@ -1313,20 +1302,19 @@ * @throw OFInvalidEncodingException The string cannot be represented in the * specified encoding */ - (void)writeToIRI: (OFIRI *)IRI encoding: (OFStringEncoding)encoding; -# ifdef OF_HAVE_BLOCKS +#ifdef OF_HAVE_BLOCKS /** * Enumerates all lines in the receiver using the specified block. * * @brief block The block to call for each line */ - (void)enumerateLinesUsingBlock: (OFStringLineEnumerationBlock)block; -# endif -@end #endif +@end #ifdef __cplusplus extern "C" { #endif /** @@ -1358,25 +1346,23 @@ } #endif OF_ASSUME_NONNULL_END -#include "OFConstantString.h" -#include "OFMutableString.h" -#ifdef __OBJC__ -# import "OFString+CryptographicHashing.h" -# import "OFString+JSONParsing.h" -# ifdef OF_HAVE_FILES -# import "OFString+PathAdditions.h" -# endif -# import "OFString+PercentEncoding.h" -# import "OFString+PropertyListParsing.h" -# import "OFString+XMLEscaping.h" -# import "OFString+XMLUnescaping.h" -#endif - -#if defined(__OBJC__) && !defined(NSINTEGER_DEFINED) && !__has_feature(modules) +#import "OFConstantString.h" +#import "OFMutableString.h" +#import "OFString+CryptographicHashing.h" +#import "OFString+JSONParsing.h" +#ifdef OF_HAVE_FILES +# import "OFString+PathAdditions.h" +#endif +#import "OFString+PercentEncoding.h" +#import "OFString+PropertyListParsing.h" +#import "OFString+XMLEscaping.h" +#import "OFString+XMLUnescaping.h" + +#if !defined(NSINTEGER_DEFINED) && !__has_feature(modules) /* * Very *ugly* hack required for string boxing literals to work. * * This hack is needed in order to work with `@class NSString` from Apple's * objc/NSString.h - which is included when using modules - as @@ -1387,8 +1373,6 @@ * * TODO: Submit a patch for Clang that makes the boxing classes configurable! */ @interface NSString: OFString @end -#endif - #endif Index: src/runtime/exception.m ================================================================== --- src/runtime/exception.m +++ src/runtime/exception.m @@ -24,11 +24,11 @@ #import "ObjFWRT.h" #import "private.h" #import "macros.h" #ifdef OF_HAVE_THREADS -# include "OFPlainMutex.h" +# import "OFPlainMutex.h" #endif #ifdef HAVE_SEH_EXCEPTIONS # include #endif