With.h
author Jens Alfke <jens@mooseyard.com>
Wed Jul 01 14:04:56 2009 -0700 (2009-07-01)
changeset 33 d52f6b0d94be
permissions -rw-r--r--
Added NSData categories for GZip and Mnemonicode.
Minor tweaks elsewhere.
     1 //
     2 //  With.h
     3 //  MYUtilities
     4 //
     5 //  Copyright 2008 Jens Alfke. All rights reserved.
     6 //
     7 
     8 #import <Cocoa/Cocoa.h>
     9 
    10 
    11 #define WITH(OBJ)       id __with=[OBJ beginWith]; @try
    12 
    13 #define ENDWITH         @finally{[__with endWith];}
    14 #define CATCHWITH       @catch(NSException *x){id w=__with; __with=nil; _catchWith(w,x);} @finally{[__with endWith];}
    15 
    16 void _catchWith( id with, NSException *x );
    17 
    18 @interface NSAutoreleasePool (With)
    19 + (NSAutoreleasePool*) beginWith;
    20 - (void) endWith;
    21 @end