@@ -27,10 +27,11 @@ #import "OFXMLElement.h" #import "OFDataArray.h" #import "OFInvalidArgumentException.h" #import "OFOutOfRangeException.h" +#import "OFUndefinedKeyException.h" static struct { Class isa; } placeholder; @@ -296,10 +297,33 @@ return [ret autorelease]; } return [self objectForKey: key]; } + +- (void)setValue: (id)value + forKey: (OFString*)key +{ + if ([key hasPrefix: @"@"]) { + void *pool = objc_autoreleasePoolPush(); + + key = [key substringWithRange: of_range(1, [key length] - 1)]; + [super setValue: value + forKey: key]; + + objc_autoreleasePoolPop(pool); + return; + } + + if (![self isKindOfClass: [OFMutableDictionary class]]) + @throw [OFUndefinedKeyException exceptionWithObject: self + key: key + value: value]; + + [(OFMutableDictionary*)self setObject: value + forKey: key]; +} - (size_t)count { OF_UNRECOGNIZED_SELECTOR }