author | Jens Alfke <jens@mooseyard.com> |
Sun Jul 13 10:45:42 2008 -0700 (2008-07-13) | |
changeset 16 | ce9c83f7ec14 |
permissions | -rw-r--r-- |
jens@0 | 1 |
// |
jens@0 | 2 |
// With.h |
jens@0 | 3 |
// MYUtilities |
jens@0 | 4 |
// |
jens@0 | 5 |
// Copyright 2008 Jens Alfke. All rights reserved. |
jens@0 | 6 |
// |
jens@0 | 7 |
|
jens@0 | 8 |
#import <Cocoa/Cocoa.h> |
jens@0 | 9 |
|
jens@0 | 10 |
|
jens@0 | 11 |
#define WITH(OBJ) id __with=[OBJ beginWith]; @try |
jens@0 | 12 |
|
jens@0 | 13 |
#define ENDWITH @finally{[__with endWith];} |
jens@0 | 14 |
#define CATCHWITH @catch(NSException *x){id w=__with; __with=nil; _catchWith(w,x);} @finally{[__with endWith];} |
jens@0 | 15 |
|
jens@0 | 16 |
void _catchWith( id with, NSException *x ); |
jens@0 | 17 |
|
jens@0 | 18 |
@interface NSAutoreleasePool (With) |
jens@0 | 19 |
+ (NSAutoreleasePool*) beginWith; |
jens@0 | 20 |
- (void) endWith; |
jens@0 | 21 |
@end |