Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 31 lines (23 sloc) 1.232 kB
5c4974c @rentzsch [NEW] mogenerator. TODO: momc invocation.
authored
1 /****************************************************************************************
2 nsenumerate.h $Revision: 1.0 $
3
4 Copyright (c) 2003 Red Shed Software. All rights reserved.
5 by Jonathan 'Wolf' Rentzsch (jon at redshed dot net)
6
7 Wed Oct 8 2003 wolf: Created.
8
9 ************************************************************************************/
10
11 #import <Foundation/Foundation.h>
12
13 #define nsenumerate_getEnumerator( TYPE, OBJ ) \
14 (TYPE)([OBJ isKindOfClass:[NSEnumerator class]] \
15 ? OBJ \
16 : [OBJ performSelector:@selector(objectEnumerator)])
17
18 #define nsenumerate( CONTAINER, ITERATOR_TYPE, ITERATOR_SYMBOL ) \
19 for( ITERATOR_TYPE \
20 *enumerator = nsenumerate_getEnumerator(ITERATOR_TYPE*, CONTAINER), \
21 *ITERATOR_SYMBOL = [((NSEnumerator*) enumerator) nextObject]; \
22 ITERATOR_SYMBOL != nil; \
23 ITERATOR_SYMBOL = [((NSEnumerator*) enumerator) nextObject] )
24
25 #define nsenumerat( CONTAINER, ITERATOR_SYMBOL ) \
26 for( id \
27 enumerator = nsenumerate_getEnumerator(id, CONTAINER), \
28 ITERATOR_SYMBOL = [((NSEnumerator*) enumerator) nextObject]; \
29 ITERATOR_SYMBOL != nil; \
30 ITERATOR_SYMBOL = [((NSEnumerator*) enumerator) nextObject] )
Something went wrong with that request. Please try again.