Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

32 lines (25 sloc) 1.16 kB
//
// Prefix header for all source files of the 'Fibre' target in the 'Fibre' project
//
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
// Rentzsh's handy enumeration macros. http://rentzsch.com/papers/improvingCocoaObjCEnumeration
// Bring on Obj-C 2.0, please.
// NB - Doesn't nest very well
#define nsenumerate_getEnumerator( TYPE, OBJ ) \
(TYPE)([OBJ isKindOfClass:[NSEnumerator class]] \
? OBJ \
: [OBJ performSelector:@selector(objectEnumerator)])
#define nsenumerate( CONTAINER, ITERATOR_TYPE, ITERATOR_SYMBOL ) \
for( ITERATOR_TYPE \
*enumerator = nsenumerate_getEnumerator(ITERATOR_TYPE*, CONTAINER), \
*ITERATOR_SYMBOL = [((NSEnumerator*) enumerator) nextObject]; \
ITERATOR_SYMBOL != nil; \
ITERATOR_SYMBOL = [((NSEnumerator*) enumerator) nextObject] )
#define nsenumerat( CONTAINER, ITERATOR_SYMBOL ) \
for( id \
enumerator = nsenumerate_getEnumerator(id, CONTAINER), \
ITERATOR_SYMBOL = [((NSEnumerator*) enumerator) nextObject]; \
ITERATOR_SYMBOL != nil; \
ITERATOR_SYMBOL = [((NSEnumerator*) enumerator) nextObject] )
#endif
Jump to Line
Something went wrong with that request. Please try again.