ObjFW  Check-in [7f0e327251]

Overview
Comment:Add -[OFEnumerator allObjects].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7f0e327251c6a525dac55f8cea83188cf2b936bc322244d50a7617a4690a30bb
User & Date: js on 2013-04-09 21:35:20
Other Links: manifest | tags
Context
2013-04-09
21:37
Simplify -[OFDictionary all{Keys,Objects}]. check-in: bff98a6244 user: js tags: trunk
21:35
Add -[OFEnumerator allObjects]. check-in: 7f0e327251 user: js tags: trunk
18:08
Add support for SjLj exceptions. check-in: 5eb22639e4 user: js tags: trunk
Changes

Modified src/OFEnumerator.h from [347caeb18b] to [e6517d3735].

13
14
15
16
17
18
19

20
21
22
23
24
25
26
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#import "OFObject.h"

@class OFEnumerator;


/*!
 * @brief A protocol for getting an enumerator for the object.
 */
@protocol OFEnumerating
/*!
 * @brief Returns an OFEnumerator to enumerate through all objects of the







>







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#import "OFObject.h"

@class OFEnumerator;
@class OFArray;

/*!
 * @brief A protocol for getting an enumerator for the object.
 */
@protocol OFEnumerating
/*!
 * @brief Returns an OFEnumerator to enumerate through all objects of the
38
39
40
41
42
43
44







45
46
47
48
49
50
51
/*!
 * @brief Returns the next object.
 *
 * @return The next object
 */
- (id)nextObject;








/*!
 * @brief Resets the enumerator, so the next call to nextObject returns the
 *	  first object again.
 */
- (void)reset;
@end








>
>
>
>
>
>
>







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*!
 * @brief Returns the next object.
 *
 * @return The next object
 */
- (id)nextObject;

/*!
 * @brief Returns an array of all remaining objects in the collection.
 *
 * @return An array of all remaining objects in the collection
 */
- (OFArray*)allObjects;

/*!
 * @brief Resets the enumerator, so the next call to nextObject returns the
 *	  first object again.
 */
- (void)reset;
@end

Modified src/OFEnumerator.m from [7e1866fc04] to [e3173d5720].

15
16
17
18
19
20
21



22
23
24
25
26
27
28
 */

#include "config.h"

#include <stdlib.h>

#import "OFEnumerator.h"




@implementation OFEnumerator
- init
{
	if (object_getClass(self) == [OFEnumerator class]) {
		@try {
			[self doesNotRecognizeSelector: _cmd];







>
>
>







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 */

#include "config.h"

#include <stdlib.h>

#import "OFEnumerator.h"
#import "OFArray.h"

#import "autorelease.h"

@implementation OFEnumerator
- init
{
	if (object_getClass(self) == [OFEnumerator class]) {
		@try {
			[self doesNotRecognizeSelector: _cmd];
37
38
39
40
41
42
43
















44
45
46
47
48
49
50
}

- (id)nextObject
{
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

















- (void)reset
{
	[self doesNotRecognizeSelector: _cmd];
	abort();
}
@end







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
}

- (id)nextObject
{
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (OFArray*)allObjects
{
	OFMutableArray *ret = [OFMutableArray array];
	void *pool = objc_autoreleasePoolPush();
	id object;

	while ((object = [self nextObject]) != nil)
		[ret addObject: object];

	[ret makeImmutable];

	objc_autoreleasePoolPop(pool);

	return ret;
}

- (void)reset
{
	[self doesNotRecognizeSelector: _cmd];
	abort();
}
@end