@@ -14,12 +14,14 @@ * file. */ #import "OFObject.h" -@class OFEnumerator; -@class OFArray; +#ifndef DOXYGEN +@class OFEnumerator OF_GENERIC(ObjectType); +@class OFArray OF_GENERIC(ObjectType); +#endif /*! * @protocol OFEnumerating OFEnumerator.h ObjFW/OFEnumerator.h * * @brief A protocol for getting an enumerator for the object. @@ -37,31 +39,41 @@ /*! * @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 +#endif /*! * @brief Returns the next object. * * @return The next object */ -- (id)nextObject; +- (ObjectType)nextObject; /*! * @brief Returns an array of all remaining objects in the collection. * * @return An array of all remaining objects in the collection */ -- (OFArray*)allObjects; +- (OFArray OF_GENERIC(ObjectType)*)allObjects; /*! * @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 /* * This needs to be exactly like this because it's hardcoded in the compiler. * * We need this bad check to see if we already imported Cocoa, which defines