@@ -16,12 +16,51 @@ #include "config.h" #import "OFConditionWaitFailedException.h" #import "OFString.h" + +#import "OFNotImplementedException.h" @implementation OFConditionWaitFailedException ++ newWithClass: (Class)class_ + condition: (OFCondition*)condition +{ + return [[self alloc] initWithClass: class_ + condition: condition]; +} + +- initWithClass: (Class)class_ +{ + Class c = isa; + [self release]; + @throw [OFNotImplementedException newWithClass: c + selector: _cmd]; +} + +- initWithClass: (Class)class_ + condition: (OFCondition*)condition_ +{ + self = [super initWithClass: class_]; + + @try { + condition = [condition_ retain]; + } @catch (id e) { + [self release]; + @throw e; + } + + return self; +} + +- (void)dealloc +{ + [condition release]; + + [super dealloc]; +} + - (OFString*)description { if (description != nil) return description; @@ -28,6 +67,11 @@ description = [[OFString alloc] initWithFormat: @"Waiting for a condition of type %@ failed!", inClass]; return description; } + +- (OFCondition*)condition +{ + return condition; +} @end