Revision: 9864
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 26, 2008 13:48 by nesium
Initial Code
// // SynthesizeSingleton.h // // Created by Matt Gallagher on 20/10/08. // #define SYNTHESIZE_SINGLETON_FOR_CLASS(classname) static classname *shared##classname = nil; + (classname *)shared##classname { @synchronized(self) { if (shared##classname == nil) { [[self alloc] init]; } } return shared##classname; } + (id)allocWithZone:(NSZone *)zone { @synchronized(self) { if (shared##classname == nil) { shared##classname = [super allocWithZone:zone]; return shared##classname; } } return nil; } - (id)copyWithZone:(NSZone *)zone { return self; } - (id)retain { return self; } - (NSUInteger)retainCount { return NSUIntegerMax; } - (void)release { } - (id)autorelease { return self; }
Initial URL
Initial Description
Initial Title
Synthesize singleton
Initial Tags
textmate
Initial Language
Other