ObjFW  Diff

Differences From Artifact [04188c1de5]:

To Artifact [289c822ada]:


12
13
14
15
16
17
18

19
20



21
22
23
24
25
26
27
12
13
14
15
16
17
18
19


20
21
22
23
24
25
26
27
28
29







+
-
-
+
+
+







 * 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.
 */

#import "OFObject.h"

#ifndef DOXYGEN
@class OFEnumerator;
@class OFArray;
@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.
 */
@protocol OFEnumerating
35
36
37
38
39
40
41






42

43
44
45
46
47
48

49
50
51
52
53
54
55

56
57
58
59
60
61
62



63
64
65
66
67
68
69
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

57
58
59
60
61
62
63

64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81







+
+
+
+
+
+

+





-
+






-
+







+
+
+







@end

/*!
 * @class OFEnumerator OFEnumerator.h ObjFW/OFEnumerator.h
 *
 * @brief A class which provides methods to enumerate through collections.
 */
#ifdef OF_HAVE_GENERICS
@interface OFEnumerator <ObjectType>: 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
 * this as well.
 */