Index: Doxyfile ================================================================== --- Doxyfile +++ Doxyfile @@ -6,10 +6,12 @@ GENERATE_LATEX = NO HIDE_UNDOC_CLASSES = YES HIDE_UNDOC_MEMBERS = YES PREDEFINED = DOXYGEN \ OF_CONSUMED \ + OF_DESIGNATED_INITIALIZER \ + OF_GENERIC(...)= \ OF_HAVE_BLOCKS \ OF_HAVE_FILES \ OF_HAVE_SANDBOX \ OF_HAVE_SOCKETS \ OF_HAVE_THREADS \ Index: src/OFApplication.h ================================================================== --- src/OFApplication.h +++ src/OFApplication.h @@ -18,18 +18,16 @@ #import "OFObject.h" OF_ASSUME_NONNULL_BEGIN -@class OFString; -#ifndef DOXYGEN @class OFArray OF_GENERIC(ObjectType); @class OFDictionary OF_GENERIC(KeyType, ObjectType); @class OFMutableArray OF_GENERIC(ObjectType); @class OFMutableDictionary OF_GENERIC(KeyType, ObjectType); -#endif @class OFSandbox; +@class OFString; #define OF_APPLICATION_DELEGATE(cls) \ int \ main(int argc, char *argv[]) \ { \ Index: src/OFArray.h ================================================================== --- src/OFArray.h +++ src/OFArray.h @@ -84,20 +84,16 @@ /*! * @class OFArray OFArray.h ObjFW/OFArray.h * * @brief An abstract class for storing objects in an array. */ -#ifdef OF_HAVE_GENERICS -@interface OFArray: -#else -# ifndef DOXYGEN -# define ObjectType id -# endif -@interface OFArray: +@interface OFArray OF_GENERIC(ObjectType): OFObject +#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) +# define ObjectType id #endif - OFObject /*! * @brief Creates a new OFArray. * * @return A new autoreleased OFArray */ @@ -480,14 +476,14 @@ * all objects except the first * @return The array folded to a single object */ - (nullable id)foldUsingBlock: (of_array_fold_block_t)block; #endif -@end #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) # undef ObjectType #endif +@end @interface OFArrayEnumerator: OFEnumerator { OFArray *_array; size_t _count; Index: src/OFCountedSet.h ================================================================== --- src/OFCountedSet.h +++ src/OFCountedSet.h @@ -37,17 +37,14 @@ * @class OFCountedSet OFCountedSet.h ObjFW/OFCountedSet.h * * @brief An abstract class for a mutable unordered set of objects, counting how * often it contains an object. */ -#ifdef OF_HAVE_GENERICS -@interface OFCountedSet: OFMutableSet -#else -# ifndef DOXYGEN -# define ObjectType id -# endif -@interface OFCountedSet: OFMutableSet +@interface OFCountedSet OF_GENERIC(ObjectType): + OFMutableSet OF_GENERIC(ObjectType) +#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) +# define ObjectType id #endif /*! * @brief Returns how often the object is in the set. * * @return How often the object is in the set @@ -61,11 +58,11 @@ * @param block The block to execute for each object in the set */ - (void)enumerateObjectsAndCountUsingBlock: (of_counted_set_enumeration_block_t)block; #endif -@end #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) # undef ObjectType #endif +@end OF_ASSUME_NONNULL_END Index: src/OFDictionary.h ================================================================== --- src/OFDictionary.h +++ src/OFDictionary.h @@ -49,21 +49,17 @@ * Keys are copied and thus must conform to the OFCopying protocol. * * @note Fast enumeration on a dictionary enumerates through the keys of the * dictionary. */ -#ifdef OF_HAVE_GENERICS -@interface OFDictionary: -#else -# ifndef DOXYGEN -# define KeyType id -# define ObjectType id -# endif -@interface OFDictionary: +@interface OFDictionary OF_GENERIC(KeyType, ObjectType): OFObject +#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) +# define KeyType id +# define ObjectType id #endif - OFObject /*! * @brief Creates a new OFDictionary. * * @return A new autoreleased OFDictionary */ @@ -303,19 +299,19 @@ * @return A new autoreleased OFDictionary */ - (OFDictionary OF_GENERIC(KeyType, ObjectType) *)filteredDictionaryUsingBlock: (of_dictionary_filter_block_t)block; #endif -@end #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) # undef KeyType # undef ObjectType #endif +@end OF_ASSUME_NONNULL_END #import "OFMutableDictionary.h" #if !defined(NSINTEGER_DEFINED) && !__has_feature(modules) /* Required for dictionary literals to work */ @compatibility_alias NSDictionary OFDictionary; #endif Index: src/OFEnumerator.h ================================================================== --- src/OFEnumerator.h +++ src/OFEnumerator.h @@ -16,14 +16,12 @@ #import "OFObject.h" OF_ASSUME_NONNULL_BEGIN -#ifndef DOXYGEN -@class OFEnumerator OF_GENERIC(ObjectType); @class OFArray OF_GENERIC(ObjectType); -#endif +@class OFEnumerator OF_GENERIC(ObjectType); /*! * @protocol OFEnumerating OFEnumerator.h ObjFW/OFEnumerator.h * * @brief A protocol for getting an enumerator for the object. @@ -41,17 +39,13 @@ /*! * @class OFEnumerator OFEnumerator.h ObjFW/OFEnumerator.h * * @brief A class which provides methods to enumerate through collections. */ -#ifdef OF_HAVE_GENERICS -@interface OFEnumerator: OFObject -#else -# ifndef DOXYGEN -# define ObjectType id -# endif -@interface OFEnumerator: OFObject +@interface OFEnumerator OF_GENERIC(ObjectType): OFObject +#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) +# define ObjectType id #endif /*! * @brief Returns the next object or `nil` if there is none left. * * @return The next object or `nil` if there is none left @@ -68,14 +62,14 @@ /*! * @brief Resets the enumerator, so the next call to nextObject returns the * first object again. */ - (void)reset; -@end #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) # undef ObjectType #endif +@end /* * This needs to be exactly like this because it's hard-coded in the compiler. * * We need this bad check to see if we already imported Cocoa, which defines Index: src/OFINICategory.h ================================================================== --- src/OFINICategory.h +++ src/OFINICategory.h @@ -16,15 +16,13 @@ #import "OFObject.h" OF_ASSUME_NONNULL_BEGIN -@class OFString; -#ifndef DOXYGEN @class OFArray OF_GENERIC(ObjectType); @class OFMutableArray OF_GENERIC(ObjectType); -#endif +@class OFString; /*! * @class OFINICategory OFINICategory.h ObjFW/OFINICategory.h * * @brief A class for representing a category of an INI file. Index: src/OFIntrospection.h ================================================================== --- src/OFIntrospection.h +++ src/OFIntrospection.h @@ -16,15 +16,13 @@ #import "OFObject.h" OF_ASSUME_NONNULL_BEGIN -@class OFString; @class OFArray OF_GENERIC(ObjectType); -#ifndef DOXYGEN @class OFMutableArray OF_GENERIC(ObjectType); -#endif +@class OFString; enum { OF_PROPERTY_READONLY = 0x01, OF_PROPERTY_ASSIGN = 0x04, OF_PROPERTY_READWRITE = 0x08, Index: src/OFList.h ================================================================== --- src/OFList.h +++ src/OFList.h @@ -42,19 +42,15 @@ /*! * @class OFList OFList.h ObjFW/OFList.h * * @brief A class which provides easy to use double-linked lists. */ -#ifdef OF_HAVE_GENERICS -@interface OFList: -#else -# ifndef DOXYGEN -# define ObjectType id -# endif -@interface OFList: +@interface OFList OF_GENERIC(ObjectType): OFObject +#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) +# define ObjectType id #endif - OFObject { of_list_object_t *_firstListObject; of_list_object_t *_lastListObject; size_t _count; unsigned long _mutations; @@ -179,14 +175,14 @@ /*! * @brief Removes all objects from the list. */ - (void)removeAllObjects; -@end #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) # undef ObjectType #endif +@end @interface OFListEnumerator: OFEnumerator { OFList *_list; of_list_object_t *_current; Index: src/OFMutableArray.h ================================================================== --- src/OFMutableArray.h +++ src/OFMutableArray.h @@ -35,17 +35,13 @@ * @class OFMutableArray OFArray.h ObjFW/OFArray.h * * @brief An abstract class for storing, adding and removing objects in an * array. */ -#ifdef OF_HAVE_GENERICS -@interface OFMutableArray: OFArray -#else -# ifndef DOXYGEN -# define ObjectType id -# endif -@interface OFMutableArray: OFArray +@interface OFMutableArray OF_GENERIC(ObjectType): OFArray OF_GENERIC(ObjectType) +#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) +# define ObjectType id #endif /*! * @brief Creates a new OFMutableArray with enough memory to hold the specified * number of objects. * @@ -206,11 +202,11 @@ /*! * @brief Converts the mutable array to an immutable array. */ - (void)makeImmutable; -@end #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) # undef ObjectType #endif +@end OF_ASSUME_NONNULL_END Index: src/OFMutableDictionary.h ================================================================== --- src/OFMutableDictionary.h +++ src/OFMutableDictionary.h @@ -34,19 +34,15 @@ /*! * @class OFMutableDictionary OFDictionary.h ObjFW/OFDictionary.h * * @brief An abstract class for storing and changing objects in a dictionary. */ -#ifdef OF_HAVE_GENERICS -@interface OFMutableDictionary: - OFDictionary -#else -# ifndef DOXYGEN -# define KeyType id -# define ObjectType id -# endif -@interface OFMutableDictionary: OFDictionary +@interface OFMutableDictionary OF_GENERIC(KeyType, ObjectType): + OFDictionary OF_GENERIC(KeyType, ObjectType) +#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) +# define KeyType id +# define ObjectType id #endif /*! * @brief Creates a new OFMutableDictionary with enough memory to hold the * specified number of objects. * @@ -108,12 +104,12 @@ /*! * @brief Converts the mutable dictionary to an immutable dictionary. */ - (void)makeImmutable; -@end #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) # undef KeyType # undef ObjectType #endif +@end OF_ASSUME_NONNULL_END Index: src/OFMutableSet.h ================================================================== --- src/OFMutableSet.h +++ src/OFMutableSet.h @@ -21,17 +21,13 @@ /*! * @class OFMutableSet OFSet.h ObjFW/OFSet.h * * @brief An abstract class for a mutable unordered set of unique objects. */ -#ifdef OF_HAVE_GENERICS -@interface OFMutableSet: OFSet -#else -# ifndef DOXYGEN -# define ObjectType id -# endif -@interface OFMutableSet: OFSet +@interface OFMutableSet OF_GENERIC(ObjectType): OFSet OF_GENERIC(ObjectType) +#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) +# define ObjectType id #endif /*! * @brief Creates a new OFMutableSet with enough memory to hold the specified * number of objects. * @@ -87,11 +83,11 @@ /*! * @brief Converts the mutable set to an immutable set. */ - (void)makeImmutable; -@end #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) # undef ObjectType #endif +@end OF_ASSUME_NONNULL_END Index: src/OFSandbox.h ================================================================== --- src/OFSandbox.h +++ src/OFSandbox.h @@ -16,13 +16,11 @@ #import "OFObject.h" OF_ASSUME_NONNULL_BEGIN -#ifndef DOXYGEN @class OFArray OF_GENERIC(ObjectType); -#endif /*! * @class OFSandbox OFSandbox.h ObjFW/OFSandbox.h * * @brief A class which describes a sandbox for the application. Index: src/OFSet.h ================================================================== --- src/OFSet.h +++ src/OFSet.h @@ -58,19 +58,15 @@ * @brief An abstract class for an unordered set of unique objects. * * @warning Do not mutate objects that are in a set! Changing the hash of * objects in a set breaks the internal representation of the set! */ -#ifdef OF_HAVE_GENERICS -@interface OFSet: -#else -# ifndef DOXYGEN -# define ObjectType id -# endif -@interface OFSet: +@interface OFSet OF_GENERIC(ObjectType): OFObject +#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) +# define ObjectType id #endif - OFObject /*! * @brief Creates a new set. * * @return A new, autoreleased set */ @@ -275,13 +271,13 @@ * @return A new, autoreleased OFSet */ - (OFSet OF_GENERIC(ObjectType) *)filteredSetUsingBlock: (of_set_filter_block_t)block; #endif -@end #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) # undef ObjectType #endif +@end OF_ASSUME_NONNULL_END #import "OFMutableSet.h" Index: src/OFSortedList.h ================================================================== --- src/OFSortedList.h +++ src/OFSortedList.h @@ -24,26 +24,22 @@ * @brief A class which provides easy to use sorted double-linked lists. * * @warning Because the list is sorted, all methods inserting an object at a * specific place are unavailable, even though they exist in OFList! */ -#ifdef OF_HAVE_GENERICS -@interface OFSortedList: OFList -#else -# ifndef DOXYGEN -# define ObjectType id -# endif -@interface OFSortedList: OFList +@interface OFSortedList OF_GENERIC(ObjectType): OFList OF_GENERIC(ObjectType) +#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) +# define ObjectType id #endif /*! * @brief Inserts the object to the list while keeping the list sorted. * * @param object The object to insert * @return The list object for the object just added */ - (of_list_object_t *)insertObject: (ObjectType )object; -@end #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) # undef ObjectType #endif +@end OF_ASSUME_NONNULL_END Index: src/OFThreadPool.h ================================================================== --- src/OFThreadPool.h +++ src/OFThreadPool.h @@ -25,15 +25,13 @@ * @brief A block for a job which should be executed in a thread pool. */ typedef void (^of_thread_pool_block_t)(void); #endif -#ifndef DOXYGEN -@class OFMutableArray OF_GENERIC(ObjectType); +@class OFCondition; @class OFList OF_GENERIC(ObjectType); -#endif -@class OFCondition; +@class OFMutableArray OF_GENERIC(ObjectType); @class OFThreadPoolJob; /*! * @class OFThreadPool OFThreadPool.h ObjFW/OFThreadPool.h * Index: src/OFXMLElement.h ================================================================== --- src/OFXMLElement.h +++ src/OFXMLElement.h @@ -16,17 +16,15 @@ #import "OFXMLNode.h" OF_ASSUME_NONNULL_BEGIN -@class OFString; -@class OFMutableString; -#ifndef DOXYGEN @class OFArray OF_GENERIC(ObjectType); @class OFMutableArray OF_GENERIC(ObjectType); @class OFMutableDictionary OF_GENERIC(KeyType, ObjectType); -#endif +@class OFMutableString; +@class OFString; @class OFXMLAttribute; /*! * @class OFXMLElement OFXMLElement.h ObjFW/OFXMLElement.h * Index: src/OFXMLParser.h ================================================================== --- src/OFXMLParser.h +++ src/OFXMLParser.h @@ -18,18 +18,16 @@ #import "OFString.h" #import "OFXMLAttribute.h" OF_ASSUME_NONNULL_BEGIN -@class OFXMLParser; -#ifndef DOXYGEN @class OFArray OF_GENERIC(ObjectType); +@class OFDataArray; @class OFMutableArray OF_GENERIC(ObjectType); @class OFMutableDictionary OF_GENERIC(KeyType, ObjectType); -#endif -@class OFDataArray; @class OFStream; +@class OFXMLParser; /*! * @protocol OFXMLParserDelegate OFXMLParser.h ObjFW/OFXMLParser.h * * @brief A protocol that needs to be implemented by delegates for OFXMLParser. Index: src/OFZIPArchive.h ================================================================== --- src/OFZIPArchive.h +++ src/OFZIPArchive.h @@ -18,15 +18,13 @@ #import "OFString.h" #import "OFZIPArchiveEntry.h" OF_ASSUME_NONNULL_BEGIN -#ifndef DOXYGEN @class OFArray OF_GENERIC(ObjectType); @class OFMutableArray OF_GENERIC(ObjectType); @class OFMutableDictionary OF_GENERIC(KeyType, ObjectType); -#endif @class OFSeekableStream; @class OFStream; /*! * @class OFZIPArchive OFZIPArchive.h ObjFW/OFZIPArchive.h Index: src/exceptions/OFException.h ================================================================== --- src/exceptions/OFException.h +++ src/exceptions/OFException.h @@ -16,15 +16,13 @@ #import "OFObject.h" OF_ASSUME_NONNULL_BEGIN -@class OFString; -#ifndef DOXYGEN @class OFArray OF_GENERIC(ObjectType); @class OFMutableArray OF_GENERIC(ObjectType); -#endif +@class OFString; #define OF_BACKTRACE_SIZE 32 #if defined(OF_WINDOWS) && defined(OF_HAVE_SOCKETS) # ifndef EADDRINUSE