Index: src/OFDictionary.h ================================================================== --- src/OFDictionary.h +++ src/OFDictionary.h @@ -182,10 +182,11 @@ * * \param key The key whose object should be returned * \return The object for the given key or nil if the key was not found */ - (id)objectForKey: (id)key; +- (id)objectForKeyedSubscript: (id)key; /** * \brief Checks whether the dictionary contains an object with the specified * address. * @@ -251,5 +252,10 @@ copyKeys: (BOOL)copyKeys; #endif @end #import "OFMutableDictionary.h" + +#ifndef NSINTEGER_DEFINED +/* Required for dictionary literals to work */ +@compatibility_alias NSDictionary OFDictionary; +#endif Index: src/OFDictionary.m ================================================================== --- src/OFDictionary.m +++ src/OFDictionary.m @@ -256,10 +256,15 @@ - (id)objectForKey: (id)key { @throw [OFNotImplementedException exceptionWithClass: isa selector: _cmd]; } + +- (id)objectForKeyedSubscript: (id)key +{ + return [self objectForKey: key]; +} - (size_t)count { @throw [OFNotImplementedException exceptionWithClass: isa selector: _cmd]; Index: src/OFMutableDictionary.h ================================================================== --- src/OFMutableDictionary.h +++ src/OFMutableDictionary.h @@ -32,10 +32,12 @@ * \param key The key to set * \param object The object to set the key to */ - (void)setObject: (id)object forKey: (id)key; +- (void)setObject: (id)object + forKeyedSubscript: (id)key; /** * \brief Removes the object for the specified key from the dictionary. * * \param key The key whose object should be removed Index: src/OFMutableDictionary.m ================================================================== --- src/OFMutableDictionary.m +++ src/OFMutableDictionary.m @@ -146,10 +146,17 @@ forKey: (id)key { @throw [OFNotImplementedException exceptionWithClass: isa selector: _cmd]; } + +- (void)setObject: (id)object + forKeyedSubscript: (id)key +{ + [self setObject: object + forKey: key]; +} - (void)removeObjectForKey: (id)key { @throw [OFNotImplementedException exceptionWithClass: isa selector: _cmd];