@@ -14,10 +14,11 @@ #include #import "OFDictionary.h" #import "OFEnumerator.h" #import "OFArray.h" +#import "OFString.h" #import "OFAutoreleasePool.h" #import "OFExceptions.h" #import "macros.h" struct of_dictionary_bucket of_dictionary_deleted_bucket = {}; @@ -614,10 +615,38 @@ OF_HASH_FINALIZE(hash); return hash; } + +- (OFString*)description +{ + OFMutableString *ret = [OFMutableString stringWithString: @"{"]; + OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init], *pool2; + OFEnumerator *enumerator = [self keyEnumerator]; + id key; + size_t i; + + i = 0; + pool2 = [[OFAutoreleasePool alloc] init]; + + while ((key = [enumerator nextObject]) != nil) { + [ret appendString: [key description]]; + [ret appendString: @" = "]; + [ret appendString: [[self objectForKey: key] description]]; + + if (++i < count) + [ret appendString: @"; "]; + + [pool2 releaseObjects]; + } + [ret appendString: @"}"]; + + [pool release]; + + return ret; +} @end /// \cond internal @implementation OFDictionaryEnumerator - initWithData: (struct of_dictionary_bucket**)data_